+
+bool SystemTray::eventFilter(QObject *obj, QEvent *event) {
+ Q_UNUSED(obj);
+ if(event->type() == QEvent::MouseButtonRelease) {
+ _inhibitActivation = false;
+ }
+ return false;
+}
+
+void SystemTray::on_activated(QSystemTrayIcon::ActivationReason reason) {
+ emit activated(reason);
+
+ if(reason == QSystemTrayIcon::Trigger && !_inhibitActivation) {
+
+# ifdef HAVE_KDE
+ // the slot is private, but meh, who cares :)
+ QMetaObject::invokeMethod(_trayIcon, "activateOrHide", Q_ARG(QSystemTrayIcon::ActivationReason, QSystemTrayIcon::Trigger));
+# else
+ QtUi::mainWindow()->toggleMinimizedToTray();
+# endif
+
+ }
+}