From 71f9f9dc076968e72d344168b68a695c235597e8 Mon Sep 17 00:00:00 2001 From: Albert Vaca Date: Thu, 22 Aug 2013 04:39:04 +0200 Subject: [PATCH] Do not show notifications already present in the device as new --- .../notificationsdbusinterface.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/daemon/plugins/notifications/notificationsdbusinterface.cpp b/daemon/plugins/notifications/notificationsdbusinterface.cpp index cba65159a..3b9eabde4 100644 --- a/daemon/plugins/notifications/notificationsdbusinterface.cpp +++ b/daemon/plugins/notifications/notificationsdbusinterface.cpp @@ -51,6 +51,17 @@ void NotificationsDbusInterface::processPackage(const NetworkPackage& np) } else { Notification* noti = new Notification(np, this); addNotification(noti); + + if (!np.get("requestAnswer", false)) { //Do not show notifications for answers to a initial request + KNotification* notification = new KNotification("notification"); + notification->setPixmap(KIcon("preferences-desktop-notification").pixmap(48, 48)); + notification->setComponentData(KComponentData("kdeconnect", "kdeconnect")); + notification->setTitle(mDevice->name()); + notification->setText(noti->appName() + ": " + noti->ticker()); + notification->sendEvent(); + } + + } } @@ -72,12 +83,6 @@ void NotificationsDbusInterface::addNotification(Notification* noti) QDBusConnection::sessionBus().registerObject(mDevice->dbusPath()+"/notifications/"+publicId, noti, QDBusConnection::ExportScriptableContents); Q_EMIT notificationPosted(publicId); - KNotification* notification = new KNotification("notification"); - notification->setPixmap(KIcon("preferences-desktop-notification").pixmap(48, 48)); - notification->setComponentData(KComponentData("kdeconnect", "kdeconnect")); - notification->setTitle(mDevice->name()); - notification->setText(noti->appName() + ": " + noti->ticker()); - notification->sendEvent(); } void NotificationsDbusInterface::removeNotification(const QString& internalId)