diff --git a/src/gui/DatabaseOpenWidget.cpp b/src/gui/DatabaseOpenWidget.cpp index 1c013ea08..e106f2b09 100644 --- a/src/gui/DatabaseOpenWidget.cpp +++ b/src/gui/DatabaseOpenWidget.cpp @@ -87,19 +87,15 @@ DatabaseOpenWidget::DatabaseOpenWidget(QWidget* parent) connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(openDatabase())); connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(reject())); - connect(m_ui->addKeyFileLinkLabel, &QLabel::linkActivated, this, [&](const QString&) { - if (browseKeyFile()) { - toggleKeyFileComponent(true); - } - }); + connect(m_ui->addKeyFileLinkLabel, &QLabel::linkActivated, this, &DatabaseOpenWidget::browseKeyFile); connect(m_ui->keyFileLineEdit, &PasswordWidget::textChanged, this, [&](const QString& text) { - if (text.isEmpty() && m_ui->keyFileLineEdit->isVisible()) { - toggleKeyFileComponent(false); - } + bool state = !text.isEmpty(); + m_ui->addKeyFileLinkLabel->setVisible(!state); + m_ui->selectKeyFileComponent->setVisible(state); }); connect(m_ui->useHardwareKeyCheckBox, &QCheckBox::toggled, m_ui->hardwareKeyCombo, &QComboBox::setEnabled); - toggleKeyFileComponent(false); + m_ui->selectKeyFileComponent->setVisible(false); toggleHardwareKeyComponent(false); QSizePolicy sp = m_ui->hardwareKeyProgress->sizePolicy(); @@ -140,12 +136,6 @@ DatabaseOpenWidget::DatabaseOpenWidget(QWidget* parent) DatabaseOpenWidget::~DatabaseOpenWidget() = default; -void DatabaseOpenWidget::toggleKeyFileComponent(bool state) -{ - m_ui->addKeyFileLinkLabel->setVisible(!state); - m_ui->selectKeyFileComponent->setVisible(state); -} - void DatabaseOpenWidget::toggleHardwareKeyComponent(bool state) { m_ui->hardwareKeyProgress->setVisible(false); @@ -241,7 +231,6 @@ void DatabaseOpenWidget::load(const QString& filename) auto lastKeyFiles = config()->get(Config::LastKeyFiles).toHash(); if (lastKeyFiles.contains(m_filename)) { m_ui->keyFileLineEdit->setText(lastKeyFiles[m_filename].toString()); - toggleKeyFileComponent(true); } } diff --git a/src/gui/DatabaseOpenWidget.h b/src/gui/DatabaseOpenWidget.h index 2236e52d8..f75e118de 100644 --- a/src/gui/DatabaseOpenWidget.h +++ b/src/gui/DatabaseOpenWidget.h @@ -78,7 +78,6 @@ protected slots: private slots: bool browseKeyFile(); - void toggleKeyFileComponent(bool state); void toggleHardwareKeyComponent(bool state); void pollHardwareKey(bool manualTrigger = false); void hardwareKeyResponse(bool found);