mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-01 02:36:12 -05:00
closeEvent() should always hide the window, never raise it.
This fixes an issue on X11 where Alt-F4 would not close the window, due to toggleWindow() believing the window is inactive and trying to raise it. Avoid the problem by closing the window unconditionally.
This commit is contained in:
parent
93c212f28d
commit
ac0178d2c7
@ -612,7 +612,7 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
|||||||
if (minimizeOnClose && !appExitCalled)
|
if (minimizeOnClose && !appExitCalled)
|
||||||
{
|
{
|
||||||
event->ignore();
|
event->ignore();
|
||||||
toggleWindow();
|
hideWindow();
|
||||||
|
|
||||||
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
||||||
m_ui->tabWidget->lockDatabases();
|
m_ui->tabWidget->lockDatabases();
|
||||||
@ -777,15 +777,20 @@ void MainWindow::trayIconTriggered(QSystemTrayIcon::ActivationReason reason)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::toggleWindow()
|
void MainWindow::hideWindow()
|
||||||
{
|
{
|
||||||
if ((QApplication::activeWindow() == this) && isVisible() && !isMinimized()) {
|
|
||||||
setWindowState(windowState() | Qt::WindowMinimized);
|
setWindowState(windowState() | Qt::WindowMinimized);
|
||||||
QTimer::singleShot(0, this, SLOT(hide()));
|
QTimer::singleShot(0, this, SLOT(hide()));
|
||||||
|
|
||||||
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
||||||
m_ui->tabWidget->lockDatabases();
|
m_ui->tabWidget->lockDatabases();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::toggleWindow()
|
||||||
|
{
|
||||||
|
if ((QApplication::activeWindow() == this) && isVisible() && !isMinimized()) {
|
||||||
|
hideWindow();
|
||||||
} else {
|
} else {
|
||||||
ensurePolished();
|
ensurePolished();
|
||||||
setWindowState(windowState() & ~Qt::WindowMinimized);
|
setWindowState(windowState() & ~Qt::WindowMinimized);
|
||||||
|
@ -72,6 +72,7 @@ private Q_SLOTS:
|
|||||||
void rememberOpenDatabases(const QString& filePath);
|
void rememberOpenDatabases(const QString& filePath);
|
||||||
void applySettingsChanges();
|
void applySettingsChanges();
|
||||||
void trayIconTriggered(QSystemTrayIcon::ActivationReason reason);
|
void trayIconTriggered(QSystemTrayIcon::ActivationReason reason);
|
||||||
|
void hideWindow();
|
||||||
void toggleWindow();
|
void toggleWindow();
|
||||||
void lockDatabasesAfterInactivity();
|
void lockDatabasesAfterInactivity();
|
||||||
void repairDatabase();
|
void repairDatabase();
|
||||||
|
Loading…
Reference in New Issue
Block a user