[SCM] kdeconnect packaging branch, master, updated. debian/0.9g-1-1183-g9d69498
Maximiliano Curia
maxy at moszumanska.debian.org
Fri Oct 14 14:27:02 UTC 2016
Gitweb-URL: http://git.debian.org/?p=pkg-kde/kde-extras/kdeconnect.git;a=commitdiff;h=a53ec2a
The following commit has been merged in the master branch:
commit a53ec2a9eaba60dad4aef004ed4421c756d846b5
Author: Albert Vaca <albertvaka at gmail.com>
Date: Tue Sep 24 14:11:11 2013 +0200
Notification Plugin can now receive payloads with the notification icon
---
kded/plugins/notifications/notification.cpp | 3 ++-
kded/plugins/notifications/notification.h | 6 ++++--
.../notifications/notificationsdbusinterface.cpp | 17 ++++++++++++++---
kded/plugins/notifications/notificationsplugin.cpp | 2 +-
4 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/kded/plugins/notifications/notification.cpp b/kded/plugins/notifications/notification.cpp
index 7cd39bc..b85cf53 100644
--- a/kded/plugins/notifications/notification.cpp
+++ b/kded/plugins/notifications/notification.cpp
@@ -23,13 +23,14 @@
#include <QDBusConnection>
#include <QDebug>
-Notification::Notification(const NetworkPackage& np, QObject* parent)
+Notification::Notification(const NetworkPackage& np, const QString& iconPath, QObject* parent)
: QObject(parent)
{
mId = np.get<QString>("id");
mAppName = np.get<QString>("appName");
mTicker = np.get<QString>("ticker");
mDismissable = np.get<bool>("isClearable");
+ mIconPath = iconPath;
}
Notification::~Notification()
diff --git a/kded/plugins/notifications/notification.h b/kded/plugins/notifications/notification.h
index fad11f1..a97d487 100644
--- a/kded/plugins/notifications/notification.h
+++ b/kded/plugins/notifications/notification.h
@@ -34,15 +34,17 @@ class Notification
Q_PROPERTY(QString internalId READ internalId)
Q_PROPERTY(QString appName READ appName)
Q_PROPERTY(QString ticker READ ticker)
+ Q_PROPERTY(QString iconPath READ iconPath)
Q_PROPERTY(bool dismissable READ dismissable)
public:
- Notification(const NetworkPackage& np, QObject* parent);
+ Notification(const NetworkPackage& np, const QString& iconPath, QObject* parent);
virtual ~Notification();
QString internalId() { return mId; }
QString appName() { return mAppName; }
QString ticker() { return mTicker; }
+ QString iconPath() { return mIconPath; }
bool dismissable() { return mDismissable; }
public Q_SLOTS:
@@ -55,7 +57,7 @@ private:
QString mId;
QString mAppName;
QString mTicker;
- //QIcon mIcon;
+ QString mIconPath;
bool mDismissable;
};
diff --git a/kded/plugins/notifications/notificationsdbusinterface.cpp b/kded/plugins/notifications/notificationsdbusinterface.cpp
index a62e2d1..475c7cc 100644
--- a/kded/plugins/notifications/notificationsdbusinterface.cpp
+++ b/kded/plugins/notifications/notificationsdbusinterface.cpp
@@ -20,11 +20,15 @@
#include "notificationsdbusinterface.h"
+#include "../../filetransferjob.h"
+
#include <QDebug>
+#include <qdir.h>
#include <QDBusConnection>
#include <KNotification>
#include <KIcon>
+#include <KMD5>
NotificationsDbusInterface::NotificationsDbusInterface(Device* device, QObject *parent)
: QDBusAbstractAdaptor(parent)
@@ -49,9 +53,17 @@ void NotificationsDbusInterface::processPackage(const NetworkPackage& np)
if (np.get<bool>("isCancel")) {
removeNotification(np.get<QString>("id"));
} else {
- Notification* noti = new Notification(np, this);
- //TODO: Store the app icon if any under tmp with the app name as filename (so we only store one per app) and export the path to that file to dbus inside Notification
+ QString destination;
+ if (np.hasPayload()) {
+ //TODO: Store the image with extension?
+ destination = QDir::temp().absoluteFilePath("kdeconnect/"+KMD5(np.get<QString>("appName").toLatin1()).hexDigest());
+ FileTransferJob* job = np.createPayloadTransferJob(destination);
+ job->start();
+ }
+
+ Notification* noti = new Notification(np, destination, this);
+ addNotification(noti);
//Do not show updates to existent notification nor answers to a initialization request
if (!mInternalIdToPublicId.contains(noti->internalId()) && !np.get<bool>("requestAnswer", false)) {
@@ -63,7 +75,6 @@ void NotificationsDbusInterface::processPackage(const NetworkPackage& np)
notification->sendEvent();
}
- addNotification(noti);
}
}
diff --git a/kded/plugins/notifications/notificationsplugin.cpp b/kded/plugins/notifications/notificationsplugin.cpp
index 4df6dc5..c2b900c 100644
--- a/kded/plugins/notifications/notificationsplugin.cpp
+++ b/kded/plugins/notifications/notificationsplugin.cpp
@@ -38,7 +38,7 @@ NotificationsPlugin::NotificationsPlugin(QObject* parent, const QVariantList& ar
void NotificationsPlugin::connected()
{
NetworkPackage np(PACKAGE_TYPE_NOTIFICATION);
- np.set("request",true);
+ np.set("request", true);
device()->sendPackage(np);
}
--
kdeconnect packaging
More information about the pkg-kde-commits
mailing list