mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-12-29 01:06:27 -05:00
Make sure we don't lock the database while a dialog is open.
This can happen when - the user is picking out a file to save the database as - a dialog asking the user to save/discard/cancel the current database changes is active It is dangerous to lock the databases while these actions are still in progress. Closes #208
This commit is contained in:
parent
c6105a08ab
commit
721bec9794
@ -72,7 +72,7 @@ MainWindow::MainWindow()
|
|||||||
|
|
||||||
m_inactivityTimer = new InactivityTimer(this);
|
m_inactivityTimer = new InactivityTimer(this);
|
||||||
connect(m_inactivityTimer, SIGNAL(inactivityDetected()),
|
connect(m_inactivityTimer, SIGNAL(inactivityDetected()),
|
||||||
m_ui->tabWidget, SLOT(lockDatabases()));
|
this, SLOT(lockDatabasesAfterInactivity()));
|
||||||
applySettingsChanges();
|
applySettingsChanges();
|
||||||
|
|
||||||
setShortcut(m_ui->actionDatabaseOpen, QKeySequence::Open, Qt::CTRL + Qt::Key_O);
|
setShortcut(m_ui->actionDatabaseOpen, QKeySequence::Open, Qt::CTRL + Qt::Key_O);
|
||||||
@ -579,6 +579,16 @@ void MainWindow::toggleWindow()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::lockDatabasesAfterInactivity()
|
||||||
|
{
|
||||||
|
// ignore event if a modal dialog is open (such as a message box or file dialog)
|
||||||
|
if (QApplication::activeModalWidget()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ui->tabWidget->lockDatabases();
|
||||||
|
}
|
||||||
|
|
||||||
bool MainWindow::isTrayIconEnabled() const
|
bool MainWindow::isTrayIconEnabled() const
|
||||||
{
|
{
|
||||||
return config()->get("GUI/ShowTrayIcon").toBool()
|
return config()->get("GUI/ShowTrayIcon").toBool()
|
||||||
|
@ -65,6 +65,7 @@ private Q_SLOTS:
|
|||||||
void applySettingsChanges();
|
void applySettingsChanges();
|
||||||
void trayIconTriggered(QSystemTrayIcon::ActivationReason reason);
|
void trayIconTriggered(QSystemTrayIcon::ActivationReason reason);
|
||||||
void toggleWindow();
|
void toggleWindow();
|
||||||
|
void lockDatabasesAfterInactivity();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void setShortcut(QAction* action, QKeySequence::StandardKey standard, int fallback = 0);
|
static void setShortcut(QAction* action, QKeySequence::StandardKey standard, int fallback = 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user