+
+void StatusNotifierItem::init()
+{
+ qDBusRegisterMetaType<DBusImageStruct>();
+ qDBusRegisterMetaType<DBusImageVector>();
+ qDBusRegisterMetaType<DBusToolTipStruct>();
+
+ _statusNotifierItemDBus = new StatusNotifierItemDBus(this);
+
+ connect(this, SIGNAL(toolTipChanged(QString, QString)), _statusNotifierItemDBus, SIGNAL(NewToolTip()));
+ connect(this, SIGNAL(animationEnabledChanged(bool)), _statusNotifierItemDBus, SIGNAL(NewAttentionIcon()));
+
+ QDBusServiceWatcher *watcher = new QDBusServiceWatcher(_statusNotifierWatcherServiceName,
+ QDBusConnection::sessionBus(),
+ QDBusServiceWatcher::WatchForOwnerChange,
+ this);
+ connect(watcher, SIGNAL(serviceOwnerChanged(QString, QString, QString)), SLOT(serviceChange(QString, QString, QString)));
+
+ setMode(StatusNotifier);
+
+ _notificationsClient = new org::freedesktop::Notifications("org.freedesktop.Notifications", "/org/freedesktop/Notifications",
+ QDBusConnection::sessionBus(), this);
+
+ connect(_notificationsClient, SIGNAL(NotificationClosed(uint, uint)), SLOT(notificationClosed(uint, uint)));
+ connect(_notificationsClient, SIGNAL(ActionInvoked(uint, QString)), SLOT(notificationInvoked(uint, QString)));
+
+ if (_notificationsClient->isValid()) {
+ QStringList desktopCapabilities = _notificationsClient->GetCapabilities();
+ _notificationsClientSupportsMarkup = desktopCapabilities.contains("body-markup");
+ _notificationsClientSupportsActions = desktopCapabilities.contains("actions");
+ }
+
+ StatusNotifierItemParent::init();
+ trayMenu()->installEventFilter(this);
+
+ // use the appdata icon folder for now
+ _iconThemePath = Quassel::findDataFilePath("icons");
+
+#ifdef HAVE_DBUSMENU
+ _menuObjectPath = "/MenuBar";
+ new QuasselDBusMenuExporter(menuObjectPath(), trayMenu(), _statusNotifierItemDBus->dbusConnection()); // will be added as menu child