X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fqtui%2Fmainwin.cpp;h=d0a623f6a9acc0d33631e5b925a353cb8f2d6699;hp=2a5b379d102567edc21e1006ae03b788b393b0a6;hb=d76bb125c8dd275095409edd3426700a98d89f3a;hpb=f8dcbdf74b286506cc19b6efcad8c7d128f8fc80 diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index 2a5b379d..d0a623f6 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -194,7 +194,9 @@ void MainWin::init() { #ifndef HAVE_KDE QtUi::registerNotificationBackend(new TaskbarNotificationBackend(this)); +# ifndef QT_NO_SYSTEMTRAYICON QtUi::registerNotificationBackend(new SystrayNotificationBackend(this)); +# endif # ifdef HAVE_PHONON QtUi::registerNotificationBackend(new PhononNotificationBackend(this)); # endif @@ -277,9 +279,13 @@ void MainWin::restoreStateFromSettings(UiSettings &s) { move(_normalPos); #endif - if(s.value("MainWinHidden").toBool()) +#ifndef QT_NO_SYSTEMTRAYICON + if(s.value("MainWinHidden").toBool()) { hideToTray(); - else if(s.value("MainWinMinimized").toBool()) + return; + } +#endif + if(s.value("MainWinMinimized").toBool()) showMinimized(); else if(maximized) showMaximized(); @@ -675,7 +681,9 @@ void MainWin::saveStatusBarStatus(bool enabled) { } void MainWin::setupSystray() { +#ifndef QT_NO_SYSTEMTRAYICON _systemTray = new SystemTray(this); +#endif } void MainWin::setupToolBars() { @@ -739,7 +747,9 @@ void MainWin::setConnectedState() { _coreConnectionStatusWidget->setVisible(!Client::internalCore()); updateIcon(); +#ifndef QT_NO_SYSTEMTRAYICON systemTray()->setState(SystemTray::Active); +#endif if(Client::networkIds().isEmpty()) { IrcConnectionWizard *wizard = new IrcConnectionWizard(this, Qt::Sheet); @@ -805,7 +815,9 @@ void MainWin::setDisconnectedState() { if(_msgProcessorStatusWidget) _msgProcessorStatusWidget->setProgress(0, 0); updateIcon(); +#ifndef QT_NO_SYSTEMTRAYICON systemTray()->setState(SystemTray::Inactive); +#endif } void MainWin::userAuthenticationRequired(CoreAccount *account, bool *valid, const QString &errorMessage) { @@ -999,6 +1011,7 @@ void MainWin::resizeEvent(QResizeEvent *event) { } void MainWin::closeEvent(QCloseEvent *event) { +#ifndef QT_NO_SYSTEMTRAYICON QtUiSettings s; QtUiApplication* app = qobject_cast qApp; Q_ASSERT(app); @@ -1009,6 +1022,10 @@ void MainWin::closeEvent(QCloseEvent *event) { event->accept(); quit(); } +#else + event->accept(); + quit(); +#endif } void MainWin::changeEvent(QEvent *event) { @@ -1020,6 +1037,8 @@ void MainWin::changeEvent(QEvent *event) { QMainWindow::changeEvent(event); } +#ifndef QT_NO_SYSTEMTRAYICON + void MainWin::hideToTray() { if(!systemTray()->isSystemTrayAvailable()) { qWarning() << Q_FUNC_INFO << "was called with no SystemTray available!"; @@ -1052,6 +1071,8 @@ void MainWin::toggleMinimizedToTray() { #endif } +#endif /* QT_NO_SYSTEMTRAYICON */ + void MainWin::forceActivated() { #ifdef HAVE_KDE show();