From 060dc05579e4addaadc43c8a273ca56e13b24a70 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Wed, 10 Mar 2010 17:55:02 +0000 Subject: kde notification: added kde 4.4 support (patch by Artur Guzik) git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1613 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/General/kdenotify/kdenotify.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src/plugins/General/kdenotify/kdenotify.cpp') diff --git a/src/plugins/General/kdenotify/kdenotify.cpp b/src/plugins/General/kdenotify/kdenotify.cpp index 908e21432..419189f3a 100644 --- a/src/plugins/General/kdenotify/kdenotify.cpp +++ b/src/plugins/General/kdenotify/kdenotify.cpp @@ -32,17 +32,26 @@ #include #include "kdenotify.h" -KdeNotify::KdeNotify(QObject *parent) : General(parent) +KdeNotify::KdeNotify(QObject *parent) : General(parent),m_UseFreedesktopSpec(false) { notifier = new QDBusInterface("org.kde.VisualNotifications", "/VisualNotifications", "org.kde.VisualNotifications"); if(notifier->lastError().type() != QDBusError::NoError) { - qWarning() << "KdeNotify: unable to create dbus interface(" + - notifier->lastError().message() + ")"; - return; + delete(notifier); + qWarning() << "KdeNotify: unable to create dbus interface." + << "Have you got KDE SC 4.4 or newer? Lets try..."; + + notifier = new QDBusInterface("org.freedesktop.Notifications", + "/org/freedesktop/Notifications","org.freedesktop.Notifications"); + if(notifier->lastError().type() != QDBusError::NoError) + { + qWarning() << "KdeNotify: Can't create interface. Sorry."; + return; + } + m_UseFreedesktopSpec = true; } - + qWarning() << "KdeNotify: DBus interfece created successfully."; m_ConfigDir = QFileInfo(Qmmp::configFile()).absoluteDir().path(); QSettings settings(Qmmp::configFile(),QSettings::IniFormat); @@ -92,7 +101,8 @@ QList KdeNotify::prepareNotification() args.append("Qmmp"); //app-name args.append(0U); //replaces-id - args.append(""); //event-id + if(!m_UseFreedesktopSpec) + args.append(""); //event-id args.append(m_ConfigDir + "/app_icon.png"); //app-icon(path to icon on disk) args.append(tr("Qmmp now playing:")); //summary (notification title) -- cgit v1.2.3-13-gbd6f