mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
[PasswordManager] Moved saving selected backend to switchBackend().
-Also added PasswordManager::passwordBackendChanged() signal. -Also some other options moved to AutoFillManager::currentPasswordBackendChanged()
This commit is contained in:
parent
aaf082a332
commit
102d90b77b
@ -131,8 +131,10 @@ PasswordBackend* PasswordManager::activeBackend()
|
|||||||
return m_backend;
|
return m_backend;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PasswordManager::switchBackend(PasswordBackend* backend)
|
void PasswordManager::switchBackend(const QString &backendID)
|
||||||
{
|
{
|
||||||
|
PasswordBackend* backend = m_backends.value(backendID);
|
||||||
|
|
||||||
if (!backend) {
|
if (!backend) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -140,6 +142,13 @@ void PasswordManager::switchBackend(PasswordBackend* backend)
|
|||||||
m_backend->setActive(false);
|
m_backend->setActive(false);
|
||||||
m_backend = backend;
|
m_backend = backend;
|
||||||
m_backend->setActive(true);
|
m_backend->setActive(true);
|
||||||
|
|
||||||
|
Settings settings;
|
||||||
|
settings.beginGroup("PasswordManager");
|
||||||
|
settings.setValue("Backend", backendID);
|
||||||
|
settings.endGroup();
|
||||||
|
|
||||||
|
emit passwordBackendChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PasswordManager::registerBackend(const QString &id, PasswordBackend* backend)
|
bool PasswordManager::registerBackend(const QString &id, PasswordBackend* backend)
|
||||||
|
@ -74,7 +74,7 @@ public:
|
|||||||
|
|
||||||
QHash<QString, PasswordBackend*> availableBackends();
|
QHash<QString, PasswordBackend*> availableBackends();
|
||||||
PasswordBackend* activeBackend();
|
PasswordBackend* activeBackend();
|
||||||
void switchBackend(PasswordBackend* backend);
|
void switchBackend(const QString &backendID);
|
||||||
|
|
||||||
bool registerBackend(const QString &id, PasswordBackend* backend);
|
bool registerBackend(const QString &id, PasswordBackend* backend);
|
||||||
void unregisterBackend(PasswordBackend* backend);
|
void unregisterBackend(PasswordBackend* backend);
|
||||||
@ -90,6 +90,9 @@ private:
|
|||||||
PasswordBackend* m_backend;
|
PasswordBackend* m_backend;
|
||||||
DatabasePasswordBackend* m_databaseBackend;
|
DatabasePasswordBackend* m_databaseBackend;
|
||||||
QHash<QString, PasswordBackend*> m_backends;
|
QHash<QString, PasswordBackend*> m_backends;
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void passwordBackendChanged();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Hint to QVector to use std::realloc on item moving
|
// Hint to QVector to use std::realloc on item moving
|
||||||
|
@ -46,6 +46,7 @@ AutoFillManager::AutoFillManager(QWidget* parent)
|
|||||||
connect(ui->search, SIGNAL(textChanged(QString)), ui->treePass, SLOT(filterString(QString)));
|
connect(ui->search, SIGNAL(textChanged(QString)), ui->treePass, SLOT(filterString(QString)));
|
||||||
connect(ui->changeBackend, SIGNAL(clicked()), this, SLOT(changePasswordBackend()));
|
connect(ui->changeBackend, SIGNAL(clicked()), this, SLOT(changePasswordBackend()));
|
||||||
connect(ui->backendOptions, SIGNAL(clicked()), this, SLOT(showBackendOptions()));
|
connect(ui->backendOptions, SIGNAL(clicked()), this, SLOT(showBackendOptions()));
|
||||||
|
connect(m_passwordManager, SIGNAL(passwordBackendChanged()), this, SLOT(currentPasswordBackendChanged()));
|
||||||
|
|
||||||
connect(ui->removeExcept, SIGNAL(clicked()), this, SLOT(removeExcept()));
|
connect(ui->removeExcept, SIGNAL(clicked()), this, SLOT(removeExcept()));
|
||||||
connect(ui->removeAllExcept, SIGNAL(clicked()), this, SLOT(removeAllExcept()));
|
connect(ui->removeAllExcept, SIGNAL(clicked()), this, SLOT(removeAllExcept()));
|
||||||
@ -119,9 +120,6 @@ void AutoFillManager::changePasswordBackend()
|
|||||||
|
|
||||||
// Switch backends
|
// Switch backends
|
||||||
if (!item.isEmpty()) {
|
if (!item.isEmpty()) {
|
||||||
Settings settings;
|
|
||||||
settings.beginGroup("PasswordManager");
|
|
||||||
|
|
||||||
PasswordBackend* backend = 0;
|
PasswordBackend* backend = 0;
|
||||||
|
|
||||||
QHashIterator<QString, PasswordBackend*> i(backends);
|
QHashIterator<QString, PasswordBackend*> i(backends);
|
||||||
@ -129,21 +127,14 @@ void AutoFillManager::changePasswordBackend()
|
|||||||
i.next();
|
i.next();
|
||||||
if (i.value()->name() == item) {
|
if (i.value()->name() == item) {
|
||||||
backend = i.value();
|
backend = i.value();
|
||||||
settings.setValue("Backend", i.key());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.endGroup();
|
|
||||||
|
|
||||||
if (backend) {
|
if (backend) {
|
||||||
m_passwordManager->switchBackend(backend);
|
m_passwordManager->switchBackend(backends.key(backend));
|
||||||
ui->backendOptions->setVisible(backend->hasSettings());
|
|
||||||
ui->currentBackend->setText(QString("<b>%1</b>").arg(backend->name()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QTimer::singleShot(0, this, SLOT(loadPasswords()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutoFillManager::showBackendOptions()
|
void AutoFillManager::showBackendOptions()
|
||||||
@ -335,6 +326,14 @@ void AutoFillManager::slotExportPasswords()
|
|||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AutoFillManager::currentPasswordBackendChanged()
|
||||||
|
{
|
||||||
|
ui->currentBackend->setText(QString("<b>%1</b>").arg(m_passwordManager->activeBackend()->name()));
|
||||||
|
ui->backendOptions->setVisible(m_passwordManager->activeBackend()->hasSettings());
|
||||||
|
|
||||||
|
QTimer::singleShot(0, this, SLOT(loadPasswords()));
|
||||||
|
}
|
||||||
|
|
||||||
AutoFillManager::~AutoFillManager()
|
AutoFillManager::~AutoFillManager()
|
||||||
{
|
{
|
||||||
delete ui;
|
delete ui;
|
||||||
|
@ -58,6 +58,8 @@ private slots:
|
|||||||
void slotImportPasswords();
|
void slotImportPasswords();
|
||||||
void slotExportPasswords();
|
void slotExportPasswords();
|
||||||
|
|
||||||
|
void currentPasswordBackendChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AutoFillManager* ui;
|
Ui::AutoFillManager* ui;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user