From b6de71b1b562861fd9e7576a78991b94d9cd1cb7 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sun, 11 Apr 2010 07:50:20 +0000 Subject: kdenotify plugin: fixed kde 3.3 support (Artur Guzik) git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1665 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/General/kdenotify/kdenotify.cpp | 33 +++++++++++++++++------------ 1 file changed, 19 insertions(+), 14 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 b33f7d789..d1d196362 100644 --- a/src/plugins/General/kdenotify/kdenotify.cpp +++ b/src/plugins/General/kdenotify/kdenotify.cpp @@ -36,23 +36,23 @@ #include "kdenotify.h" -KdeNotify::KdeNotify(QObject *parent) : General(parent),m_useFreedesktopSpec(true) +KdeNotify::KdeNotify(QObject *parent) : General(parent),m_useFreedesktopSpec(false) { - m_notifier = new QDBusInterface("org.freedesktop.Notifications", - "/org/freedesktop/Notifications","org.freedesktop.Notifications", - QDBusConnection::sessionBus(), this); + m_notifier = new QDBusInterface("org.kde.VisualNotifications", + "/VisualNotifications", "org.kde.VisualNotifications", + QDBusConnection::sessionBus(), this); if(m_notifier->lastError().type() != QDBusError::NoError) { delete(m_notifier); - m_notifier = new QDBusInterface("org.kde.VisualNotifications", - "/VisualNotifications", "org.kde.VisualNotifications", - QDBusConnection::sessionBus(), this); + m_notifier = new QDBusInterface("org.freedesktop.Notifications", + "/org/freedesktop/Notifications","org.freedesktop.Notifications", + QDBusConnection::sessionBus(), this); if(m_notifier->lastError().type() != QDBusError::NoError) { qWarning() << "KdeNotify: Unable to create interface."; return; } - m_useFreedesktopSpec = false; + m_useFreedesktopSpec = true; } qWarning() << "KdeNotify: DBus interfece created successfully."; QString path = QFileInfo(Qmmp::configFile()).absoluteDir().path(); @@ -118,7 +118,7 @@ QList KdeNotify::prepareNotification() args.append(m_currentNotifyId); //replaces-id; if(!m_useFreedesktopSpec) args.append(""); //event-id - args.append(m_imagesDir + "/app.png"); //app-icon(path to icon on disk) + args.append(m_imagesDir + "/app-icon.png"); //app-icon(path to icon on disk) args.append(tr("Qmmp now playing:")); //summary (notification title) MetaDataFormatter f(m_template); @@ -137,12 +137,18 @@ QList KdeNotify::prepareNotification() if(coverPath.isEmpty()) coverPath = m_imagesDir + "/empty_cover.png"; - QString nBody; - nBody.append(body); - args.append(nBody); //body + if(m_useFreedesktopSpec) + args.append(body); //body + else + { + QString nBody; + nBody.append("
"); + nBody.append("%2
"); + nBody = nBody.arg(coverPath,body); + args.append(nBody); + } args.append(QStringList()); //actions - QVariantMap hints; hints.insert("image_path",coverPath); args.append(hints); //hints @@ -168,7 +174,6 @@ void KdeNotify::showMetaData() void KdeNotify::notificationClosed(uint id, uint reason) { Q_UNUSED(reason); - qWarning() << "notificationClosed: " << id; if(m_currentNotifyId == id) m_currentNotifyId = 0; } -- cgit v1.2.3-13-gbd6f