diff --git a/libnotificationmanager/abstractnotificationsmodel.cpp b/libnotificationmanager/abstractnotificationsmodel.cpp index c4e7d0cba..b2ac93e92 100644 --- a/libnotificationmanager/abstractnotificationsmodel.cpp +++ b/libnotificationmanager/abstractnotificationsmodel.cpp @@ -103,16 +103,14 @@ void AbstractNotificationsModel::Private::onNotificationReplaced(uint replacedId Notification newNotification(notification); - // Resident notifications are expected to be updateable in the history - // transfer a few flags over to new notification so it doesn't plop back up - if (newNotification.resident()) { - const Notification &oldNotification = notifications.at(row); - if (oldNotification.resident()) { - newNotification.setExpired(oldNotification.expired()); - newNotification.setDismissed(oldNotification.dismissed()); - newNotification.setRead(oldNotification.read()); - } - } + const Notification &oldNotification = notifications.at(row); + // As per spec a notification must be replaced atomically with no visual cues. + // Transfer over properties that might cause this, such as unread showing the bell again, + // or created() which should indicate the original date, whereas updated() is when it was last updated + newNotification.setCreated(oldNotification.created()); + newNotification.setExpired(oldNotification.expired()); + newNotification.setDismissed(oldNotification.dismissed()); + newNotification.setRead(oldNotification.read()); notifications[row] = newNotification; const QModelIndex idx = q->index(row, 0); diff --git a/libnotificationmanager/notification.cpp b/libnotificationmanager/notification.cpp index 8405d3a1d..5b0429214 100644 --- a/libnotificationmanager/notification.cpp +++ b/libnotificationmanager/notification.cpp @@ -490,6 +490,11 @@ QDateTime Notification::created() const return d->created; } +void Notification::setCreated(const QDateTime &created) +{ + d->created = created; +} + QDateTime Notification::updated() const { return d->updated; diff --git a/libnotificationmanager/notification.h b/libnotificationmanager/notification.h index 5590b2bd8..5d66b4618 100644 --- a/libnotificationmanager/notification.h +++ b/libnotificationmanager/notification.h @@ -55,8 +55,11 @@ public: QString dBusService() const; void setDBusService(const QString &dBusService); + // Creation time of the original notification QDateTime created() const; + void setCreated(const QDateTime &created); + // Last time it was updated, or invalid if it never was QDateTime updated() const; void resetUpdated();