[meego-commits] 14495: Changes to Trunk:Testing/meegotouch-systemui
Fathi Boudra
no_reply at build.meego.com
Thu Mar 3 13:29:49 UTC 2011
Hi,
I have made the following changes to meegotouch-systemui in project Trunk:Testing. Please review and accept ASAP.
Thank You,
Fathi Boudra
[This message was auto-generated]
---
Request #14495:
submit: devel:qt-mtf/meegotouch-systemui(r53) -> Trunk:Testing/meegotouch-systemui
Message:
* Wed Mar 02 2011 Miroslav Safr <miroslav.safr at tieto.com.com> 0.20.12
-BMC#14028 - Update meegotouch components to week 9
- update to 0.20.12
* Thu Feb 24 2011 Luis Araujo <luis.araujo at collabora.co.uk> - 0.20.7
- Update to release tag 0.20.7-1 (BMC#13802)
State: new 2011-03-03T00:27:41 boudra
Comment: None
changes files:
--------------
--- meegotouch-systemui.changes
+++ meegotouch-systemui.changes
@@ -0,0 +1,7 @@
+* Wed Mar 02 2011 Miroslav Safr <miroslav.safr at tieto.com.com> 0.20.12
+-BMC#14028 - Update meegotouch components to week 9
+ - update to 0.20.12
+
+* Thu Feb 24 2011 Luis Araujo <luis.araujo at collabora.co.uk> - 0.20.7
+- Update to release tag 0.20.7-1 (BMC#13802)
+
old:
----
meegotouch-systemui-0.20.5.tar.bz2
new:
----
meegotouch-systemui-0.20.12.tar.bz2
spec files:
-----------
--- meegotouch-systemui.spec
+++ meegotouch-systemui.spec
@@ -1,13 +1,13 @@
#
# Do NOT Edit the Auto-generated Part!
-# Generated by: spectacle version 0.22git
+# Generated by: spectacle version 0.22
#
# >> macros
# << macros
Name: meegotouch-systemui
Summary: System UI daemon
-Version: 0.20.5
+Version: 0.20.12
Release: 1
Group: System/Desktop
License: LGPLv2.1
@@ -30,8 +30,8 @@
BuildRequires: pkgconfig(qmsystem2)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(xcomposite)
-BuildRequires: pkgconfig(xdamage)
BuildRequires: pkgconfig(xext)
+BuildRequires: pkgconfig(xdamage)
BuildRequires: expat-devel
BuildRequires: desktop-file-utils
BuildRequires: fdupes
@@ -113,7 +113,7 @@
%prep
-%setup -q -n %{name}-%{version}
+%setup -q -n ./%{name}-%{version}
# >> setup
# << setup
@@ -212,6 +212,8 @@
%defattr(-,root,root,-)
%{_libdir}/meegotouch/applicationextensions/libsysuid-volume.so
%{_datadir}/meegotouch/applicationextensions/sysuid-volume.desktop
+%{_datadir}/themes/base/meegotouch/libsysuid-volume/libsysuid-volume.conf
+%{_datadir}/themes/base/meegotouch/libsysuid-volume/style/libsysuid-volume.css
# >> files volume-fullscreen
# << files volume-fullscreen
other changes:
--------------
++++++ meegotouch-systemui-0.20.5.tar.bz2 -> meegotouch-systemui-0.20.12.tar.bz2
--- debian/changelog
+++ debian/changelog
@@ -1,8 +1,47 @@
-system-ui (0.20.6~1) unstable; urgency=low
+system-ui (0.20.12-1) unstable; urgency=low
- * [UNRELEASED]
+ * Low power mode fixes
- -- Vesa Halttunen <vesa.halttunen at nokia.com> Mon, 14 Feb 2011 16:47:43 +0200
+ -- Vesa Halttunen <vesa.halttunen at nokia.com> Tue, 01 Mar 2011 18:12:37 +0200
+
+system-ui (0.20.11-1) unstable; urgency=low
+
+ * Fixes: NB#227635 - Strings in Full event banner are in wrong order
+
+ -- Vesa Halttunen <vesa.halttunen at nokia.com> Tue, 01 Mar 2011 15:04:58 +0200
+
+system-ui (0.20.10-1) unstable; urgency=low
+
+ * Fixes: NB#229695 - [TASK] screen lock needs to change its window priority
+ * Fixes: NB#231290 - Feedback "power-off" should be renamed to "priority1_power_off"
+ * Fixes: NB#227871 - User input that unblanks the screen is passed through
+
+ -- Vesa Halttunen <vesa.halttunen at nokia.com> Tue, 01 Mar 2011 12:13:31 +0200
+
+system-ui (0.20.9-1) unstable; urgency=low
+
+ * Fixes to the status indicators
+
+ -- Vesa Halttunen <vesa.halttunen at nokia.com> Fri, 25 Feb 2011 16:47:35 +0200
+
+system-ui (0.20.8-1) unstable; urgency=low
+
+ * Fixes: NB#216807 - Status menu opens too slowly
+
+ -- Vesa Halttunen <vesa.halttunen at nokia.com> Fri, 25 Feb 2011 13:20:14 +0200
+
+system-ui (0.20.7-1) unstable; urgency=low
+
+ * Fixes: NB#228153 - MSTATUSBAR_GEOMETRY and ORIENTATION_ANGLE properties on touch screen lock window are wrong
+
+ -- Vesa Halttunen <vesa.halttunen at nokia.com> Thu, 24 Feb 2011 14:22:07 +0200
+
+system-ui (0.20.6-2) unstable; urgency=low
+
+ * Fixes: NB#227801 - When opening status menu, homescreen jams often for a while
+ * Fixes: NB#227295 - Device will freeze after performing several open-close actions on status menu
+
+ -- Vesa Halttunen <vesa.halttunen at nokia.com> Mon, 21 Feb 2011 13:52:44 +0200
system-ui (0.20.5-1) unstable; urgency=low
--- debian/system-ui-volume-fullscreen.install
+++ debian/system-ui-volume-fullscreen.install
@@ -1,2 +1,4 @@
usr/lib/meegotouch/applicationextensions/libsysuid-volume.so
usr/share/meegotouch/applicationextensions/sysuid-volume.desktop
+usr/share/themes/base/meegotouch/libsysuid-volume/style/*.css
+usr/share/themes/base/meegotouch/libsysuid-volume/*.conf
--- doc/src/notifications.dox
+++ doc/src/notifications.dox
@@ -71,7 +71,7 @@
The \c class key can be used to define whether a notification of given type is a system notification or an application notification. If class equals system the notification is a system notification. It class equals application or the key is missing the notification is an application notification. System notifications may be treated differently by the notification sinks. For instance, system notifications are not displayed by the \c NotificationAreaSink. They may also have a higher priority than the application notifications.
-The \c genericTextId key and the \c genericTextCatalogue key can be used to define the translation ID and the translation catalogue of a generic text for the visual notifications of the given type. This generic text can replace the notification content when showing the content is not desired, for instance when the device is locked and privacy is of concern. Both keys are needed to define the generic text. Otherwise the generic text is considered to be empty.
+The \c genericTextId key and the \c genericTextCatalogue key can be used to define the translation ID and the translation catalogue of a generic text for the visual notifications of the given type. This generic text can replace the notification content when showing the content is not desired, for instance when the device is locked and privacy is of concern. Both keys are needed to define the generic text. Otherwise the generic text is considered to be empty. The translated string is retrieved from the provided catalogue in either singular or plural form depending on the cardinality of the particular notification. Once the translated string is retrieved the escape sequences "%n" and "%Ln" of the returned string are replaced with the cardinality of the notification. For more information on how translations are provided refer to "internationalisation" in libmeegotouch documentation.
\section links Links
--- src/extensions/extensions.pro
+++ src/extensions/extensions.pro
@@ -3,3 +3,4 @@
addSubDirs(screenlock)
addSubDirs(screenlock/themes)
addSubDirs(volume)
+addSubDirs(volume/themes)
--- src/extensions/screenlock/lockscreenstatusareaview.cpp
+++ src/extensions/screenlock/lockscreenstatusareaview.cpp
@@ -36,7 +36,6 @@
batteryIndicator(new BatteryStatusIndicator(contextFrameworkContext, controller)),
phoneSignalStrengthIndicator(new PhoneNetworkSignalStrengthStatusIndicator(contextFrameworkContext, controller)),
phoneNetworkTypeIndicator(new PhoneNetworkTypeStatusIndicator(contextFrameworkContext, controller)),
- internetConnectionIndicator(new InternetConnectionStatusIndicator(contextFrameworkContext, controller)),
bluetoothIndicator(new BluetoothStatusIndicator(contextFrameworkContext, controller)),
gpsIndicator(new GPSStatusIndicator(contextFrameworkContext, controller)),
presenceIndicator(new PresenceStatusIndicator(contextFrameworkContext, controller)),
@@ -44,6 +43,7 @@
callIndicator(new CallStatusIndicator(contextFrameworkContext, controller)),
alarmIndicator(new AlarmStatusIndicator(contextFrameworkContext, controller)),
notifierIndicator(new NotificationStatusIndicator(controller)),
+ callForwardingIndicator(new CallForwardingStatusIndicator(contextFrameworkContext, controller)),
transferStatusIndicator(new TransferStatusIndicator(controller)),
orientationChangeSignalConnected(false)
{
@@ -59,12 +59,12 @@
layout->setSpacing(0);
layout->addItem(batteryIndicator);
layout->addItem(phoneSignalStrengthIndicator);
- layout->addItem(phoneNetworkTypeIndicator);
layout->addItem(phoneNetworkIndicator);
+ layout->addItem(phoneNetworkTypeIndicator);
layout->addStretch();
layout->addItem(notifierIndicator);
layout->addItem(transferStatusIndicator);
- layout->addItem(internetConnectionIndicator);
+ layout->addItem(callForwardingIndicator);
layout->addItem(bluetoothIndicator);
layout->addItem(gpsIndicator);
layout->addItem(presenceIndicator);
--- src/extensions/screenlock/lockscreenstatusareaview.h
+++ src/extensions/screenlock/lockscreenstatusareaview.h
@@ -64,7 +64,7 @@
//! The controller instance
StatusArea *controller;
- //! Phone network indicator
+ //! Phone network and Internet connection indicator
StatusIndicator *phoneNetworkIndicator;
//! Battery indicator
@@ -76,9 +76,6 @@
//! Phone network type indicator
StatusIndicator *phoneNetworkTypeIndicator;
- //! Internet connection indicator
- StatusIndicator *internetConnectionIndicator;
-
//! Bluetooth indicator
StatusIndicator *bluetoothIndicator;
@@ -100,6 +97,9 @@
//! Notification notifier
StatusIndicator *notifierIndicator;
+ //! Call forwarding indicator
+ StatusIndicator *callForwardingIndicator;
+
//! Transfer status indicator
StatusIndicator *transferStatusIndicator;
--- src/extensions/volume/themes
+++ src/extensions/volume/themes
+(directory)
--- src/extensions/volume/themes/style
+++ src/extensions/volume/themes/style
+(directory)
--- src/extensions/volume/themes/style/libsysuid-volume.css
+++ src/extensions/volume/themes/style/libsysuid-volume.css
(renamed from themes/style/volumecontrol.css)
--- src/extensions/volume/themes/style/style.pro
+++ src/extensions/volume/themes/style/style.pro
+include(../../../../../mconfig.pri)
+
+TEMPLATE = subdirs
+
+INSTALLS += style
+
+style.files = *.css
+style.path = /usr/share/themes/base/meegotouch/libsysuid-volume/style
+
+QMAKE_EXTRA_TARGETS += check
+check.commands = $$system(true)
+QMAKE_EXTRA_TARGETS += check-xml
+check-xml.commands = $$system(true)
--- src/extensions/volume/themes/themes.pro
+++ src/extensions/volume/themes/themes.pro
+include(../../../../mconfig.pri)
+include(../../../../shared.pri)
+
+TEMPLATE = subdirs
+addSubDirs(style)
+
+INSTALLS += conf
+
+#
+# We just need an extra target so that the recursive make will pass, we don't
+# need to do anything else.
+#
+contains(BUILD_FEATURES,coverage) {
+ QMAKE_EXTRA_TARGETS += coverage
+ coverage.commands = $$system(true)
+}
+
+conf.files = *.conf
+conf.path = /usr/share/themes/base/meegotouch/libsysuid-volume
+
+QMAKE_EXTRA_TARGETS += check
+check.commands = $$system(true)
+QMAKE_EXTRA_TARGETS += check-xml
+check-xml.commands = $$system(true)
--- src/systemui/notifications/notificationareasink.cpp
+++ src/systemui/notifications/notificationareasink.cpp
@@ -53,7 +53,7 @@
}
}
-void NotificationAreaSink::setupInfoBanner(MBanner *infoBanner)
+void NotificationAreaSink::setupInfoBanner(MBanner *infoBanner, const NotificationParameters ¶meters)
{
// Don't allow the scene manager to destroy the banner
infoBanner->setManagedManually(true);
@@ -61,15 +61,20 @@
// Since the notification area only shows event banners, set the style name
infoBanner->setStyleName("FullEventBanner");
+ // In the full event banners the order of the title and the subtitle needs to be reversed
+ infoBanner->setProperty(TITLE_TEXT_PROPERTY, infoBannerSubtitleText(parameters));
+ infoBanner->setProperty(SUBTITLE_TEXT_PROPERTY, infoBannerTitleText(parameters));
+ updateTitles(infoBanner);
+
// Catch clicks and send signal that a banner was clicked.
connect(infoBanner, SIGNAL(clicked()), this, SIGNAL(bannerClicked()), Qt::QueuedConnection);
}
-MBanner *NotificationAreaSink::updateNotification(MBanner *infoBanner, const NotificationParameters ¶meters)
+void NotificationAreaSink::updateNotification(MBanner *infoBanner, const NotificationParameters ¶meters)
{
- // Update the info banner widget
- infoBanner->setProperty(TITLE_TEXT_PROPERTY, infoBannerTitleText(parameters));
- infoBanner->setProperty(SUBTITLE_TEXT_PROPERTY, infoBannerSubtitleText(parameters));
+ // Update the info banner widget. In the full event banners the order of the title and the subtitle needs to be reversed.
+ infoBanner->setProperty(TITLE_TEXT_PROPERTY, infoBannerSubtitleText(parameters));
+ infoBanner->setProperty(SUBTITLE_TEXT_PROPERTY, infoBannerTitleText(parameters));
infoBanner->setProperty(GENERIC_TEXT_PROPERTY, infoBannerGenericText(parameters));
infoBanner->setProperty(USER_REMOVABLE_PROPERTY, determineUserRemovability(parameters));
infoBanner->setBannerTimeStamp(QDateTime::fromTime_t(parameters.value("timestamp").toUInt()));
@@ -80,8 +85,6 @@
updateImage(infoBanner, parameters);
updateTitles(infoBanner);
updateActions(infoBanner, parameters);
-
- return infoBanner;
}
void NotificationAreaSink::addGroup(uint groupId, const NotificationParameters ¶meters)
@@ -93,7 +96,7 @@
} else {
// Keep track of the mapping between IDs and info banners
MBanner *infoBanner = createInfoBanner(Notification::ApplicationEvent, groupId, parameters);
- setupInfoBanner(infoBanner);
+ setupInfoBanner(infoBanner, parameters);
groupIdToMBanner.insert(groupId, infoBanner);
}
@@ -158,7 +161,7 @@
MBanner* NotificationAreaSink::createGroupBanner(uint groupId, const NotificationParameters ¶meters)
{
MBanner *infoBanner = createInfoBanner(Notification::ApplicationEvent, groupId, parameters);
- setupInfoBanner(infoBanner);
+ setupInfoBanner(infoBanner, parameters);
infoBanner->setParentItem(NULL);
groupIdToMBanner.insert(groupId, infoBanner);
return infoBanner;
@@ -199,7 +202,7 @@
updateNotification(infoBanner, notification.parameters());
} else {
infoBanner = createInfoBanner(notification);
- setupInfoBanner(infoBanner);
+ setupInfoBanner(infoBanner, notification.parameters());
notificationIdToMBanner.insert(notification.notificationId(), infoBanner);
// Add to the notification area
emit addNotification(*infoBanner);
--- src/systemui/notifications/notificationareasink.h
+++ src/systemui/notifications/notificationareasink.h
@@ -90,9 +90,10 @@
private:
//! Sets up the info banner can connects its signals
- void setupInfoBanner(MBanner *infoBanner);
+ void setupInfoBanner(MBanner *infoBanner, const NotificationParameters ¶meters);
+
//! Updates a notification widget
- MBanner *updateNotification(MBanner *dn, const NotificationParameters ¶meters);
+ void updateNotification(MBanner *infoBanner, const NotificationParameters ¶meters);
//! A mapping between notification IDs and MBanner widgets
QHash<uint, MBanner *> notificationIdToMBanner;
--- src/systemui/screenlock/eventeater.cpp
+++ src/systemui/screenlock/eventeater.cpp
@@ -16,7 +16,6 @@
** of this file.
**
****************************************************************************/
-
#include "eventeater.h"
// Event eater instance that listens input events
@@ -88,8 +87,9 @@
X11Wrapper::XMapRaised(dpy, window);
- // Grab is released automatically at unmap
+ // Grabs are released automatically at unmap
X11Wrapper::XGrabKeyboard(dpy, window, False, GrabModeAsync, GrabModeAsync, CurrentTime);
+ X11Wrapper::XGrabPointer(dpy, window, False, ButtonPressMask, GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
}
void EventEater::hide()
@@ -101,9 +101,7 @@
{
bool handled = false;
- if ((event->xany.window == window) &&
- (event->type == ButtonPress || event->type == KeyPress)) {
-
+ if ((event->xany.window == window) && (event->type == ButtonPress || event->type == KeyPress)) {
handled = true;
emit inputEventReceived();
}
--- src/systemui/screenlock/screenlockbusinesslogic.cpp
+++ src/systemui/screenlock/screenlockbusinesslogic.cpp
@@ -86,6 +86,10 @@
QTimer::singleShot(0, this, SLOT(showLowPowerMode()));
break;
+ case TkLockRealBlankMode:
+ QTimer::singleShot(0, this, SLOT(setDisplayOffMode()));
+ break;
+
default:
break;
}
@@ -134,6 +138,12 @@
void ScreenLockBusinessLogic::showScreenLock()
{
+ // When the low power mode is switched off, it must be done before updating the window contents.
+ // If the window does not yet exist, the window is created to be in the non-low power mode.
+ if (screenLockWindow != NULL) {
+ screenLockWindow->setLowPowerMode(false);
+ }
+
foreach (ScreenLockExtensionInterface *screenLockExtension, screenLockExtensions) {
screenLockExtension->setMode(ScreenLockExtensionInterface::NormalMode);
}
@@ -148,6 +158,24 @@
}
toggleScreenLockUI(true);
toggleEventEater(false);
+
+ // When the low power mode is switched on, it must be done after updating the window contents
+ screenLockWindow->setLowPowerMode(true);
+}
+
+void ScreenLockBusinessLogic::setDisplayOffMode()
+{
+ // When the low power mode is switched off, it must be done before updating the window contents.
+ // If the window does not yet exist, the window is created to be in the non-low power mode.
+ if (screenLockWindow != NULL) {
+ screenLockWindow->setLowPowerMode(false);
+ }
+
+ foreach (ScreenLockExtensionInterface *screenLockExtension, screenLockExtensions) {
+ screenLockExtension->setMode(ScreenLockExtensionInterface::DisplayOffMode);
+ }
+ toggleScreenLockUI(true);
+ toggleEventEater(false);
}
void ScreenLockBusinessLogic::hideScreenLockAndEventEater()
@@ -185,6 +213,7 @@
screenLockWindow->raise();
} else {
if (screenLockWindow != NULL && screenLockWindow->isVisible()) {
+ screenLockWindow->setLowPowerMode(false);
screenLockWindow->hide();
}
}
--- src/systemui/screenlock/screenlockbusinesslogic.h
+++ src/systemui/screenlock/screenlockbusinesslogic.h
@@ -97,6 +97,9 @@
//! Shows the screen lock window in low power mode and hides the event eater window.
void showLowPowerMode();
+ //! Sets the screen lock extensions into display off state
+ void setDisplayOffMode();
+
//! Hides the event eater window and the screen lock window.
void hideScreenLockAndEventEater();
@@ -131,7 +134,8 @@
TkLockModeSelect, // Deprecated
TkLockModeOneInput, // Turn the event eater on
TkLockEnableVisual, // Show unlock UI
- TkLockEnableLowPowerMode // Show low power UI
+ TkLockEnableLowPowerMode, // Show low power UI
+ TkLockRealBlankMode // Display completely off
};
enum TkLockStatus {
@@ -168,7 +172,7 @@
#endif
#ifdef UNIT_TEST
- friend class Ut_LockScreenBusinessLogic;
+ friend class Ut_ScreenLockBusinessLogic;
friend class Ft_LockScreenBusinessLogic;
#endif
};
--- src/systemui/screenlock/screenlockextensioninterface.h
+++ src/systemui/screenlock/screenlockextensioninterface.h
@@ -39,7 +39,8 @@
//! Screen lock modes
enum ScreenLockMode {
NormalMode,
- LowPowerMode
+ LowPowerMode,
+ DisplayOffMode
};
/*!
--- src/systemui/screenlock/screenlockwindow.cpp
+++ src/systemui/screenlock/screenlockwindow.cpp
@@ -16,7 +16,6 @@
** of this file.
**
****************************************************************************/
-
#include "screenlockwindow.h"
#include "screenlockwindowstyle.h"
#include <MApplicationExtensionArea>
@@ -27,7 +26,7 @@
#include "x11wrapper.h"
ScreenLockWindow::ScreenLockWindow(MApplicationExtensionArea *extensionArea, QWidget *parent) :
- MWindow(parent)
+ MWindow(parent), lowPowerMode(false)
{
setWindowTitle("Screen Lock");
setSceneManager(new MSceneManager);
@@ -54,6 +53,10 @@
void ScreenLockWindow::applyStyle()
{
const ScreenLockWindowStyle *style = static_cast<const ScreenLockWindowStyle *>(MTheme::style("ScreenLockWindowStyle", "", "", "", M::Landscape, NULL));
+
+ // This must be set before setting the orientation. See bug #230352.
+ setTranslucentBackground(style->translucent());
+
if (style->lockedOrientation() == "landscape") {
setLandscapeOrientation();
setOrientationLocked(true);
@@ -63,8 +66,6 @@
} else {
setOrientationLocked(false);
}
-
- setTranslucentBackground(style->translucent());
}
void ScreenLockWindow::showEvent(QShowEvent *event)
@@ -76,14 +77,46 @@
Display *display = QX11Info::display();
Atom stackingLayerAtom = X11Wrapper::XInternAtom(display, "_MEEGO_STACKING_LAYER", False);
if (stackingLayerAtom != None) {
- long layer = 2;
- X11Wrapper::XChangeProperty(display, internalWinId(), stackingLayerAtom, XA_CARDINAL, 32, PropModeReplace, (unsigned char*)&layer, 1);
+ long layer = 5;
+ X11Wrapper::XChangeProperty(display, effectiveWinId(), stackingLayerAtom, XA_CARDINAL, 32, PropModeReplace, (unsigned char*)&layer, 1);
+ }
+
+ // Set the orientation angle (since it doesn't seem to get set properly for translucent windows, see bug #230352)
+ Atom orientationAngleAtom = XInternAtom(display, "_MEEGOTOUCH_ORIENTATION_ANGLE", False);
+ if (orientationAngleAtom != None) {
+ M::OrientationAngle angle = sceneManager()->orientationAngle();
+ X11Wrapper::XChangeProperty(display, effectiveWinId(), orientationAngleAtom, XA_CARDINAL, 32, PropModeReplace, (unsigned char*)&angle, 1);
}
// Exclude the window from the task bar
excludeFromTaskBar();
+
+ // Set the current low power mode
+ setLowPowerMode(lowPowerMode);
}
+void ScreenLockWindow::setLowPowerMode(bool enable)
+{
+ lowPowerMode = enable;
+
+ // Set the low power mode X property if needed to make compositor paint the window even when the display state is off,
+ // so the low power mode view can update itself
+ Display *display = QX11Info::display();
+ Atom lowPowerModeAtom = X11Wrapper::XInternAtom(display, "_MEEGO_LOW_POWER_MODE", False);
+ if (lowPowerModeAtom != None) {
+ long mode = enable ? 1 : 0;
+ X11Wrapper::XChangeProperty(display, internalWinId(), lowPowerModeAtom, XA_CARDINAL, 32, PropModeReplace, (unsigned char*)&mode, 1);
+ }
+}
+
+void ScreenLockWindow::paintEvent(QPaintEvent *event)
+{
+ // Avoid running MWindow's paintEvent, because it stops painting when
+ // display is off, but we need to paint the low power mode view even in that state
+ QGraphicsView::paintEvent(event);
+}
+
+
void ScreenLockWindow::excludeFromTaskBar()
{
// Tell the window to not to be shown in the switcher
--- src/systemui/screenlock/screenlockwindow.h
+++ src/systemui/screenlock/screenlockwindow.h
@@ -46,12 +46,24 @@
*/
virtual ~ScreenLockWindow();
+ /*!
+ * Sets the low power mode property of the window to enable or isable compositor
+ * painting even in low power mode state
+ * \param enable if true, enables the low power state
+ */
+ void setLowPowerMode(bool enable);
+
protected:
/*!
- * Sets the _MEEGO_STACKING_LAYER window property to 2.
+ * Sets the _MEEGO_STACKING_LAYER window property to 5. For incoming call feature
+ * this needs to be at least higher than call-ui's value (currently 2).
*/
virtual void showEvent(QShowEvent *event);
+ //! \reimp
+ virtual void paintEvent(QPaintEvent *event);
+ //! \reimp_end
+
private:
//! Set window properties to not show the window in the switcher
void excludeFromTaskBar();
@@ -60,8 +72,11 @@
//! Applies the lock screen orientation and locking from the style
void applyStyle();
+ //! Low power mode of the window
+ bool lowPowerMode;
+
#ifdef UNIT_TEST
- friend class Ut_LockScreenWindow;
+ friend class Ut_ScreenLockWindow;
#endif
};
--- src/systemui/shutdownui.cpp
+++ src/systemui/shutdownui.cpp
@@ -70,7 +70,7 @@
// Initialize non-graphical feedback
feedback = new MFeedback(this);
- feedback->setName("power-off");
+ feedback->setName("priority1_power_off");
//% "Shutting down"
label1 = new MLabel(qtTrId("qtn_shut_down"));
--- src/systemui/statusarea/statusareaview.cpp
+++ src/systemui/statusarea/statusareaview.cpp
@@ -48,8 +48,6 @@
portraitPhoneSignalStrengthIndicator(new PhoneNetworkSignalStrengthStatusIndicator(contextFrameworkContext, controller)),
landscapePhoneNetworkTypeIndicator(new PhoneNetworkTypeStatusIndicator(contextFrameworkContext, controller)),
portraitPhoneNetworkTypeIndicator(new PhoneNetworkTypeStatusIndicator(contextFrameworkContext, controller)),
- landscapeInternetConnectionIndicator(new InternetConnectionStatusIndicator(contextFrameworkContext, controller)),
- portraitInternetConnectionIndicator(new InternetConnectionStatusIndicator(contextFrameworkContext, controller)),
landscapeBluetoothIndicator(new BluetoothStatusIndicator(contextFrameworkContext, controller)),
portraitBluetoothIndicator(new BluetoothStatusIndicator(contextFrameworkContext, controller)),
landscapeGPSIndicator(new GPSStatusIndicator(contextFrameworkContext, controller)),
@@ -63,14 +61,16 @@
portraitCallIndicator(new CallStatusIndicator(contextFrameworkContext, controller)),
landscapeNotificationIndicator(new NotificationStatusIndicator(controller)),
portraitNotificationIndicator(new NotificationStatusIndicator(controller)),
+ landscapeCallForwardingIndicator(new CallForwardingStatusIndicator(contextFrameworkContext, controller)),
+ portraitCallForwardingIndicator(new CallForwardingStatusIndicator(contextFrameworkContext, controller)),
landscapeTransferStatusIndicator(new TransferStatusIndicator(controller)),
portraitTransferStatusIndicator(new TransferStatusIndicator(controller)),
landscapeClock(new Clock(controller)),
portraitClock(new Clock(controller))
{
// Connect related phone network indicators
- connect(portraitPhoneNetworkTypeIndicator, SIGNAL(networkAvailabilityChanged(bool)), portraitPhoneSignalStrengthIndicator, SLOT(setDisplay(bool)));
- connect(landscapePhoneNetworkTypeIndicator, SIGNAL(networkAvailabilityChanged(bool)), landscapePhoneSignalStrengthIndicator, SLOT(setDisplay(bool)));
+ connect(portraitPhoneSignalStrengthIndicator, SIGNAL(networkAvailabilityChanged(bool)), portraitPhoneNetworkTypeIndicator, SLOT(setNetworkAvailability(bool)));
+ connect(landscapePhoneSignalStrengthIndicator, SIGNAL(networkAvailabilityChanged(bool)), landscapePhoneNetworkTypeIndicator, SLOT(setNetworkAvailability(bool)));
// Set up the clock styles
landscapeClock->setObjectName("StatusAreaLandscapeClock");
@@ -121,8 +121,6 @@
portraitPhoneSignalStrengthIndicator->setParent(portraitWidget);
landscapePhoneNetworkTypeIndicator->setParent(landscapeWidget);
portraitPhoneNetworkTypeIndicator->setParent(portraitWidget);
- landscapeInternetConnectionIndicator->setParent(landscapeWidget);
- portraitInternetConnectionIndicator->setParent(portraitWidget);
landscapeBluetoothIndicator->setParent(landscapeWidget);
portraitBluetoothIndicator->setParent(portraitWidget);
landscapeGPSIndicator->setParent(landscapeWidget);
@@ -138,6 +136,8 @@
portraitNotificationIndicator->setParent(portraitWidget);
landscapeClock->setParent(landscapeWidget);
portraitClock->setParent(portraitWidget);
+ landscapeCallForwardingIndicator->setParent(landscapeWidget);
+ portraitCallForwardingIndicator->setParent(portraitWidget);
landscapeTransferStatusIndicator->setParent(landscapeWidget);
portraitTransferStatusIndicator->setParent(portraitWidget);
}
@@ -166,12 +166,12 @@
// Put indicators into the layout
layout->addItem(landscapeBatteryIndicator);
layout->addItem(landscapePhoneSignalStrengthIndicator);
- layout->addItem(landscapePhoneNetworkTypeIndicator);
layout->addItem(landscapePhoneNetworkIndicator);
+ layout->addItem(landscapePhoneNetworkTypeIndicator);
layout->addStretch();
layout->addItem(landscapeNotificationIndicator);
layout->addItem(landscapeTransferStatusIndicator);
- layout->addItem(landscapeInternetConnectionIndicator);
+ layout->addItem(landscapeCallForwardingIndicator);
layout->addItem(landscapeBluetoothIndicator);
layout->addItem(landscapeGPSIndicator);
layout->addItem(landscapePresenceIndicator);
@@ -193,12 +193,12 @@
// Put indicators into the layout
layout->addItem(portraitBatteryIndicator);
layout->addItem(portraitPhoneSignalStrengthIndicator);
- layout->addItem(portraitPhoneNetworkTypeIndicator);
layout->addItem(portraitPhoneNetworkIndicator);
+ layout->addItem(portraitPhoneNetworkTypeIndicator);
layout->addStretch();
layout->addItem(portraitNotificationIndicator);
layout->addItem(portraitTransferStatusIndicator);
- layout->addItem(portraitInternetConnectionIndicator);
+ layout->addItem(portraitCallForwardingIndicator);
layout->addItem(portraitBluetoothIndicator);
layout->addItem(portraitGPSIndicator);
layout->addItem(portraitPresenceIndicator);
--- src/systemui/statusarea/statusareaview.h
+++ src/systemui/statusarea/statusareaview.h
@@ -84,14 +84,10 @@
StatusIndicator *landscapePhoneSignalStrengthIndicator;
StatusIndicator *portraitPhoneSignalStrengthIndicator;
- //! Phone network type indicator
+ //! Phone network type and Internet connection indicator
StatusIndicator *landscapePhoneNetworkTypeIndicator;
StatusIndicator *portraitPhoneNetworkTypeIndicator;
- //! Internet connection indicator
- StatusIndicator *landscapeInternetConnectionIndicator;
- StatusIndicator *portraitInternetConnectionIndicator;
-
//! Bluetooth indicator
StatusIndicator *landscapeBluetoothIndicator;
StatusIndicator *portraitBluetoothIndicator;
@@ -119,6 +115,10 @@
StatusIndicator *landscapeNotificationIndicator;
StatusIndicator *portraitNotificationIndicator;
+ //! Call forwarding status indicator
+ StatusIndicator *landscapeCallForwardingIndicator;
+ StatusIndicator *portraitCallForwardingIndicator;
+
//! Transfer status indicator
StatusIndicator *landscapeTransferStatusIndicator;
StatusIndicator *portraitTransferStatusIndicator;
--- src/systemui/statusarea/statusindicator.cpp
+++ src/systemui/statusarea/statusindicator.cpp
@@ -91,6 +91,7 @@
foreach(ContextItem* item, contextItems) {
item->subscribe();
}
+ emit subscriptionMade();
}
void StatusIndicator::exitDisplayEvent()
@@ -123,19 +124,23 @@
{
ContextItem *item = context.createContextItem(key);
contextItems.append(item);
+ connect(this, SIGNAL(subscriptionMade()), item, SIGNAL(contentsChanged()));
return item;
}
PhoneNetworkSignalStrengthStatusIndicator::PhoneNetworkSignalStrengthStatusIndicator(ApplicationContext &context, QGraphicsItem *parent) :
- StatusIndicator(parent)
+ StatusIndicator(parent), networkAvailable(false)
{
- setStyleName(metaObject()->className());
-
signalStrength = createContextItem(context, "Cellular.SignalBars");
connect(signalStrength, SIGNAL(contentsChanged()), this, SLOT(signalStrengthChanged()));
- setValue(0);
- setDisplay(false);
+ systemOfflineMode = createContextItem(context, "System.OfflineMode");
+ connect(systemOfflineMode, SIGNAL(contentsChanged()), this, SLOT(setNetworkStatus()));
+
+ cellularRegistrationStatus = createContextItem(context, "Cellular.RegistrationStatus");
+ connect(cellularRegistrationStatus, SIGNAL(contentsChanged()), this, SLOT(setNetworkStatus()));
+
+ setNetworkStatus();
}
PhoneNetworkSignalStrengthStatusIndicator::~PhoneNetworkSignalStrengthStatusIndicator()
@@ -147,27 +152,48 @@
setValue(signalStrength->value().toDouble() * 0.2f );
}
-void PhoneNetworkSignalStrengthStatusIndicator::setDisplay(bool display)
+void PhoneNetworkSignalStrengthStatusIndicator::setNetworkStatus()
{
- if(display) {
- setStyleNameAndUpdate(metaObject()->className());
+ QString postFix = "";
+
+ bool offlineMode = systemOfflineMode->value().toBool();
+ QString status = cellularRegistrationStatus->value().toString(); // home roam no-sim offline forbidden
+
+ if (offlineMode) {
+ postFix = "Offline";
+ } else if (status == "no-sim") {
+ postFix = "NoSIM";
+ } else if (status == "" || status == "offline" || status == "forbidden") {
+ postFix = "NoNetwork";
+ }
+
+ bool networkCurrentlyAvailable = postFix.isEmpty();
+ if (networkCurrentlyAvailable) {
+ signalStrengthChanged();
} else {
- setStyleNameAndUpdate();
+ setValue(0);
+ }
+ if (networkAvailable != networkCurrentlyAvailable) {
+ emit networkAvailabilityChanged(networkCurrentlyAvailable);
+ networkAvailable = networkCurrentlyAvailable;
}
+ setStyleNameAndUpdate(metaObject()->className() + postFix);
}
-
PhoneNetworkTypeStatusIndicator::PhoneNetworkTypeStatusIndicator(ApplicationContext &context, QGraphicsItem *parent) :
- StatusIndicator(parent), networkAvailable(false)
+ StatusIndicator(parent)
{
- systemOfflineMode = createContextItem(context, "System.OfflineMode");
- connect(systemOfflineMode, SIGNAL(contentsChanged()), this, SLOT(setNetworkType()));
-
cellularDataTechnology = createContextItem(context, "Cellular.DataTechnology");
connect(cellularDataTechnology, SIGNAL(contentsChanged()), this, SLOT(setNetworkType()));
- cellularRegistrationStatus = createContextItem(context, "Cellular.RegistrationStatus");
- connect(cellularRegistrationStatus, SIGNAL(contentsChanged()), this, SLOT(setNetworkType()));
+ connectionType = createContextItem(context, "Internet.NetworkType");
+ connect(connectionType, SIGNAL(contentsChanged()), this, SLOT(setNetworkType()));
+
+ connectionState = createContextItem(context, "Internet.NetworkState");
+ connect(connectionState, SIGNAL(contentsChanged()), this, SLOT(setNetworkType()));
+
+ packetData = createContextItem(context, "Cellular.PacketData");
+ connect(packetData, SIGNAL(contentsChanged()), this, SLOT(setNetworkType()));
setNetworkType();
}
@@ -176,43 +202,57 @@
{
}
-void PhoneNetworkTypeStatusIndicator::setNetworkType()
+void PhoneNetworkTypeStatusIndicator::setNetworkAvailability(bool available)
{
- QString postFix = "NoNetwork";
+ QString state = connectionState->value().toString(); // disconnected connecting connected
+ if (!available && (state == "disconnected")) {
+ setStyleNameAndUpdate();
+ } else {
+ setNetworkType();
+ }
+}
- bool offlineMode = systemOfflineMode->value().toBool();
- QString dataTechnology = cellularDataTechnology->value().toString(); // gprs egprs umts hspa
- QString status = cellularRegistrationStatus->value().toString(); // home roam no-sim offline forbidden
+void PhoneNetworkTypeStatusIndicator::setNetworkType()
+{
+ QString postFix = "";
+ QString dataTechnology = cellularDataTechnology->value().toString(); // gprs egprs umts hspa
+ QString state = connectionState->value().toString(); // disconnected connecting connected
+ QString connection = connectionType->value().toString(); // GPRS WLAN
+ bool data = packetData->value().toBool();
setValue(0);
- if (offlineMode) {
- postFix = "Offline";
- } else {
- if (status == "no-sim") {
- postFix = "NoSIM";
- } else if (status == "" || status == "offline" || status == "forbidden") {
- postFix = "NoNetwork";
- } else {
- if (dataTechnology == "gprs") {
- postFix = "2G";
- } else if(dataTechnology == "egprs") {
- postFix = "25G";
- } else if(dataTechnology == "umts") {
- postFix = "3G";
- } else if(dataTechnology == "hspa") {
- postFix = "35G";
- }
- }
+ if (state == "disconnected") {
+ setStyleNameAndUpdate(); // hide indicator
+ return; // no further actions needed
}
- bool n = !(postFix == "NoNetwork" || postFix == "Offline" || postFix == "NoSIM");
- if (n != networkAvailable) {
- networkAvailable = n;
- emit networkAvailabilityChanged(n);
+ if (connection == "WLAN") {
+ postFix = "WLAN";
+ } else if (dataTechnology == "gprs") {
+ postFix = "2G";
+ } else if (dataTechnology == "egprs") {
+ postFix = "25G";
+ } else if (dataTechnology == "umts") {
+ postFix = "3G";
+ } else if (dataTechnology == "hspa") {
+ postFix = "35G";
}
+ if (state == "connecting") {
+ postFix += "Connecting";
+ animateIfPossible = true;
+ } else if (data) { // TODO: when wlan transfer info available from context fw, add here
+ postFix += "Active";
+ animateIfPossible = false;
+ } else {
+ animateIfPossible = false;
+ }
+ // TODO: add suspended state here when available from context fw (postFix: Suspended)
+ // TODO: when wlan transfer info available swap with wlan and gprs if both active at the same time
setStyleNameAndUpdate(metaObject()->className() + postFix);
+
+ updateAnimationStatus();
}
BatteryStatusIndicator::BatteryStatusIndicator(ApplicationContext &context, QGraphicsItem *parent) :
@@ -374,68 +414,10 @@
}
}
-InternetConnectionStatusIndicator::InternetConnectionStatusIndicator(ApplicationContext &context, QGraphicsItem *parent) :
- StatusIndicator(parent)
-{
- connectionType = createContextItem(context, "Internet.NetworkType");
- connect(connectionType, SIGNAL(contentsChanged()), this, SLOT(updateStatus()));
-
- connectionState = createContextItem(context, "Internet.NetworkState");
- connect(connectionState, SIGNAL(contentsChanged()), this, SLOT(updateStatus()));
-
- packetData = createContextItem(context, "Cellular.PacketData");
- connect(packetData, SIGNAL(contentsChanged()), this, SLOT(updateStatus()));
-
- updateStatus();
-}
-
-InternetConnectionStatusIndicator::~InternetConnectionStatusIndicator()
-{
-}
-
-void InternetConnectionStatusIndicator::updateStatus()
-{
- QString postFix = "";
-
- QString state = connectionState->value().toString(); // disconnected connecting connected
- QString connection = connectionType->value().toString(); // GPRS WLAN
- bool data = packetData->value().toBool();
-
- setValue(0);
-
- if(connection == "WLAN") {
- postFix = "WLAN";
- } else if(connection == "GPRS") {
- postFix = "PacketData";
- }
-
- if(state == "connecting") {
- postFix += "Connecting";
- animateIfPossible = true;
- } else if(state == "connected") {
- animateIfPossible = false;
- } else {
- postFix = "";
- animateIfPossible = false;
- }
-
- // If a GPRS connection is in the process of being established,
- // hide packet data activity. Otherwise, packet data actvity is
- // show regardless of the network state as it may be a result of
- // MMS sending or device being used as a GPRS modem.
- if(data && (connection != "GPRS" || state != "connecting")) {
- postFix = "PacketDataActive";
- }
-
- setStyleNameAndUpdate(metaObject()->className() + postFix);
-
- updateAnimationStatus();
-}
-
PhoneNetworkStatusIndicator::PhoneNetworkStatusIndicator(ApplicationContext &context, QGraphicsItem *parent) :
StatusIndicator(parent)
{
- setStyleName(metaObject()->className());
+ setStyleNameAndUpdate(metaObject()->className());
networkName = createContextItem(context, "Cellular.NetworkName");
connect(networkName, SIGNAL(contentsChanged()), this, SLOT(phoneNetworkChanged()));
@@ -627,3 +609,27 @@
updateAnimationStatus();
}
+CallForwardingStatusIndicator::CallForwardingStatusIndicator(ApplicationContext &context, QGraphicsItem *parent) :
+ StatusIndicator(parent)
+{
+ setStyleName(metaObject()->className());
+
+ callForwarding = createContextItem(context, "Phone.CallForwarding");
+ connect(callForwarding, SIGNAL(contentsChanged()), this, SLOT(callForwardingChanged()));
+ callForwardingChanged();
+}
+
+CallForwardingStatusIndicator::~CallForwardingStatusIndicator()
+{
+}
+
+void CallForwardingStatusIndicator::callForwardingChanged()
+{
+ bool isSet = callForwarding->value().toBool();
+
+ if (isSet) {
+ setStyleNameAndUpdate(QString(metaObject()->className()) + "Set");
+ } else {
+ setStyleNameAndUpdate(QString(metaObject()->className()));
+ }
+}
--- src/systemui/statusarea/statusindicator.h
+++ src/systemui/statusarea/statusindicator.h
@@ -61,6 +61,10 @@
virtual void updateGeometry();
//! \reimp_end
+signals:
+ //! Emitted when a subscription to the context items has been made
+ void subscriptionMade();
+
protected:
/*!
* Calls setStyleName(name) and update() for convenience.
@@ -150,19 +154,34 @@
virtual ~PhoneNetworkSignalStrengthStatusIndicator();
+signals:
+ void networkAvailabilityChanged(bool available);
+
private slots:
void signalStrengthChanged();
-
-public slots:
- void setDisplay(bool display);
+ void setNetworkStatus();
private:
ContextItem *signalStrength;
+ ContextItem *systemOfflineMode;
+ ContextItem *cellularRegistrationStatus;
+
+ bool networkAvailable;
+
+#ifdef UNIT_TEST
+ friend class Ut_StatusIndicator;
+#endif
};
/*!
- * A status indicator for showing the phone network type
+ * A status indicator for showing the phone network type and
+ * the internet connection status.
+ * Displays either a WiFi or a packet data connection symbol. The
+ * symbol is animated while the connection is being established.
+ * If a packet data connection is active (data is being transfered),
+ * a "packet data connection active" symbol is shown.
*/
+
class PhoneNetworkTypeStatusIndicator : public StatusIndicator
{
Q_OBJECT
@@ -179,18 +198,23 @@
virtual ~PhoneNetworkTypeStatusIndicator();
-signals:
- void networkAvailabilityChanged(bool available);
+public slots:
+ void setNetworkAvailability(bool availability);
private slots:
void setNetworkType();
private:
- ContextItem *systemOfflineMode;
+
ContextItem *cellularDataTechnology;
- ContextItem *cellularRegistrationStatus;
+ ContextItem *connectionType;
+ ContextItem *connectionState;
+ ContextItem *packetData;
+
+#ifdef UNIT_TEST
+ friend class Ut_StatusIndicator;
+#endif
- bool networkAvailable;
};
/*!
@@ -309,31 +333,6 @@
ContextItem *presence;
};
-/*!
- * A status indicator for showing the internet connection status.
- * Displays either a WiFi or a packet data connection symbol. The
- * symbol is animated while the connection is being established.
- * If a packet data connection is active (data is being transfered),
- * a "packet data connection active" symbol is shown.
- */
-class InternetConnectionStatusIndicator : public StatusIndicator
-{
- Q_OBJECT
- M_CONTROLLER(InternetConnectionStatusIndicator)
-
-public:
- explicit InternetConnectionStatusIndicator(ApplicationContext &context, QGraphicsItem *parent = NULL);
-
- virtual ~InternetConnectionStatusIndicator();
-
-private slots:
- void updateStatus();
-
-private:
- ContextItem *connectionType;
- ContextItem *connectionState;
- ContextItem *packetData;
-};
/*!
* A status indicator for showing the used phone network name.
@@ -464,6 +463,31 @@
ContextItem *gpsState;
};
+/*!
+ * A status indicator for showing call forwarding is activated.
+ */
+class CallForwardingStatusIndicator : public StatusIndicator
+{
+ Q_OBJECT
+ M_CONTROLLER(CallForwardingStatusIndicator)
+
+public:
+ /*!
+ * Constructs a CallForwardingStatusIndicator.
+ *
+ * \param context the application context to get status information from
+ * \param parent parent MWidget
+ */
+ explicit CallForwardingStatusIndicator(ApplicationContext &context, QGraphicsItem *parent = NULL);
+
+ virtual ~CallForwardingStatusIndicator();
+
+private slots:
+ void callForwardingChanged();
+
+private:
+ ContextItem *callForwarding;
+};
/*!
* A status indicator for showing the status of transfer.
--- src/systemui/statusarea/statusindicatorlabelview.cpp
+++ src/systemui/statusarea/statusindicatorlabelview.cpp
@@ -60,7 +60,7 @@
} else if (strcmp(member, MWidgetModel::StyleName) == 0) {
if (controller->styleName().contains("Landscape")) {
label->setStyleName("StatusIndicatorLabelLandscape");
- } else {
+ } else if (controller->styleName().contains("Portrait")) {
label->setStyleName("StatusIndicatorLabelPortrait");
}
}
--- src/systemui/statusarea/statusindicatormodel.h
+++ src/systemui/statusarea/statusindicatormodel.h
@@ -97,6 +97,11 @@
M_MODEL(NotificationStatusIndicatorModel)
};
+class CallForwardingStatusIndicatorModel : public StatusIndicatorModel
+{
+ M_MODEL(CallForwardingStatusIndicatorModel)
+};
+
class TransferStatusIndicatorModel : public StatusIndicatorModel
{
M_MODEL(TransferStatusIndicatorModel)
--- src/systemui/statusindicatormenu/statusindicatormenuwindow.cpp
+++ src/systemui/statusindicatormenu/statusindicatormenuwindow.cpp
@@ -112,6 +112,12 @@
// Always raise the window. Even if it's visible (from Qt's point of view) it may not be the topmost window.
raise();
+
+ // If the menu is closed and opened quickly enough, we might never get the displayEnter signal because the display state
+ // exits with a delay, so displayActive is not called and we need to make the menu widget appear here
+ if(menuWidget->sceneWindowState() == MSceneWindow::Disappeared && isOnDisplay()) {
+ sceneManager()->appearSceneWindow(menuWidget);
+ }
}
#ifdef HAVE_QMSYSTEM
--- src/systemui/x11wrapper.cpp
+++ src/systemui/x11wrapper.cpp
@@ -128,3 +128,9 @@
{
return ::XGrabKeyboard(display, grab_window, owner_events, pointer_mode, keyboard_mode, time);
}
+
+int X11Wrapper::XGrabPointer(Display *display, Window grab_window, Bool owner_events, unsigned int event_mask,
+ int pointer_mode, int keyboard_mode, Window confine_to, Cursor cursor, Time time)
+{
+ return ::XGrabPointer(display, grab_window, owner_events, event_mask, pointer_mode, keyboard_mode, confine_to, cursor, time);
+}
--- src/systemui/x11wrapper.h
+++ src/systemui/x11wrapper.h
@@ -51,6 +51,8 @@
static int XUnmapWindow(Display *display, Window w);
static int XStoreName(Display *display, Window w, char *window_name);
static int XGrabKeyboard(Display *display, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode, Time time);
+ static int XGrabPointer(Display *display, Window grab_window, Bool owner_events, unsigned int event_mask,
+ int pointer_mode, int keyboard_mode, Window confine_to, Cursor cursor, Time time);
};
#endif /* X11WRAPPER_H_ */
--- tests/stubs/callforwardingstatusindicator_stub.h
+++ tests/stubs/callforwardingstatusindicator_stub.h
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui at nokia.com)
+**
+** This file is part of systemui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui at nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+#ifndef CALLFORWARDINGSTATUSINDICATOR_STUB
+#define CALLFORWARDINGSTATUSINDICATOR_STUB
+
+#include "statusindicator_stub.h"
+#include <stubbase.h>
+
+
+// 1. DECLARE STUB
+// FIXME - stubgen is not yet finished
+class CallForwardingStatusIndicatorStub : public StubBase
+{
+public:
+ virtual void CallForwardingStatusIndicatorConstructor(ApplicationContext &context, QGraphicsItem *parent);
+ virtual void CallForwardingStatusIndicatorDestructor();
+ virtual void callForwardingChanged();
+};
+
+// 2. IMPLEMENT STUB
+void CallForwardingStatusIndicatorStub::CallForwardingStatusIndicatorConstructor(ApplicationContext &context, QGraphicsItem *parent)
+{
+ Q_UNUSED(context);
+ Q_UNUSED(parent);
+}
+
+void CallForwardingStatusIndicatorStub::CallForwardingStatusIndicatorDestructor()
+{
+}
+
+void CallForwardingStatusIndicatorStub::callForwardingChanged()
+{
+ stubMethodEntered("callForwardingChanged");
+}
+
+// 3. CREATE A STUB INSTANCE
+CallForwardingStatusIndicatorStub gDefaultCallForwardingStatusIndicatorStub;
+CallForwardingStatusIndicatorStub *gCallForwardingStatusIndicatorStub = &gDefaultCallForwardingStatusIndicatorStub;
+
+// 4. CREATE A PROXY WHICH CALLS THE STUB
+CallForwardingStatusIndicator::CallForwardingStatusIndicator(ApplicationContext &context, QGraphicsItem *parent)
+{
+ gCallForwardingStatusIndicatorStub->CallForwardingStatusIndicatorConstructor(context, parent);
+}
+
+CallForwardingStatusIndicator::~CallForwardingStatusIndicator()
+{
+ gCallForwardingStatusIndicatorStub->CallForwardingStatusIndicatorDestructor();
+}
+
+void CallForwardingStatusIndicator::callForwardingChanged()
+{
+ gCallForwardingStatusIndicatorStub->callForwardingChanged();
+}
+
+#endif
--- tests/stubs/lockscreenwindow_stub.h
+++ tests/stubs/lockscreenwindow_stub.h
@@ -31,6 +31,7 @@
virtual void ScreenLockWindowDestructor();
virtual void applyStyle();
virtual void showEvent(QShowEvent *event);
+ virtual void setLowPowerMode(bool enable);
};
// 2. IMPLEMENT STUB
@@ -51,6 +52,13 @@
stubMethodEntered("showEvent", params);
}
+void ScreenLockWindowStub::setLowPowerMode(bool enable)
+{
+ QList<ParameterBase*> params;
+ params.append( new Parameter<bool>(enable));
+ stubMethodEntered("setLowPowerMode", params);
+}
+
// 3. CREATE A STUB INSTANCE
ScreenLockWindowStub gDefaultScreenLockWindowStub;
ScreenLockWindowStub* gScreenLockWindowStub = &gDefaultScreenLockWindowStub;
@@ -75,4 +83,13 @@
gScreenLockWindowStub->showEvent(event);
}
+void ScreenLockWindow::setLowPowerMode(bool enable)
+{
+ gScreenLockWindowStub->setLowPowerMode(enable);
+}
+
+void ScreenLockWindow::paintEvent(QPaintEvent *event)
+{
+}
+
#endif
--- tests/stubs/notificationareasink_stub.h
+++ tests/stubs/notificationareasink_stub.h
@@ -36,8 +36,8 @@
virtual void removeNotification(uint notificationId);
virtual void addNotification(MBanner ¬ification);
virtual void removeNotification(MBanner ¬ification);
- virtual void setupInfoBanner(MBanner *infoBanner);
- virtual MBanner *updateNotification(MBanner *dn, const NotificationParameters ¶meters);
+ virtual void setupInfoBanner(MBanner *infoBanner, const NotificationParameters ¶meters);
+ virtual void updateNotification(MBanner *dn, const NotificationParameters ¶meters);
virtual void removeGroupBanner(uint groupId);
virtual void applyPrivacySetting(bool privacyEnabled);
virtual void updateCurrentNotifications(NotificationManagerInterface ¬ificationManagerInterface);
@@ -95,20 +95,20 @@
stubMethodEntered("removeNotification", params);
}
-void NotificationAreaSinkStub::setupInfoBanner(MBanner *infoBanner)
+void NotificationAreaSinkStub::setupInfoBanner(MBanner *infoBanner, const NotificationParameters ¶meters)
{
QList<ParameterBase *> params;
params.append(new Parameter<MBanner * >(infoBanner));
+ params.append(new Parameter<const NotificationParameters & >(parameters));
stubMethodEntered("setupInfoBanner", params);
}
-MBanner *NotificationAreaSinkStub::updateNotification(MBanner *dn, const NotificationParameters ¶meters)
+void NotificationAreaSinkStub::updateNotification(MBanner *dn, const NotificationParameters ¶meters)
{
QList<ParameterBase *> params;
params.append(new Parameter<MBanner * >(dn));
params.append(new Parameter<const NotificationParameters & >(parameters));
stubMethodEntered("updateNotification", params);
- return stubReturnValue<MBanner *>("updateNotification");
}
void NotificationAreaSinkStub::removeGroupBanner(uint groupId)
@@ -169,14 +169,14 @@
gNotificationAreaSinkStub->removeNotification(notificationId);
}
-void NotificationAreaSink::setupInfoBanner(MBanner *infoBanner)
+void NotificationAreaSink::setupInfoBanner(MBanner *infoBanner, const NotificationParameters ¶meters)
{
- gNotificationAreaSinkStub->setupInfoBanner(infoBanner);
+ gNotificationAreaSinkStub->setupInfoBanner(infoBanner, parameters);
}
-MBanner *NotificationAreaSink::updateNotification(MBanner *dn, const NotificationParameters ¶meters)
+void NotificationAreaSink::updateNotification(MBanner *dn, const NotificationParameters ¶meters)
{
- return gNotificationAreaSinkStub->updateNotification(dn, parameters);
+ gNotificationAreaSinkStub->updateNotification(dn, parameters);
}
void NotificationAreaSink::removeGroupBanner(uint groupId)
--- tests/stubs/phonenetworksignalstrengthstatusindicator_stub.h
+++ tests/stubs/phonenetworksignalstrengthstatusindicator_stub.h
@@ -31,7 +31,7 @@
virtual void PhoneNetworkSignalStrengthStatusIndicatorConstructor(ApplicationContext &context, QGraphicsItem *parent);
virtual void PhoneNetworkSignalStrengthStatusIndicatorDestructor();
virtual void signalStrengthChanged();
- virtual void setDisplay(bool display);
+ virtual void setNetworkStatus();
};
// 2. IMPLEMENT STUB
@@ -49,15 +49,11 @@
{
stubMethodEntered("signalStrengthChanged");
}
-
-void PhoneNetworkSignalStrengthStatusIndicatorStub::setDisplay(bool display)
+void PhoneNetworkSignalStrengthStatusIndicatorStub::setNetworkStatus()
{
- QList<ParameterBase*> params;
- params.append(new Parameter<bool>(display));
- stubMethodEntered("setDisplay", params);
+ stubMethodEntered("setNetworkStatus");
}
-
// 3. CREATE A STUB INSTANCE
PhoneNetworkSignalStrengthStatusIndicatorStub gDefaultPhoneNetworkSignalStrengthStatusIndicatorStub;
PhoneNetworkSignalStrengthStatusIndicatorStub *gPhoneNetworkSignalStrengthStatusIndicatorStub = &gDefaultPhoneNetworkSignalStrengthStatusIndicatorStub;
@@ -79,9 +75,9 @@
gPhoneNetworkSignalStrengthStatusIndicatorStub->signalStrengthChanged();
}
-void PhoneNetworkSignalStrengthStatusIndicator::setDisplay(bool display)
+void PhoneNetworkSignalStrengthStatusIndicator::setNetworkStatus()
{
- gPhoneNetworkSignalStrengthStatusIndicatorStub->setDisplay(display);
+ gPhoneNetworkSignalStrengthStatusIndicatorStub->setNetworkStatus();
}
#endif
--- tests/stubs/phonenetworktypestatusindicator_stub.h
+++ tests/stubs/phonenetworktypestatusindicator_stub.h
@@ -30,6 +30,7 @@
public:
virtual void PhoneNetworkTypeStatusIndicatorConstructor(ApplicationContext &context, QGraphicsItem *parent);
virtual void PhoneNetworkTypeStatusIndicatorDestructor();
+ virtual void setNetworkAvailability(bool available);
virtual void setNetworkType();
};
@@ -44,13 +45,20 @@
{
}
+
+void PhoneNetworkTypeStatusIndicatorStub::setNetworkAvailability(bool available)
+{
+ QList<ParameterBase *> params;
+ params.append(new Parameter<QVariant >(available));
+ stubMethodEntered("setNetworkAvailability", params);
+}
+
void PhoneNetworkTypeStatusIndicatorStub::setNetworkType()
{
stubMethodEntered("setNetworkType");
}
-
// 3. CREATE A STUB INSTANCE
PhoneNetworkTypeStatusIndicatorStub gDefaultPhoneNetworkTypeStatusIndicatorStub;
PhoneNetworkTypeStatusIndicatorStub *gPhoneNetworkTypeStatusIndicatorStub = &gDefaultPhoneNetworkTypeStatusIndicatorStub;
@@ -67,10 +75,17 @@
gPhoneNetworkTypeStatusIndicatorStub->PhoneNetworkTypeStatusIndicatorDestructor();
}
+void PhoneNetworkTypeStatusIndicator::setNetworkAvailability(bool available)
+{
+ gPhoneNetworkTypeStatusIndicatorStub->setNetworkAvailability(available);
+}
+
+
void PhoneNetworkTypeStatusIndicator::setNetworkType()
{
gPhoneNetworkTypeStatusIndicatorStub->setNetworkType();
}
+
#endif
--- tests/stubs/x11wrapper_stub.h
+++ tests/stubs/x11wrapper_stub.h
@@ -48,6 +48,8 @@
virtual int XUnmapWindow(Display *display, Window w);
virtual int XStoreName(Display *display, Window w, char *window_name);
virtual int XGrabKeyboard(Display *display, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode, Time time);
+ virtual int XGrabPointer(Display *display, Window grab_window, Bool owner_events, unsigned int event_mask,
+ int pointer_mode, int keyboard_mode, Window confine_to, Cursor cursor, Time time);
};
// 2. IMPLEMENT STUB
@@ -274,6 +276,23 @@
return stubReturnValue<int>("XGrabKeyboard");
}
+int X11WrapperStub::XGrabPointer(Display *display, Window grab_window, Bool owner_events, unsigned int event_mask,
+ int pointer_mode, int keyboard_mode, Window confine_to, Cursor cursor, Time time)
+{
+ QList<ParameterBase *> params;
+ params.append(new Parameter<Display *>(display));
+ params.append(new Parameter<Window>(grab_window));
+ params.append(new Parameter<Bool>(owner_events));
+ params.append(new Parameter<int>(event_mask));
+ params.append(new Parameter<int>(pointer_mode));
+ params.append(new Parameter<int>(keyboard_mode));
+ params.append(new Parameter<Window>(confine_to));
+ params.append(new Parameter<Cursor>(cursor));
+ params.append(new Parameter<Time>(time));
+ stubMethodEntered("XGrabPointer", params);
+ return stubReturnValue<int>("XGrabPointer");
+}
+
// 3. CREATE A STUB INSTANCE
X11WrapperStub gDefaultX11WrapperStub;
X11WrapperStub *gX11WrapperStub = &gDefaultX11WrapperStub;
@@ -380,4 +399,10 @@
return gX11WrapperStub->XGrabKeyboard(display, grab_window, owner_events, pointer_mode, keyboard_mode, time);
}
+int X11Wrapper::XGrabPointer(Display *display, Window grab_window, Bool owner_events, unsigned int event_mask,
+ int pointer_mode, int keyboard_mode, Window confine_to, Cursor cursor, Time time)
+{
+ return gX11WrapperStub->XGrabPointer(display, grab_window, owner_events, event_mask,
+ pointer_mode, keyboard_mode, confine_to, cursor, time);
+}
#endif
--- tests/ut_clock/ut_clock.cpp
+++ tests/ut_clock/ut_clock.cpp
@@ -107,20 +107,17 @@
void Ut_Clock::testModelUpdates()
{
- MOnDisplayChangeEvent exitDisplayEvent(MOnDisplayChangeEvent::FullyOffDisplay, QRectF());
- MOnDisplayChangeEvent enterDisplayEvent(MOnDisplayChangeEvent::FullyOnDisplay, QRectF());
-
// The timer should be running by default and the model should contain the current time
QVERIFY(timerTimeout >= 0);
QCOMPARE(m_subject->model()->time(), expectedDateTime);
// When the application becomes invisible the timer should stop
- qApp->sendEvent(m_subject, &exitDisplayEvent);
+ m_subject->exitDisplayEvent();
QCOMPARE(timerTimeout, -1);
// When the application becomes visible the timer should start and the model should be updated to contain the current time
expectedDateTime = QDateTime(QDate(2001, 1, 1));
- qApp->sendEvent(m_subject, &enterDisplayEvent);
+ m_subject->enterDisplayEvent();
QVERIFY(timerTimeout >= 0);
QCOMPARE(m_subject->model()->time(), expectedDateTime);
}
--- tests/ut_eventeater/ut_eventeater.cpp
+++ tests/ut_eventeater/ut_eventeater.cpp
@@ -141,13 +141,23 @@
QCOMPARE(gX11WrapperStub->stubCallCount("XGrabKeyboard"), 1);
MethodCall &xgk = gX11WrapperStub->stubLastCallTo("XGrabKeyboard");
-
QCOMPARE(xgk.parameter<Window>(1), WINDOW_ID);
QCOMPARE(xgk.parameter<Bool>(2), False);
QCOMPARE(xgk.parameter<int>(3), (int)GrabModeAsync);
QCOMPARE(xgk.parameter<int>(4), (int)GrabModeAsync);
QCOMPARE(xgk.parameter<Time>(5), (Time)CurrentTime);
+ QCOMPARE(gX11WrapperStub->stubCallCount("XGrabPointer"), 1);
+ MethodCall &xgp = gX11WrapperStub->stubLastCallTo("XGrabPointer");
+ QCOMPARE(xgp.parameter<Window>(1), WINDOW_ID);
+ QCOMPARE(xgp.parameter<Bool>(2), False);
+ QCOMPARE(xgp.parameter<int>(3), (int)ButtonPressMask);
+ QCOMPARE(xgp.parameter<int>(4), (int)GrabModeAsync);
+ QCOMPARE(xgp.parameter<int>(5), (int)GrabModeAsync);
+ QCOMPARE(xgp.parameter<Window>(6), (Window)None);
+ QCOMPARE(xgp.parameter<Cursor>(7), (Cursor)None);
+ QCOMPARE(xgp.parameter<Time>(8), (Time)CurrentTime);
+
int xmr_i = 0, xgk_i = 0;
QList<MethodCall*> x11Calls = gX11WrapperStub->stubCallHistory();
--- tests/ut_lockscreenbusinesslogic
+++ tests/ut_lockscreenbusinesslogic
-(directory)
--- tests/ut_lockscreenbusinesslogic/ut_lockscreenbusinesslogic.cpp
+++ tests/ut_lockscreenbusinesslogic/ut_lockscreenbusinesslogic.cpp
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui at nokia.com)
-**
-** This file is part of systemui.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui at nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <QDBusAbstractInterface>
-
-#define TEST_SERVICE QString("com.nokia.mcetest")
-#define TEST_PATH QString("/com/nokia/mcetest")
-#define TEST_INTERFACE QString("com.nokia.mcetest")
-#define TEST_METHOD QString("testmethod")
-
-#include "ut_lockscreenbusinesslogic.h"
-#include "screenlockbusinesslogic.h"
-#include "lockscreenwindow_stub.h"
-#include "eventeater_stub.h"
-#include "sysuid_stub.h"
-#include "eventeater_stub.h"
-#include "closeeventeater_stub.h"
-#include "notifiernotificationsink_stub.h"
-#include "notificationsink_stub.h"
-#include <MApplication>
-#include <MApplicationWindow>
-#include <MApplicationExtensionArea>
-
-#ifdef HAVE_QMSYSTEM
-#include <qmdisplaystate.h>
-MeeGo::QmDisplayState::DisplayState qmDisplayState;
-MeeGo::QmDisplayState::DisplayState MeeGo::QmDisplayState::get() const
-{
- return qmDisplayState;
-}
-#endif
-
-QMap<QWidget *, bool> gQWidgetVisible;
-void QWidget::setVisible(bool visible)
-{
- gQWidgetVisible[this] = visible;
- setAttribute(Qt::WA_WState_Visible, visible);
-}
-
-bool gQWidgetRaiseCalled = false;
-void QWidget::raise()
-{
- gQWidgetRaiseCalled = true;
-}
-
-bool MApplicationExtensionArea::init()
-{
- return true;
-}
-
-ScreenLockExtension::ScreenLockExtension() : widget_(NULL)
-{
-}
-ScreenLockExtension::~ScreenLockExtension()
-{
-}
-bool screenLockExtensionReset = false;
-void ScreenLockExtension::reset()
-{
- screenLockExtensionReset = true;
-}
-void ScreenLockExtension::setNotificationManagerInterface(NotificationManagerInterface &)
-{
-}
-bool ScreenLockExtension::initialize(const QString &)
-{
- widget_ = new LockScreen;
- return true;
-}
-QGraphicsWidget *ScreenLockExtension::widget()
-{
- return widget_;
-}
-QObject *ScreenLockExtension::qObject()
-{
- return this;
-}
-bool screenLockExtensionModeSet = false;
-ScreenLockExtensionInterface::ScreenLockMode screenLockExtensionMode;
-void ScreenLockExtension::setMode(ScreenLockExtensionInterface::ScreenLockMode mode)
-{
- screenLockExtensionModeSet = true;
- screenLockExtensionMode = mode;
-}
-
-QDBus::CallMode qDbusAbstractInterfaceCallMode;
-QVariant qDbusAbstractInterfaceCallArg1;
-QString qDbusAbstractInterfaceCallMethod;
-QString qDbusAbstractInterfaceCallPath;
-QString qDbusAbstractInterfaceCallService;
-QString qDbusAbstractInterfaceCallInterface;
-QDBusMessage QDBusAbstractInterface::call(QDBus::CallMode mode, const QString & method, const QVariant & arg1, const QVariant & arg2, const QVariant & arg3, const QVariant & arg4, const QVariant & arg5, const QVariant & arg6, const QVariant & arg7, const QVariant & arg8)
-{
- Q_UNUSED(arg2);
- Q_UNUSED(arg3);
- Q_UNUSED(arg4);
- Q_UNUSED(arg5);
- Q_UNUSED(arg6);
- Q_UNUSED(arg7);
- Q_UNUSED(arg8);
-
- qDbusAbstractInterfaceCallMode = mode;
- qDbusAbstractInterfaceCallArg1 = arg1;
- qDbusAbstractInterfaceCallMethod = method;
- qDbusAbstractInterfaceCallPath = path();
- qDbusAbstractInterfaceCallService = service();
- qDbusAbstractInterfaceCallInterface = interface();
-
- return QDBusMessage();
-}
-
-void QTimer::singleShot(int, QObject *receiver, const char *member)
-{
- // The "member" string is of form "1member()", so remove the trailing 1 and the ()
- int memberLength = strlen(member) - 3;
- char modifiedMember[memberLength + 1];
- strncpy(modifiedMember, member + 1, memberLength);
- modifiedMember[memberLength] = 0;
- QMetaObject::invokeMethod(receiver, modifiedMember, Qt::DirectConnection);
-}
-
-void Ut_LockScreenBusinessLogic::init()
-{
- m_subject = new ScreenLockBusinessLogic;
-}
-
-void Ut_LockScreenBusinessLogic::cleanup()
-{
- delete m_subject;
- gQWidgetRaiseCalled = false;
- gQWidgetVisible.clear();
- screenLockExtensionReset = false;
- screenLockExtensionModeSet = false;
- gScreenLockWindowStub->stubReset();
- gEventEaterStub->stubReset();
-#ifdef HAVE_QMSYSTEM
- qmDisplayState = MeeGo::QmDisplayState::On;
-#endif
-}
-
-void Ut_LockScreenBusinessLogic::initTestCase()
-{
- static int argc = 1;
- static char *argv = (char *) "./ut_lockscreenbusinesslogic";
- m_App = new MApplication(argc, &argv);
- /* XXX: input context caused a crash :-S */
- m_App->setLoadMInputContext (false);
- m_App->setQuitOnLastWindowClosed (false);
- notifierSink = new NotifierNotificationSink;
- gSysuidStub->stubSetReturnValue("notifierNotificationSink", notifierSink);
-}
-
-void Ut_LockScreenBusinessLogic::cleanupTestCase()
-{
- m_App->deleteLater ();
- delete notifierSink;
-}
-
-void Ut_LockScreenBusinessLogic::testToggleScreenLockUI()
-{
- QSignalSpy spy(m_subject, SIGNAL(screenIsLocked(bool)));
-
- ScreenLockExtension screenLockExtension;
- screenLockExtension.initialize("");
- m_subject->registerExtension(&screenLockExtension);
-
-#ifdef HAVE_QMSYSTEM
- // First try with display off
- qmDisplayState = MeeGo::QmDisplayState::Off;
- m_subject->locksChanged (MeeGo::QmLocks::TouchAndKeyboard, MeeGo::QmLocks::Locked);
-#endif
-
- // When the lock is toggled on, make sure the screen locking signals are sent and the lock UI is shown
- m_subject->toggleScreenLockUI(true);
-#ifdef HAVE_QMSYSTEM
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.at(0).at(0).toBool(), true);
-#else
- spy.clear ();
-#endif
-
- // The lock screen should now be visible
- QCOMPARE(gQWidgetVisible[m_subject->screenLockWindow], true);
-
- // Raising should happen
- QCOMPARE(gQWidgetRaiseCalled, true);
-
- // The lock screen needs to be reset
- QCOMPARE(screenLockExtensionReset, true);
- screenLockExtensionReset = false;
-
- // Reset the stubs
- gQWidgetVisible[m_subject->screenLockWindow] = false;
- gQWidgetRaiseCalled = false;
-
- // Lock the screen again
- m_subject->toggleScreenLockUI(true);
-
- // show() should not be called
- QCOMPARE(gQWidgetVisible[m_subject->screenLockWindow], false);
-
- // Raising should happen
- QCOMPARE(gQWidgetRaiseCalled, true);
-
- // The lock screen still needs to be reset
- QCOMPARE(screenLockExtensionReset, true);
-
- // When the lock is toggled off, make sure the screen locking signals are sent and the lock UI is hidden
- m_subject->toggleScreenLockUI(false);
- QCOMPARE(m_subject->screenLockWindow->isVisible(), false);
-}
-
-void Ut_LockScreenBusinessLogic::testToggleEventEater()
-{
- // Make sure the screen locking signals are sent and the eater UI is shown/hidden
- m_subject->toggleEventEater(true);
- QCOMPARE(gEventEaterStub->stubCallCount("show"), 1);
-
- m_subject->toggleEventEater(false);
- QCOMPARE(gEventEaterStub->stubCallCount("hide"), 1);
-}
-
-void Ut_LockScreenBusinessLogic::testUnlockScreen()
-{
- QSignalSpy spy(m_subject, SIGNAL(screenIsLocked(bool)));
-
- m_subject->tklock_open(TEST_SERVICE, TEST_PATH, TEST_INTERFACE, TEST_METHOD, ScreenLockBusinessLogic::TkLockModeNone, false, false);
- m_subject->unlockScreen();
-
-#ifdef HAVE_QMSYSTEM
- m_subject->locksChanged (MeeGo::QmLocks::TouchAndKeyboard, MeeGo::QmLocks::Unlocked);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.at(0).at(0).toBool(), false);
-#endif
-
- QCOMPARE(m_subject->screenLockWindow, (ScreenLockWindow *)NULL);
- QCOMPARE(qDbusAbstractInterfaceCallMethod, TEST_METHOD);
- QCOMPARE(qDbusAbstractInterfaceCallPath, TEST_PATH);
- QCOMPARE(qDbusAbstractInterfaceCallService, TEST_SERVICE);
- QCOMPARE(qDbusAbstractInterfaceCallInterface, TEST_INTERFACE);
- QCOMPARE(qDbusAbstractInterfaceCallMode, QDBus::NoBlock);
- QCOMPARE(qDbusAbstractInterfaceCallArg1.toInt(), (int)ScreenLockBusinessLogic::TkLockUnlock);
-}
-
-void Ut_LockScreenBusinessLogic::testHideEventEater()
-{
- m_subject->showEventEater();
- m_subject->hideEventEater();
- QCOMPARE(gEventEaterStub->stubCallCount("hide"), 1);
-}
-
-#ifdef HAVE_QMSYSTEM
-void Ut_LockScreenBusinessLogic::testDisplayStateChanged()
-{
- ScreenLockExtension screenLockExtension;
- screenLockExtension.initialize("");
- m_subject->registerExtension(&screenLockExtension);
-
- m_subject->toggleScreenLockUI(true);
-
- // When lock-screen-ui is shown reset should be called on it
- QCOMPARE(screenLockExtensionReset, true);
- screenLockExtensionReset = false;
-
- m_subject->displayStateChanged(MeeGo::QmDisplayState::Off);
- m_subject->displayStateChanged(MeeGo::QmDisplayState::On);
-
- // Also check whether the reset called on the
- // lock-screen-ui (after display turn on)
- QCOMPARE(screenLockExtensionReset, true);
-}
-#endif
-
-
-void Ut_LockScreenBusinessLogic::testReset()
-{
- ScreenLockExtension screenLockExtension;
- screenLockExtension.initialize("");
- m_subject->registerExtension(&screenLockExtension);
- m_subject->reset();
- QVERIFY(screenLockExtensionReset);
-}
-
-void Ut_LockScreenBusinessLogic::testWhenExtensionIsRegisteredSignalsAreConnected()
-{
- ScreenLockExtension screenLockExtension;
- screenLockExtension.initialize("");
- m_subject->registerExtension(&screenLockExtension);
-
- QVERIFY(disconnect(screenLockExtension.qObject(), SIGNAL(unlocked()), m_subject, SLOT(unlockScreen())));
- QVERIFY(disconnect(&Sysuid::instance()->notifierNotificationSink(), SIGNAL(notifierSinkActive(bool)), screenLockExtension.qObject(), SIGNAL(notifierSinkActive(bool))));
-}
-
-void Ut_LockScreenBusinessLogic::testRegisteringAndUnregisteringExtension()
-{
- ScreenLockExtension screenLockExtension;
- screenLockExtension.initialize("");
- m_subject->registerExtension(&screenLockExtension);
- QCOMPARE(m_subject->screenLockExtensions.count(), 1);
-
- m_subject->unregisterExtension(&screenLockExtension);
- QCOMPARE(m_subject->screenLockExtensions.count(), 0);
-}
-
-void Ut_LockScreenBusinessLogic::testTkLockOpen_data()
-{
- QTest::addColumn<int>("mode");
- QTest::addColumn<bool>("screenLockWindowVisibilityModified");
- QTest::addColumn<bool>("screenLockWindowVisible");
- QTest::addColumn<bool>("eventEaterWindowVisibilityModified");
- QTest::addColumn<bool>("eventEaterWindowVisible");
- QTest::addColumn<bool>("screenLockModeSet");
- QTest::addColumn<int>("screenLockMode");
-
- QTest::newRow("TkLockModeNone") << (int)ScreenLockBusinessLogic::TkLockModeNone << false << false << false << false << false << 0;
- QTest::newRow("TkLockModeEnable") << (int)ScreenLockBusinessLogic::TkLockModeEnable << true << true << true << false << true << (int)ScreenLockExtensionInterface::NormalMode;
- QTest::newRow("TkLockModeHelp") << (int)ScreenLockBusinessLogic::TkLockModeHelp << false << false << false << false << false << 0;
- QTest::newRow("TkLockModeSelect") << (int)ScreenLockBusinessLogic::TkLockModeSelect << false << false << false << false << false << 0;
- QTest::newRow("TkLockModeOneInput") << (int)ScreenLockBusinessLogic::TkLockModeOneInput << false << false << true << true << false << 0;
- QTest::newRow("TkLockEnableVisual") << (int)ScreenLockBusinessLogic::TkLockEnableVisual << true << true << true << false << true << (int)ScreenLockExtensionInterface::NormalMode;
- QTest::newRow("TkLockEnableLowPowerMode") << (int)ScreenLockBusinessLogic::TkLockEnableLowPowerMode << true << true << true << false << true << (int)ScreenLockExtensionInterface::LowPowerMode;
-}
-
-void Ut_LockScreenBusinessLogic::testTkLockOpen()
-{
- QFETCH(int, mode);
- QFETCH(bool, screenLockWindowVisibilityModified);
- QFETCH(bool, screenLockWindowVisible);
- QFETCH(bool, eventEaterWindowVisibilityModified);
- QFETCH(bool, eventEaterWindowVisible);
- QFETCH(bool, screenLockModeSet);
- QFETCH(int, screenLockMode);
-
- ScreenLockExtension screenLockExtension;
- screenLockExtension.initialize("");
- m_subject->registerExtension(&screenLockExtension);
-
- // Make sure the event eater is visible so that it will be hidden if necessary
- m_subject->showEventEater();
- gEventEaterStub->stubReset();
-
- // Modify the state
- int reply = m_subject->tklock_open(TEST_SERVICE, TEST_PATH, TEST_INTERFACE, TEST_METHOD, mode, false, false);
- QCOMPARE(reply, (int)ScreenLockBusinessLogic::TkLockReplyOk);
-
- // Check that screen lock window visibility was only changed if needed (and to the correct state)
- QCOMPARE(gQWidgetVisible.contains(m_subject->screenLockWindow), screenLockWindowVisibilityModified);
- if (screenLockWindowVisibilityModified) {
- QCOMPARE(gQWidgetVisible[m_subject->screenLockWindow], screenLockWindowVisible);
- }
-
- // Check that event eater window visibility was only changed if needed (and to the correct state)
- if (eventEaterWindowVisibilityModified) {
- QCOMPARE(gEventEaterStub->stubCallCount(eventEaterWindowVisible ? "show" : "hide"), 1);
- } else {
- QCOMPARE(gEventEaterStub->stubCallCount("show"), 0);
- QCOMPARE(gEventEaterStub->stubCallCount("hide"), 0);
- }
-
- QCOMPARE(screenLockExtensionModeSet, screenLockModeSet);
- if (screenLockModeSet) {
- QCOMPARE((int)screenLockExtensionMode, screenLockMode);
- }
-}
-
-void Ut_LockScreenBusinessLogic::testTkLockClose()
-{
- // Show the screen lock window and the event eater
- m_subject->showScreenLock();
- m_subject->showEventEater();
-
- // Modify the state
- int reply = m_subject->tklock_close(false);
- QCOMPARE(reply, (int)ScreenLockBusinessLogic::TkLockReplyOk);
-
- // Both windows should be hidden
- QCOMPARE(gQWidgetVisible.contains(m_subject->screenLockWindow), true);
- QCOMPARE(gEventEaterStub->stubCallCount("hide"), 1);
- QCOMPARE(gQWidgetVisible[m_subject->screenLockWindow], false);
-}
-
-QTEST_APPLESS_MAIN(Ut_LockScreenBusinessLogic)
--- tests/ut_lockscreenbusinesslogic/ut_lockscreenbusinesslogic.h
+++ tests/ut_lockscreenbusinesslogic/ut_lockscreenbusinesslogic.h
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (directui at nokia.com)
-**
-** This file is part of systemui.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui at nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-#ifndef UT_LOCKSCREENBUSINESSLOGIC_H
-#define UT_LOCKSCREENBUSINESSLOGIC_H
-
-#include <QGraphicsWidget>
-#include "screenlockextensioninterface.h"
-
-class MApplication;
-class NotifierNotificationSink;
-class ScreenLockBusinessLogic;
-
-class LockScreen : public QGraphicsWidget
-{
- Q_OBJECT
-
-signals:
- void unlocked();
-};
-
-class ScreenLockExtension : public QObject, public ScreenLockExtensionInterface
-{
- Q_OBJECT
- Q_INTERFACES(ScreenLockExtensionInterface MApplicationExtensionInterface)
-
-public:
- ScreenLockExtension();
- virtual ~ScreenLockExtension();
-
- //! Methods derived from ScreenLockExtensionInterface
- virtual void reset();
- virtual void setNotificationManagerInterface(NotificationManagerInterface ¬ificationManager);
- virtual QObject *qObject();
- virtual void setMode(ScreenLockExtensionInterface::ScreenLockMode mode);
-
- //! Methods derived from MApplicationExtensionInterface
- virtual bool initialize(const QString &interface);
- virtual QGraphicsWidget *widget();
-
-signals:
- void unlocked();
- void notifierSinkActive(bool active);
-
-private:
- QGraphicsWidget *widget_;
-};
-
-class Ut_LockScreenBusinessLogic : public QObject
-{
- Q_OBJECT
-
-private slots:
- void init();
- void cleanup();
- void initTestCase();
- void cleanupTestCase();
-
- void testToggleScreenLockUI();
- void testToggleEventEater();
- void testUnlockScreen();
- void testHideEventEater();
-#ifdef HAVE_QMSYSTEM
- void testDisplayStateChanged();
-#endif
- void testWhenExtensionIsRegisteredSignalsAreConnected();
- void testReset();
- void testRegisteringAndUnregisteringExtension();
- void testTkLockOpen_data();
- void testTkLockOpen();
- void testTkLockClose();
-
-private:
- MApplication *m_App;
- NotifierNotificationSink *notifierSink;
- ScreenLockBusinessLogic *m_subject;
-};
-
-#endif
-
--- tests/ut_lockscreenbusinesslogic/ut_lockscreenbusinesslogic.pro
+++ tests/ut_lockscreenbusinesslogic/ut_lockscreenbusinesslogic.pro
-include(../coverage.pri)
-include(../common_top.pri)
-TARGET = ut_lockscreenbusinesslogic
-INCLUDEPATH += $$LIBNOTIFICATIONSRCDIR $$SRCDIR/screenlock $$SRCDIR/notifications
-
-SOURCES += ut_lockscreenbusinesslogic.cpp \
- $$SRCDIR/screenlock/screenlockbusinesslogic.cpp \
- $$STUBSDIR/stubbase.cpp
-
-HEADERS += ut_lockscreenbusinesslogic.h \
- $$SRCDIR/screenlock/screenlockbusinesslogic.h \
- $$SRCDIR/sysuid.h \
- $$SRCDIR/screenlock/screenlockwindow.h \
- $$SRCDIR/screenlock/eventeater.h \
- $$SRCDIR/closeeventeater.h \
- $$SRCDIR/notifications/notifiernotificationsink.h \
- $$LIBNOTIFICATIONSRCDIR/notificationsink.h
-
-include(../common_bot.pri)
-
--- tests/ut_lockscreenstatusareaview/ut_lockscreenstatusareaview.cpp
+++ tests/ut_lockscreenstatusareaview/ut_lockscreenstatusareaview.cpp
@@ -32,7 +32,6 @@
#include "batterystatusindicator_stub.h"
#include "phonenetworksignalstrengthstatusindicator_stub.h"
#include "phonenetworktypestatusindicator_stub.h"
-#include "internetconnectionstatusindicator_stub.h"
#include "bluetoothstatusindicator_stub.h"
#include "gpsstatusindicator_stub.h"
#include "presencestatusindicator_stub.h"
@@ -41,6 +40,7 @@
#include "inputmethodstatusindicator_stub.h"
#include "callstatusindicator_stub.h"
#include "profilestatusindicator_stub.h"
+#include "callforwardingstatusindicator_stub.h"
#include "notificationstatusindicator_stub.h"
#include "transferstatusindicator_stub.h"
#include "screenlockextension_stub.h"
--- tests/ut_lockscreenwindow
+++ tests/ut_lockscreenwindow
-(directory)
--- tests/ut_lockscreenwindow/ut_lockscreenwindow.cpp
+++ tests/ut_lockscreenwindow/ut_lockscreenwindow.cpp
-/****************************************************************************
-**
-** Copyright(C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation(directui at nokia.com)
-**
-** This file is part of systemui.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui at nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-
-#include <QtTest/QtTest>
-#include <MApplication>
-#include <MSceneWindow>
-#include <MApplicationExtensionArea>
-#include <QShowEvent>
-#include "ut_lockscreenwindow.h"
-#include "screenlockwindow.h"
-#include "screenlockwindowstyle.h"
-#include "notifiernotificationsink_stub.h"
-#include "notificationsink_stub.h"
-#include "sysuid_stub.h"
-#include <X11/Xutil.h>
-#include "x11wrapper_stub.h"
-
-// X stubs to avoid crashes
-void XSetWMProperties(Display *, Window, XTextProperty *, XTextProperty *, char **, int, XSizeHints *, XWMHints *, XClassHint *)
-{
-}
-
-bool mWindowOrientationLocked = false;
-void MWindow::setOrientationLocked(bool locked)
-{
- mWindowOrientationLocked = locked;
-}
-
-QString mWindowOrientation;
-void MWindow::setLandscapeOrientation()
-{
- mWindowOrientation = "landscape";
-}
-
-void MWindow::setPortraitOrientation()
-{
- mWindowOrientation = "portrait";
-}
-
-MWindow* appearedWindow = NULL;
-void MSceneWindow::appear(MWindow* window, MSceneWindow::DeletionPolicy policy)
-{
- appearedWindow = window;
- Q_UNUSED(policy);
-}
-
-
-void Ut_LockScreenWindow::initTestCase()
-{
- int argc = 1;
- char *argv[] = {(char *) "./ut_lockscreenwindow", NULL };
- app = new MApplication(argc, argv);
-}
-
-void Ut_LockScreenWindow::cleanupTestCase()
-{
- delete app;
-}
-
-void Ut_LockScreenWindow::init()
-{
- lockScreenWindow = new ScreenLockWindow(new MApplicationExtensionArea(""));
-}
-
-void Ut_LockScreenWindow::cleanup()
-{
- delete lockScreenWindow;
- lockScreenWindow = NULL;
- appearedWindow = NULL;
- mWindowOrientationLocked = false;
- mWindowOrientation.clear();
- gX11WrapperStub->stubReset();
-}
-
-void Ut_LockScreenWindow::testWhenWindowIsCreatedLockScreenAppears()
-{
- QCOMPARE(appearedWindow, lockScreenWindow);
-}
-
-void Ut_LockScreenWindow::testWhenWindowIsShownItIsExcludedFromTaskbar()
-{
- // The stub needs to be reset so that things done at construction time won't affect the test
- gX11WrapperStub->stubReset();
-
- Display *display = QX11Info::display();
-
- QShowEvent *showEvent = new QShowEvent;
- lockScreenWindow->showEvent(showEvent);
-
- QCOMPARE(gX11WrapperStub->stubCallCount("XSendEvent"), 1);
- QCOMPARE(gX11WrapperStub->stubLastCallTo("XSendEvent").parameter<Display *>(0), display);
- QCOMPARE(gX11WrapperStub->stubLastCallTo("XSendEvent").parameter<Window>(1), RootWindow(display, lockScreenWindow->x11Info().screen()));
- QCOMPARE(gX11WrapperStub->stubLastCallTo("XSendEvent").parameter<Bool>(2), (Bool)False);
- QCOMPARE(gX11WrapperStub->stubLastCallTo("XSendEvent").parameter<long>(3), (long)(SubstructureNotifyMask | SubstructureRedirectMask));
- XEvent event = gX11WrapperStub->stubLastCallTo("XSendEvent").parameter<XEvent>(4);
- QCOMPARE(event.xclient.type, ClientMessage);
- QCOMPARE(event.xclient.display, display);
- QCOMPARE(event.xclient.window, lockScreenWindow->internalWinId());
- QCOMPARE(event.xclient.message_type, X11Wrapper::XInternAtom(display, "_NET_WM_STATE", False));
- QCOMPARE(event.xclient.format, 32);
- QCOMPARE(event.xclient.data.l[0], (long)1);
- QCOMPARE(event.xclient.data.l[1], (long)X11Wrapper::XInternAtom(display, "_NET_WM_STATE_SKIP_TASKBAR", False));
- delete showEvent;
-}
-
-void Ut_LockScreenWindow::testOrientationLocking_data()
-{
- QTest::addColumn<QString>("lockedOrientation");
- QTest::addColumn<bool>("orientationLocked");
- QTest::addColumn<QString>("expectedOrientation");
-
- QTest::newRow("No locking") << QString() << false << QString();
- QTest::newRow("Locked to landscape") << QString("landscape") << true << QString("landscape");
- QTest::newRow("Locked to portrait") << QString("portrait") << true << QString("portrait");
- QTest::newRow("Locked to something else") << QString("unknown") << false << QString();
-}
-
-void Ut_LockScreenWindow::testOrientationLocking()
-{
- QFETCH(QString, lockedOrientation);
- QFETCH(bool, orientationLocked);
- QFETCH(QString, expectedOrientation);
-
- // Reset the stubs
- mWindowOrientationLocked = false;
- mWindowOrientation = QString();
-
- // Set the style
- ScreenLockWindowStyle *style = const_cast<ScreenLockWindowStyle *>(static_cast<const ScreenLockWindowStyle *>(MTheme::style("ScreenLockWindowStyle", "", "", "", M::Landscape, NULL)));
- style->setLockedOrientation(lockedOrientation);
-
- // Create a new window
- delete lockScreenWindow;
- lockScreenWindow = new ScreenLockWindow(new MApplicationExtensionArea(""));
- QCOMPARE(mWindowOrientationLocked, orientationLocked);
- QCOMPARE(mWindowOrientation, expectedOrientation);
-}
-
-void Ut_LockScreenWindow::testTranslucency_data()
-{
- QTest::addColumn<bool>("translucent");
-
- QTest::newRow("Translucent") << true;
- QTest::newRow("Not translucent") << false;
-}
-
-void Ut_LockScreenWindow::testTranslucency()
-{
- QFETCH(bool, translucent);
-
- // Set the style
- ScreenLockWindowStyle *style = const_cast<ScreenLockWindowStyle *>(static_cast<const ScreenLockWindowStyle *>(MTheme::style("ScreenLockWindowStyle", "", "", "", M::Landscape, NULL)));
- style->setTranslucent(translucent);
-
- // Create a new window
- delete lockScreenWindow;
- lockScreenWindow = new ScreenLockWindow(new MApplicationExtensionArea(""));
- QCOMPARE(lockScreenWindow->testAttribute(Qt::WA_TranslucentBackground), translucent);
-}
-
-QTEST_APPLESS_MAIN(Ut_LockScreenWindow)
--- tests/ut_lockscreenwindow/ut_lockscreenwindow.h
+++ tests/ut_lockscreenwindow/ut_lockscreenwindow.h
-/****************************************************************************
-**
-** Copyright(C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation(directui at nokia.com)
-**
-** This file is part of systemui.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at directui at nokia.com.
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging
-** of this file.
-**
-****************************************************************************/
-#ifndef UT_LOCKSCREENWINDOW_H
-#define UT_LOCKSCREENWINDOW_H
-
-#include <QObject>
-
-class MApplication;
-class ScreenLockWindow;
-
-class Ut_LockScreenWindow : public QObject
-{
- Q_OBJECT
-
-private slots:
- void init();
- void cleanup();
- void initTestCase();
- void cleanupTestCase();
-
- void testWhenWindowIsCreatedLockScreenAppears();
- void testWhenWindowIsShownItIsExcludedFromTaskbar();
- void testOrientationLocking_data();
- void testOrientationLocking();
- void testTranslucency_data();
- void testTranslucency();
-
-private:
- MApplication *app;
- ScreenLockWindow *lockScreenWindow;
-};
-
-#endif
--- tests/ut_lockscreenwindow/ut_lockscreenwindow.pro
+++ tests/ut_lockscreenwindow/ut_lockscreenwindow.pro
-include(../coverage.pri)
-include(../common_top.pri)
-TARGET = ut_lockscreenwindow
-
-INCLUDEPATH += $$LIBNOTIFICATIONSRCDIR $$SRCDIR/screenlock $$SRCDIR/notifications
-
-STYLE_HEADERS += $$SRCDIR/screenlock/screenlockwindowstyle.h
-
-SOURCES += ut_lockscreenwindow.cpp \
- $$SRCDIR/screenlock/screenlockwindow.cpp \
- $$STUBSDIR/stubbase.cpp \
-
-HEADERS += ut_lockscreenwindow.h \
- $$SRCDIR/screenlock/screenlockwindow.h \
- $$SRCDIR/screenlock/screenlockwindowstyle.h \
- $$SRCDIR/sysuid.h \
- $$SRCDIR/notifications/notifiernotificationsink.h \
- $$LIBNOTIFICATIONSRCDIR/notificationsink.h \
- $$SRCDIR/x11wrapper.h
-
-include(../common_bot.pri)
-
--- tests/ut_notificationareasink/ut_notificationareasink.cpp
+++ tests/ut_notificationareasink/ut_notificationareasink.cpp
@@ -383,7 +383,7 @@
QCOMPARE(bannerCatcher.banners.count(), 1);
MBanner *banner = bannerCatcher.banners.at(0);
// The banner should have the notification group's data
- QCOMPARE(banner->title(), GROUP_SUMMARY);
+ QCOMPARE(banner->title(), GROUP_BODY);
}
void Ut_NotificationAreaSink::testUpdateGroup()
@@ -393,10 +393,11 @@
TestNotificationParameters parameters1("title1", "subtitle1", "buttonicon1", "content1", 123456);
emit addNotification(Notification(0, 1, 2, parameters1, Notification::ApplicationEvent, 1000));
- QCOMPARE(titles.length(), 1);
- QCOMPARE(titles[0], QString("title0"));
- QCOMPARE(subtitles.length(), 1);
- QCOMPARE(subtitles[0], QString("subtitle0"));
+ // The titles and subtitles get set twice and the second one is the relevant one
+ QCOMPARE(titles.length(), 2);
+ QCOMPARE(titles[1], QString("subtitle0"));
+ QCOMPARE(subtitles.length(), 2);
+ QCOMPARE(subtitles[1], QString("title0"));
QCOMPARE(buttonIcons.length(), 1);
QCOMPARE(buttonIcons[0], QString("buttonicon0"));
QCOMPARE(timestamps[0].toTime_t(), (uint)12345);
@@ -405,10 +406,11 @@
emit addGroup(1, parameters1);
- QCOMPARE(titles.length(), 1);
- QCOMPARE(titles[0], QString("title1"));
- QCOMPARE(subtitles.length(), 1);
- QCOMPARE(subtitles[0], QString("subtitle1"));
+ // The stub is now aware of the banner so updates go to the first occurrence of the banner
+ QCOMPARE(titles.length(), 2);
+ QCOMPARE(titles[0], QString("subtitle1"));
+ QCOMPARE(subtitles.length(), 2);
+ QCOMPARE(subtitles[0], QString("title1"));
QCOMPARE(buttonIcons.length(), 1);
QCOMPARE(buttonIcons[0], QString("buttonicon1"));
QCOMPARE(timestamps[0].toTime_t(), (uint)123456);
@@ -426,9 +428,9 @@
QTest::addColumn<QString>("subtitle");
QTest::newRow("Privacy enabled and honored") << true << true << "test0" << QString();
- QTest::newRow("Privacy disabled and honored") << true << false << "title0" << "subtitle0";
- QTest::newRow("Privacy enabled but not honored") << false << true << "title0" << "subtitle0";
- QTest::newRow("Privacy disabled and not honored") << false << false << "title0" << "subtitle0";
+ QTest::newRow("Privacy disabled and honored") << true << false << "subtitle0" << "title0";
+ QTest::newRow("Privacy enabled but not honored") << false << true << "subtitle0" << "title0";
+ QTest::newRow("Privacy disabled and not honored") << false << false << "subtitle0" << "title0";
}
void Ut_NotificationAreaSink::testApplyPrivacySetting()
@@ -452,18 +454,18 @@
emit privacySettingChanged(privacyEnabled);
// The titles should be as expected
- QCOMPARE(titles.length(), 1);
- QCOMPARE(titles[0], title);
- QCOMPARE(subtitles.length(), 1);
- QCOMPARE(subtitles[0], subtitle);
+ QCOMPARE(titles.length(), 2);
+ QCOMPARE(titles[1], title);
+ QCOMPARE(subtitles.length(), 2);
+ QCOMPARE(subtitles[1], subtitle);
// Update the notification
emit addNotification(Notification(0, 0, 2, parameters0, Notification::ApplicationEvent, 1000));
- // The titles should still be as expected
- QCOMPARE(titles.length(), 1);
+ // The titles should still be as expected. The stub is now aware of the banner so updates go to the first occurrence of the banner.
+ QCOMPARE(titles.length(), 2);
QCOMPARE(titles[0], title);
- QCOMPARE(subtitles.length(), 1);
+ QCOMPARE(subtitles.length(), 2);
QCOMPARE(subtitles[0], subtitle);
}
--- tests/ut_screenlockbusinesslogic
+++ tests/ut_screenlockbusinesslogic
+(directory)
--- tests/ut_screenlockbusinesslogic/ut_screenlockbusinesslogic.cpp
+++ tests/ut_screenlockbusinesslogic/ut_screenlockbusinesslogic.cpp
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui at nokia.com)
+**
+** This file is part of systemui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui at nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QDBusAbstractInterface>
+
+#define TEST_SERVICE QString("com.nokia.mcetest")
+#define TEST_PATH QString("/com/nokia/mcetest")
+#define TEST_INTERFACE QString("com.nokia.mcetest")
+#define TEST_METHOD QString("testmethod")
+
+#include "ut_screenlockbusinesslogic.h"
+#include "screenlockbusinesslogic.h"
+#include "lockscreenwindow_stub.h"
+#include "eventeater_stub.h"
+#include "sysuid_stub.h"
+#include "eventeater_stub.h"
+#include "closeeventeater_stub.h"
+#include "notifiernotificationsink_stub.h"
+#include "notificationsink_stub.h"
+#include <MApplication>
+#include <MApplicationWindow>
+#include <MApplicationExtensionArea>
+
+#ifdef HAVE_QMSYSTEM
+#include <qmdisplaystate.h>
+MeeGo::QmDisplayState::DisplayState qmDisplayState;
+MeeGo::QmDisplayState::DisplayState MeeGo::QmDisplayState::get() const
+{
+ return qmDisplayState;
+}
+#endif
+
+QMap<QWidget *, bool> gQWidgetVisible;
+void QWidget::setVisible(bool visible)
+{
+ gQWidgetVisible[this] = visible;
+ setAttribute(Qt::WA_WState_Visible, visible);
+}
+
+bool gQWidgetRaiseCalled = false;
+void QWidget::raise()
+{
+ gQWidgetRaiseCalled = true;
+}
+
+bool MApplicationExtensionArea::init()
+{
+ return true;
+}
+
+ScreenLockExtension::ScreenLockExtension() : widget_(NULL)
+{
+}
+ScreenLockExtension::~ScreenLockExtension()
+{
+}
+bool screenLockExtensionReset = false;
+void ScreenLockExtension::reset()
+{
+ screenLockExtensionReset = true;
+}
+void ScreenLockExtension::setNotificationManagerInterface(NotificationManagerInterface &)
+{
+}
+bool ScreenLockExtension::initialize(const QString &)
+{
+ widget_ = new LockScreen;
+ return true;
+}
+QGraphicsWidget *ScreenLockExtension::widget()
+{
+ return widget_;
+}
+QObject *ScreenLockExtension::qObject()
+{
+ return this;
+}
+bool screenLockExtensionModeSet = false;
+ScreenLockExtensionInterface::ScreenLockMode screenLockExtensionMode;
+void ScreenLockExtension::setMode(ScreenLockExtensionInterface::ScreenLockMode mode)
+{
+ screenLockExtensionModeSet = true;
+ screenLockExtensionMode = mode;
+}
+
+QDBus::CallMode qDbusAbstractInterfaceCallMode;
+QVariant qDbusAbstractInterfaceCallArg1;
+QString qDbusAbstractInterfaceCallMethod;
+QString qDbusAbstractInterfaceCallPath;
+QString qDbusAbstractInterfaceCallService;
+QString qDbusAbstractInterfaceCallInterface;
+QDBusMessage QDBusAbstractInterface::call(QDBus::CallMode mode, const QString & method, const QVariant & arg1, const QVariant & arg2, const QVariant & arg3, const QVariant & arg4, const QVariant & arg5, const QVariant & arg6, const QVariant & arg7, const QVariant & arg8)
+{
+ Q_UNUSED(arg2);
+ Q_UNUSED(arg3);
+ Q_UNUSED(arg4);
+ Q_UNUSED(arg5);
+ Q_UNUSED(arg6);
+ Q_UNUSED(arg7);
+ Q_UNUSED(arg8);
+
+ qDbusAbstractInterfaceCallMode = mode;
+ qDbusAbstractInterfaceCallArg1 = arg1;
+ qDbusAbstractInterfaceCallMethod = method;
+ qDbusAbstractInterfaceCallPath = path();
+ qDbusAbstractInterfaceCallService = service();
+ qDbusAbstractInterfaceCallInterface = interface();
+
+ return QDBusMessage();
+}
+
+void QTimer::singleShot(int, QObject *receiver, const char *member)
+{
+ // The "member" string is of form "1member()", so remove the trailing 1 and the ()
+ int memberLength = strlen(member) - 3;
+ char modifiedMember[memberLength + 1];
+ strncpy(modifiedMember, member + 1, memberLength);
+ modifiedMember[memberLength] = 0;
+ QMetaObject::invokeMethod(receiver, modifiedMember, Qt::DirectConnection);
+}
+
+void Ut_ScreenLockBusinessLogic::init()
+{
+ m_subject = new ScreenLockBusinessLogic;
+}
+
+void Ut_ScreenLockBusinessLogic::cleanup()
+{
+ delete m_subject;
+ gQWidgetRaiseCalled = false;
+ gQWidgetVisible.clear();
+ screenLockExtensionReset = false;
+ screenLockExtensionModeSet = false;
+ gScreenLockWindowStub->stubReset();
+ gEventEaterStub->stubReset();
+#ifdef HAVE_QMSYSTEM
+ qmDisplayState = MeeGo::QmDisplayState::On;
+#endif
+}
+
+void Ut_ScreenLockBusinessLogic::initTestCase()
+{
+ static int argc = 1;
+ static char *argv = (char *) "./ut_screenlockbusinesslogic";
+ m_App = new MApplication(argc, &argv);
+ /* XXX: input context caused a crash :-S */
+ m_App->setLoadMInputContext (false);
+ m_App->setQuitOnLastWindowClosed (false);
+ notifierSink = new NotifierNotificationSink;
+ gSysuidStub->stubSetReturnValue("notifierNotificationSink", notifierSink);
+}
+
+void Ut_ScreenLockBusinessLogic::cleanupTestCase()
+{
+ m_App->deleteLater ();
+ delete notifierSink;
+}
+
+void Ut_ScreenLockBusinessLogic::testToggleScreenLockUI()
+{
+ QSignalSpy spy(m_subject, SIGNAL(screenIsLocked(bool)));
+
+ ScreenLockExtension screenLockExtension;
+ screenLockExtension.initialize("");
+ m_subject->registerExtension(&screenLockExtension);
+
+#ifdef HAVE_QMSYSTEM
+ // First try with display off
+ qmDisplayState = MeeGo::QmDisplayState::Off;
+ m_subject->locksChanged (MeeGo::QmLocks::TouchAndKeyboard, MeeGo::QmLocks::Locked);
+#endif
+
+ // When the lock is toggled on, make sure the screen locking signals are sent and the lock UI is shown
+ m_subject->toggleScreenLockUI(true);
+#ifdef HAVE_QMSYSTEM
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.at(0).at(0).toBool(), true);
+#else
+ spy.clear ();
+#endif
+
+ // The lock screen should now be visible
+ QCOMPARE(gQWidgetVisible[m_subject->screenLockWindow], true);
+
+ // Raising should happen
+ QCOMPARE(gQWidgetRaiseCalled, true);
+
+ // The lock screen needs to be reset
+ QCOMPARE(screenLockExtensionReset, true);
+ screenLockExtensionReset = false;
+
+ // Reset the stubs
+ gQWidgetVisible[m_subject->screenLockWindow] = false;
+ gQWidgetRaiseCalled = false;
+
+ // Lock the screen again
+ m_subject->toggleScreenLockUI(true);
+
+ // show() should not be called
+ QCOMPARE(gQWidgetVisible[m_subject->screenLockWindow], false);
+
+ // Raising should happen
+ QCOMPARE(gQWidgetRaiseCalled, true);
+
+ // The lock screen still needs to be reset
+ QCOMPARE(screenLockExtensionReset, true);
+
+ // When the lock is toggled off, make sure the screen locking signals are sent and the lock UI is hidden
+ m_subject->toggleScreenLockUI(false);
+ QCOMPARE(m_subject->screenLockWindow->isVisible(), false);
+}
+
+void Ut_ScreenLockBusinessLogic::testToggleEventEater()
+{
+ // Make sure the screen locking signals are sent and the eater UI is shown/hidden
+ m_subject->toggleEventEater(true);
+ QCOMPARE(gEventEaterStub->stubCallCount("show"), 1);
+
+ m_subject->toggleEventEater(false);
+ QCOMPARE(gEventEaterStub->stubCallCount("hide"), 1);
+}
+
+void Ut_ScreenLockBusinessLogic::testUnlockScreen()
+{
+ QSignalSpy spy(m_subject, SIGNAL(screenIsLocked(bool)));
+
+ m_subject->tklock_open(TEST_SERVICE, TEST_PATH, TEST_INTERFACE, TEST_METHOD, ScreenLockBusinessLogic::TkLockModeNone, false, false);
+ m_subject->unlockScreen();
+
+#ifdef HAVE_QMSYSTEM
+ m_subject->locksChanged (MeeGo::QmLocks::TouchAndKeyboard, MeeGo::QmLocks::Unlocked);
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.at(0).at(0).toBool(), false);
+#endif
+
+ QCOMPARE(m_subject->screenLockWindow, (ScreenLockWindow *)NULL);
+ QCOMPARE(qDbusAbstractInterfaceCallMethod, TEST_METHOD);
+ QCOMPARE(qDbusAbstractInterfaceCallPath, TEST_PATH);
+ QCOMPARE(qDbusAbstractInterfaceCallService, TEST_SERVICE);
+ QCOMPARE(qDbusAbstractInterfaceCallInterface, TEST_INTERFACE);
+ QCOMPARE(qDbusAbstractInterfaceCallMode, QDBus::NoBlock);
+ QCOMPARE(qDbusAbstractInterfaceCallArg1.toInt(), (int)ScreenLockBusinessLogic::TkLockUnlock);
+}
+
+void Ut_ScreenLockBusinessLogic::testHideEventEater()
+{
+ m_subject->showEventEater();
+ m_subject->hideEventEater();
+ QCOMPARE(gEventEaterStub->stubCallCount("hide"), 1);
+}
+
+#ifdef HAVE_QMSYSTEM
+void Ut_ScreenLockBusinessLogic::testDisplayStateChanged()
+{
+ ScreenLockExtension screenLockExtension;
+ screenLockExtension.initialize("");
+ m_subject->registerExtension(&screenLockExtension);
+
+ m_subject->toggleScreenLockUI(true);
+
+ // When lock-screen-ui is shown reset should be called on it
+ QCOMPARE(screenLockExtensionReset, true);
+ screenLockExtensionReset = false;
+
+ m_subject->displayStateChanged(MeeGo::QmDisplayState::Off);
+ m_subject->displayStateChanged(MeeGo::QmDisplayState::On);
+
+ // Also check whether the reset called on the
+ // lock-screen-ui (after display turn on)
+ QCOMPARE(screenLockExtensionReset, true);
+}
+#endif
+
+
+void Ut_ScreenLockBusinessLogic::testReset()
+{
+ ScreenLockExtension screenLockExtension;
+ screenLockExtension.initialize("");
+ m_subject->registerExtension(&screenLockExtension);
+ m_subject->reset();
+ QVERIFY(screenLockExtensionReset);
+}
+
+void Ut_ScreenLockBusinessLogic::testWhenExtensionIsRegisteredSignalsAreConnected()
+{
+ ScreenLockExtension screenLockExtension;
+ screenLockExtension.initialize("");
+ m_subject->registerExtension(&screenLockExtension);
+
+ QVERIFY(disconnect(screenLockExtension.qObject(), SIGNAL(unlocked()), m_subject, SLOT(unlockScreen())));
+ QVERIFY(disconnect(&Sysuid::instance()->notifierNotificationSink(), SIGNAL(notifierSinkActive(bool)), screenLockExtension.qObject(), SIGNAL(notifierSinkActive(bool))));
+}
+
+void Ut_ScreenLockBusinessLogic::testRegisteringAndUnregisteringExtension()
+{
+ ScreenLockExtension screenLockExtension;
+ screenLockExtension.initialize("");
+ m_subject->registerExtension(&screenLockExtension);
+ QCOMPARE(m_subject->screenLockExtensions.count(), 1);
+
+ m_subject->unregisterExtension(&screenLockExtension);
+ QCOMPARE(m_subject->screenLockExtensions.count(), 0);
+}
+
+void Ut_ScreenLockBusinessLogic::testTkLockOpen_data()
+{
+ QTest::addColumn<int>("mode");
+ QTest::addColumn<bool>("screenLockWindowVisibilityModified");
+ QTest::addColumn<bool>("screenLockWindowVisible");
+ QTest::addColumn<bool>("eventEaterWindowVisibilityModified");
+ QTest::addColumn<bool>("eventEaterWindowVisible");
+ QTest::addColumn<bool>("screenLockModeSet");
+ QTest::addColumn<int>("screenLockMode");
+ QTest::addColumn<bool>("lowPowerModeWindow");
+
+ QTest::newRow("TkLockModeNone") << (int)ScreenLockBusinessLogic::TkLockModeNone << false << false << false << false << false << 0 << false;
+ QTest::newRow("TkLockModeEnable") << (int)ScreenLockBusinessLogic::TkLockModeEnable << true << true << true << false << true << (int)ScreenLockExtensionInterface::NormalMode << false;
+ QTest::newRow("TkLockModeHelp") << (int)ScreenLockBusinessLogic::TkLockModeHelp << false << false << false << false << false << 0 << false;
+ QTest::newRow("TkLockModeSelect") << (int)ScreenLockBusinessLogic::TkLockModeSelect << false << false << false << false << false << 0 << false;
+ QTest::newRow("TkLockModeOneInput") << (int)ScreenLockBusinessLogic::TkLockModeOneInput << false << false << true << true << false << 0 << false;
+ QTest::newRow("TkLockEnableVisual") << (int)ScreenLockBusinessLogic::TkLockEnableVisual << true << true << true << false << true << (int)ScreenLockExtensionInterface::NormalMode << false;
+ QTest::newRow("TkLockEnableLowPowerMode") << (int)ScreenLockBusinessLogic::TkLockEnableLowPowerMode << true << true << true << false << true << (int)ScreenLockExtensionInterface::LowPowerMode << true;
+ QTest::newRow("TkLockRealBlankMode") << (int)ScreenLockBusinessLogic::TkLockRealBlankMode << true << true << true << false << true << (int)ScreenLockExtensionInterface::DisplayOffMode << false;
+}
+
+void Ut_ScreenLockBusinessLogic::testTkLockOpen()
+{
+ QFETCH(int, mode);
+ QFETCH(bool, screenLockWindowVisibilityModified);
+ QFETCH(bool, screenLockWindowVisible);
+ QFETCH(bool, eventEaterWindowVisibilityModified);
+ QFETCH(bool, eventEaterWindowVisible);
+ QFETCH(bool, screenLockModeSet);
+ QFETCH(int, screenLockMode);
+ QFETCH(bool, lowPowerModeWindow);
+
+ ScreenLockExtension screenLockExtension;
+ screenLockExtension.initialize("");
+ m_subject->registerExtension(&screenLockExtension);
+
+ // Make sure the event eater is visible so that it will be hidden if necessary
+ m_subject->showEventEater();
+ gEventEaterStub->stubReset();
+
+ // Modify the state
+ int reply = m_subject->tklock_open(TEST_SERVICE, TEST_PATH, TEST_INTERFACE, TEST_METHOD, mode, false, false);
+ QCOMPARE(reply, (int)ScreenLockBusinessLogic::TkLockReplyOk);
+
+ // Check that screen lock window visibility was only changed if needed (and to the correct state)
+ QCOMPARE(gQWidgetVisible.contains(m_subject->screenLockWindow), screenLockWindowVisibilityModified);
+ if (screenLockWindowVisibilityModified) {
+ QCOMPARE(gQWidgetVisible[m_subject->screenLockWindow], screenLockWindowVisible);
+ }
+
+ // Check that event eater window visibility was only changed if needed (and to the correct state)
+ if (eventEaterWindowVisibilityModified) {
+ QCOMPARE(gEventEaterStub->stubCallCount(eventEaterWindowVisible ? "show" : "hide"), 1);
+ } else {
+ QCOMPARE(gEventEaterStub->stubCallCount("show"), 0);
+ QCOMPARE(gEventEaterStub->stubCallCount("hide"), 0);
+ }
+
+ QCOMPARE(screenLockExtensionModeSet, screenLockModeSet);
+ if (screenLockModeSet) {
+ QCOMPARE((int)screenLockExtensionMode, screenLockMode);
+ }
+
+ if(screenLockMode >= ScreenLockBusinessLogic::TkLockEnableVisual && screenLockMode <= ScreenLockBusinessLogic::TkLockRealBlankMode) {
+ QCOMPARE(gScreenLockWindowStub->stubLastCallTo("setLowPowerMode").parameter<bool>(0), lowPowerModeWindow);
+ }
+}
+
+void Ut_ScreenLockBusinessLogic::testTkLockClose()
+{
+ // Show the screen lock window and the event eater
+ m_subject->showScreenLock();
+ m_subject->showEventEater();
+
+ // Modify the state
+ int reply = m_subject->tklock_close(false);
+ QCOMPARE(reply, (int)ScreenLockBusinessLogic::TkLockReplyOk);
+
+ // Both windows should be hidden
+ QCOMPARE(gQWidgetVisible.contains(m_subject->screenLockWindow), true);
+ QCOMPARE(gEventEaterStub->stubCallCount("hide"), 1);
+ QCOMPARE(gQWidgetVisible[m_subject->screenLockWindow], false);
+}
+
+QTEST_APPLESS_MAIN(Ut_ScreenLockBusinessLogic)
--- tests/ut_screenlockbusinesslogic/ut_screenlockbusinesslogic.h
+++ tests/ut_screenlockbusinesslogic/ut_screenlockbusinesslogic.h
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (directui at nokia.com)
+**
+** This file is part of systemui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui at nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+#ifndef UT_SCREENLOCKBUSINESSLOGIC_H
+#define UT_SCREENLOCKBUSINESSLOGIC_H
+
+#include <QGraphicsWidget>
+#include "screenlockextensioninterface.h"
+
+class MApplication;
+class NotifierNotificationSink;
+class ScreenLockBusinessLogic;
+
+class LockScreen : public QGraphicsWidget
+{
+ Q_OBJECT
+
+signals:
+ void unlocked();
+};
+
+class ScreenLockExtension : public QObject, public ScreenLockExtensionInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(ScreenLockExtensionInterface MApplicationExtensionInterface)
+
+public:
+ ScreenLockExtension();
+ virtual ~ScreenLockExtension();
+
+ //! Methods derived from ScreenLockExtensionInterface
+ virtual void reset();
+ virtual void setNotificationManagerInterface(NotificationManagerInterface ¬ificationManager);
+ virtual QObject *qObject();
+ virtual void setMode(ScreenLockExtensionInterface::ScreenLockMode mode);
+
+ //! Methods derived from MApplicationExtensionInterface
+ virtual bool initialize(const QString &interface);
+ virtual QGraphicsWidget *widget();
+
+signals:
+ void unlocked();
+ void notifierSinkActive(bool active);
+
+private:
+ QGraphicsWidget *widget_;
+};
+
+class Ut_ScreenLockBusinessLogic : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void init();
+ void cleanup();
+ void initTestCase();
+ void cleanupTestCase();
+
+ void testToggleScreenLockUI();
+ void testToggleEventEater();
+ void testUnlockScreen();
+ void testHideEventEater();
+#ifdef HAVE_QMSYSTEM
+ void testDisplayStateChanged();
+#endif
+ void testWhenExtensionIsRegisteredSignalsAreConnected();
+ void testReset();
+ void testRegisteringAndUnregisteringExtension();
+ void testTkLockOpen_data();
+ void testTkLockOpen();
+ void testTkLockClose();
+
+private:
+ MApplication *m_App;
+ NotifierNotificationSink *notifierSink;
+ ScreenLockBusinessLogic *m_subject;
+};
+
+#endif
+
--- tests/ut_screenlockbusinesslogic/ut_screenlockbusinesslogic.pro
+++ tests/ut_screenlockbusinesslogic/ut_screenlockbusinesslogic.pro
+include(../coverage.pri)
+include(../common_top.pri)
+TARGET = ut_screenlockbusinesslogic
+INCLUDEPATH += $$LIBNOTIFICATIONSRCDIR $$SRCDIR/screenlock $$SRCDIR/notifications
+
+SOURCES += ut_screenlockbusinesslogic.cpp \
+ $$SRCDIR/screenlock/screenlockbusinesslogic.cpp \
+ $$STUBSDIR/stubbase.cpp
+
+HEADERS += ut_screenlockbusinesslogic.h \
+ $$SRCDIR/screenlock/screenlockbusinesslogic.h \
+ $$SRCDIR/sysuid.h \
+ $$SRCDIR/screenlock/screenlockwindow.h \
+ $$SRCDIR/screenlock/eventeater.h \
+ $$SRCDIR/closeeventeater.h \
+ $$SRCDIR/notifications/notifiernotificationsink.h \
+ $$LIBNOTIFICATIONSRCDIR/notificationsink.h
+
+include(../common_bot.pri)
+
--- tests/ut_screenlockwindow
+++ tests/ut_screenlockwindow
+(directory)
--- tests/ut_screenlockwindow/ut_screenlockwindow.cpp
+++ tests/ut_screenlockwindow/ut_screenlockwindow.cpp
+/****************************************************************************
+**
+** Copyright(C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation(directui at nokia.com)
+**
+** This file is part of systemui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui at nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <MApplication>
+#include <MSceneWindow>
+#include <MApplicationExtensionArea>
+#include <QShowEvent>
+#include "ut_screenlockwindow.h"
+#include "screenlockwindow.h"
+#include "screenlockwindowstyle.h"
+#include "notifiernotificationsink_stub.h"
+#include "notificationsink_stub.h"
+#include "sysuid_stub.h"
+#include <X11/Xutil.h>
+#include "x11wrapper_stub.h"
+
+// X stubs to avoid crashes
+void XSetWMProperties(Display *, Window, XTextProperty *, XTextProperty *, char **, int, XSizeHints *, XWMHints *, XClassHint *)
+{
+}
+
+bool mWindowOrientationLocked = false;
+void MWindow::setOrientationLocked(bool locked)
+{
+ mWindowOrientationLocked = locked;
+}
+
+QString mWindowOrientation;
+void MWindow::setLandscapeOrientation()
+{
+ mWindowOrientation = "landscape";
+}
+
+void MWindow::setPortraitOrientation()
+{
+ mWindowOrientation = "portrait";
+}
+
+MWindow* appearedWindow = NULL;
+void MSceneWindow::appear(MWindow* window, MSceneWindow::DeletionPolicy policy)
+{
+ appearedWindow = window;
+ Q_UNUSED(policy);
+}
+
+
+void Ut_ScreenLockWindow::initTestCase()
+{
+ int argc = 1;
+ char *argv[] = {(char *) "./ut_screenlockwindow", NULL };
+ app = new MApplication(argc, argv);
+}
+
+void Ut_ScreenLockWindow::cleanupTestCase()
+{
+ delete app;
+}
+
+void Ut_ScreenLockWindow::init()
+{
+ lockScreenWindow = new ScreenLockWindow(new MApplicationExtensionArea(""));
+}
+
+void Ut_ScreenLockWindow::cleanup()
+{
+ delete lockScreenWindow;
+ lockScreenWindow = NULL;
+ appearedWindow = NULL;
+ mWindowOrientationLocked = false;
+ mWindowOrientation.clear();
+ gX11WrapperStub->stubReset();
+}
+
+void Ut_ScreenLockWindow::testWhenWindowIsCreatedLockScreenAppears()
+{
+ QCOMPARE(appearedWindow, lockScreenWindow);
+}
+
+void Ut_ScreenLockWindow::testWhenWindowIsShownItIsExcludedFromTaskbar()
+{
+ // The stub needs to be reset so that things done at construction time won't affect the test
+ gX11WrapperStub->stubReset();
+
+ Display *display = QX11Info::display();
+
+ QShowEvent *showEvent = new QShowEvent;
+ lockScreenWindow->showEvent(showEvent);
+
+ QCOMPARE(gX11WrapperStub->stubCallCount("XSendEvent"), 1);
+ QCOMPARE(gX11WrapperStub->stubLastCallTo("XSendEvent").parameter<Display *>(0), display);
+ QCOMPARE(gX11WrapperStub->stubLastCallTo("XSendEvent").parameter<Window>(1), RootWindow(display, lockScreenWindow->x11Info().screen()));
+ QCOMPARE(gX11WrapperStub->stubLastCallTo("XSendEvent").parameter<Bool>(2), (Bool)False);
+ QCOMPARE(gX11WrapperStub->stubLastCallTo("XSendEvent").parameter<long>(3), (long)(SubstructureNotifyMask | SubstructureRedirectMask));
+ XEvent event = gX11WrapperStub->stubLastCallTo("XSendEvent").parameter<XEvent>(4);
+ QCOMPARE(event.xclient.type, ClientMessage);
+ QCOMPARE(event.xclient.display, display);
+ QCOMPARE(event.xclient.window, lockScreenWindow->internalWinId());
+ QCOMPARE(event.xclient.message_type, X11Wrapper::XInternAtom(display, "_NET_WM_STATE", False));
+ QCOMPARE(event.xclient.format, 32);
+ QCOMPARE(event.xclient.data.l[0], (long)1);
+ QCOMPARE(event.xclient.data.l[1], (long)X11Wrapper::XInternAtom(display, "_NET_WM_STATE_SKIP_TASKBAR", False));
+ delete showEvent;
+}
+
+void Ut_ScreenLockWindow::testOrientationLocking_data()
+{
+ QTest::addColumn<QString>("lockedOrientation");
+ QTest::addColumn<bool>("orientationLocked");
+ QTest::addColumn<QString>("expectedOrientation");
+
+ QTest::newRow("No locking") << QString() << false << QString();
+ QTest::newRow("Locked to landscape") << QString("landscape") << true << QString("landscape");
+ QTest::newRow("Locked to portrait") << QString("portrait") << true << QString("portrait");
+ QTest::newRow("Locked to something else") << QString("unknown") << false << QString();
+}
+
+void Ut_ScreenLockWindow::testOrientationLocking()
+{
+ QFETCH(QString, lockedOrientation);
+ QFETCH(bool, orientationLocked);
+ QFETCH(QString, expectedOrientation);
+
+ // Reset the stubs
+ mWindowOrientationLocked = false;
+ mWindowOrientation = QString();
+
+ // Set the style
+ ScreenLockWindowStyle *style = const_cast<ScreenLockWindowStyle *>(static_cast<const ScreenLockWindowStyle *>(MTheme::style("ScreenLockWindowStyle", "", "", "", M::Landscape, NULL)));
+ style->setLockedOrientation(lockedOrientation);
+
+ // Create a new window
+ delete lockScreenWindow;
+ lockScreenWindow = new ScreenLockWindow(new MApplicationExtensionArea(""));
+ QCOMPARE(mWindowOrientationLocked, orientationLocked);
+ QCOMPARE(mWindowOrientation, expectedOrientation);
+}
+
+void Ut_ScreenLockWindow::testTranslucency_data()
+{
+ QTest::addColumn<bool>("translucent");
+
+ QTest::newRow("Translucent") << true;
+ QTest::newRow("Not translucent") << false;
+}
+
+void Ut_ScreenLockWindow::testTranslucency()
+{
+ QFETCH(bool, translucent);
+
+ // Set the style
+ ScreenLockWindowStyle *style = const_cast<ScreenLockWindowStyle *>(static_cast<const ScreenLockWindowStyle *>(MTheme::style("ScreenLockWindowStyle", "", "", "", M::Landscape, NULL)));
+ style->setTranslucent(translucent);
+
+ // Create a new window
+ delete lockScreenWindow;
+ lockScreenWindow = new ScreenLockWindow(new MApplicationExtensionArea(""));
+ QCOMPARE(lockScreenWindow->testAttribute(Qt::WA_TranslucentBackground), translucent);
+}
+
+QTEST_APPLESS_MAIN(Ut_ScreenLockWindow)
--- tests/ut_screenlockwindow/ut_screenlockwindow.h
+++ tests/ut_screenlockwindow/ut_screenlockwindow.h
+/****************************************************************************
+**
+** Copyright(C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation(directui at nokia.com)
+**
+** This file is part of systemui.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at directui at nokia.com.
+**
+** This library is free software; you can redistribute it and/or
+** modify it under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging
+** of this file.
+**
+****************************************************************************/
+#ifndef UT_SCREENLOCKWINDOW_H
+#define UT_SCREENLOCKWINDOW_H
+
+#include <QObject>
+
+class MApplication;
+class ScreenLockWindow;
+
+class Ut_ScreenLockWindow : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void init();
+ void cleanup();
+ void initTestCase();
+ void cleanupTestCase();
+
+ void testWhenWindowIsCreatedLockScreenAppears();
+ void testWhenWindowIsShownItIsExcludedFromTaskbar();
+ void testOrientationLocking_data();
+ void testOrientationLocking();
+ void testTranslucency_data();
+ void testTranslucency();
+
+private:
+ MApplication *app;
+ ScreenLockWindow *lockScreenWindow;
+};
+
+#endif
--- tests/ut_screenlockwindow/ut_screenlockwindow.pro
+++ tests/ut_screenlockwindow/ut_screenlockwindow.pro
+include(../coverage.pri)
+include(../common_top.pri)
+TARGET = ut_screenlockwindow
+
+INCLUDEPATH += $$LIBNOTIFICATIONSRCDIR $$SRCDIR/screenlock $$SRCDIR/notifications
+
+STYLE_HEADERS += $$SRCDIR/screenlock/screenlockwindowstyle.h
+
+SOURCES += ut_screenlockwindow.cpp \
+ $$SRCDIR/screenlock/screenlockwindow.cpp \
+ $$STUBSDIR/stubbase.cpp \
+
+HEADERS += ut_screenlockwindow.h \
+ $$SRCDIR/screenlock/screenlockwindow.h \
+ $$SRCDIR/screenlock/screenlockwindowstyle.h \
+ $$SRCDIR/sysuid.h \
+ $$SRCDIR/notifications/notifiernotificationsink.h \
+ $$LIBNOTIFICATIONSRCDIR/notificationsink.h \
+ $$SRCDIR/x11wrapper.h
+
+include(../common_bot.pri)
+
--- tests/ut_statusareaview/ut_statusareaview.cpp
+++ tests/ut_statusareaview/ut_statusareaview.cpp
@@ -28,7 +28,6 @@
#include "batterystatusindicator_stub.h"
#include "phonenetworksignalstrengthstatusindicator_stub.h"
#include "phonenetworktypestatusindicator_stub.h"
-#include "internetconnectionstatusindicator_stub.h"
#include "bluetoothstatusindicator_stub.h"
#include "gpsstatusindicator_stub.h"
#include "presencestatusindicator_stub.h"
@@ -38,6 +37,7 @@
#include "transferstatusindicator_stub.h"
#include "callstatusindicator_stub.h"
#include "profilestatusindicator_stub.h"
+#include "callforwardingstatusindicator_stub.h"
#include "notificationarea_stub.h"
#include "notificationstatusindicator_stub.h"
#include "notificationsink_stub.h"
--- tests/ut_statusindicator/ut_statusindicator.cpp
+++ tests/ut_statusindicator/ut_statusindicator.cpp
@@ -137,21 +137,25 @@
void Ut_StatusIndicator::testContextItemSubscribe()
{
- MOnDisplayChangeEvent exitDisplayEvent(MOnDisplayChangeEvent::FullyOffDisplay, QRectF());
- MOnDisplayChangeEvent enterDisplayEvent(MOnDisplayChangeEvent::FullyOnDisplay, QRectF());
-
gContextItemStub->stubReset();
m_subject = new PhoneNetworkTypeStatusIndicator(*testContext, NULL);
+ QSignalSpy spy(m_subject, SIGNAL(subscriptionMade()));
+
+ testContextItems["Internet.NetworkType"]->setValue(QVariant());
// When the application becomes not visible, the context item updates
// should be unsubscribed from
- qApp->sendEvent(m_subject, &exitDisplayEvent);
- QCOMPARE(gContextItemStub->stubCallCount("unsubscribe"), 3);
+ m_subject->exitDisplayEvent();
+ QCOMPARE(gContextItemStub->stubCallCount("unsubscribe"), 4);
+
+ testContextItems["Internet.NetworkType"]->setValue("WLAN");
// When the application becomes not visible, the context item updates
// should be subscribed to
- qApp->sendEvent(m_subject, &enterDisplayEvent);
- QCOMPARE(gContextItemStub->stubCallCount("subscribe"), 3);
+ m_subject->enterDisplayEvent();
+ QCOMPARE(gContextItemStub->stubCallCount("subscribe"), 4);
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(m_subject->styleName().contains("WLAN"), QBool(true));
}
void Ut_StatusIndicator::testContextItemDeletion()
@@ -159,16 +163,16 @@
gContextItemStub->stubReset();
m_subject = new PhoneNetworkTypeStatusIndicator(*testContext, NULL);
- // There should be a total of two items constructed using the
+ // There should be a total of four items constructed using the
// StatusIndicator::createContextItem() call
- QCOMPARE(gContextItemStub->stubCallCount("ContextItemConstructor"), 3);
+ QCOMPARE(gContextItemStub->stubCallCount("ContextItemConstructor"), 4);
delete m_subject;
m_subject = NULL;
- // There should be a total of two items deleted by the
+ // There should be a total of four items deleted by the
// StatusIndicator destructor
- QCOMPARE(gContextItemStub->stubCallCount("ContextItemDestructor"), 3);
+ QCOMPARE(gContextItemStub->stubCallCount("ContextItemDestructor"), 4);
}
void Ut_StatusIndicator::testPhoneNetworkSignalStrength()
@@ -179,57 +183,51 @@
m_subject = statusIndicator;
testContextItems["Cellular.SignalBars"]->setValue(QVariant(5));
+ testContextItems["Cellular.RegistrationStatus"]->setValue(QVariant("home"));
- QVERIFY(statusIndicator->model()->value().type() == QVariant::Double);
+ QCOMPARE(statusIndicator->model()->value().type(), QVariant::Double);
QCOMPARE(qRound(statusIndicator->model()->value().toDouble() * 100), 100);
- QVERIFY(statusIndicator->styleName() == "");
- statusIndicator->setDisplay(true);
- QVERIFY(statusIndicator->styleName() != "");
+ QCOMPARE(statusIndicator->styleName(), QString("PhoneNetworkSignalStrengthStatusIndicator"));
}
-void Ut_StatusIndicator::testPhoneNetworkTypeObjectName_data()
+void Ut_StatusIndicator::testPhoneNetworkSignalStrenghtStyleName_data()
{
QTest::addColumn<bool>("SystemOfflineMode");
QTest::addColumn<QString>("CellularRegistrationStatus");
- QTest::addColumn<QString>("CellularDataTechnology");
QTest::addColumn<QString>("ExpectedObjectNamePostfix");
- QTest::newRow("Offline mode") << true << QString("") << QString("") << QString("Offline");
- QTest::newRow("No-sim registration status") << false << QString("no-sim") << QString("") << QString("NoSIM");
- QTest::newRow("Empty registration status") << false << QString("") << QString("") << QString("NoNetwork");
- QTest::newRow("Offline registration status") << false << QString("offline") << QString("") << QString("NoNetwork");
- QTest::newRow("Offline registration status") << false << QString("forbidden") << QString("") << QString("NoNetwork");
- QTest::newRow("Home registration status without data technology") << false << QString("home") << QString("") << QString("NoNetwork");
- QTest::newRow("Home registration status with gprs data technology") << false << QString("home") << QString("gprs") << QString("2G");
- QTest::newRow("Home registration status with egprs data technology") << false << QString("home") << QString("egprs") << QString("25G");
- QTest::newRow("Home registration status with umts data technology") << false << QString("home") << QString("umts") << QString("3G");
- QTest::newRow("Home registration status with hspa data technology") << false << QString("home") << QString("hspa") << QString("35G");
+ QTest::newRow("Offline mode") << true << QString("") << QString("Offline");
+ QTest::newRow("No-sim registration status") << false << QString("no-sim") << QString("NoSIM");
+ QTest::newRow("Empty registration status") << false << QString("") << QString("NoNetwork");
+ QTest::newRow("Offline registration status") << false << QString("offline") << QString("NoNetwork");
+ QTest::newRow("Forbidden registration status") << false << QString("forbidden") << QString("NoNetwork");
+ QTest::newRow("Home registration status") << false << QString("home") << QString("");
+ QTest::newRow("Roam registration status") << false << QString("roam") << QString("");
}
-void Ut_StatusIndicator::testPhoneNetworkTypeObjectName()
+void Ut_StatusIndicator::testPhoneNetworkSignalStrenghtStyleName()
{
QFETCH(bool, SystemOfflineMode);
QFETCH(QString, CellularRegistrationStatus);
- QFETCH(QString, CellularDataTechnology);
QFETCH(QString, ExpectedObjectNamePostfix);
- m_subject = new PhoneNetworkTypeStatusIndicator(*testContext);
+ m_subject = new PhoneNetworkSignalStrengthStatusIndicator(*testContext);
testContextItems["System.OfflineMode"]->setValue(SystemOfflineMode);
testContextItems["Cellular.RegistrationStatus"]->setValue(CellularRegistrationStatus);
- testContextItems["Cellular.DataTechnology"]->setValue(CellularDataTechnology);
QCOMPARE(m_subject->styleName().contains(ExpectedObjectNamePostfix), QBool(true));
}
void Ut_StatusIndicator::testWhenPhoneNetworkBecomesAvailableThenSignalIsEmitted()
{
- m_subject = new PhoneNetworkTypeStatusIndicator(*testContext);
- QSignalSpy spy(m_subject, SIGNAL(networkAvailabilityChanged(bool)));
+ m_subject = new PhoneNetworkSignalStrengthStatusIndicator(*testContext);
+ testContextItems["Cellular.RegistrationStatus"]->setValue(QVariant("offline"));
+
+ QSignalSpy spy(m_subject, SIGNAL(networkAvailabilityChanged(bool)));
testContextItems["Cellular.RegistrationStatus"]->setValue(QVariant("home"));
- testContextItems["Cellular.DataTechnology"]->setValue(QVariant("gprs"));
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.at(0)[0], QVariant(true));
@@ -237,10 +235,9 @@
void Ut_StatusIndicator::testWhenPhoneNetworkBecomesUnavailableThenSignalIsEmitted()
{
- m_subject = new PhoneNetworkTypeStatusIndicator(*testContext);
+ m_subject = new PhoneNetworkSignalStrengthStatusIndicator(*testContext);
testContextItems["Cellular.RegistrationStatus"]->setValue(QVariant("home"));
- testContextItems["Cellular.DataTechnology"]->setValue(QVariant("gprs"));
QSignalSpy spy(m_subject, SIGNAL(networkAvailabilityChanged(bool)));
testContextItems["Cellular.RegistrationStatus"]->setValue(QVariant("offline"));
@@ -249,6 +246,81 @@
QCOMPARE(spy.at(0)[0], QVariant(false));
}
+void Ut_StatusIndicator::testPhoneNetworkTypeStyleNameWhenSystemOnlineName_data()
+{
+ QTest::addColumn<bool>("PacketDataActive");
+ QTest::addColumn<QString>("CellularDataTechnology");
+ QTest::addColumn<QString>("InternetConnectionType");
+ QTest::addColumn<QString>("InternetConnectionState");
+ QTest::addColumn<QString>("ExpectedObjectNamePostfix");
+
+ QTest::newRow("gprs connection type and 2g tech not active") << false << QString("gprs") << QString("GPRS") << QString("connected") << QString("2G");
+ QTest::newRow("gprs connection type and 2g tech connecting") << false << QString("gprs") << QString("GPRS") << QString("connecting") << QString("2GConnecting");
+ QTest::newRow("gprs connection type and 2g tech active") << true << QString("gprs") << QString("GPRS") << QString("connected") << QString("2GActive");
+ QTest::newRow("gprs connection type and 25g tech not active") << false << QString("egprs") << QString("GPRS") << QString("connected") << QString("25G");
+ QTest::newRow("gprs connection type and 25g tech connecting") << false << QString("egprs") << QString("GPRS") << QString("connecting") << QString("25GConnecting");
+ QTest::newRow("gprs connection type and 25g tech active") << true << QString("egprs") << QString("GPRS") << QString("connected") << QString("25GActive");
+ QTest::newRow("gprs connection type and 3g tech not active") << false << QString("umts") << QString("GPRS") << QString("connected") << QString("3G");
+ QTest::newRow("gprs connection type and 3g tech connecting") << false << QString("umts") << QString("GPRS") << QString("connecting") << QString("3GConnecting");
+ QTest::newRow("gprs connection type and 3g tech active") << true << QString("umts") << QString("GPRS") << QString("connected") << QString("3GActive");
+ QTest::newRow("gprs connection type and 35g tech not active") << false << QString("hspa") << QString("GPRS") << QString("connected") << QString("35G");
+ QTest::newRow("gprs connection type and 35g tech connecting") << false << QString("hspa") << QString("GPRS") << QString("connecting") << QString("35GConnecting");
+ QTest::newRow("gprs connection type and 35g tech active") << true << QString("hspa") << QString("GPRS") << QString("connected") << QString("35GActive");
+ QTest::newRow("wlan connection type and wlan tech not active") << false << QString("") << QString("WLAN") << QString("connected") << QString("WLAN");
+ QTest::newRow("wlan connection type and wlan tech connecting") << false << QString("") << QString("WLAN") << QString("connecting") << QString("WLANConnecting");
+// QTest::newRow("wlan connection type and wlan tech active") << true << QString("") << QStringU("WLAN") << QString("connected") << QStringU("WLANActive"); //wlan activity not supported yet
+
+}
+
+void Ut_StatusIndicator::testPhoneNetworkTypeStyleNameWhenSystemOnlineName()
+{
+ QFETCH(bool, PacketDataActive);
+ QFETCH(QString, CellularDataTechnology);
+ QFETCH(QString, InternetConnectionType);
+ QFETCH(QString, InternetConnectionState);
+ QFETCH(QString, ExpectedObjectNamePostfix);
+
+ m_subject = new PhoneNetworkTypeStatusIndicator(*testContext);
+
+ testContextItems["Cellular.PacketData"]->setValue(PacketDataActive);
+ testContextItems["Cellular.DataTechnology"]->setValue(CellularDataTechnology);
+ testContextItems["Internet.NetworkType"]->setValue(InternetConnectionType);
+ testContextItems["Internet.NetworkState"]->setValue(InternetConnectionState);
+
+ QCOMPARE(m_subject->styleName(), QString("PhoneNetworkTypeStatusIndicator") + ExpectedObjectNamePostfix);
+}
+
+void Ut_StatusIndicator::testPhoneNetworkAvailabilityChanged()
+{
+ m_subject = new PhoneNetworkTypeStatusIndicator(*testContext);
+
+ PhoneNetworkTypeStatusIndicator* networkTypeIndicator = qobject_cast<PhoneNetworkTypeStatusIndicator*>(m_subject);
+
+ testContextItems["Internet.NetworkState"]->setValue(QVariant("disconnected"));
+ networkTypeIndicator->setNetworkAvailability(false);
+ QCOMPARE(networkTypeIndicator->styleName(), QString(""));
+
+ testContextItems["Internet.NetworkState"]->setValue(QVariant("connected"));
+ networkTypeIndicator->setNetworkAvailability(false);
+ QVERIFY(networkTypeIndicator->styleName() != QString(""));
+
+ testContextItems["Internet.NetworkState"]->setValue(QVariant("connecting"));
+ networkTypeIndicator->setNetworkAvailability(false);
+ QVERIFY(networkTypeIndicator->styleName() != QString(""));
+
+ testContextItems["Internet.NetworkState"]->setValue(QVariant("disconnected"));
+ networkTypeIndicator->setNetworkAvailability(true);
+ QCOMPARE(networkTypeIndicator->styleName(), QString(""));
+
+ testContextItems["Internet.NetworkState"]->setValue(QVariant("connected"));
+ networkTypeIndicator->setNetworkAvailability(true);
+ QVERIFY(networkTypeIndicator->styleName() != QString(""));
+
+ testContextItems["Internet.NetworkState"]->setValue(QVariant("connecting"));
+ networkTypeIndicator->setNetworkAvailability(true);
+ QVERIFY(networkTypeIndicator->styleName() != QString(""));
+}
+
void Ut_StatusIndicator::testBattery()
{
m_subject = new BatteryStatusIndicator(*testContext);
@@ -395,55 +467,15 @@
QVERIFY(m_subject->styleName().indexOf("Away") < 0);
}
-void Ut_StatusIndicator::testInternetConnection_data()
-{
- QTest::addColumn<QString>("networkType");
- QTest::addColumn<QString>("networkState");
- QTest::addColumn<bool>("packetData");
- QTest::addColumn<QString>("styleName");
-
- QTest::newRow("wlan connecting") << "WLAN" << "connecting" << false << "WLANConnecting";
- QTest::newRow("wlan connecting, packet data") << "WLAN" << "connecting" << true << "PacketDataActive";
- QTest::newRow("wlan connected") << "WLAN" << "connected" << false << "WLAN";
- QTest::newRow("wlan connected, packet data") << "WLAN" << "connected" << true << "PacketDataActive";
-
- QTest::newRow("gprs connecting") << "GPRS" << "connecting" << false << "PacketDataConnecting";
- QTest::newRow("gprs connecting, packet data") << "GPRS" << "connecting" << true << "PacketDataConnecting";
- QTest::newRow("gprs connected") << "GPRS" << "connected" << false << "PacketData";
- QTest::newRow("gprs connected, packet data") << "GPRS" << "connected" << true << "PacketDataActive";
-
- QTest::newRow("disconnected") << "" << "disconnected" << false << "";
- QTest::newRow("disconnected, packet data") << "" << "disconnected" << true << "PacketDataActive";
-}
-
-
-void Ut_StatusIndicator::testInternetConnection()
-{
- QFETCH(QString, networkType);
- QFETCH(QString, networkState);
- QFETCH(bool, packetData);
- QFETCH(QString, styleName);
-
- m_subject = new InternetConnectionStatusIndicator(*testContext);
-
- testContextItems["Internet.NetworkType"]->setValue(QVariant(networkType));
- testContextItems["Internet.NetworkState"]->setValue(QVariant(networkState));
- testContextItems["Cellular.PacketData"]->setValue(QVariant(packetData));
-
- QCOMPARE(m_subject->styleName(), QString("InternetConnectionStatusIndicator") + styleName);
-}
-
void Ut_StatusIndicator::testAnimation()
{
- MOnDisplayChangeEvent exitDisplayEvent(MOnDisplayChangeEvent::FullyOffDisplay, QRectF());
- MOnDisplayChangeEvent enterDisplayEvent(MOnDisplayChangeEvent::FullyOnDisplay, QRectF());
StatusIndicator *m_subject = new BatteryStatusIndicator(*testContext);
testContextItems["Battery.IsCharging"]->setValue(QVariant(true));
- qApp->sendEvent(m_subject, &exitDisplayEvent);
+ m_subject->exitDisplayEvent();
QCOMPARE(m_subject->model()->animate(), false);
- qApp->sendEvent(m_subject, &enterDisplayEvent);
+ m_subject->enterDisplayEvent();
QCOMPARE(m_subject->model()->animate(), true);
delete m_subject;
}
@@ -645,5 +677,15 @@
QCOMPARE(transferStatusIndicator->styleName(), QString("TransferStatusIndicator") + transferStatusIndicator->TRANSFER_UI_SUFFIX_PENDING);
}
+void Ut_StatusIndicator::testCallForwarding()
+{
+ m_subject = new CallForwardingStatusIndicator(*testContext);
+
+ testContextItems["Phone.CallForwarding"]->setValue(QVariant(false));
+ QVERIFY(m_subject->styleName().indexOf("Set") < 0);
+
+ testContextItems["Phone.CallForwarding"]->setValue(QVariant(true));
+ QVERIFY(m_subject->styleName().indexOf("Set") >= 0);
+}
QTEST_APPLESS_MAIN(Ut_StatusIndicator)
--- tests/ut_statusindicator/ut_statusindicator.h
+++ tests/ut_statusindicator/ut_statusindicator.h
@@ -75,16 +75,17 @@
void testContextItemSubscribe();
void testContextItemDeletion();
void testPhoneNetworkSignalStrength();
- void testPhoneNetworkTypeObjectName_data();
- void testPhoneNetworkTypeObjectName();
+ void testPhoneNetworkSignalStrenghtStyleName_data();
+ void testPhoneNetworkSignalStrenghtStyleName();
void testWhenPhoneNetworkBecomesAvailableThenSignalIsEmitted();
void testWhenPhoneNetworkBecomesUnavailableThenSignalIsEmitted();
+ void testPhoneNetworkTypeStyleNameWhenSystemOnlineName_data();
+ void testPhoneNetworkTypeStyleNameWhenSystemOnlineName();
+ void testPhoneNetworkAvailabilityChanged();
void testBattery();
void testAlarm();
void testBluetooth();
void testPresence();
- void testInternetConnection_data();
- void testInternetConnection();
void testAnimation();
void testPhoneNetwork_data();
void testPhoneNetwork();
@@ -95,6 +96,7 @@
void testGPS();
void testTransferStatusIndicatorDBusConnectionCreationInConstructor();
void testTransferStatusStateChange();
+ void testCallForwarding();
};
#endif //_UT_STATUSINDICATOR_
--- tests/ut_statusindicatormenuwindow/ut_statusindicatormenuwindow.cpp
+++ tests/ut_statusindicatormenuwindow/ut_statusindicatormenuwindow.cpp
@@ -41,9 +41,10 @@
mWindowSetVisible.second = visible;
}
+bool gMWindowIsOnDisplay = false;
bool MWindow::isOnDisplay() const
{
- return testAttribute(Qt::WA_WState_Visible);
+ return gMWindowIsOnDisplay;
}
QWidget *qWidgetRaise = NULL;
@@ -97,6 +98,7 @@
#ifdef HAVE_QMSYSTEM
gQmLocksStub->stubSetReturnValue("getState", MeeGo::QmLocks::Unlocked);
#endif
+ gMWindowIsOnDisplay = false;
}
void Ut_StatusIndicatorMenuWindow::cleanup()
@@ -165,6 +167,16 @@
QCOMPARE(qWidgetRaise, raiseCalled ? statusIndicatorMenuWindow : NULL);
}
+void Ut_StatusIndicatorMenuWindow::testWhenWindowAlreadyOnDisplayThenMenuWidgetAppearsWithoutDisplayEnterSignal()
+{
+ gMWindowIsOnDisplay = true;
+
+ statusIndicatorMenuWindow->makeVisible();
+
+ QVERIFY(gSceneWindowStateMap.contains(statusIndicatorMenuWindow->menuWidget));
+ QCOMPARE(gSceneWindowStateMap[statusIndicatorMenuWindow->menuWidget], MSceneWindow::Appeared);
+}
+
void Ut_StatusIndicatorMenuWindow::testWindowType()
{
QVERIFY(statusIndicatorMenuWindow->testAttribute(Qt::WA_X11NetWmWindowTypeMenu));
--- tests/ut_statusindicatormenuwindow/ut_statusindicatormenuwindow.h
+++ tests/ut_statusindicatormenuwindow/ut_statusindicatormenuwindow.h
@@ -57,6 +57,7 @@
void testWhenLanguageChangeEventWithoutLanguageChangingThenMenuWidgetIsNotResetted();
void testStatusIndicatorMenuAppearsAfterEnteringDisplay();
void testStatusIndicatorMenuIsClosedWhenStatusBarIsTapped();
+ void testWhenWindowAlreadyOnDisplayThenMenuWidgetAppearsWithoutDisplayEnterSignal();
#ifdef HAVE_QMSYSTEM
void testQmLocksSignalConnectionWhenDeviceLocked();
--- themes/feedbacks/feedbacks.pro
+++ themes/feedbacks/feedbacks.pro
@@ -32,9 +32,9 @@
# Power-off feedback
poweroff.files = \
- power-off/*
+ priority1_power_off/*
-poweroff.path = $$SYSTEMUI_THEMES_DIR/feedbacks/power-off
+poweroff.path = $$SYSTEMUI_THEMES_DIR/feedbacks/priority1_power_off
INSTALLS += \
startdnd \
--- themes/feedbacks/power-off
+++ themes/feedbacks/power-off
-(directory)
--- themes/feedbacks/power-off/vibra.ivt
+++ themes/feedbacks/power-off/vibra.ivt
(renamed to themes/feedbacks/priority1_power_off/vibra.ivt)
--- themes/feedbacks/priority1_power_off
+++ themes/feedbacks/priority1_power_off
+(directory)
--- themes/feedbacks/priority1_power_off/vibra.ivt
+++ themes/feedbacks/priority1_power_off/vibra.ivt
(renamed from themes/feedbacks/power-off/vibra.ivt)
--- themes/style/statusarea.css
+++ themes/style/statusarea.css
@@ -149,7 +149,7 @@
padding-right: 0;
padding-top: 0;
padding-bottom: 0;
- preferred-size: 13.0mm 3.6mm;
+ preferred-size: -1 3.6mm;
minimum-size: 0 3.6mm;
maximum-size: 13.0mm 3.6mm;
}
@@ -165,11 +165,12 @@
padding-right: 0;
padding-top: 0;
padding-bottom: 0;
- preferred-size: 55.0mm 3.6mm;
+ preferred-size: -1 3.6mm;
minimum-size: 0 3.6mm;
maximum-size: 55.0mm 3.6mm;
}
+
MLabelStyle#StatusIndicatorLabelPortrait {
font: $FONT_SMALL;
color: #FFFFFF;
@@ -181,19 +182,40 @@
padding-right: 0;
padding-top: 0;
padding-bottom: 0;
- preferred-size: 17.0mm 3.6mm;
+ preferred-size: -1 3.6mm;
minimum-size: 0 3.6mm;
maximum-size: 17.0mm 3.6mm;
}
StatusIndicatorIconStyle#PhoneNetworkSignalStrengthStatusIndicator {
- /* The list of IDs of the images to be shown in the status indicator separated by spaces */
+ /* The list of IDs of the images to be shown in the status indicator when signal strength is available, separated by spaces */
image-list: "icon-s-status-network0 icon-s-status-network1 icon-s-status-network2 icon-s-status-network3 icon-s-status-network4 icon-s-status-network5";
preferred-size: 1.4mm 1.8mm;
minimum-size: 1.4mm 1.8mm;
maximum-size: 1.4mm 1.8mm;
}
+StatusIndicatorIconStyle#PhoneNetworkSignalStrengthStatusIndicatorNoSIM {
+ image-list: "icon-s-status-no-simcard";
+ preferred-size: 1.8mm 1.8mm;
+ minimum-size: 1.8mm 1.8mm;
+ maximum-size: 1.8mm 1.8mm;
+}
+
+StatusIndicatorIconStyle#PhoneNetworkSignalStrengthStatusIndicatorNoNetwork {
+ image-list: "icon-s-status-no-gsm-connection";
+ preferred-size: 1.8mm 1.8mm;
+ minimum-size: 1.8mm 1.8mm;
+ maximum-size: 1.8mm 1.8mm;
+}
+
+StatusIndicatorIconStyle#PhoneNetworkSignalStrengthStatusIndicatorOffline {
+ image-list: "icon-s-status-offline";
+ preferred-size: 2.1mm 1.8mm;
+ minimum-size: 2.1mm 1.8mm;
+ maximum-size: 2.1mm 1.8mm;
+}
+
StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicator2G {
image-list: "icon-s-status-gsm";
preferred-size: 1.8mm 1.8mm;
@@ -222,27 +244,141 @@
maximum-size: 1.8mm 1.8mm;
}
-StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicatorNoSIM {
- image-list: "icon-s-status-no-simcard";
+StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicator2GActive {
+ image-list: "icon-s-status-gsm-active";
preferred-size: 1.8mm 1.8mm;
minimum-size: 1.8mm 1.8mm;
maximum-size: 1.8mm 1.8mm;
}
-StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicatorNoNetwork {
- image-list: "icon-s-status-no-gsm-connection";
+StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicator25GActive {
+ image-list: "icon-s-status-25g-active";
preferred-size: 1.8mm 1.8mm;
minimum-size: 1.8mm 1.8mm;
maximum-size: 1.8mm 1.8mm;
}
-StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicatorOffline {
- image-list: "icon-s-status-offline";
- preferred-size: 2.1mm 1.8mm;
- minimum-size: 2.1mm 1.8mm;
- maximum-size: 2.1mm 1.8mm;
+StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicator3GActive {
+ image-list: "icon-s-status-3g-active";
+ preferred-size: 1.8mm 1.8mm;
+ minimum-size: 1.8mm 1.8mm;
+ maximum-size: 1.8mm 1.8mm;
+}
+
+StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicator35GActive {
+ image-list: "icon-s-status-35g-active";
+ preferred-size: 1.8mm 1.8mm;
+ minimum-size: 1.8mm 1.8mm;
+ maximum-size: 1.8mm 1.8mm;
+}
+
+StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicator2GSuspended {
+ image-list: "icon-s-status-gsm-suspended";
+ preferred-size: 1.8mm 1.8mm;
+ minimum-size: 1.8mm 1.8mm;
+ maximum-size: 1.8mm 1.8mm;
}
+StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicator25GSuspended {
+ image-list: "icon-s-status-25g-suspended";
+ preferred-size: 1.8mm 1.8mm;
+ minimum-size: 1.8mm 1.8mm;
+ maximum-size: 1.8mm 1.8mm;
+}
+
+StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicator3GSuspended {
+ image-list: "icon-s-status-3g-suspended";
+ preferred-size: 1.8mm 1.8mm;
+ minimum-size: 1.8mm 1.8mm;
+ maximum-size: 1.8mm 1.8mm;
+}
+
+StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicator35GSuspended {
+ image-list: "icon-s-status-35g-suspended";
+ preferred-size: 1.8mm 1.8mm;
+ minimum-size: 1.8mm 1.8mm;
+ maximum-size: 1.8mm 1.8mm;
+}
+
+StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicator2GConnecting {
+ image-list: "icon-s-status-gsm icon-s-status-gsm-active";
+ preferred-size: 1.8mm 1.8mm;
+ minimum-size: 1.8mm 1.8mm;
+ maximum-size: 1.8mm 1.8mm;
+}
+
+StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicator25GConnecting {
+ image-list: "icon-s-status-25g icon-s-status-25g-active";
+ preferred-size: 1.8mm 1.8mm;
+ minimum-size: 1.8mm 1.8mm;
+ maximum-size: 1.8mm 1.8mm;
+}
+
+StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicator3GConnecting {
+ image-list: "icon-s-status-3g icon-s-status-3g-active";
+ preferred-size: 1.8mm 1.8mm;
+ minimum-size: 1.8mm 1.8mm;
+ maximum-size: 1.8mm 1.8mm;
+}
+
+StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicator35GConnecting {
+ image-list: "icon-s-status-35g icon-s-status-35g-active";
+ preferred-size: 1.8mm 1.8mm;
+ minimum-size: 1.8mm 1.8mm;
+ maximum-size: 1.8mm 1.8mm;
+}
+
+StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicator2GWLAN {
+ image-list: "icon-s-status-gsm icon-s-status-wlan-active";
+ preferred-size: 1.8mm 1.8mm;
+ minimum-size: 1.8mm 1.8mm;
+ maximum-size: 1.8mm 1.8mm;
+}
+
+StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicator25GWLAN {
+ image-list: "icon-s-status-25g icon-s-status-wlan-active";
+ preferred-size: 1.8mm 1.8mm;
+ minimum-size: 1.8mm 1.8mm;
+ maximum-size: 1.8mm 1.8mm;
+}
+
+StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicator3GWLAN {
+ image-list: "icon-s-status-3g icon-s-status-wlan-active";
+ preferred-size: 1.8mm 1.8mm;
+ minimum-size: 1.8mm 1.8mm;
+ maximum-size: 1.8mm 1.8mm;
+}
+
+StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicator35GWLAN {
+ image-list: "icon-s-status-35g icon-s-status-wlan-active";
+ preferred-size: 1.8mm 1.8mm;
+ minimum-size: 1.8mm 1.8mm;
+ maximum-size: 1.8mm 1.8mm;
+}
+
+StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicatorWLAN {
+ /* The list of IDs of the images to be shown in the status indicator separated by spaces */
+ image-list: "icon-s-status-wlan";
+ preferred-size: 2.4mm 1.8mm;
+ minimum-size: 2.4mm 1.8mm;
+ maximum-size: 2.4mm 1.8mm;
+}
+
+StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicatorWLANActive {
+ /* The list of IDs of the images to be shown in the status indicator separated by spaces */
+ image-list: "icon-s-status-wlan-active";
+ preferred-size: 2.4mm 1.8mm;
+ minimum-size: 2.4mm 1.8mm;
+ maximum-size: 2.4mm 1.8mm;
+}
+
+StatusIndicatorIconStyle#PhoneNetworkTypeStatusIndicatorWLANConnecting {
+ /* The list of IDs of the images to be shown in the status indicator separated by spaces */
+ image-list: "icon-s-status-wlan icon-s-status-wlan-active";
+ preferred-size: 2.4mm 1.8mm;
+ minimum-size: 2.4mm 1.8mm;
+ maximum-size: 2.4mm 1.8mm;
+}
StatusIndicatorIconStyle#BatteryStatusIndicatorLevel {
/* The list of IDs of the images to be shown in the status indicator separated by spaces */
@@ -322,55 +458,6 @@
maximum-size: 1.4mm 1.8mm;
}
-StatusIndicatorIconStyle#InternetConnectionStatusIndicator {
- /* The list of IDs of the images to be shown in the status indicator separated by spaces */
- image-list: "";
- preferred-size: 0 1.8mm;
- minimum-size: 0 1.8mm;
- maximum-size: 0 1.8mm;
-}
-
-StatusIndicatorIconStyle#InternetConnectionStatusIndicatorWLAN {
- /* The list of IDs of the images to be shown in the status indicator separated by spaces */
- image-list: "icon-s-status-wlan";
- preferred-size: 2.4mm 1.8mm;
- minimum-size: 2.4mm 1.8mm;
- maximum-size: 2.4mm 1.8mm;
-}
-
-StatusIndicatorIconStyle#InternetConnectionStatusIndicatorPacketData {
- /* The list of IDs of the images to be shown in the status indicator separated by spaces */
- image-list: "icon-s-status-packetdata";
- preferred-size: 2.0mm 1.8mm;
- minimum-size: 2.0mm 1.8mm;
- maximum-size: 2.0mm 1.8mm;
-}
-
-StatusIndicatorIconStyle#InternetConnectionStatusIndicatorPacketDataActive {
- /* The list of IDs of the images to be shown in the status indicator separated by spaces */
- image-list: "icon-s-status-packetdata-active";
- preferred-size: 2.0mm 1.8mm;
- minimum-size: 2.0mm 1.8mm;
- maximum-size: 2.0mm 1.8mm;
-}
-
-StatusIndicatorIconStyle#InternetConnectionStatusIndicatorPacketDataConnecting {
- /* The list of IDs of the images to be shown in the status indicator separated by spaces */
- image-list: "icon-s-status-packetdata1 icon-s-status-packetdata2 icon-s-status-packetdata3 icon-s-status-packetdata4 icon-s-status-packetdata5 icon-s-status-packetdata6 icon-s-status-packetdata7 icon-s-status-packetdata8";
- preferred-size: 2.4mm 1.8mm;
- minimum-size: 2.4mm 1.8mm;
- maximum-size: 2.4mm 1.8mm;
-}
-
-StatusIndicatorIconStyle#InternetConnectionStatusIndicatorWLANConnecting {
- /* The list of IDs of the images to be shown in the status indicator separated by spaces */
- image-list: "icon-s-status-wlan1 icon-s-status-wlan2 icon-s-status-wlan3 icon-s-status-wlan4 icon-s-status-wlan5 icon-s-status-wlan6";
- preferred-size: 2.4mm 1.8mm;
- minimum-size: 2.4mm 1.8mm;
- maximum-size: 2.4mm 1.8mm;
-}
-
-
StatusIndicatorIconStyle#CallStatusIndicator {
/* The list of IDs of the images to be shown in the status indicator separated by spaces */
image-list: "";
@@ -507,4 +594,17 @@
maximum-size: 1.8mm 1.8mm;
}
+StatusIndicatorIconStyle#CallForwardingStatusIndicator {
+ image-list: "";
+ preferred-size: 0 1.8mm;
+ minimum-size: 0 1.8mm;
+ maximum-size: 0 1.8mm;
+}
+
+StatusIndicatorIconStyle#CallForwardingStatusIndicatorSet {
+ image-list: "icon-s-status-call-diverted";
+ preferred-size: 1.8mm 1.8mm;
+ minimum-size: 1.8mm 1.8mm;
+ maximum-size: 1.8mm 1.8mm;
+}
--- themes/style/statusindicatormenu.css
+++ themes/style/statusindicatormenu.css
@@ -4,11 +4,23 @@
notification-area: true;
}
+MSceneLayerEffectDimStyle {
+ opacity: 0.98;
+ easing-curve: inquint;
+ fade-duration: 200;
+}
+
StatusIndicatorMenu MWidgetSlideAnimationStyle#In {
+ delay: 0;
+ duration: 200;
+ easing-curve: outexpo;
origin: "top";
}
StatusIndicatorMenu MWidgetSlideAnimationStyle#Out {
+ delay: 0;
+ duration: 150;
+ easing-curve: inquint;
origin: "top";
}
--- themes/style/volumecontrol.css
+++ themes/style/volumecontrol.css
(renamed to src/extensions/volume/themes/style/libsysuid-volume.css)
++++++ meegotouch-systemui.yaml
--- meegotouch-systemui.yaml
+++ meegotouch-systemui.yaml
@@ -1,6 +1,6 @@
Name: meegotouch-systemui
Summary: System UI daemon
-Version: 0.20.5
+Version: 0.20.12
Release: 1
Group: System/Desktop
License: LGPLv2.1
@@ -28,8 +28,8 @@
- qmsystem2
- x11
- xcomposite
- - xdamage
- xext
+ - xdamage
Requires:
- "%{name}-screenlock-padlock"
Provides :
@@ -84,6 +84,9 @@
Files:
- "%{_libdir}/meegotouch/applicationextensions/libsysuid-volume.so"
- "%{_datadir}/meegotouch/applicationextensions/sysuid-volume.desktop"
+ - "%{_datadir}/themes/base/meegotouch/libsysuid-volume/libsysuid-volume.conf"
+ - "%{_datadir}/themes/base/meegotouch/libsysuid-volume/style/libsysuid-volume.css"
+
- Name: meegocontrolpanel-privatemodeapplet
AsWholeName: yes
More information about the MeeGo-commits
mailing list