From d84964c056155a9da40cace8f2b13e73dd14d941 Mon Sep 17 00:00:00 2001 From: varjolintu Date: Sat, 27 Apr 2019 13:37:42 +0300 Subject: [PATCH] Close popups when database is locked --- src/browser/BrowserService.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/browser/BrowserService.cpp b/src/browser/BrowserService.cpp index 9c06c24875..112a7cda92 100644 --- a/src/browser/BrowserService.cpp +++ b/src/browser/BrowserService.cpp @@ -296,6 +296,7 @@ QString BrowserService::storeKey(const QString& key) do { QInputDialog keyDialog; + connect(m_dbTabWidget, SIGNAL(databaseLocked(DatabaseWidget*)), &keyDialog, SLOT(reject())); keyDialog.setWindowTitle(tr("KeePassXC: New key association request")); keyDialog.setLabelText(tr("You have received an association request for the above key.\n\n" "If you would like to allow it access to your KeePassXC database,\n" @@ -310,7 +311,7 @@ QString BrowserService::storeKey(const QString& key) id = keyDialog.textValue(); - if (ok != QDialog::Accepted || id.isEmpty()) { + if (ok != QDialog::Accepted || id.isEmpty() || !isDatabaseOpened()) { hideWindow(); return {}; } @@ -406,6 +407,11 @@ QJsonArray BrowserService::findMatchingEntries(const QString& id, return QJsonArray(); } + // Ensure that database is not locked when the popup was visible + if (!isDatabaseOpened()) { + return QJsonArray(); + } + // Sort results pwEntries = sortEntries(pwEntries, host, submitUrl); @@ -760,6 +766,7 @@ bool BrowserService::confirmEntries(QList& pwEntriesToConfirm, m_dialogActive = true; BrowserAccessControlDialog accessControlDialog; + connect(m_dbTabWidget, SIGNAL(databaseLocked(DatabaseWidget*)), &accessControlDialog, SLOT(reject())); accessControlDialog.setUrl(url); accessControlDialog.setItems(pwEntriesToConfirm);