I have made the following changes intended for : CE:MW:Shared / 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/8417 Thank You, vesuri [This message was auto-generated] --- Request # 8417: Messages from BOSS: State: review at 2013-03-13T18:19:49 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:MW:Shared / lipstick -> CE:MW:Shared / lipstick changes files: -------------- --- lipstick.changes +++ lipstick.changes @@ -0,0 +1,3 @@ +* Wed Mar 13 2013 Vesa Halttunen <[email protected]> - 0.10.3 +- Disable notification previews when the touch screen is locked and the display is off (from Vesa) + old: ---- lipstick-0.10.2.tar.bz2 new: ---- lipstick-0.10.3.tar.bz2 spec files: ----------- --- lipstick.spec +++ lipstick.spec @@ -9,7 +9,7 @@ # << macros Summary: QML toolkit for homescreen creation -Version: 0.10.2 +Version: 0.10.3 Release: 1 Group: System/Libraries License: LGPLv2.1 other changes: -------------- ++++++ lipstick-0.10.2.tar.bz2 -> lipstick-0.10.3.tar.bz2 --- src/notifications/notificationpreviewpresenter.cpp +++ src/notifications/notificationpreviewpresenter.cpp @@ -19,6 +19,8 @@ #include <QDeclarativeContext> #include <QX11Info> #include <X11/extensions/shape.h> +#include <qmdisplaystate.h> +#include <qmlocks.h> #include "utilities/closeeventeater.h" #include "xtools/x11wrapper.h" #include "notifications/notificationmanager.h" @@ -28,7 +30,9 @@ QObject(parent), window(0), currentNotification(0), - presentOnlyCriticalNotifications(false) + presentOnlyCriticalNotifications(false), + locks(new MeeGo::QmLocks(this)), + displayState(new MeeGo::QmDisplayState(this)) { connect(NotificationManager::instance(), SIGNAL(notificationModified(uint)), this, SLOT(updateNotification(uint))); connect(NotificationManager::instance(), SIGNAL(notificationRemoved(uint)), this, SLOT(removeNotification(uint))); @@ -47,17 +51,31 @@ window->hide(); } - currentNotification = 0; - emit notificationChanged(); - } else { - // A notification to show: show the notification window and the first queued notification in it - createWindowIfNecessary(); - if (!window->isVisible()) { - window->show(); + if (currentNotification != 0) { + currentNotification = 0; + emit notificationChanged(); } + } else { + if (locks->getState(MeeGo::QmLocks::TouchAndKeyboard) == MeeGo::QmLocks::Locked && displayState->get() == MeeGo::QmDisplayState::Off) { + // Screen locked and off: don't show the notification but just remove it from the queue + notificationQueue.removeFirst(); + + if (currentNotification != 0) { + currentNotification = 0; + emit notificationChanged(); + } + + showNextNotification(); + } else { + // Show the notification window and the first queued notification in it + createWindowIfNecessary(); + if (!window->isVisible()) { + window->show(); + } - currentNotification = notificationQueue.takeFirst(); - emit notificationChanged(); + currentNotification = notificationQueue.takeFirst(); + emit notificationChanged(); + } } } --- src/notifications/notificationpreviewpresenter.h +++ src/notifications/notificationpreviewpresenter.h @@ -22,6 +22,11 @@ class QDeclarativeView; class Notification; +namespace MeeGo { +class QmLocks; +class QmDisplayState; +} + /*! * \class NotificationPreviewPresenter * @@ -123,6 +128,12 @@ //! Whether only notifications of critical urgency should be shown bool presentOnlyCriticalNotifications; + //! For getting information about the touch screen lock state + MeeGo::QmLocks *locks; + + //! For getting information about the display state + MeeGo::QmDisplayState *displayState; + #ifdef UNIT_TEST friend class Ut_NotificationPreviewPresenter; #endif --- src/src.pro +++ src/src.pro @@ -3,7 +3,7 @@ TEMPLATE = lib TARGET = lipstick -VERSION = 0.10.2 +VERSION = 0.10.3 DEFINES += LIPSTICK_BUILD_LIBRARY VERSION=\\\"$$VERSION\\\" --- tests/ut_notificationpreviewpresenter/ut_notificationpreviewpresenter.cpp +++ tests/ut_notificationpreviewpresenter/ut_notificationpreviewpresenter.cpp @@ -23,6 +23,8 @@ #include "xtools/x11wrapper.h" #include <X11/extensions/shape.h> #include "closeeventeater_stub.h" +#include "qmlocks_stub.h" +#include "qmdisplaystate_stub.h" Q_DECLARE_METATYPE(NotificationPreviewPresenter*) Q_DECLARE_METATYPE(Notification*) @@ -437,4 +439,36 @@ QCOMPARE(presenter.notification(), (Notification *)0); } +Q_DECLARE_METATYPE(MeeGo::QmDisplayState::DisplayState) +Q_DECLARE_METATYPE(MeeGo::QmLocks::State) + +void Ut_NotificationPreviewPresenter::testNotificationNotShownIfTouchScreenIsLockedAndDisplayIsOff_data() +{ + QTest::addColumn<MeeGo::QmDisplayState::DisplayState>("displayState"); + QTest::addColumn<MeeGo::QmLocks::State>("lockState"); + QTest::addColumn<int>("notifications"); + QTest::newRow("Display on, touch screen not locked") << MeeGo::QmDisplayState::On << MeeGo::QmLocks::Unlocked << 1; + QTest::newRow("Display on, touch screen locked") << MeeGo::QmDisplayState::On << MeeGo::QmLocks::Locked << 1; + QTest::newRow("Display off, touch screen not locked") << MeeGo::QmDisplayState::Off << MeeGo::QmLocks::Unlocked << 1; + QTest::newRow("Display off, touch screen locked") << MeeGo::QmDisplayState::Off << MeeGo::QmLocks::Locked << 0; +} + +void Ut_NotificationPreviewPresenter::testNotificationNotShownIfTouchScreenIsLockedAndDisplayIsOff() +{ + QFETCH(MeeGo::QmDisplayState::DisplayState, displayState); + QFETCH(MeeGo::QmLocks::State, lockState); + QFETCH(int, notifications); + + gQmDisplayStateStub->stubSetReturnValue("get", displayState); + gQmLocksStub->stubSetReturnValue("getState", lockState); + + NotificationPreviewPresenter presenter; + QSignalSpy spy(&presenter, SIGNAL(notificationChanged())); + + createNotification(1); + presenter.updateNotification(1); + QCOMPARE(qDeclarativeViews.count(), notifications); + QCOMPARE(spy.count(), notifications); +} + QTEST_MAIN(Ut_NotificationPreviewPresenter) --- tests/ut_notificationpreviewpresenter/ut_notificationpreviewpresenter.h +++ tests/ut_notificationpreviewpresenter/ut_notificationpreviewpresenter.h @@ -37,6 +37,8 @@ void testNotificationNotShownIfHidden(); void testShowingOnlyCriticalNotifications(); void testUpdateNotificationRemovesNotificationFromQueueIfNotShowable(); + void testNotificationNotShownIfTouchScreenIsLockedAndDisplayIsOff_data(); + void testNotificationNotShownIfTouchScreenIsLockedAndDisplayIsOff(); }; #endif --- tests/ut_notificationpreviewpresenter/ut_notificationpreviewpresenter.pro +++ tests/ut_notificationpreviewpresenter/ut_notificationpreviewpresenter.pro @@ -1,6 +1,6 @@ include(../common.pri) TARGET = ut_notificationpreviewpresenter -INCLUDEPATH += $$SRCDIR $$NOTIFICATIONSRCDIR $$UTILITYSRCDIR +INCLUDEPATH += $$SRCDIR $$NOTIFICATIONSRCDIR $$UTILITYSRCDIR /usr/include/qmsystem2 QT += declarative dbus # unit test and unit @@ -16,4 +16,6 @@ $$NOTIFICATIONSRCDIR/notificationpreviewpresenter.h \ $$NOTIFICATIONSRCDIR/notificationmanager.h \ $$NOTIFICATIONSRCDIR/notification.h \ - $$UTILITYSRCDIR/closeeventeater.h + $$UTILITYSRCDIR/closeeventeater.h \ + /usr/include/qmsystem2/qmlocks.h \ + /usr/include/qmsystem2/qmdisplaystate.h ++++++ lipstick.yaml --- lipstick.yaml +++ lipstick.yaml @@ -1,6 +1,6 @@ Name: lipstick Summary: QML toolkit for homescreen creation -Version: 0.10.2 +Version: 0.10.3 Release: 1 Group: System/Libraries License: LGPLv2.1
