aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/General/kdenotify/kdenotify.cpp33
-rw-r--r--src/plugins/General/kdenotify/kdenotify.h3
-rw-r--r--src/plugins/General/kdenotify/settingsdialog.cpp2
3 files changed, 21 insertions, 17 deletions
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<QVariant> 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<QVariant> 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("<table padding=\"3px\"><tr><td width=\"80px\" height=\"80px\" padding=\"3px\">");
+ nBody.append("<img height=\"80\" width=\"80\" src=\"%1\"></td><td width=\"10\"></td><td>%2</td></tr></table>");
+ 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 "<b>%if(%t,%t,%f)</b>\n%if(%p,<br>%p,)\n%if(%a,<br>%a,)\n%if(%l,<br><b>%l</b>,)"
-#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();