summary refs log tree commit diff
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-11 20:55:13 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-07-11 20:56:44 +0300
commit363e3735f13fb5d2f03078bfc7146dd0487bd6ce (patch)
treee10f63aacfbc9fa46b1d9bb408b0c2cc4a1b4e74
parentWorking D-Bus desktop notifications (#361) (diff)
downloadnheko-363e3735f13fb5d2f03078bfc7146dd0487bd6ce.tar.xz
Allow close events from the session manager (#353)
-rw-r--r--include/MainWindow.h2
-rw-r--r--src/MainWindow.cc14
2 files changed, 11 insertions, 5 deletions
diff --git a/include/MainWindow.h b/include/MainWindow.h

index 3840bd9a..92040191 100644 --- a/include/MainWindow.h +++ b/include/MainWindow.h
@@ -119,6 +119,8 @@ private: void restoreWindowSize(); //! Check if there is an open dialog. bool hasActiveDialogs() const; + //! Check if the current page supports the "minimize to tray" functionality. + bool pageSupportsTray() const; static MainWindow *instance_; diff --git a/src/MainWindow.cc b/src/MainWindow.cc
index 37739dc3..37b806d0 100644 --- a/src/MainWindow.cc +++ b/src/MainWindow.cc
@@ -277,11 +277,8 @@ MainWindow::showChatPage() void MainWindow::closeEvent(QCloseEvent *event) { - // Decide whether or not we should enable tray for the current page. - bool pageSupportsTray = - !welcome_page_->isVisible() && !login_page_->isVisible() && !register_page_->isVisible(); - - if (isVisible() && pageSupportsTray && userSettings_->isTrayEnabled()) { + if (!qApp->isSavingSession() && isVisible() && pageSupportsTray() && + userSettings_->isTrayEnabled()) { event->ignore(); hide(); } @@ -505,3 +502,10 @@ MainWindow::hasActiveDialogs() const (!createRoomModal_.isNull() && createRoomModal_->isVisible()) || (!logoutModal_.isNull() && logoutModal_->isVisible()); } + +bool +MainWindow::pageSupportsTray() const +{ + return !welcome_page_->isVisible() && !login_page_->isVisible() && + !register_page_->isVisible(); +}