aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/General/kdenotify/kdenotify.cpp
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2010-03-10 17:55:02 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2010-03-10 17:55:02 +0000
commit060dc05579e4addaadc43c8a273ca56e13b24a70 (patch)
tree56a4ae0e4194e180a403e12a82cd98ae41aa3db5 /src/plugins/General/kdenotify/kdenotify.cpp
parent88b5787715a116f9deb2dcc4e64a12ca8794b5a9 (diff)
downloadqmmp-060dc05579e4addaadc43c8a273ca56e13b24a70.tar.gz
qmmp-060dc05579e4addaadc43c8a273ca56e13b24a70.tar.bz2
qmmp-060dc05579e4addaadc43c8a273ca56e13b24a70.zip
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
Diffstat (limited to 'src/plugins/General/kdenotify/kdenotify.cpp')
-rw-r--r--src/plugins/General/kdenotify/kdenotify.cpp22
1 files changed, 16 insertions, 6 deletions
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 <qmmp/metadatamanager.h>
#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<QVariant> 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)