Skip to content

Commit

Permalink
Replace popup with general message which appears on first ESC or clos…
Browse files Browse the repository at this point in the history
  • Loading branch information
WinnetouL committed Sep 3, 2024
1 parent 69fad1e commit 33ddbbd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
14 changes: 6 additions & 8 deletions src/gui/DatabaseOpenWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ DatabaseOpenWidget::DatabaseOpenWidget(QWidget* parent)
okBtn->setText(tr("Unlock"));
okBtn->setDefault(true);
connect(m_ui->buttonBox, SIGNAL(accepted()), SLOT(openDatabase()));
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(cancelDatabaseUnlock()));
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(closeDatabase()));

connect(m_ui->addKeyFileLinkLabel, &QLabel::linkActivated, this, &DatabaseOpenWidget::browseKeyFile);
connect(m_ui->keyFileLineEdit, &PasswordWidget::textChanged, this, [&](const QString& text) {
Expand Down Expand Up @@ -448,15 +448,13 @@ QSharedPointer<CompositeKey> DatabaseOpenWidget::buildDatabaseKey()
return databaseKey;
}

void DatabaseOpenWidget::cancelDatabaseUnlock()
void DatabaseOpenWidget::closeDatabase()
{
auto result = MessageBox::question(this,
tr("Cancel Database Unlock"),
tr("Would you like to cancel unlocking this database?"),
MessageBox::Cancel | MessageBox::Ok,
MessageBox::Cancel);
if (result == MessageBox::Ok) {
if (m_escPressedOnce) {
reject();
} else {
m_escPressedOnce = true;
m_ui->messageWidget->showMessage(tr("Press ESC again to close this database."), MessageWidget::Information);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/gui/DatabaseOpenWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected slots:

private slots:
bool browseKeyFile();
void cancelDatabaseUnlock();
void closeDatabase();
void reject();
void toggleHardwareKeyComponent(bool state);
void pollHardwareKey(bool manualTrigger = false);
Expand All @@ -91,6 +91,7 @@ private slots:
bool m_manualHardwareKeyRefresh = false;
bool m_blockQuickUnlock = false;
bool m_unlockingDatabase = false;
bool m_escPressedOnce = false;
QTimer m_hideTimer;
QTimer m_hideNoHardwareKeysFoundTimer;

Expand Down

0 comments on commit 33ddbbd

Please sign in to comment.