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 ++++++++++++++++------ src/plugins/General/kdenotify/kdenotify.h | 2 +- .../kdenotify/translations/kdenotify_plugin_cs.ts | 6 +++--- .../kdenotify/translations/kdenotify_plugin_de.ts | 6 +++--- .../kdenotify/translations/kdenotify_plugin_it.ts | 6 +++--- .../kdenotify/translations/kdenotify_plugin_lt.ts | 6 +++--- .../kdenotify/translations/kdenotify_plugin_pl.ts | 6 +++--- .../kdenotify/translations/kdenotify_plugin_ru.ts | 6 +++--- .../kdenotify/translations/kdenotify_plugin_tr.ts | 6 +++--- .../translations/kdenotify_plugin_uk_UA.ts | 6 +++--- .../translations/kdenotify_plugin_zh_CN.ts | 6 +++--- .../translations/kdenotify_plugin_zh_TW.ts | 6 +++--- 12 files changed, 47 insertions(+), 37 deletions(-) (limited to 'src/plugins/General/kdenotify') 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) diff --git a/src/plugins/General/kdenotify/kdenotify.h b/src/plugins/General/kdenotify/kdenotify.h index 652e111eb..58317d61d 100644 --- a/src/plugins/General/kdenotify/kdenotify.h +++ b/src/plugins/General/kdenotify/kdenotify.h @@ -42,7 +42,7 @@ private: QString m_ConfigDir; int m_NotifyDelay; bool m_ShowCovers; - + bool m_UseFreedesktopSpec; private slots: void showMetaData(); QString totalTimeString(); diff --git a/src/plugins/General/kdenotify/translations/kdenotify_plugin_cs.ts b/src/plugins/General/kdenotify/translations/kdenotify_plugin_cs.ts index 6981288e8..c3205d308 100644 --- a/src/plugins/General/kdenotify/translations/kdenotify_plugin_cs.ts +++ b/src/plugins/General/kdenotify/translations/kdenotify_plugin_cs.ts @@ -4,17 +4,17 @@ KdeNotify - + Qmmp now playing: Qmmp nyní přehrává: - + by - - + on - diff --git a/src/plugins/General/kdenotify/translations/kdenotify_plugin_de.ts b/src/plugins/General/kdenotify/translations/kdenotify_plugin_de.ts index 86da28416..a35e8c10a 100644 --- a/src/plugins/General/kdenotify/translations/kdenotify_plugin_de.ts +++ b/src/plugins/General/kdenotify/translations/kdenotify_plugin_de.ts @@ -4,17 +4,17 @@ KdeNotify - + Qmmp now playing: Qmmp spielt zurzeit: - + by von - + on auf diff --git a/src/plugins/General/kdenotify/translations/kdenotify_plugin_it.ts b/src/plugins/General/kdenotify/translations/kdenotify_plugin_it.ts index c84ad5af7..cb4ca17ba 100644 --- a/src/plugins/General/kdenotify/translations/kdenotify_plugin_it.ts +++ b/src/plugins/General/kdenotify/translations/kdenotify_plugin_it.ts @@ -4,17 +4,17 @@ KdeNotify - + Qmmp now playing: Qmmp ora in esecuzione: - + by di - + on su diff --git a/src/plugins/General/kdenotify/translations/kdenotify_plugin_lt.ts b/src/plugins/General/kdenotify/translations/kdenotify_plugin_lt.ts index 3bacbeba8..d6ea24065 100644 --- a/src/plugins/General/kdenotify/translations/kdenotify_plugin_lt.ts +++ b/src/plugins/General/kdenotify/translations/kdenotify_plugin_lt.ts @@ -4,17 +4,17 @@ KdeNotify - + Qmmp now playing: Qmmp dabar groja: - + by - + on diff --git a/src/plugins/General/kdenotify/translations/kdenotify_plugin_pl.ts b/src/plugins/General/kdenotify/translations/kdenotify_plugin_pl.ts index 08ff804ee..d464615aa 100644 --- a/src/plugins/General/kdenotify/translations/kdenotify_plugin_pl.ts +++ b/src/plugins/General/kdenotify/translations/kdenotify_plugin_pl.ts @@ -4,17 +4,17 @@ KdeNotify - + Qmmp now playing: Qmmp teraz odtwarza: - + by przez - + on na diff --git a/src/plugins/General/kdenotify/translations/kdenotify_plugin_ru.ts b/src/plugins/General/kdenotify/translations/kdenotify_plugin_ru.ts index b1fc4be10..6aa6fe232 100644 --- a/src/plugins/General/kdenotify/translations/kdenotify_plugin_ru.ts +++ b/src/plugins/General/kdenotify/translations/kdenotify_plugin_ru.ts @@ -4,17 +4,17 @@ KdeNotify - + Qmmp now playing: Играет: - + by исполнитель - + on на diff --git a/src/plugins/General/kdenotify/translations/kdenotify_plugin_tr.ts b/src/plugins/General/kdenotify/translations/kdenotify_plugin_tr.ts index f06ed9846..6d4e10a3f 100644 --- a/src/plugins/General/kdenotify/translations/kdenotify_plugin_tr.ts +++ b/src/plugins/General/kdenotify/translations/kdenotify_plugin_tr.ts @@ -4,17 +4,17 @@ KdeNotify - + Qmmp now playing: - + by - + on diff --git a/src/plugins/General/kdenotify/translations/kdenotify_plugin_uk_UA.ts b/src/plugins/General/kdenotify/translations/kdenotify_plugin_uk_UA.ts index 47999a098..ea4ded89d 100644 --- a/src/plugins/General/kdenotify/translations/kdenotify_plugin_uk_UA.ts +++ b/src/plugins/General/kdenotify/translations/kdenotify_plugin_uk_UA.ts @@ -4,17 +4,17 @@ KdeNotify - + Qmmp now playing: Відтворюється: - + by виконавець - + on на diff --git a/src/plugins/General/kdenotify/translations/kdenotify_plugin_zh_CN.ts b/src/plugins/General/kdenotify/translations/kdenotify_plugin_zh_CN.ts index f06ed9846..6d4e10a3f 100644 --- a/src/plugins/General/kdenotify/translations/kdenotify_plugin_zh_CN.ts +++ b/src/plugins/General/kdenotify/translations/kdenotify_plugin_zh_CN.ts @@ -4,17 +4,17 @@ KdeNotify - + Qmmp now playing: - + by - + on diff --git a/src/plugins/General/kdenotify/translations/kdenotify_plugin_zh_TW.ts b/src/plugins/General/kdenotify/translations/kdenotify_plugin_zh_TW.ts index f06ed9846..6d4e10a3f 100644 --- a/src/plugins/General/kdenotify/translations/kdenotify_plugin_zh_TW.ts +++ b/src/plugins/General/kdenotify/translations/kdenotify_plugin_zh_TW.ts @@ -4,17 +4,17 @@ KdeNotify - + Qmmp now playing: - + by - + on -- cgit v1.2.3-13-gbd6f