I have made the following changes intended for : CE:UX:MTF / lipstick Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below.
https://build.pub.meego.com//request/show/7724 Thank You, vesuri [This message was auto-generated] --- Request # 7724: Messages from BOSS: State: review at 2013-01-24T22:52:10 by bossbot Reviews: accepted by bossbot : Prechecks succeeded. new for CE-maintainers : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: home:vesuri:branches:CE:UX:MTF / lipstick -> CE:UX:MTF / lipstick changes files: -------------- --- lipstick.changes +++ lipstick.changes @@ -0,0 +1,3 @@ +* Thu Jan 24 2013 Vesa Halttunen <[email protected]> - 0.6.8 +- Don't show notifications that have been removed but not closed on startup (from Vesa) + old: ---- lipstick-0.6.7.tar.bz2 new: ---- lipstick-0.6.8.tar.bz2 spec files: ----------- --- lipstick.spec +++ lipstick.spec @@ -9,7 +9,7 @@ # << macros Summary: QML toolkit for homescreen creation -Version: 0.6.7 +Version: 0.6.8 Release: 1 Group: System/Libraries License: LGPLv2.1 other changes: -------------- ++++++ lipstick-0.6.7.tar.bz2 -> lipstick-0.6.8.tar.bz2 --- src/notifications/notificationlistmodel.cpp +++ src/notifications/notificationlistmodel.cpp @@ -48,5 +48,5 @@ bool NotificationListModel::notificationShouldBeShown(Notification *notification) { - return !(notification->body().isEmpty() && notification->summary().isEmpty()) && notification->hints().value(NotificationManager::HINT_URGENCY).toInt() < 2; + return !notification->hints().value(NotificationManager::HINT_HIDDEN).toBool() && !(notification->body().isEmpty() && notification->summary().isEmpty()) && notification->hints().value(NotificationManager::HINT_URGENCY).toInt() < 2; } --- src/notifications/notificationmanager.cpp +++ src/notifications/notificationmanager.cpp @@ -63,6 +63,7 @@ const char *NotificationManager::HINT_USER_REMOVABLE = "x-nemo-user-removable"; const char *NotificationManager::HINT_USER_CLOSEABLE = "x-nemo-user-closeable"; const char *NotificationManager::HINT_FEEDBACK = "x-nemo-feedback"; +const char *NotificationManager::HINT_HIDDEN = "x-nemo-hidden"; NotificationManager *NotificationManager::instance_ = 0; @@ -515,6 +516,9 @@ } else { // Uncloseable notifications should be only removed emit notificationRemoved(id); + + // Mark the notification as hidden + execSQL("INSERT INTO hints VALUES (?, ?, ?)", QVariantList() << id << HINT_HIDDEN << true); } } } --- src/notifications/notificationmanager.h +++ src/notifications/notificationmanager.h @@ -94,6 +94,9 @@ //! Nemo hint: Feedback of the notification. static const char *HINT_FEEDBACK; + //! Nemo hint: Whether the notification is hidden. + static const char *HINT_HIDDEN; + //! Notifation closing reasons used in the NotificationClosed signal enum NotificationClosedReason { //! The notification expired. --- src/notifications/notificationpreviewpresenter.cpp +++ src/notifications/notificationpreviewpresenter.cpp @@ -122,7 +122,7 @@ bool NotificationPreviewPresenter::notificationShouldBeShown(Notification *notification) { - return !(notification->previewBody().isEmpty() && notification->previewSummary().isEmpty()) && (!presentOnlyCriticalNotifications || notification->hints().value(NotificationManager::HINT_URGENCY).toInt() >= 2); + return !notification->hints().value(NotificationManager::HINT_HIDDEN).toBool() && !(notification->previewBody().isEmpty() && notification->previewSummary().isEmpty()) && (!presentOnlyCriticalNotifications || notification->hints().value(NotificationManager::HINT_URGENCY).toInt() >= 2); } void NotificationPreviewPresenter::setNotificationPreviewRect(qreal x1, qreal y1, qreal x2, qreal y2) --- src/src.pro +++ src/src.pro @@ -3,7 +3,7 @@ TEMPLATE = lib TARGET = lipstick -VERSION = 0.6.7 +VERSION = 0.6.8 DEFINES += LIPSTICK_BUILD_LIBRARY VERSION=\\\"$$VERSION\\\" --- tests/stubs/notificationmanager_stub.h +++ tests/stubs/notificationmanager_stub.h @@ -136,6 +136,7 @@ const char *NotificationManager::HINT_PREVIEW_ICON = "x-nemo-preview-icon"; const char *NotificationManager::HINT_PREVIEW_BODY = "x-nemo-preview-body"; const char *NotificationManager::HINT_PREVIEW_SUMMARY = "x-nemo-preview-summary"; +const char *NotificationManager::HINT_HIDDEN = "x-nemo-hidden"; NotificationManager *NotificationManager::instance_ = 0; NotificationManager * NotificationManager::instance() { --- tests/ut_notificationlistmodel/ut_notificationlistmodel.cpp +++ tests/ut_notificationlistmodel/ut_notificationlistmodel.cpp @@ -88,6 +88,18 @@ QCOMPARE(gQObjectListModelStub->stubCallCount("addItem"), 0); } +void Ut_NotificationListModel::testNotificationIsNotAddedIfHidden() +{ + QVariantHash hints; + hints.insert(NotificationManager::HINT_HIDDEN, true); + Notification notification("appName", 1, "appIcon", "summary", "body", QStringList() << "action", hints, 1); + gNotificationManagerStub->stubSetReturnValue("notificationIds", QList<uint>() << 1); + gNotificationManagerStub->stubSetReturnValue("notification", ¬ification); + gQObjectListModelStub->stubSetReturnValue("indexOf", -1); + NotificationListModel model; + QCOMPARE(gQObjectListModelStub->stubCallCount("addItem"), 0); +} + void Ut_NotificationListModel::testAlreadyAddedNotificationIsRemovedIfNoLongerAddable() { Notification notification("appName", 1, "appIcon", "", "", QStringList() << "action", QVariantHash(), 1); --- tests/ut_notificationlistmodel/ut_notificationlistmodel.h +++ tests/ut_notificationlistmodel/ut_notificationlistmodel.h @@ -29,6 +29,7 @@ void testNotificationIsNotAddedIfNoSummaryOrBody_data(); void testNotificationIsNotAddedIfNoSummaryOrBody(); void testNotificationIsNotAddedIfUrgencyIsCritical(); + void testNotificationIsNotAddedIfHidden(); void testAlreadyAddedNotificationIsRemovedIfNoLongerAddable(); void testNotificationRemoval(); }; --- tests/ut_notificationmanager/ut_notificationmanager.cpp +++ tests/ut_notificationmanager/ut_notificationmanager.cpp @@ -760,6 +760,8 @@ uint id = manager->Notify("app2", 0, QString(), QString(), QString(), QStringList(), hints, 0); Notification *notification = manager->notification(id); connect(this, SIGNAL(actionInvoked(QString)), notification, SIGNAL(actionInvoked(QString))); + qSqlQueryPrepare.clear(); + qSqlQueryAddBindValue.clear(); // Make the notifications emit the actionInvoked() signal for action "action"; removable notifications should get removed but non-closeable should not be closed QSignalSpy removedSpy(manager, SIGNAL(notificationRemoved(uint))); @@ -768,6 +770,14 @@ QCOMPARE(removedSpy.count(), 1); QCOMPARE(removedSpy.at(0).at(0).toUInt(), id); QCOMPARE(closedSpy.count(), 0); + + // Pim + QCOMPARE(qSqlQueryPrepare.count(), 1); + QCOMPARE(qSqlQueryPrepare.at(0), QString("INSERT INTO hints VALUES (?, ?, ?)")); + QCOMPARE(qSqlQueryAddBindValue.count(), 3); + QCOMPARE(qSqlQueryAddBindValue.at(0).toUInt(), id); + QCOMPARE(qSqlQueryAddBindValue.at(1), QVariant(NotificationManager::HINT_HIDDEN)); + QCOMPARE(qSqlQueryAddBindValue.at(2), QVariant(true)); } void Ut_NotificationManager::testListingNotifications() --- tests/ut_notificationpreviewpresenter/ut_notificationpreviewpresenter.cpp +++ tests/ut_notificationpreviewpresenter/ut_notificationpreviewpresenter.cpp @@ -82,6 +82,7 @@ const char *NotificationManager::HINT_PREVIEW_ICON = "x-nemo-preview-icon"; const char *NotificationManager::HINT_PREVIEW_BODY = "x-nemo-preview-body"; const char *NotificationManager::HINT_PREVIEW_SUMMARY = "x-nemo-preview-summary"; +const char *NotificationManager::HINT_HIDDEN = "x-nemo-hidden"; NotificationManager::NotificationManager(QObject *parent) : QObject(parent) { @@ -356,6 +357,25 @@ QCOMPARE(qWidgetVisible[static_cast<QWidget *>(qDeclarativeViews.first())], windowVisible); } +void Ut_NotificationPreviewPresenter::testNotificationNotShownIfHidden() +{ + NotificationPreviewPresenter presenter; + QSignalSpy spy(&presenter, SIGNAL(notificationChanged())); + + // Create notification + Notification *notification = new Notification; + QVariantHash hints; + hints.insert(NotificationManager::HINT_PREVIEW_SUMMARY, "previewSummary"); + hints.insert(NotificationManager::HINT_PREVIEW_BODY, "previewBody"); + hints.insert(NotificationManager::HINT_HIDDEN, true); + notification->setHints(hints); + notificationManagerNotification.insert(1, notification); + presenter.updateNotification(1); + + QCOMPARE(spy.count(), 0); + QCOMPARE(qWidgetVisible[static_cast<QWidget *>(qDeclarativeViews.first())], false); +} + void Ut_NotificationPreviewPresenter::testShowingOnlyCriticalNotifications() { NotificationPreviewPresenter presenter; --- tests/ut_notificationpreviewpresenter/ut_notificationpreviewpresenter.h +++ tests/ut_notificationpreviewpresenter/ut_notificationpreviewpresenter.h @@ -34,6 +34,7 @@ void testWindowMasking(); void testNotificationNotShownIfNoSummaryOrBody_data(); void testNotificationNotShownIfNoSummaryOrBody(); + void testNotificationNotShownIfHidden(); void testShowingOnlyCriticalNotifications(); void testUpdateNotificationRemovesNotificationFromQueueIfNotShowable(); }; ++++++ lipstick.yaml --- lipstick.yaml +++ lipstick.yaml @@ -1,6 +1,6 @@ Name: lipstick Summary: QML toolkit for homescreen creation -Version: 0.6.7 +Version: 0.6.8 Release: 1 Group: System/Libraries License: LGPLv2.1
