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 ++++++++++++++---------- src/plugins/General/kdenotify/kdenotify.h | 3 +-- src/plugins/General/kdenotify/settingsdialog.cpp | 2 +- 3 files changed, 21 insertions(+), 17 deletions(-) (limited to 'src') 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; } diff --git a/src/plugins/General/kdenotify/kdenotify.h b/src/plugins/General/kdenotify/kdenotify.h index 937c383f6..d6c4d7300 100644 --- a/src/plugins/General/kdenotify/kdenotify.h +++ b/src/plugins/General/kdenotify/kdenotify.h @@ -28,10 +28,9 @@ #include "qmmp/qmmp.h" #define DEFAULT_TEMPLATE "%if(%t,%t,%f)\n%if(%p,
%p,)\n%if(%a,
%a,)\n%if(%l,
%l,)" -#define NOTIFY_DELAY 2 +#define NOTIFY_DELAY 2000 class QDBusInterface; -class QTimer; class KdeNotify : public General { diff --git a/src/plugins/General/kdenotify/settingsdialog.cpp b/src/plugins/General/kdenotify/settingsdialog.cpp index b3e835ca8..ddfdc26a3 100644 --- a/src/plugins/General/kdenotify/settingsdialog.cpp +++ b/src/plugins/General/kdenotify/settingsdialog.cpp @@ -34,7 +34,7 @@ SettingsDialog::SettingsDialog(QWidget *parent) : QSettings settings(Qmmp::configFile(),QSettings::IniFormat); settings.beginGroup("Kde_Notifier"); - ui->notifyDelaySpinBox->setValue(settings.value("notify_duration",10000).toInt()/1000); + ui->notifyDelaySpinBox->setValue(settings.value("notify_duration",5000).toInt()/1000); ui->showCoversCheckBox->setChecked(settings.value("show_covers",true).toBool()); ui->updateNotifyCheckBox->setChecked(settings.value("update_notify",true).toBool()); m_template = settings.value("template", DEFAULT_TEMPLATE).toString(); -- cgit v1.2.3-13-gbd6f