mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
Allow close events from the session manager (#353)
This commit is contained in:
parent
80ebe3f29d
commit
363e3735f1
2 changed files with 11 additions and 5 deletions
|
@ -119,6 +119,8 @@ private:
|
||||||
void restoreWindowSize();
|
void restoreWindowSize();
|
||||||
//! Check if there is an open dialog.
|
//! Check if there is an open dialog.
|
||||||
bool hasActiveDialogs() const;
|
bool hasActiveDialogs() const;
|
||||||
|
//! Check if the current page supports the "minimize to tray" functionality.
|
||||||
|
bool pageSupportsTray() const;
|
||||||
|
|
||||||
static MainWindow *instance_;
|
static MainWindow *instance_;
|
||||||
|
|
||||||
|
|
|
@ -277,11 +277,8 @@ MainWindow::showChatPage()
|
||||||
void
|
void
|
||||||
MainWindow::closeEvent(QCloseEvent *event)
|
MainWindow::closeEvent(QCloseEvent *event)
|
||||||
{
|
{
|
||||||
// Decide whether or not we should enable tray for the current page.
|
if (!qApp->isSavingSession() && isVisible() && pageSupportsTray() &&
|
||||||
bool pageSupportsTray =
|
userSettings_->isTrayEnabled()) {
|
||||||
!welcome_page_->isVisible() && !login_page_->isVisible() && !register_page_->isVisible();
|
|
||||||
|
|
||||||
if (isVisible() && pageSupportsTray && userSettings_->isTrayEnabled()) {
|
|
||||||
event->ignore();
|
event->ignore();
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
@ -505,3 +502,10 @@ MainWindow::hasActiveDialogs() const
|
||||||
(!createRoomModal_.isNull() && createRoomModal_->isVisible()) ||
|
(!createRoomModal_.isNull() && createRoomModal_->isVisible()) ||
|
||||||
(!logoutModal_.isNull() && logoutModal_->isVisible());
|
(!logoutModal_.isNull() && logoutModal_->isVisible());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
MainWindow::pageSupportsTray() const
|
||||||
|
{
|
||||||
|
return !welcome_page_->isVisible() && !login_page_->isVisible() &&
|
||||||
|
!register_page_->isVisible();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue