mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-12-02 14:52:55 -08:00
Close databases when they are locked.
Previously we've only hidden access to them. Closes #275
This commit is contained in:
1 parent
33650c4a04
commit
9e051e835b
11 files changed
+149
-91
No files matched your search
@@ -25,33 +25,6 @@ UnlockDatabaseWidget::UnlockDatabaseWidget(QWidget* parent)
|
||||
: DatabaseOpenWidget(parent)
|
||||
{
|
||||
m_ui->labelHeadline->setText(tr("Unlock database"));
|
||||
|
||||
m_ui->buttonBox->removeButton(m_ui->buttonBox->button(QDialogButtonBox::Cancel));
|
||||
connect(this, SIGNAL(editFinished(bool)), SLOT(clearForms()));
|
||||
}
|
||||
|
||||
void UnlockDatabaseWidget::load(const QString& filename, Database* db)
|
||||
{
|
||||
Q_ASSERT(db);
|
||||
|
||||
DatabaseOpenWidget::load(filename);
|
||||
m_db = db;
|
||||
}
|
||||
|
||||
void UnlockDatabaseWidget::openDatabase()
|
||||
{
|
||||
CompositeKey masterKey = databaseKey();
|
||||
if (masterKey.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_db->verifyKey(masterKey)) {
|
||||
Q_EMIT editFinished(true);
|
||||
}
|
||||
else {
|
||||
MessageBox::warning(this, tr("Error"), tr("Wrong key."));
|
||||
m_ui->editPassword->clear();
|
||||
}
|
||||
}
|
||||
|
||||
void UnlockDatabaseWidget::clearForms()
|
||||
@@ -60,4 +33,5 @@ void UnlockDatabaseWidget::clearForms()
|
||||
m_ui->comboKeyFile->clear();
|
||||
m_ui->checkPassword->setChecked(false);
|
||||
m_ui->checkKeyFile->setChecked(false);
|
||||
m_db = Q_NULLPTR;
|
||||
}
|
||||
Reference in new issue
Block a user