diff --git a/src/gui/DatabaseOpenWidget.cpp b/src/gui/DatabaseOpenWidget.cpp index d5c9707f8..4d313dd35 100644 --- a/src/gui/DatabaseOpenWidget.cpp +++ b/src/gui/DatabaseOpenWidget.cpp @@ -35,6 +35,7 @@ #endif #include +#include #include #include @@ -168,6 +169,11 @@ void DatabaseOpenWidget::hideEvent(QHideEvent* event) } } +bool DatabaseOpenWidget::unlockingDatabase() +{ + return m_unlockingDatabase; +} + void DatabaseOpenWidget::load(const QString& filename) { clearForms(); @@ -522,6 +528,7 @@ void DatabaseOpenWidget::setUserInteractionLock(bool state) } m_ui->centralStack->setEnabled(true); } + m_unlockingDatabase = state; } bool DatabaseOpenWidget::isOnQuickUnlockScreen() diff --git a/src/gui/DatabaseOpenWidget.h b/src/gui/DatabaseOpenWidget.h index 673032ba3..756234c57 100644 --- a/src/gui/DatabaseOpenWidget.h +++ b/src/gui/DatabaseOpenWidget.h @@ -46,6 +46,7 @@ public: void enterKey(const QString& pw, const QString& keyFile); QSharedPointer database(); void resetQuickUnlock(); + bool unlockingDatabase(); signals: void dialogFinished(bool accepted); @@ -78,6 +79,7 @@ private slots: private: bool m_pollingHardwareKey = false; bool m_blockQuickUnlock = false; + bool m_unlockingDatabase = false; QTimer m_hideTimer; Q_DISABLE_COPY(DatabaseOpenWidget) diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index ebdca17bb..2ac0779c6 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -1565,12 +1565,12 @@ Group* DatabaseWidget::currentGroup() const void DatabaseWidget::closeEvent(QCloseEvent* event) { - if (!isLocked() && !lock()) { + if (!lock() || m_databaseOpenWidget->unlockingDatabase()) { event->ignore(); return; } - m_databaseOpenWidget->resetQuickUnlock(); + m_databaseOpenWidget->resetQuickUnlock(); event->accept(); }