Skip to content

Commit

Permalink
Keep key file text when provided on command line
Browse files Browse the repository at this point in the history
* Fixes #10552
  • Loading branch information
droidmonkey committed May 5, 2024
1 parent c9d71e7 commit 8f98d39
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
21 changes: 5 additions & 16 deletions src/gui/DatabaseOpenWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,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();
Expand Down Expand Up @@ -152,12 +148,6 @@ DatabaseOpenWidget::~DatabaseOpenWidget()
{
}

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);
Expand Down Expand Up @@ -247,7 +237,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);
}
}

Expand Down
1 change: 0 additions & 1 deletion src/gui/DatabaseOpenWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8f98d39

Please sign in to comment.