mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-11-22 16:00:38 -05:00
🔒 Implement automatic locking when minimizing
This commit is contained in:
parent
2e9b42688f
commit
6c3c0087dd
4 changed files with 31 additions and 7 deletions
|
|
@ -516,6 +516,11 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
|||
{
|
||||
event->ignore();
|
||||
hide();
|
||||
|
||||
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
||||
m_ui->tabWidget->lockDatabases();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -534,12 +539,17 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
|||
|
||||
void MainWindow::changeEvent(QEvent* event)
|
||||
{
|
||||
if ((event->type() == QEvent::WindowStateChange) && isMinimized()
|
||||
&& isTrayIconEnabled() && m_trayIcon && m_trayIcon->isVisible()
|
||||
&& config()->get("GUI/MinimizeToTray").toBool())
|
||||
{
|
||||
event->ignore();
|
||||
QTimer::singleShot(0, this, SLOT(hide()));
|
||||
if ((event->type() == QEvent::WindowStateChange) && isMinimized()) {
|
||||
if (isTrayIconEnabled() && m_trayIcon && m_trayIcon->isVisible()
|
||||
&& config()->get("GUI/MinimizeToTray").toBool())
|
||||
{
|
||||
event->ignore();
|
||||
QTimer::singleShot(0, this, SLOT(hide()));
|
||||
}
|
||||
|
||||
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
||||
m_ui->tabWidget->lockDatabases();
|
||||
}
|
||||
}
|
||||
else {
|
||||
QMainWindow::changeEvent(event);
|
||||
|
|
@ -674,6 +684,10 @@ void MainWindow::toggleWindow()
|
|||
{
|
||||
if ((QApplication::activeWindow() == this) && isVisible() && !isMinimized()) {
|
||||
hide();
|
||||
|
||||
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
||||
m_ui->tabWidget->lockDatabases();
|
||||
}
|
||||
}
|
||||
else {
|
||||
ensurePolished();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue