Fix notifications when minimized.
[quassel.git] / src / qtui / mainwin.cpp
index bf7cda3..9019e24 100644 (file)
@@ -94,6 +94,9 @@
 #  ifdef HAVE_PHONON
 #    include "phononnotificationbackend.h"
 #  endif
+#  ifdef HAVE_LIBSNORE
+#    include "snorenotificationbackend.h"
+#  endif
 #  include "systraynotificationbackend.h"
 #  include "taskbarnotificationbackend.h"
 #else /* HAVE_KDE */
   #include "osxnotificationbackend.h"
 #endif
 
+#ifdef HAVE_DBUS
+  #include "dockmanagernotificationbackend.h"
+#endif
+
 #include "settingspages/aliasessettingspage.h"
 #include "settingspages/appearancesettingspage.h"
 #include "settingspages/backlogsettingspage.h"
@@ -208,7 +215,9 @@ void MainWin::init()
 #  ifdef HAVE_PHONON
     QtUi::registerNotificationBackend(new PhononNotificationBackend(this));
 #  endif
-#  ifndef QT_NO_SYSTEMTRAYICON
+#  ifdef HAVE_LIBSNORE
+    QtUi::registerNotificationBackend(new SnoreNotificationBackend(this));
+#  elif !defined(QT_NO_SYSTEMTRAYICON)
     QtUi::registerNotificationBackend(new SystrayNotificationBackend(this));
 #  endif
 
@@ -226,6 +235,10 @@ void MainWin::init()
     QtUi::registerNotificationBackend(new OSXNotificationBackend(this));
 #endif
 
+#ifdef HAVE_DBUS
+    QtUi::registerNotificationBackend(new DockManagerNotificationBackend(this));
+#endif
+
     // we assume that at this point, all configurable actions are defined!
     QtUi::loadShortcuts();
 
@@ -306,7 +319,9 @@ void MainWin::restoreStateFromSettings(UiSettings &s)
     move(_normalPos);
 #endif
 
-    if (s.value("MainWinHidden").toBool() && QtUi::haveSystemTray())
+    if ((Quassel::isOptionSet("hidewindow")
+            || s.value("MainWinHidden").toBool())
+            && _systemTray->isSystemTrayAvailable())
         QtUi::hideMainWidget();
     else if (s.value("MainWinMinimized").toBool())
         showMinimized();
@@ -642,7 +657,7 @@ void MainWin::removeBufferView(int bufferViewConfigId)
 
 void MainWin::bufferViewToggled(bool enabled)
 {
-    if (!enabled && !isVisible()) {
+    if (!enabled && !isMinimized()) {
         // hiding the mainwindow triggers a toggle of the bufferview (which pretty much sucks big time)
         // since this isn't our fault and we can't do anything about it, we suppress the resulting calls
         return;