Fix tray icon behavior for non-KDE StatusNotifier
[quassel.git] / src / qtui / indicatornotificationbackend.cpp
index 41fce5c..281fe98 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "client.h"
 #include "clientsettings.h"
+#include "iconloader.h"
 #include "mainwin.h"
 #include "networkmodel.h"
 #include "qtui.h"
@@ -51,7 +52,7 @@ IndicatorNotificationBackend::IndicatorNotificationBackend(QObject *parent)
     .arg(XSTR(XDG_APPS_INSTALL_DIR))
     .arg(QCoreApplication::applicationFilePath().section('/', -1));
   _server->setDesktopFile(desktopFile);
-  connect(_server, SIGNAL(serverDisplay()), QtUi::mainWindow(), SLOT(forceActivated()));
+  connect(_server, SIGNAL(serverDisplay()), SLOT(activateMainWidget()));
 
   if (_enabled) {
     _server->show();
@@ -62,6 +63,10 @@ IndicatorNotificationBackend::~IndicatorNotificationBackend() {
   qDeleteAll(_indicatorHash);
 }
 
+void IndicatorNotificationBackend::activateMainWidget() {
+  GraphicalUi::activateMainWidget();
+}
+
 void IndicatorNotificationBackend::notify(const Notification &notification) {
   if(!_enabled) {
     return;
@@ -150,6 +155,8 @@ IndicatorNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent)
 : SettingsPage("Internal", "IndicatorNotification", parent)
 {
   ui.setupUi(this);
+   // FIXME find proper icon (this one is used by the plasmoid as well)
+  ui.enabled->setIcon(SmallIcon("mail-message-new"));
 
   connect(ui.enabled, SIGNAL(toggled(bool)), SLOT(widgetChanged()));
 }