diff options
Diffstat (limited to 'notificationconn.cc')
-rw-r--r-- | notificationconn.cc | 24 |
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() { |