From 837df4f4cb2176e95f160d6aec93beeca47a4ee2 Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Fri, 8 Nov 2019 17:56:24 -0500 Subject: [PATCH] Fix issues with database unlock * Fix #3735 - Don't focus on OpenDatabaseWidget fields that are not visible; ensures password field is focused after database lock. * Fix #3487 - Password input is selected after failed unlock. * Fix #1938 - Password input is focused after toggling visibility using the keyboard --- src/gui/DatabaseOpenWidget.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/DatabaseOpenWidget.cpp b/src/gui/DatabaseOpenWidget.cpp index b15db7b9c..a409aadc3 100644 --- a/src/gui/DatabaseOpenWidget.cpp +++ b/src/gui/DatabaseOpenWidget.cpp @@ -58,6 +58,7 @@ DatabaseOpenWidget::DatabaseOpenWidget(QWidget* parent) m_ui->buttonTogglePassword->setIcon(filePath()->onOffIcon("actions", "password-show")); connect(m_ui->buttonTogglePassword, SIGNAL(toggled(bool)), m_ui->editPassword, SLOT(setShowPassword(bool))); + connect(m_ui->buttonTogglePassword, SIGNAL(toggled(bool)), m_ui->editPassword, SLOT(setFocus())); connect(m_ui->buttonBrowseFile, SIGNAL(clicked()), SLOT(browseKeyFile())); connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(openDatabase())); @@ -165,8 +166,6 @@ void DatabaseOpenWidget::load(const QString& filename) QHash useTouchID = config()->get("UseTouchID").toHash(); m_ui->checkTouchID->setChecked(useTouchID.value(m_filename, false).toBool()); - - m_ui->editPassword->setFocus(); } void DatabaseOpenWidget::clearForms() @@ -230,6 +229,9 @@ void DatabaseOpenWidget::openDatabase() } m_retryUnlockWithEmptyPassword = false; m_ui->messageWidget->showMessage(error, MessageWidget::MessageType::Error); + // Focus on the password field and select the input for easy retry + m_ui->editPassword->selectAll(); + m_ui->editPassword->setFocus(); return; }