Add support for Qt5 in the build system
[quassel.git] / src / qtui / systraynotificationbackend.cpp
index b6d1ff5..7413495 100644 (file)
@@ -1,5 +1,5 @@
 /***************************************************************************
- *   Copyright (C) 2005-2010 by the Quassel Project                        *
+ *   Copyright (C) 2005-2012 by the Quassel Project                        *
  *   devel@quassel-irc.org                                                 *
  *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
@@ -79,7 +79,7 @@ void SystrayNotificationBackend::close(uint notificationId) {
 
   QtUi::mainWindow()->systemTray()->closeMessage(notificationId);
 
-  if(!_notifications.count())
+  //if(!_notifications.count()) //FIXME make configurable
     QtUi::mainWindow()->systemTray()->setAlert(false);
 
   updateToolTip();
@@ -87,8 +87,9 @@ void SystrayNotificationBackend::close(uint notificationId) {
 
 void SystrayNotificationBackend::notificationActivated(uint notificationId) {
   if(!_blockActivation) {
-    if(QtUi::mainWindow()->systemTray()->isAlerted()) {
-      _blockActivation = true; // prevent double activation because both tray icon and bubble might send a signal
+    if(_notifications.count()) {
+      if(QtUi::mainWindow()->systemTray()->mode() == SystemTray::Legacy)
+        _blockActivation = true; // prevent double activation because both tray icon and bubble might send a signal
       if(!notificationId)
         notificationId = _notifications.count()? _notifications.last().notificationId : 0;
       emit activated(notificationId);
@@ -121,7 +122,7 @@ void SystrayNotificationBackend::animateChanged(const QVariant &v) {
 
 void SystrayNotificationBackend::updateToolTip() {
   QtUi::mainWindow()->systemTray()->setToolTip("Quassel IRC",
-                                               _notifications.count()? tr("%n pending highlights", "", _notifications.count()) : QString());
+                                               _notifications.count()? tr("%n pending highlight(s)", "", _notifications.count()) : QString());
 }
 
 SettingsPage *SystrayNotificationBackend::createConfigWidget() const {