Fix cancelling logout when window is maxmimized

Fixes #565
This commit is contained in:
Jonas Kvinge 2020-10-25 19:59:27 +01:00
parent 27d6f881cd
commit a50c978ce3
1 changed files with 3 additions and 1 deletions

View File

@ -1531,18 +1531,20 @@ void MainWindow::showEvent(QShowEvent *e) {
void MainWindow::closeEvent(QCloseEvent *e) { void MainWindow::closeEvent(QCloseEvent *e) {
if (!hidden_ && keep_running_ && e->spontaneous() && QSystemTrayIcon::isSystemTrayAvailable()) { if (!hidden_ && keep_running_ && e->spontaneous() && QSystemTrayIcon::isSystemTrayAvailable()) {
e->ignore();
SetHiddenInTray(true); SetHiddenInTray(true);
} }
else { else {
Exit(); Exit();
} }
QMainWindow::closeEvent(e);
} }
void MainWindow::SetHiddenInTray(const bool hidden) { void MainWindow::SetHiddenInTray(const bool hidden) {
hidden_ = hidden; hidden_ = hidden;
settings_.setValue("hidden", hidden_);
// Some window managers don't remember maximized state between calls to hide() and show(), so we have to remember it ourself. // Some window managers don't remember maximized state between calls to hide() and show(), so we have to remember it ourself.
if (hidden) { if (hidden) {