From 0a656b75f3fc80f13424db0e7ec403dff28a366e Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Sun, 2 Oct 2011 16:39:40 +0200 Subject: new notifications list, time syncing --- .../meegohandsetnotification.cpp | 27 +++++++++++++++++++--- .../meegohandsetnotification.h | 7 ++---- meegohandsetnotification/watchnotificationsink.cpp | 2 +- 3 files changed, 27 insertions(+), 9 deletions(-) (limited to 'meegohandsetnotification') diff --git a/meegohandsetnotification/meegohandsetnotification.cpp b/meegohandsetnotification/meegohandsetnotification.cpp index 69e2bd5..41264b6 100644 --- a/meegohandsetnotification/meegohandsetnotification.cpp +++ b/meegohandsetnotification/meegohandsetnotification.cpp @@ -48,14 +48,35 @@ void MeegoHandsetNotification::activate() // TODO Actually do something } -void MeegoHandsetNotification::clear() +void MeegoHandsetNotification::dismiss() { - // TODO Actually clear... - emit cleared(); + // TODO Actually dismiss } void MeegoHandsetNotification::changeTo(const ::Notification ¬ification) { + uint oldCount = count(); + QDateTime oldDateTime = dateTime(); + QString oldTitle = title(); + QString oldBody = body(); _n = notification; + if (oldCount != count()) { + emit countChanged(); + } + if (oldDateTime != dateTime()) { + emit dateTimeChanged(); + emit displayTimeChanged(); + } + if (oldTitle != title()) { + emit titleChanged(); + } + if (oldBody != body()) { + emit bodyChanged(); + } emit changed(); } + +void MeegoHandsetNotification::remove() +{ + emit dismissed(); +} diff --git a/meegohandsetnotification/meegohandsetnotification.h b/meegohandsetnotification/meegohandsetnotification.h index fc9d50f..06cacf9 100644 --- a/meegohandsetnotification/meegohandsetnotification.h +++ b/meegohandsetnotification/meegohandsetnotification.h @@ -19,14 +19,11 @@ public: QString title() const; QString body() const; void activate(); - void clear(); - -signals: - void changed(); - void cleared(); + void dismiss(); protected: void changeTo(const ::Notification& notification); + void remove(); protected: ::Notification _n; diff --git a/meegohandsetnotification/watchnotificationsink.cpp b/meegohandsetnotification/watchnotificationsink.cpp index cf03c30..860c4b6 100644 --- a/meegohandsetnotification/watchnotificationsink.cpp +++ b/meegohandsetnotification/watchnotificationsink.cpp @@ -26,7 +26,7 @@ void WatchNotificationSink::removeNotification(uint notificationId) if (_trackedNotifications.contains(notificationId)) { MeegoHandsetNotification* n = _trackedNotifications[notificationId]; _trackedNotifications.remove(notificationId); - n->clear(); + n->remove(); n->deleteLater(); } } -- cgit v1.2.3