mirror of
https://github.com/keepassxreboot/keepassxc-browser.git
synced 2026-03-11 08:54:43 +00:00
Fix icon state update and rename CSS variables used
This commit is contained in:
parent
a2bce477a7
commit
3e6a9101e7
2 changed files with 18 additions and 18 deletions
|
|
@ -841,6 +841,7 @@ const initcb = async function() {
|
|||
kpxc.initObserver();
|
||||
}
|
||||
|
||||
await kpxc.updateDatabaseState();
|
||||
await kpxc.initCredentialFields();
|
||||
|
||||
// Retrieve submitted credentials if available.
|
||||
|
|
@ -1038,14 +1039,6 @@ kpxc.initCredentialFields = async function(forceCall, inputs) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Check database closed status
|
||||
const res = await browser.runtime.sendMessage({
|
||||
action: 'get_status',
|
||||
args: [ true ]
|
||||
});
|
||||
|
||||
_databaseState = !res.keePassXCAvailable ? DatabaseState.DISCONNECTED : DatabaseState.LOCKED;
|
||||
|
||||
if (!kpxcFields.useDefinedCredentialFields()) {
|
||||
// Get all combinations of username + password fields
|
||||
kpxcFields.combinations = kpxcFields.getAllCombinations(inputs);
|
||||
|
|
@ -1940,6 +1933,19 @@ kpxc.passwordFilled = async function() {
|
|||
return await browser.runtime.sendMessage({ action: 'password_get_filled' });
|
||||
};
|
||||
|
||||
kpxc.updateDatabaseState = async function() {
|
||||
const res = await browser.runtime.sendMessage({
|
||||
action: 'get_status',
|
||||
args: [ true ]
|
||||
});
|
||||
|
||||
if (!res.keePassXCAvailable) {
|
||||
_databaseState = DatabaseState.DISCONNECTED;
|
||||
return;
|
||||
}
|
||||
|
||||
_databaseState = res.databaseClosed ? DatabaseState.LOCKED : DatabaseState.UNLOCKED;
|
||||
};
|
||||
|
||||
const kpxcEvents = {};
|
||||
|
||||
|
|
@ -1964,13 +1970,7 @@ kpxcEvents.triggerActivatedTab = async function() {
|
|||
// Doesn't run a second time because of _called.initCredentialFields set to true
|
||||
kpxc.init();
|
||||
|
||||
// Update username field lock state
|
||||
const res = await browser.runtime.sendMessage({
|
||||
action: 'get_status',
|
||||
args: [ true ]
|
||||
});
|
||||
|
||||
_databaseState = !res.keePassXCAvailable ? DatabaseState.DISCONNECTED : DatabaseState.LOCKED;
|
||||
await kpxc.updateDatabaseState();
|
||||
kpxc.switchIcons();
|
||||
|
||||
// initCredentialFields calls also "retrieve_credentials", to prevent it
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ kpxcUsernameIcons.newIcon = function(field, databaseState = DatabaseState.DISCON
|
|||
kpxcUsernameIcons.icons.push(new UsernameFieldIcon(field, databaseState));
|
||||
};
|
||||
|
||||
kpxcUsernameIcons.switchIcon = function(locked) {
|
||||
kpxcUsernameIcons.icons.forEach(u => u.switchIcon(locked));
|
||||
kpxcUsernameIcons.switchIcon = function(state) {
|
||||
kpxcUsernameIcons.icons.forEach(u => u.switchIcon(state));
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ class UsernameFieldIcon extends Icon {
|
|||
return;
|
||||
}
|
||||
|
||||
this.icon.classList.remove('lock', 'moz-lock', 'unlock', 'moz-unlock', 'disconnected', 'moz-disconnected');
|
||||
this.icon.classList.remove('lock', 'lock-moz', 'unlock', 'unlock-moz', 'disconnected', 'disconnected-moz');
|
||||
this.icon.classList.add(getIconClassName(state));
|
||||
this.icon.title = getIconText(state);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue