diff --git a/src/gui/mainwindow.cpp b/src/gui/mainwindow.cpp index 314d14455..d89a7850b 100644 --- a/src/gui/mainwindow.cpp +++ b/src/gui/mainwindow.cpp @@ -953,17 +953,17 @@ void MainWindow::notifyOfUpdate(QString) } // Toggle Main window visibility -void MainWindow::toggleVisibility(QSystemTrayIcon::ActivationReason e) +void MainWindow::toggleVisibility(const QSystemTrayIcon::ActivationReason reason) { - if ((e == QSystemTrayIcon::Trigger) || (e == QSystemTrayIcon::DoubleClick)) { + switch (reason) { + case QSystemTrayIcon::Trigger: { if (isHidden()) { - if (m_uiLocked) { - // Ask for UI lock password - if (!unlockUI()) - return; - } + if (m_uiLocked && !unlockUI()) // Ask for UI lock password + return; + // Make sure the window is not minimized setWindowState((windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); + // Then show it show(); raise(); @@ -972,6 +972,12 @@ void MainWindow::toggleVisibility(QSystemTrayIcon::ActivationReason e) else { hide(); } + + break; + } + + default: + break; } } diff --git a/src/gui/mainwindow.h b/src/gui/mainwindow.h index 80966c20b..f764bca29 100644 --- a/src/gui/mainwindow.h +++ b/src/gui/mainwindow.h @@ -102,7 +102,7 @@ public: void showNotificationBaloon(QString title, QString msg) const; private slots: - void toggleVisibility(QSystemTrayIcon::ActivationReason e = QSystemTrayIcon::Trigger); + void toggleVisibility(const QSystemTrayIcon::ActivationReason reason = QSystemTrayIcon::Trigger); void balloonClicked(); void writeSettings();