Fix tray icon behavior for non-KDE StatusNotifier
authorManuel Nickschas <sputnick@quassel-irc.org>
Wed, 14 Apr 2010 07:41:02 +0000 (09:41 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 14 Apr 2010 08:34:51 +0000 (10:34 +0200)
Our workaround for QSystemTrayIcon activation misbehavior (clicking the bubble
should NOT send two activation signals!) fails when using StatusNotifier instead,
but only if KDE integration is disabled (wtf?). Turns out we don't get mouse events
from the notifier then.

Solution: only enable workaround when using the legacy tray icon.

src/qtui/systemtray.h
src/qtui/systraynotificationbackend.cpp

index 4a2a805..a83d356 100644 (file)
@@ -64,6 +64,7 @@ public:
   virtual ~SystemTray();
   virtual void init();
 
+  inline Mode mode() const;
   inline State state() const;
   inline bool isAlerted() const;
   virtual inline bool isSystemTrayAvailable() const;
@@ -93,7 +94,6 @@ protected slots:
 
 protected:
   virtual void setMode(Mode mode);
-  inline Mode mode() const;
   inline bool shouldBeVisible() const;
 
   virtual Icon stateIcon() const;
index dade708..cb409ae 100644 (file)
@@ -88,7 +88,8 @@ void SystrayNotificationBackend::close(uint notificationId) {
 void SystrayNotificationBackend::notificationActivated(uint notificationId) {
   if(!_blockActivation) {
     if(_notifications.count()) {
-      _blockActivation = true; // prevent double activation because both tray icon and bubble might send a signal
+      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);