Clear database open dialog before and after merging a database (#958)

This commit is contained in:
Jonathan White 2017-09-23 11:43:29 -04:00 committed by louib
parent daef0a358c
commit df3051038e
5 changed files with 15 additions and 12 deletions

View File

@ -119,6 +119,18 @@ void DatabaseOpenWidget::load(const QString& filename)
m_ui->editPassword->setFocus();
}
void DatabaseOpenWidget::clearForms()
{
m_ui->editPassword->clear();
m_ui->comboKeyFile->clear();
m_ui->checkPassword->setChecked(false);
m_ui->checkKeyFile->setChecked(false);
m_ui->checkChallengeResponse->setChecked(false);
m_ui->buttonTogglePassword->setChecked(false);
m_db = nullptr;
}
Database* DatabaseOpenWidget::database()
{
return m_db;

View File

@ -39,6 +39,7 @@ public:
explicit DatabaseOpenWidget(QWidget* parent = nullptr);
~DatabaseOpenWidget();
void load(const QString& filename);
void clearForms();
void enterKey(const QString& pw, const QString& keyFile);
Database* database();

View File

@ -813,6 +813,7 @@ void DatabaseWidget::mergeDatabase(bool accepted)
m_db->merge(srcDb);
}
m_databaseOpenMergeWidget->clearForms();
setCurrentWidget(m_mainWidget);
emit databaseMerged(m_db);
}
@ -918,6 +919,7 @@ void DatabaseWidget::switchToImportCsv(const QString& fileName)
void DatabaseWidget::switchToOpenMergeDatabase(const QString& fileName)
{
m_databaseOpenMergeWidget->clearForms();
m_databaseOpenMergeWidget->load(fileName);
setCurrentWidget(m_databaseOpenMergeWidget);
}

View File

@ -26,14 +26,3 @@ UnlockDatabaseWidget::UnlockDatabaseWidget(QWidget* parent)
{
m_ui->labelHeadline->setText(tr("Unlock database"));
}
void UnlockDatabaseWidget::clearForms()
{
m_ui->editPassword->clear();
m_ui->comboKeyFile->clear();
m_ui->checkPassword->setChecked(false);
m_ui->checkKeyFile->setChecked(false);
m_ui->checkChallengeResponse->setChecked(false);
m_ui->buttonTogglePassword->setChecked(false);
m_db = nullptr;
}

View File

@ -26,7 +26,6 @@ class UnlockDatabaseWidget : public DatabaseOpenWidget
public:
explicit UnlockDatabaseWidget(QWidget* parent = nullptr);
void clearForms();
};
#endif // KEEPASSX_UNLOCKDATABASEWIDGET_H