mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-26 22:36:59 -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
3e76f7af0f
commit
d45c2cf0f2
@ -281,7 +281,7 @@ MainWindow::MainWindow()
|
||||
connect(m_ui->passwordGeneratorWidget, SIGNAL(dialogTerminated()), SLOT(closePasswordGen()));
|
||||
|
||||
connect(m_ui->actionAbout, SIGNAL(triggered()), SLOT(showAboutDialog()));
|
||||
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
setUnifiedTitleAndToolBarOnMac(true);
|
||||
#endif
|
||||
@ -563,7 +563,7 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
||||
if (minimizeOnClose && !appExitCalled)
|
||||
{
|
||||
event->ignore();
|
||||
toggleWindow();
|
||||
hideWindow();
|
||||
|
||||
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
||||
m_ui->tabWidget->lockDatabases();
|
||||
@ -728,22 +728,27 @@ void MainWindow::trayIconTriggered(QSystemTrayIcon::ActivationReason reason)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::hideWindow()
|
||||
{
|
||||
setWindowState(windowState() | Qt::WindowMinimized);
|
||||
QTimer::singleShot(0, this, SLOT(hide()));
|
||||
|
||||
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
||||
m_ui->tabWidget->lockDatabases();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::toggleWindow()
|
||||
{
|
||||
if ((QApplication::activeWindow() == this) && isVisible() && !isMinimized()) {
|
||||
setWindowState(windowState() | Qt::WindowMinimized);
|
||||
QTimer::singleShot(0, this, SLOT(hide()));
|
||||
|
||||
if (config()->get("security/lockdatabaseminimize").toBool()) {
|
||||
m_ui->tabWidget->lockDatabases();
|
||||
}
|
||||
hideWindow();
|
||||
} else {
|
||||
ensurePolished();
|
||||
setWindowState(windowState() & ~Qt::WindowMinimized);
|
||||
show();
|
||||
raise();
|
||||
activateWindow();
|
||||
|
||||
|
||||
#if defined(Q_OS_LINUX) && ! defined(QT_NO_DBUS)
|
||||
// re-register global D-Bus menu (needed on Ubuntu with Unity)
|
||||
// see https://github.com/keepassxreboot/keepassxc/issues/271
|
||||
|
@ -68,6 +68,7 @@ private Q_SLOTS:
|
||||
void rememberOpenDatabases(const QString& filePath);
|
||||
void applySettingsChanges();
|
||||
void trayIconTriggered(QSystemTrayIcon::ActivationReason reason);
|
||||
void hideWindow();
|
||||
void toggleWindow();
|
||||
void lockDatabasesAfterInactivity();
|
||||
void repairDatabase();
|
||||
|
Loading…
x
Reference in New Issue
Block a user