summaryrefslogtreecommitdiff
path: root/notificationconn.cc
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2015-04-26 00:33:05 +0200
committerJavier <dev.git@javispedro.com>2015-04-26 00:33:05 +0200
commitf45294559f976258831821ada062c73965201150 (patch)
treeea10d825a119a7c00b50a48193f23b87147a1a01 /notificationconn.cc
parent9949c02b0f814ad94a27864a5c39689f090299b6 (diff)
downloadsapd-f45294559f976258831821ada062c73965201150.tar.gz
sapd-f45294559f976258831821ada062c73965201150.zip
update to use new watchfish library for sailfish
Diffstat (limited to 'notificationconn.cc')
-rw-r--r--notificationconn.cc24
1 files changed, 16 insertions, 8 deletions
diff --git a/notificationconn.cc b/notificationconn.cc
index 231427e..9d596ea 100644
--- a/notificationconn.cc
+++ b/notificationconn.cc
@@ -7,7 +7,10 @@
#include "notificationconn.h"
#if SAILFISH
-#include "sailfish/notificationmonitor.h"
+#include "libwatchfish/notificationmonitor.h"
+#include "libwatchfish/notification.h"
+
+static watchfish::NotificationMonitor *monitor = 0;
#endif
NotificationConn::Notification::Notification()
@@ -113,9 +116,11 @@ void NotificationConn::handleConnected()
qDebug() << "NotificationManager socket now connected!";
#if SAILFISH
- NotificationMonitor *monitor = NotificationMonitor::instance();
- connect(monitor, SIGNAL(incomingNotification(QString,QIcon,QString,int,QString,QDateTime)),
- this, SLOT(handleIncomingNotification(QString,QIcon,QString,int,QString,QDateTime)));
+ if (!monitor) {
+ monitor = new watchfish::NotificationMonitor;
+ }
+ connect(monitor, &watchfish::NotificationMonitor::notification,
+ this, &NotificationConn::handleNotification);
#else
QTimer::singleShot(2000, this, SLOT(performTest()));
#endif
@@ -131,8 +136,10 @@ void NotificationConn::handleMessageReceived()
// TODO Seems that we receive the notification ID that we should act upon.
}
-void NotificationConn::handleIncomingNotification(const QString &sender, const QIcon &icon, const QString &summary, int count, const QString &body, const QDateTime &dateTime)
+#if SAILFISH
+void NotificationConn::handleNotification(watchfish::Notification *wfn)
{
+ QString sender = wfn->sender();
short applicationId = _knownSenders.value(sender, 0);
if (!applicationId) {
applicationId = _knownSenders.size() + 1;
@@ -142,11 +149,11 @@ void NotificationConn::handleIncomingNotification(const QString &sender, const Q
Notification n;
n.sequenceNumber = ++_lastSeqNumber;
n.type = NotificationPopup;
- n.time = dateTime;
- n.title = summary;
+ n.time = wfn->timestamp();
+ n.title = wfn->summary();
n.packageName = sender;
n.applicationName = sender;
- n.body = body;
+ n.body = wfn->body();
n.sender = 0;
n.count = 0; // TODO figure this out
n.category = 0;
@@ -155,6 +162,7 @@ void NotificationConn::handleIncomingNotification(const QString &sender, const Q
sendNotification(n);
}
+#endif
void NotificationConn::performTest()
{