mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
[PasswordManager] Correctly switch password backends.
This commit is contained in:
parent
0fe79f3f71
commit
90a4200981
@ -126,6 +126,17 @@ PasswordBackend* PasswordManager::activeBackend() const
|
|||||||
return m_backend;
|
return m_backend;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PasswordManager::switchBackend(PasswordBackend* backend)
|
||||||
|
{
|
||||||
|
if (!backend) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_backend->setActive(false);
|
||||||
|
m_backend = backend;
|
||||||
|
m_backend->setActive(true);
|
||||||
|
}
|
||||||
|
|
||||||
bool PasswordManager::registerBackend(const QString &id, PasswordBackend* backend)
|
bool PasswordManager::registerBackend(const QString &id, PasswordBackend* backend)
|
||||||
{
|
{
|
||||||
if (m_backends.contains(id)) {
|
if (m_backends.contains(id)) {
|
||||||
|
@ -67,6 +67,7 @@ public:
|
|||||||
|
|
||||||
QHash<QString, PasswordBackend*> availableBackends() const;
|
QHash<QString, PasswordBackend*> availableBackends() const;
|
||||||
PasswordBackend* activeBackend() const;
|
PasswordBackend* activeBackend() const;
|
||||||
|
void switchBackend(PasswordBackend* backend);
|
||||||
|
|
||||||
bool registerBackend(const QString &id, PasswordBackend* backend);
|
bool registerBackend(const QString &id, PasswordBackend* backend);
|
||||||
void unregisterBackend(PasswordBackend* backend);
|
void unregisterBackend(PasswordBackend* backend);
|
||||||
|
@ -117,17 +117,20 @@ void AutoFillManager::changePasswordBackend()
|
|||||||
Settings settings;
|
Settings settings;
|
||||||
settings.beginGroup("PasswordManager");
|
settings.beginGroup("PasswordManager");
|
||||||
|
|
||||||
|
PasswordBackend* backend = 0;
|
||||||
foreach (const QString &key, backends.keys()) {
|
foreach (const QString &key, backends.keys()) {
|
||||||
if (backends[key]->name() == item) {
|
if (backends[key]->name() == item) {
|
||||||
|
backend = backends[key];
|
||||||
settings.setValue("Backend", key);
|
settings.setValue("Backend", key);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
|
|
||||||
|
mApp->autoFill()->passwordManager()->switchBackend(backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
mApp->autoFill()->passwordManager()->loadSettings();
|
|
||||||
QTimer::singleShot(0, this, SLOT(loadPasswords()));
|
QTimer::singleShot(0, this, SLOT(loadPasswords()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user