mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-03-11 08:54:48 +00:00
Implement database closing question on escape
This commit is contained in:
parent
925af722f8
commit
f8b7dc88a9
3 changed files with 30 additions and 0 deletions
|
|
@ -1746,6 +1746,10 @@ Are you sure you want to continue with this file?.</source>
|
|||
<source>Hardware keys found, but no slots are configured.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Press ESC again to close this database</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Windows Hello setup was canceled or failed. Quick unlock has not been enabled.</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
|
|
|||
|
|
@ -171,6 +171,29 @@ void DatabaseOpenWidget::toggleHardwareKeyComponent(bool state)
|
|||
m_ui->useHardwareKeyCheckBox->setText(tr("Use hardware key"));
|
||||
}
|
||||
}
|
||||
void DatabaseOpenWidget::closeDatabase()
|
||||
{
|
||||
int closeWarningInterval = 3000;
|
||||
|
||||
if (!m_triedToQuit && window() == getMainWindow()) {
|
||||
m_triedToQuit = true;
|
||||
m_ui->messageWidget->showMessage(
|
||||
tr("Press ESC again to close this database"), MessageWidget::Warning, closeWarningInterval);
|
||||
|
||||
QTimer::singleShot(closeWarningInterval, this, [this]() { m_triedToQuit = false; });
|
||||
return;
|
||||
}
|
||||
reject();
|
||||
}
|
||||
|
||||
void DatabaseOpenWidget::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Escape) {
|
||||
closeDatabase();
|
||||
} else {
|
||||
DialogyWidget::keyPressEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
bool DatabaseOpenWidget::event(QEvent* event)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ signals:
|
|||
|
||||
protected:
|
||||
bool event(QEvent* event) override;
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
QSharedPointer<CompositeKey> buildDatabaseKey();
|
||||
void setUserInteractionLock(bool state);
|
||||
|
||||
|
|
@ -81,6 +82,7 @@ protected slots:
|
|||
private slots:
|
||||
bool browseKeyFile();
|
||||
void toggleHardwareKeyComponent(bool state);
|
||||
void closeDatabase();
|
||||
void pollHardwareKey(bool manualTrigger = false, int delay = 0);
|
||||
void hardwareKeyResponse(bool found);
|
||||
|
||||
|
|
@ -92,6 +94,7 @@ private:
|
|||
bool m_manualHardwareKeyRefresh = false;
|
||||
bool m_blockQuickUnlock = false;
|
||||
bool m_unlockingDatabase = false;
|
||||
bool m_triedToQuit = false;
|
||||
QTimer m_hideTimer;
|
||||
QTimer m_hideNoHardwareKeysFoundTimer;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue