[meego-commits] 8229: Changes to Trunk/meegotouch-systemui
Anas Nashif
no_reply at build.meego.com
Fri Oct 8 18:24:44 UTC 2010
Hi,
I have made the following changes to meegotouch-systemui in project Trunk. Please review and accept ASAP.
Thank You,
Anas Nashif
[This message was auto-generated]
---
Request #8229:
submit: Trunk:Testing/meegotouch-systemui(r8) -> Trunk/meegotouch-systemui
Message:
Move to Trunk
State: new 2010-10-08T11:24:39 nashif
Comment: None
changes files:
--------------
--- meegotouch-systemui.changes
+++ meegotouch-systemui.changes
@@ -0,0 +1,8 @@
+* Mon Oct 04 2010 Fathi Boudra <fathi.boudra at nokia.com> - 0.16.13
+- Various cleanup in the packaging
+- Remove useless BuildRequires (messageserver and icu)
+- Use qmake macros
+
+* Fri Sep 17 2010 Kaitlin Rupert <kaitlin.rupert at intel.com> 0.16.13
+- Update to release tag 0.16.13-2
+
old:
----
disable_unlockConfirmed_call.patch
fix_build_issues.patch
meegotouch-systemui-0.16.6.tar.bz2
new:
----
meegotouch-systemui-0.16.13.tar.bz2
spec files:
-----------
--- meegotouch-systemui.spec
+++ meegotouch-systemui.spec
@@ -1,38 +1,34 @@
#
-# Do not Edit! Generated by:
-# spectacle version 0.18
+# Do NOT Edit the Auto-generated Part!
+# Generated by: spectacle version 0.20
#
# >> macros
# << macros
Name: meegotouch-systemui
Summary: System UI daemon
-Version: 0.16.6
+Version: 0.16.13
Release: 1
Group: System/Desktop
-License: LGPL v2.1
-URL: http://meego.org
+License: LGPLv2.1
+URL: http://meego.gitorious.org/meegotouch/meegotouch-systemui
Source0: %{name}-%{version}.tar.bz2
-Source1: meegotouch-systemui.desktop
+Source1: %{name}.desktop
Source2: lock.desktop
Source100: meegotouch-systemui.yaml
Patch0: 0001-Initial-buildable-version-against-MeeGo.patch
Patch1: systemui-fix-profile-compile.patch
-Patch2: fix_build_issues.patch
-BuildRequires: pkgconfig(QtCore) >= 4.6.0
BuildRequires: pkgconfig(QtGui)
-BuildRequires: pkgconfig(messageserver)
-BuildRequires: pkgconfig(icu)
-BuildRequires: pkgconfig(meegotouch)
-BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(contextsubscriber-1.0)
-BuildRequires: pkgconfig(xcomposite)
-BuildRequires: pkgconfig(xdamage)
-BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(dbus-glib-1)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(meegotouch)
BuildRequires: pkgconfig(x11)
-BuildRequires: fdupes
+BuildRequires: pkgconfig(xcomposite)
+BuildRequires: pkgconfig(xdamage)
BuildRequires: desktop-file-utils
+BuildRequires: fdupes
Provides: duistatusindicatormenu > 0.18.1
Provides: systemui > 0.1
Obsoletes: duistatusindicatormenu <= 0.18.1
@@ -59,16 +55,15 @@
%patch0 -p1
# systemui-fix-profile-compile.patch
%patch1 -p1
-# fix_build_issues.patch
-%patch2 -p1
# >> setup
# << setup
%build
# >> build pre
-qmake
+unset LD_AS_NEEDED
# << build pre
+%qmake
make %{?jobs:-j%jobs}
@@ -77,23 +72,20 @@
%install
rm -rf %{buildroot}
# >> install pre
-export INSTALL_ROOT=%{buildroot}
# << install pre
-%make_install
+%qmake_install
# >> install post
-%fdupes %{buildroot}%{_datadir}
-
mkdir -p %{buildroot}/etc/xdg/autostart/
cp %{SOURCE1} %{buildroot}/etc/xdg/autostart/
mkdir -p %{buildroot}/usr/share/applications/
cp %{SOURCE2} %{buildroot}/usr/share/applications/
-
# << install post
desktop-file-install --delete-original \
--dir %{buildroot}%{_datadir}/applications \
%{buildroot}%{_datadir}/applications/*.desktop
+%fdupes %{buildroot}/%{_datadir}
@@ -105,7 +97,6 @@
#if [ ! -e /usr/share/pixmaps/icons-Applications-lock.png ]; then
#cp /usr/share/themes/base/meegotouch/sysuid/images/flat_drop_big_lock.png /usr/share/pixmaps/icons-Applications-lock.png
#fi
-
# << post
@@ -116,16 +107,26 @@
%files
%defattr(-,root,root,-)
# >> files
-%config /etc/dbus-1/system.d/systemui.conf
-%config /etc/xdg/autostart/meegotouch-systemui.desktop
+%config %{_sysconfdir}/dbus-1/system.d/systemui.conf
+%config %{_sysconfdir}/xdg/autostart/meegotouch-systemui.desktop
%{_bindir}/sysuid
%{_datadir}/applications/lock.desktop
%{_datadir}/l10n/meegotouch/systemui.qm
%{_datadir}/meegotouch/notifications/eventtypes
%{_datadir}/themes/base/meegotouch/sysuid/style
%{_datadir}/themes/base/meegotouch/sysuid/sysuid.conf
-%{_datadir}/themes/base/meegotouch/sysuid/svg/icon-s-status-notifier.svg
-%{_datadir}/themes/base/meegotouch/sysuid/svg/test.svg
+%{_datadir}/themes/base/meegotouch/sysuid/feedbacks/enter-dragndrop-dropzone/audio.wav
+%{_datadir}/themes/base/meegotouch/sysuid/feedbacks/enter-dragndrop-dropzone/vibra.ivt
+%{_datadir}/themes/base/meegotouch/sysuid/feedbacks/exit-dragndrop-dropzone/audio.wav
+%{_datadir}/themes/base/meegotouch/sysuid/feedbacks/exit-dragndrop-dropzone/vibra.ivt
+%{_datadir}/themes/base/meegotouch/sysuid/feedbacks/power-off/audio.wav
+%{_datadir}/themes/base/meegotouch/sysuid/feedbacks/power-off/vibra.ivt
+%{_datadir}/themes/base/meegotouch/sysuid/feedbacks/release-inside-dragndrop-dropzone/audio.wav
+%{_datadir}/themes/base/meegotouch/sysuid/feedbacks/release-inside-dragndrop-dropzone/vibra.ivt
+%{_datadir}/themes/base/meegotouch/sysuid/feedbacks/release-outside-dragndrop-dropzone/audio.wav
+%{_datadir}/themes/base/meegotouch/sysuid/feedbacks/release-outside-dragndrop-dropzone/vibra.ivt
+%{_datadir}/themes/base/meegotouch/sysuid/feedbacks/start-dragndrop/audio.wav
+%{_datadir}/themes/base/meegotouch/sysuid/feedbacks/start-dragndrop/vibra.ivt
# << files
other changes:
--------------
++++++ meegotouch-systemui-0.16.6.tar.bz2 -> meegotouch-systemui-0.16.13.tar.bz2
--- README
+++ README
@@ -6,7 +6,7 @@
Vesa Halttunen
Aki Koskinen
Mikko Levonmaa
- Artem Ergokine
+ Artem Egorkine
Pankaj Saharan
Pauli Lehtinen
Sachin Kundu
@@ -31,8 +31,10 @@
git tag system-ui-VERSION
git push --tags origin master
-Applets
+Applets/extensions
-------
-Applets moved to:
- git at dvcs.projects.maemo.org:af/systemui-applets
+applets moved to:
+ http://meego.gitorious.org/meegotouch/meegotouch-controlpanelapplets
+and extensions moved to:
+ http://meego.gitorious.org/meegotouch/meegotouch-systemuiextensions
--- configure
+++ configure
@@ -17,9 +17,9 @@
echo DEFINES += HAVE_QMSYSTEM >> ${FILENAME}
fi
- pkg-config --exists maemosec
+ pkg-config --exists aegis-crypto
if [ $? -eq 0 ]; then
- echo DEFINES += HAVE_MAEMOSEC >> ${FILENAME}
+ echo DEFINES += HAVE_AEGIS_CRYPTO >> ${FILENAME}
fi
pkg-config --exists libresourceqt1
--- debian/changelog
+++ debian/changelog
@@ -1,3 +1,116 @@
+system-ui (0.16.13-2) harmattan; urgency=low
+
+ * Fixes: NB#191228 - Hardware volume bar can not be seen when adjusting volume.
+
+ -- David Kedves <dkedves at blumsoft.eu> Fri, 10 Sep 2010 15:04:20 +0200
+
+system-ui (0.16.13-1) harmattan; urgency=low
+
+ * Fixes: NB#187054 - 12 hour clock setting results wrong time in unlock
+ screen
+ * Fixes: NB#188860 - volume control background theming issue
+ * Fixes: NB#188724 - request for usb-moded credentials
+ * Fixes: NB#184665 - Incoming event banner blocks interaction from other parts of UI
+ * Fixes: NB#182995 - shutdown sequence is skipped with device power down
+ and alarm
+ * Fixes: NB#188425 - Notifications overlaps each others.
+ * Fixes: NB#173514 - Following SMS notifications are not displayed
+ * Fixes: NB#185101 - Device stops responding to user input after unblanking the screen with tap
+
+ -- David Kedves <dkedves at blumsoft.eu> Fri, 03 Sep 2010 09:24:43 +0300
+
+system-ui (0.16.12-1) harmattan; urgency=low
+
+ * Implemented: SWP#DUI-3086 Clear all button for notifications
+ * Implemented: SWP#DUI-3761 Modify signal strength indicator to follow AT&T definition
+ * Fixes: NB#187413 - Improper location of unlock UI when missed events are shown
+ * Fixes: NB#179812 - Statusbar does not show ringing icon when someone is
+ trying to call to device.
+ * Fixes: NB#181841 - Status Indicator Menu is first Iconic and then raised
+ * Volume-control: Do not show the volume-slider-overlay window when the
+ device or the touch-screen is locked
+ * Fixes: NB#180193 - Use only valid logical IDs.
+ * Fixes: NB#188713 - Volume control/bar blocks touch input
+ * Fixes: NB#188566 - Shrinked nokia logo while shutdown in protrait mode
+
+ -- David Kedves <dkedves at blumsoft.eu> Thu, 02 Sep 2010 10:11:09 +0200
+
+system-ui (0.16.11-1) harmattan; urgency=low
+
+ * Fixes: NB#184841 - Tapping on blank screen should only wake up the display
+ and not allow the events through
+ * New: Disable opening of status indicator menu when device lock is on
+ * Fixes: NB#176019 - Include feedbacks in packaging
+ * Fixes: NB#184145 - A.M./P.M. and Abc indicators are truncated in the status bar (Italian Language Variant)
+ * Fixes: NB#184092 - Handle properly the not enough power to charge case
+
+ -- David Kedves <dkedves at blumsoft.eu> Tue, 24 Aug 2010 16:35:16 +0200
+
+system-ui (0.16.10-2) harmattan; urgency=low
+
+ * Trying to fix compilation issues
+
+ -- David Kedves <dkedves at blumsoft.eu> Wed, 11 Aug 2010 14:16:00 +0300
+
+system-ui (0.16.10-1) harmattan; urgency=low
+
+ * Implemented: SWP#3031 - Maintaing LED - effect until an unseen notification is seen.
+ * Fixes: NB#181643 - system-ui fails to build with cs2009q3 compiler
+ * Fixes: NB#180296 - system-ui depends on depreciated maemo-security-certman
+ * Implemented: SWP#DUI-3359, Cumulative battery charging animation in status
+ area.
+ * Fixes: NB#179330 - Text input inactive during notification banner
+ * Fixes: NB#179326 - End state after call is incorrect
+ (events cleared from the event area)
+ * Fixes: NB#183500 - On activating and deactivating power saver mode banners
+ are shown but no text present on it.
+ * Added vibra feedback for shutdown and lockscreen, will be available when
+ theme files are added.
+
+ -- David Kedves <dkedves at blumsoft.eu> Fri, 30 Jul 2010 11:27:13 +0200
+
+system-ui (0.16.9-1) harmattan; urgency=low
+
+ * Fixes: NB#181248 - 2x OVI Suite usb notifications appear when screen is
+ unlocked
+ * Fixes: NB#181173 - "connected to ovi suite mode" -popup keeps on showing
+ repeatedly even when not appropriate
+ * Fixes: NB#180104 - The lock icon is not mirrored
+ (handle RTL layout direction properly...)
+ * Fixes: NB#179921 - volume indicator requires input focus
+ * Fixes: NB#174943 - The default background image paths are hardcoded into
+ System-UI
+ * Fixes: Notifier was removed when a system notification arrived.
+ * Fixes: NB#178041 - Whole message text is displayed in notification 'bubble'
+
+ -- David Kedves <dkedves at blumsoft.eu> Wed, 28 Jul 2010 14:22:22 +0200
+
+system-ui (0.16.8-1) harmattan; urgency=low
+
+ [ Laszlo Pere ]
+ * Fixes: NB#177843 - Battery notification should not be displayed in the
+ unlock screen event area
+ * Fixes: NB#174920 - Charging text shown on screen lock UI
+ * Fixes: NB#176358 - missed events representation in notification area of
+ lock ui is not proper in portrait orientation.
+ * New notifier implementation in status bar
+
+ [ David Kedves ]
+ * Reset the lock-screen-ui state also on display-state changes (off->on)
+ * Fixes: NB#176316 - Screen got unlocked, but after a sec again Lock UI
+ appeared on connecting USB.
+ * Fixes: NB#176315 - Screen doesn't unlock on connecting usb cable.
+ * Fixes: NB#172851 - No warning tone can be heard when battery is low.
+
+ [ Vesa Halttunen ]
+ * Fixes: NB#178888 - Status indicator for set alarm clock is missing from status bar
+ * Fixes: NB#177849 - Status menu panning problem
+
+ [ Sachin Kundu ]
+ * Fixes: NB#173761 - Indication of SMS notification is missing in 'Status area'
+
+ -- David Kedves <dkedves at blumsoft.eu> Thu, 15 Jul 2010 14:42:51 +0300
+
system-ui (0.16.6-1) harmattan; urgency=low
* Disable MCompositorNotificationSink when screen is locked
@@ -461,7 +574,7 @@
* Updated against libdui 0.15.0-1 DuiApplicationWindow and related API changes
* NOTE: this version requires libdui version 0.15.0- or later!
- -- Telle-Tiia Pitkänen <telle-tiia.pitkanen at ixonos.com> Mon, 23 Nov 2009 16:08:50 +0200
+ -- Telle-Tiia Pitkanen <telle-tiia.pitkanen at ixonos.com> Mon, 23 Nov 2009 16:08:50 +0200
system-ui (0.9.1-0) harmattan; urgency=low
@@ -470,7 +583,7 @@
* Fixes: NB#141656 - Pin UI displays blank boxes instead of content
* Fixes: NB#145442 - Settings plug-ins cannot be shown on device
- -- Telle-Tiia Pitkänen <telle-tiia.pitkanen at ixonos.com> Thu, 19 Nov 2009 09:02:27 +0200
+ -- Telle-Tiia Pitkanen <telle-tiia.pitkanen at ixonos.com> Thu, 19 Nov 2009 09:02:27 +0200
system-ui (0.9.0-0) harmattan; urgency=low
@@ -494,7 +607,7 @@
* Fixes: NB#145403 - Manual power save mode switching does not work if automatic power save mode is set ON.
* Fixes: NB#145463 - Sysuid crashes when SIM status is changed after launch PIN query is sent
- -- Telle-Tiia Pitkänen <telle-tiia.pitianen at ixonos.com> Thu, 12 Nov 2009 12:10:09 +0200
+ -- Telle-Tiia Pitkanen <telle-tiia.pitianen at ixonos.com> Thu, 12 Nov 2009 12:10:09 +0200
system-ui (0.8.1-1) harmattan; urgency=low
@@ -508,7 +621,7 @@
* Fixes: NB#143865 - Number "0" disappears from key pad in PIN code query view when screen is rotated
* Fixes: NB#143869 - Sysuid crashes when correct operator SIM lock code is entered
- -- Telle-Tiia Pitkänen <telle-tiia.pitkanen at ixonos.com> Wed, 04 Nov 2009 16:07:17 +0200
+ -- Telle-Tiia Pitkanen <telle-tiia.pitkanen at ixonos.com> Wed, 04 Nov 2009 16:07:17 +0200
system-ui (0.8.0-0) harmattan; urgency=low
@@ -529,7 +642,7 @@
* Fixes: NB#141157 - Battery low notification is not displayed
* Fixes: NB#135824 - The upper bar of the window that contains the X should be removed
- -- Telle-Tiia Pitkänen <telle-tiia.pitkanen at ixonos.com> Thu, 22 Oct 2009 09:46:50 +0300
+ -- Telle-Tiia Pitkanen <telle-tiia.pitkanen at ixonos.com> Thu, 22 Oct 2009 09:46:50 +0300
system-ui (0.6.3-0) harmattan; urgency=low
@@ -549,7 +662,7 @@
* Fixes: NB#134122 - Correct PUK does not do anything
* Fixes: NB#135824 - The upper bar of the window that contains the X..
- -- Telle-Tiia Pitkänen <telle-tiia.pitkanen at ixonos.com> Thu, 01 Oct 2009 13:06:48 +0300
+ -- Telle-Tiia Pitkanen <telle-tiia.pitkanen at ixonos.com> Thu, 01 Oct 2009 13:06:48 +0300
system-ui (0.6.0-1) harmattan; urgency=low
--- debian/control
+++ debian/control
@@ -2,12 +2,12 @@
Section: devel
Priority: optional
Maintainer: Gabriel Schulhof <gabriel.schulhof at nokia.com>
-Build-Depends: debhelper (>= 5), doxygen (>=1.5.9),
- libmeegotouch-dev (>= 0.20.14),
- libqmsystem-dev (>= 0.1.64), libmaemosec-dev, libresourceqt-dev,
+Build-Depends: debhelper (>= 5), doxygen (>=1.5.9),libmeegotouch-dev (>= 0.20.14),
+ libqmsystem-dev (>= 0.1.64), libaegis-crypto-dev, libresourceqt-dev,
libcontextsubscriber-dev, libngf-dev, libxcomposite-dev, libxext-dev,
- libdbus-1-dev, libdbus-glib-1-dev, libglib2.0-dev
-Standards-Version: 3.7.3
+ libdbus-1-dev, libdbus-glib-1-dev, libglib2.0-dev,
+ aegis-builder (>= 1.4)
+Standards-Version: 3.8.0
Package: system-ui
Provides: duistatusindicatormenu
--- debian/rules
+++ debian/rules
@@ -100,6 +100,8 @@
dh_md5sums
dh_builddeb --destdir=$(DEBDIR)
+ aegis-deb-add -control debian/system-ui/DEBIAN/control .. debian/system-ui.aegis=_aegis
+
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure
--- debian/system-ui.aegis
+++ debian/system-ui.aegis
+<aegis>
+ <request>
+ <credential name="USBControl" />
+ <for path="/usr/bin/sysuid" />
+ </request>
+</aegis>
+
--- debian/system-ui.install
+++ debian/system-ui.install
@@ -1,6 +1,6 @@
usr/bin/sysuid
usr/share/themes/base/meegotouch/sysuid/*.conf
usr/share/themes/base/meegotouch/sysuid/style/*.css
-usr/share/themes/base/meegotouch/sysuid/svg/*.svg
usr/share/meegotouch/notifications/eventtypes/*.conf
etc/dbus-1/system.d/systemui.conf
+usr/share/themes/base/meegotouch/sysuid/feedbacks
--- doc/footer.html
+++ doc/footer.html
@@ -1,8 +1,8 @@
<hr>
<table width="100%" cellspacing="0" border="0"><tr class="address">
-<td width="30%" align="left">Copyright © 2009 Nokia Corporation</td>
+<td width="30%" align="left">Copyright © 2010 Nokia Corporation</td>
<td width="40%" align="center">Generated on $datetime<br>Doxygen $doxygenversion</td>
-<td width="30%" align="right"><div align="right">DirectUI</div></td>
+<td width="30%" align="right"><div align="right">MeeGo Touch</div></td>
</tr></table>
</body>
</html>
--- doc/header.html
+++ doc/header.html
@@ -15,8 +15,6 @@
<a href="namespaces.html">All Namespaces</a>
·
<a href="classes.html">All Classes</a>
-·
-<a href="mainclasses.html">Main Classes</a>
</td>
</tr>
</table>
--- doc/mdoxy.cfg
+++ doc/mdoxy.cfg
@@ -42,7 +42,7 @@
# configuration options related to the input files
#---------------------------------------------------------------------------
-FILE_VERSION_FILTER = "git-log --pretty=format:%H -n 1"
+FILE_VERSION_FILTER = "git log --pretty=format:%H -n 1"
INPUT = ./src/ \
./doc/src/
FILE_PATTERNS = *.cpp *.h *.dox
--- doc/src/credits.dox
+++ doc/src/credits.dox
+/*! \page credits Credits
+
+The following people have contributed code to the System UI or otherwise helped out. Thank you!
+
+<pre>
+Current authors/maintainers:
+ Vesa Halttunen
+ Artem Egorkine
+ Sachin Kundu
+ Eetu Lehmusvuo
+ Pankaj Saharan
+ Pauli Lehtinen
+ Tuomas Järvensivu
+ Mikko Levonmaa
+ Aki Koskinen
+ Ville Voutilainen
+ Janne Sakko
+ Matti Vuorela
+ Jarkko Markkanen
+ Laszlo Pere
+ David Kedves
+
+Original authors:
+ Ossi Jormakka
+ Matti Katila
+ Carita Kautto
+ Miikka Kulmala
+ Jan Lapinkataja
+ Telle-Tiia Pitkanen
+</pre>
+
+Did we forget about you? <a href="mailto:tuomas.jarvensivu at nokia.com">Drop us a line</a>!
+
+*/
--- doc/src/license.dox
+++ doc/src/license.dox
@@ -1,13 +1,520 @@
/*! \page license License
-Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies).
-All rights reserved.
+\verbatim
-This software, including documentation, is protected by copyright
-controlled by Nokia Corporation. All rights are reserved. Copying,
-including reproducing, storing, adapting or translating, any or all of
-this material requires the prior written consent of Nokia Corporation.
-This material also contains confidential information which may not be
-disclosed to others without the prior written consent of Nokia.
+ GNU LESSER GENERAL PUBLIC LICENSE
+
+ The MeeGo Touch Framework is Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+ Contact: Nokia Corporation (directui at nokia.com)
+
+ You may use, distribute and copy the MeeGo Touch Framework under the terms of
+ GNU Lesser General Public License version 2.1, which is displayed below.
+
+-------------------------------------------------------------------------
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+\endverbatim
*/
--- doc/src/mainpage.dox
+++ doc/src/mainpage.dox
@@ -3,8 +3,8 @@
<table class="mainIndex">
<tr>
<th>Getting Started</th>
- <th>General</th>
- <th>Developer Resources</th>
+ <th>Core Features</th>
+ <th>API Reference</th>
</tr>
<tr>
<td>
@@ -14,42 +14,41 @@
</td>
<td>
<ul>
- <li><a href="statusindicatormenu.html">About DirectUI Status Indicator Menu</a></li>
+ <li><a href="notifications.html">Notifications</a></li>
+ <li><a href="statusindicatormenu.html">Status Indicator Menu</a></li>
</ul>
</td>
<td>
<ul>
- <li><a href="https://cwiki.nokia.com/DirectUIFramework">DirectUI Wiki</a></li>
- <li><a href="bugreporting.html">How to Report a Bug</a></li>
+ <li><a href="classes.html">All Classes</a></li>
+ <li><a href="annotated.html">Annotated Classes</a></li>
+ <li><a href="namespaces.html">All Namespaces</a></li>
+ <li><a href="hierarchy.html">Inheritance Hierarchy</a></li>
+ <li><a href="inherits.html">Class Chart</a></li>
</ul>
</td>
</tr>
<tr>
- <th>API Reference</th>
- <th>Core Features</th>
+ <th>Developer Resources</th>
<th>Licenses & Credits</th>
+ <th></th>
</tr>
<tr>
<td>
<ul>
- <li><a href="classes.html">All Classes</a></li>
- <li><a href="annotated.html">Annotated Classes</a></li>
- </ul>
- </td>
- <td>
- <ul>
- <li><a href="notifications.html">Notifications</a></li>
+ <li><a href="bugreporting.html">How to Report a Bug</a></li>
</ul>
</td>
<td>
<ul>
<li><a href="license.html">License</a></li>
+ <li><a href="credits.html">Credits</a></li>
</ul>
</td>
+ <td></td>
</tr>
-
</table>
*/
--- doc/src/notifications.dox
+++ doc/src/notifications.dox
@@ -1,6 +1,6 @@
/*! \page notifications Notifications System Implementation
-The notifications system is implemented by the system UI daemon. This page describes the architecture and internals of the notification system itself and is meant for those developing the notification system. Convenience classes for application developers willing to use the notification system are provided in libdui. <strong>If you're an application developer willing to use notifications, refer to the libdui documentation for more information. There's a separate page for notifications that contains all the necessary information. However, if you want to define new notification event types for your application, read on.</strong>
+The notifications system is implemented by the system UI daemon. This page describes the architecture and internals of the notification system itself and is meant for those developing the notification system. Convenience classes for application developers willing to use the notification system are provided in libmeegotouch. <strong>If you're an application developer willing to use notifications, refer to the libmeegotouch documentation for more information. There's a separate page for notifications that contains all the necessary information. However, if you want to define new notification event types for your application, read on.</strong>
\section components Components
@@ -36,7 +36,7 @@
\section event_types Event types
-The event type parameter of a notification is used to describe the overall properties of a notification, such as the icon, sound, vibration etc. The event type is a string. Event types should be named using the <a href="http://www.galago-project.org/specs/notification/0.9/x211.html">Desktop Notifications Specification</a> convention \c x-vendor.class.specific. \c x-vendor specifies the vendor extending the specification, such as \c x-nokia, \c class specifies the generic type of the notification, and \c specific specifies the more specific type of the notification. For each supported event type there is a configuration file in \c /usr/share/meegotouch/notifications/eventtypes that defines the properties for that particular type of event. The base name of the file defines the event type name: the properties for an event of type \c x-nokia.message\c.received are defined in \c /usr/share/dui/notifications/eventtypes/x-nokia\c.message.received\c.conf and so on. Each configuration file consists of lines with key=value pairs. The keys are notification sink API parameter names such as iconId and feedbackId and the values are the values to be assigned to the notification sink API parameter defined by the key. An example configuration file could be as follows:
+The event type parameter of a notification is used to describe the overall properties of a notification, such as the icon, sound, vibration etc. The event type is a string. Event types should be named using the <a href="http://www.galago-project.org/specs/notification/0.9/x211.html">Desktop Notifications Specification</a> convention \c x-vendor.class.specific. \c x-vendor specifies the vendor extending the specification, such as \c x-nokia, \c class specifies the generic type of the notification, and \c specific specifies the more specific type of the notification. For each supported event type there is a configuration file in \c /usr/share/meegotouch/notifications/eventtypes that defines the properties for that particular type of event. The base name of the file defines the event type name: the properties for an event of type \c x-nokia.message\c.received are defined in \c /usr/share/meegotouch/notifications/eventtypes/x-nokia\c.message.received\c.conf and so on. Each configuration file consists of lines with key=value pairs. The keys are notification sink API parameter names such as iconId and feedbackId and the values are the values to be assigned to the notification sink API parameter defined by the key. An example configuration file could be as follows:
\verbatim
iconId=Icon-close
--- mconfig.pri
+++ mconfig.pri
@@ -2,6 +2,7 @@
load(meegotouch_defines)
# Silence the compiler
CONFIG += silent
+DEFINES += THEMEDIR=\\\"\"$$M_THEME_DIR\"\\\"
# Directories
unix {
STATUSINDICATORMENU_PLUGIN_DIR = /usr/lib/meegotouch/statusindicatormenuplugins
--- src/batterybusinesslogic.cpp
+++ src/batterybusinesslogic.cpp
@@ -1,3 +1,5 @@
+/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
+/* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
@@ -230,16 +232,25 @@
switch (state) {
case Maemo::QmBattery::StateCharging:
SYS_DEBUG ("Charging");
- /*
- * The low battery notifications should not be sent when the battery
- * is actually charging.
- */
- if (m_LowBatteryNotifier != 0) {
- delete m_LowBatteryNotifier;
- m_LowBatteryNotifier = 0;
+
+ if (m_Battery->getChargerType () == Maemo::QmBattery::USB_100mA)
+ {
+ sendNotification (NotificationNoEnoughPower);
}
+ else
+ {
+ /*
+ * The low battery notifications should not be sent
+ * when the battery is actually charging.
+ */
+ if (m_LowBatteryNotifier != 0)
+ {
+ delete m_LowBatteryNotifier;
+ m_LowBatteryNotifier = 0;
+ }
- sendNotification (NotificationCharging);
+ sendNotification (NotificationCharging);
+ }
break;
case Maemo::QmBattery::StateNotCharging:
@@ -375,9 +386,9 @@
SYS_DEBUG ("Notifying NotificationCharging");
utiliseLED (true, QString ("PatternBatteryCharging"));
sendNotification (
+ "x-nokia.battery",
//% "Charging"
qtTrId ("qtn_ener_charging"),
- "",
chargingImageId ());
break;
@@ -385,15 +396,15 @@
SYS_DEBUG ("Notifying NotificationChargingComplete");
utiliseLED (true, QString ("PatternBatteryFull"));
sendNotification (
+ "x-nokia.battery.chargingcomplete",
//% "Charging complete"
- qtTrId ("qtn_ener_charcomp"),
- "",
- "icon-m-energy-management-remove-charger");
+ qtTrId ("qtn_ener_charcomp"));
break;
case NotificationRemoveCharger:
SYS_DEBUG ("Notifying NotificationRemoveCharger");
sendNotification (
+ "x-nokia.battery.removecharger",
//% "Disconnect charger from power supply to save energy"
qtTrId ("qtn_ener_remcha"));
break;
@@ -401,53 +412,58 @@
case NotificationChargingNotStarted:
utiliseLED (false, QString ("PatternBatteryCharging"));
sendNotification (
+ "x-nokia.battery.chargingnotstarted",
//% "Charging not started. Replace charger."
- qtTrId ("qtn_ener_repcharger"),
- "IDF_WRONG_CHARGER",
- "icon-m-energy-management-replace-charger");
+ qtTrId ("qtn_ener_repcharger"));
break;
case NotificationRechargeBattery:
sendNotification (
+ "x-nokia.battery.recharge",
//% "Recharge battery"
- qtTrId ("qtn_ener_rebatt"),
- "IDF_RECHARGE_BATTERY",
- "icon-m-energy-management-recharge");
+ qtTrId ("qtn_ener_rebatt"));
break;
-
+
case NotificationEnteringPSM:
sendNotification (
+ "x-nokia.battery.enterpsm",
//% "Entering power save mode"
- qtTrId ("qtn_ener_ent_psnote"),
- "IDF_INFORMATION_STRONG");
+ qtTrId ("qtn_ener_ent_psnote"));
break;
-
+
case NotificationExitingPSM:
sendNotification (
+ "x-nokia.battery.exitpsm",
//% "Exiting power save mode"
- qtTrId ("qtn_ener_exit_psnote"),
- "IDF_INFORMATION_SOUND");
+ qtTrId ("qtn_ener_exit_psnote"));
break;
-
+
case NotificationLowBattery:
sendNotification (
+ "x-nokia.battery.lowbattery",
//% "Low battery"
- qtTrId ("qtn_ener_lowbatt"),
- "IDF_BATTERY_LOW",
- "icon-m-energy-management-low-battery");
+ qtTrId ("qtn_ener_lowbatt"));
+ break;
+
+ case NotificationNoEnoughPower:
+ sendNotification (
+ "x-nokia.battery.notenoughpower",
+ //% "Not enough power to charge"
+ qtTrId ("qtn_ener_nopowcharge"),
+ "icon-m-energy-management-insufficient-power");
break;
}
}
void
BatteryBusinessLogic::sendNotification (
+ const QString &eventType,
const QString &text,
- const QString &feedback,
const QString &icon)
{
- SYS_DEBUG ("*** text = %s", SYS_STR(text));
- SYS_DEBUG ("*** feedback = %s", SYS_STR(feedback));
- SYS_DEBUG ("*** icon = %s", SYS_STR(icon));
+ SYS_DEBUG ("*** text = %s", SYS_STR(text));
+ SYS_DEBUG ("*** eventType = %s", SYS_STR(eventType));
+ SYS_DEBUG ("*** icon = %s", SYS_STR(icon));
if (m_notification != 0) {
m_notification->remove ();
@@ -455,27 +471,18 @@
m_notification = 0;
}
- SYS_DEBUG ("+++ Sending MNotification");
-#ifdef UNIT_TEST
- /*
- * We send this signal before the actual notification so it will arrive as
- * soon as possible.
- */
- emit notificationSent (text, icon);
-#endif
- m_notification = new MNotification ("x-nokia.battery", text);
- m_notification->setImage (icon);
- m_notification->publish ();
-
-#ifndef UNIT_TEST
-/* FIXME ^^^: MComponentData::feedbackPlayer() -
- * MComponentData instance not yet created.
- */
- if (!feedback.isEmpty()) {
- MFeedback player (feedback);
- player.play();
- }
-#endif
+ /*
+ * We send this signal before the actual notification so it will arrive as
+ * soon as possible.
+ */
+ SYS_DEBUG ("Emitting notificationSent (%s, %s, %s)",
+ SYS_STR(eventType), SYS_STR(text), SYS_STR(icon));
+ emit notificationSent (eventType, text, icon);
+
+ m_notification = new MNotification (eventType, "", text);
+ if (!icon.isEmpty())
+ m_notification->setImage (icon);
+ m_notification->publish ();
}
QString
--- src/batterybusinesslogic.h
+++ src/batterybusinesslogic.h
@@ -1,3 +1,5 @@
+/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
+/* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary (-ies).
@@ -85,25 +87,25 @@
typedef enum {
NotificationCharging,
- NotificationChargingComplete,
- NotificationRemoveCharger,
- NotificationChargingNotStarted,
- NotificationRechargeBattery,
- NotificationEnteringPSM,
- NotificationExitingPSM,
- NotificationLowBattery,
+ NotificationChargingComplete,
+ NotificationRemoveCharger,
+ NotificationChargingNotStarted,
+ NotificationRechargeBattery,
+ NotificationEnteringPSM,
+ NotificationExitingPSM,
+ NotificationLowBattery,
+ NotificationNoEnoughPower,
} NotificationID;
signals:
-#ifdef UNIT_TEST
/*
* To simplify the test case we use this signal that we can catch. See
* NB#171466 for further details.
*/
void notificationSent (
+ QString eventType,
QString text,
QString icon);
-#endif
public slots:
void initBattery ();
@@ -121,9 +123,9 @@
private:
void sendNotification (BatteryBusinessLogic::NotificationID id);
void sendNotification (
- const QString &text,
- const QString &feedback = QString(""),
- const QString &icon = QString(""));
+ const QString &eventType,
+ const QString &text,
+ const QString &icon = QString(""));
QString chargingImageId ();
LowBatteryNotifier *m_LowBatteryNotifier;
--- src/lockscreenbusinesslogic.cpp
+++ src/lockscreenbusinesslogic.cpp
@@ -26,6 +26,7 @@
#include "lockscreenbusinesslogic.h"
#undef DEBUG
+#define WARNING
#include "debug.h"
#include <X11/Xlib.h>
@@ -64,15 +65,22 @@
* screen updates and wakeups.
*/
connectSuccess = connect (
- &m_QmDisplay,
+ &m_QmDisplay,
SIGNAL(displayStateChanged (Maemo::QmDisplayState::DisplayState)),
- this,
+ this,
SLOT(displayStateChanged (Maemo::QmDisplayState::DisplayState)));
Q_ASSERT (connectSuccess);
+
+ connectSuccess = connect (
+ &m_QmLocks,
+ SIGNAL(stateChanged (Maemo::QmLocks::Lock, Maemo::QmLocks::State)),
+ this,
+ SLOT(locksChanged (Maemo::QmLocks::Lock, Maemo::QmLocks::State)));
+ Q_ASSERT (connectSuccess);
#endif
-
+
/*
- * Connecting to timer that refreshes the
+ * Connecting to timer that refreshes the date-time label
*/
connectSuccess = connect (&timer, SIGNAL (timeout ()),
lockUI, SLOT (updateDateTime ()));
@@ -122,9 +130,16 @@
* off we need to start it.
*/
if (state == Maemo::QmDisplayState::On &&
- lockUI != NULL && lockUI->isVisible() &&
- !timer.isActive())
- mayStartTimer ();
+ lockUI != NULL && lockUI->isVisible ())
+ {
+ if (timer.isActive () == false)
+ mayStartTimer ();
+ /*
+ * Also we should reset the lock-screen-ui dnd icon state:
+ */
+ lockUI->reset();
+ lockUI->setFocus ();
+ }
}
#endif
@@ -153,8 +168,8 @@
lockUI->hide();
mayStopTimer ();
}
-
- emit screenIsLocked (toggle);
+
+// emit screenIsLocked (toggle);
}
void
@@ -167,9 +182,9 @@
} else {
eaterUI->hide ();
}
-
+
// Enable the unlock notification sink also for dimmed state:
- emit screenIsLocked (toggle);
+// emit screenIsLocked (toggle);
}
void
@@ -217,3 +232,26 @@
return retval;
}
+#if HAVE_QMSYSTEM
+void
+LockScreenBusinessLogic::locksChanged (
+ Maemo::QmLocks::Lock what,
+ Maemo::QmLocks::State how)
+{
+ if (what == Maemo::QmLocks::TouchAndKeyboard)
+ {
+ switch (how)
+ {
+ case Maemo::QmLocks::Locked:
+ SYS_DEBUG ("Locked");
+ emit screenIsLocked (true);
+ break;
+ default:
+ SYS_DEBUG ("Unlocked");
+ emit screenIsLocked (false);
+ break;
+ }
+ }
+}
+#endif
+
--- src/lockscreenbusinesslogic.h
+++ src/lockscreenbusinesslogic.h
@@ -23,6 +23,7 @@
#include <QTimer>
#ifdef HAVE_QMSYSTEM
+#include <qmlocks.h>
#include <qmdisplaystate.h>
#endif
@@ -46,6 +47,7 @@
void hideEventEater();
#ifdef HAVE_QMSYSTEM
void displayStateChanged (Maemo::QmDisplayState::DisplayState state);
+ void locksChanged (Maemo::QmLocks::Lock what, Maemo::QmLocks::State how);
#endif
signals:
@@ -63,6 +65,7 @@
EventEaterUI *eaterUI;
#ifdef HAVE_QMSYSTEM
Maemo::QmDisplayState m_QmDisplay;
+ Maemo::QmLocks m_QmLocks;
#endif
QTimer timer;
#ifdef UNIT_TEST
--- src/lockscreenui.cpp
+++ src/lockscreenui.cpp
@@ -30,6 +30,7 @@
#include <QTimer>
#include <QPointF>
+#include <MTheme>
#include <MApplication>
#include <MWindow>
#include <MGConfItem>
@@ -37,11 +38,12 @@
#include <MLayout>
#include <MSceneManager>
#include <MLinearLayoutPolicy>
+#include <MFeedback>
#include "mwidgetcreator.h"
M_REGISTER_WIDGET_NO_CREATE(LockScreenUI)
-#define DEBUG
+#undef DEBUG
#define WARNING
#include "debug.h"
@@ -49,11 +51,6 @@
#include <X11/Xlib.h>
#include <X11/Xatom.h>
-static const QString defaultLandscapeImageFile =
-"/usr/share/themes/base/meegotouch/duihome/images/HomeWallpaperLandscape.png";
-static const QString defaultPortraitImageFile =
-"/usr/share/themes/base/meegotouch/duihome/images/HomeWallpaperPortrait.png";
-
#define GCONF_BG_LANDSCAPE \
"/desktop/meego/background/landscape/picture_filename"
#define GCONF_BG_PORTRAIT \
@@ -106,11 +103,8 @@
QString filename = m_confBgLandscape->value().toString();
bool success;
- /*
- * This is hard-coded into duihome, so we have to hardcode too.
- */
if (filename.isEmpty())
- filename = defaultLandscapeImageFile;
+ return;
SYS_DEBUG ("landscape value = %s", SYS_STR(filename));
success = m_bgLandscape.load (filename);
@@ -125,11 +119,8 @@
QString filename = m_confBgPortrait->value().toString();
bool success;
- /*
- * This is hard-coded into duihome, so we have to hardcode too.
- */
if (filename.isEmpty())
- filename = defaultPortraitImageFile;
+ return;
SYS_DEBUG ("portrait value = %s", SYS_STR(filename));
success = m_bgPortrait.load (filename);
@@ -171,14 +162,29 @@
void
LockScreenWindow::mousePressEvent (QGraphicsSceneMouseEvent *event)
{
+ bool startDnD = false;
+
if (m_LockLiftArea == 0)
return;
+ if ((m_LockLiftArea->pos ().y () + m_LockLiftArea->preferredHeight ()) >
+ event->pos ().y ())
+ {
+ if (m_LockLiftArea->layoutDirection () == Qt::RightToLeft)
+ {
+ // Icon position in RTL layout direction
+ startDnD = event->pos ().x () < 160;
+ }
+ else
+ {
+ // Icon position in LTR layout direction
+ startDnD = event->pos ().x () > m_LockLiftArea->preferredWidth () - 160;
+ }
+ }
+
// We should go to STATE_MOVING state if user tappend on
// the top-right corner of the window...
- if (((m_LockLiftArea->pos ().y () + m_LockLiftArea->preferredHeight ()) >
- event->pos ().y ()) &&
- (event->pos ().x () > m_LockLiftArea->preferredWidth () - 160))
+ if (startDnD)
{
m_DnDstate = STATE_MOVING;
@@ -193,6 +199,12 @@
updateDnDicon ();
static_cast<UnlockHeader*>(m_LockLiftArea)->setActive (false);
static_cast<UnlockArea*> (m_LockLandArea)->setEnabled (true);
+
+ /*
+ * Playing the appropriate feedback.
+ */
+ MFeedback feedback ("start-dragndrop");
+ feedback.play ();
}
else
m_DnDstate = STATE_NONE;
@@ -225,14 +237,25 @@
// To avoid unnecessary screen updates...
if (newState != m_DnDstate)
{
+ MFeedback feedback;
m_DnDstate = newState;
switch (newState)
{
case STATE_MOVING_ACTIVE:
+ /*
+ * Entered the active area.
+ */
+ feedback.setName ("enter-dragndrop-dropzone");
+ feedback.play ();
static_cast<UnlockArea*>(m_LockLandArea)->setActive (true);
break;
case STATE_MOVING:
default:
+ /*
+ * Exited the active area.
+ */
+ feedback.setName ("exit-dragndrop-dropzone");
+ feedback.play ();
static_cast<UnlockArea*>(m_LockLandArea)->setActive (false);
break;
}
@@ -245,17 +268,31 @@
LockScreenWindow::mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
{
Q_UNUSED (event);
+ bool unlock = false;
+ MFeedback feedback;
- if (m_DnDstate == STATE_NONE)
+ if (m_DnDstate == STATE_NONE) {
return;
+ }
if (m_DnDstate == STATE_MOVING_ACTIVE)
- {
- emit unlocked ();
+ unlock = true;
+
+ /*
+ * Playing the appropriate feedback.
+ */
+ if (unlock) {
+ feedback.setName ("release-inside-dragndrop-dropzone");
+ } else {
+ feedback.setName ("release-outside-dragndrop-dropzone");
}
+ feedback.play ();
- // And finally reset the state to defaults...
+ // Reset the state to defaults...
resetState ();
+
+ if (unlock == true)
+ emit unlocked ();
}
void
@@ -346,7 +383,6 @@
void
LockScreenUI::realize ()
{
- MLayout *layout;
SYS_DEBUG ("");
if (m_Realized)
@@ -357,8 +393,7 @@
/*
* The main layout and its policy
*/
- layout = new MLayout;
- m_policy = new MLinearLayoutPolicy (layout, Qt::Vertical);
+ m_policy = new QGraphicsLinearLayout (Qt::Vertical);
m_policy->setContentsMargins (0., 0., 0., 0.);
m_policy->setSpacing (0.);
@@ -370,7 +405,8 @@
m_notificationArea->setVisible (false);
connect (m_notificationArea, SIGNAL (needToShow (bool)),
- this, SLOT (showHideNotifications (bool)));
+ this, SLOT (showHideNotifications (bool)),
+ Qt::DirectConnection);
/*
* The upper part of the lock-screen ui, this shows the
@@ -387,7 +423,7 @@
// Set the main layout
m_SceneWindow =
new LockScreenWindow (this, m_LockLiftArea, m_LockLandArea);
- m_SceneWindow->setLayout (layout);
+ m_SceneWindow->setLayout (m_policy);
m_SceneWindow->appear (this);
connect (m_SceneWindow, SIGNAL (unlocked ()),
@@ -522,6 +558,7 @@
SYS_DEBUG ("");
setAttribute(Qt::WA_TranslucentBackground);
setAttribute(Qt::WA_X11NetWmWindowTypeDialog);
+ setAttribute(Qt::WA_X11DoNotAcceptFocus);
setObjectName ("EventEaterUI");
setProperty ("NoMStyle", true);
}
@@ -572,7 +609,7 @@
Atom utf8StringAtom;
Atom stackingLayerAtom;
const char *windowName = "EventEaterUI";
- long layer = 1;
+ long layer = 6;
display = QX11Info::display ();
if (!display) {
@@ -616,3 +653,4 @@
8, PropModeReplace,
(unsigned char *) windowName, strlen(windowName));
}
+
--- src/lockscreenui.h
+++ src/lockscreenui.h
@@ -30,7 +30,7 @@
class QPointF;
class QPixmap;
class MWidget;
-class MLinearLayoutPolicy;
+class QGraphicsLinearLayout;
class QGraphicsSceneMouseEvent;
class MGConfItem;
class QShowEvent;
@@ -118,9 +118,9 @@
void showHideNotifications (bool show);
private:
- bool m_Realized;
- MLinearLayoutPolicy *m_policy;
- LockScreenWindow *m_SceneWindow;
+ bool m_Realized;
+ QGraphicsLinearLayout *m_policy;
+ LockScreenWindow *m_SceneWindow;
MWidget *m_notificationArea;
MWidget *m_LockLiftArea;
--- src/main.cpp
+++ src/main.cpp
@@ -27,6 +27,7 @@
#include "sysuid.h"
#include <MApplication>
+#include <MApplicationService>
#include <QObject>
#undef DEBUG
@@ -109,7 +110,27 @@
}
#endif
-int main (int argc, char** argv)
+class SystemUIservice : public MApplicationService
+{
+
+public:
+ SystemUIservice (QObject *parent = 0) :
+ MApplicationService ("com.nokia.sysuid", parent)
+ {
+ }
+
+ void launch ()
+ {
+ SYS_DEBUG ("");
+ /*
+ * No operation, we must not let meegotouch to
+ * raise/activate some hidden sysuid window..
+ */
+ }
+};
+
+int
+main (int argc, char** argv)
{
SYS_DEBUG ("- System-UI start");
#ifdef DEBUG
@@ -136,7 +157,7 @@
signal (SIGINT, sysuid_exit);
#endif
- MApplication app (argc, argv);
+ MApplication app (argc, argv, new SystemUIservice);
exitPtr = &app;
app.setQuitOnLastWindowClosed (false);
--- src/notifications/eventtypes/x-nokia.battery.chargingcomplete.conf
+++ src/notifications/eventtypes/x-nokia.battery.chargingcomplete.conf
+iconId=icon-m-energy-management-remove-charger
+class=system
--- src/notifications/eventtypes/x-nokia.battery.chargingnotstarted.conf
+++ src/notifications/eventtypes/x-nokia.battery.chargingnotstarted.conf
+iconId=icon-m-energy-management-replace-charger
+class=system
+feedbackId=IDF_WRONG_CHARGER
--- src/notifications/eventtypes/x-nokia.battery.enterpsm.conf
+++ src/notifications/eventtypes/x-nokia.battery.enterpsm.conf
+iconId=icon-m-energy-management-battery-verylow
+class=system
+feedbackId=IDF_INFORMATION_STRONG
--- src/notifications/eventtypes/x-nokia.battery.exitpsm.conf
+++ src/notifications/eventtypes/x-nokia.battery.exitpsm.conf
+iconId=icon-m-energy-management-battery-verylow
+class=system
+feedbackId=IDF_INFORMATION_SOUND
--- src/notifications/eventtypes/x-nokia.battery.lowbattery.conf
+++ src/notifications/eventtypes/x-nokia.battery.lowbattery.conf
+iconId=icon-m-energy-management-battery-low
+class=system
+feedbackId=IDF_BATTERY_LOW
--- src/notifications/eventtypes/x-nokia.battery.notenoughpower.conf
+++ src/notifications/eventtypes/x-nokia.battery.notenoughpower.conf
+iconId=icon-m-energy-management-insufficient-power
+class=system
--- src/notifications/eventtypes/x-nokia.battery.recharge.conf
+++ src/notifications/eventtypes/x-nokia.battery.recharge.conf
+iconId=icon-m-energy-management-battery-verylow
+class=system
+feedbackId=IDF_RECHARGE_BATTERY
--- src/notifications/eventtypes/x-nokia.battery.removecharger.conf
+++ src/notifications/eventtypes/x-nokia.battery.removecharger.conf
+iconId=icon-m-energy-management-remove-charger
+class=system
--- src/notifications/eventtypes/x-nokia.battery.shutdown.conf
+++ src/notifications/eventtypes/x-nokia.battery.shutdown.conf
+iconId=icon-m-energy-management-battery-verylow
+class=system
+feedbackId=IDF_RECHARGE_BATTERY
--- src/notifications/eventtypes/x-nokia.battery.temperature.conf
+++ src/notifications/eventtypes/x-nokia.battery.temperature.conf
+iconId=icon-m-notification-temperature
+class=system
+feedbackId=IDF_INFORMATION_STRONG
--- src/notifications/genericnotificationparameterfactory.h
+++ src/notifications/genericnotificationparameterfactory.h
@@ -57,6 +57,10 @@
return QString("class");
}
+ static QString unseenKey() {
+ return QString("unseen");
+ }
+
/*!
* Creates a NotificationParameter with the given event type.
*
--- src/notifications/mcompositornotificationsink.cpp
+++ src/notifications/mcompositornotificationsink.cpp
@@ -22,14 +22,26 @@
#include <MSceneManager>
#include <MOnDisplayChangeEvent>
#include <QApplication>
+#include <MGConfItem>
+
+static const QString NOTIFICATION_PREVIEW_ENABLED = "/desktop/meego/notifications/previews_enabled";
MCompositorNotificationSink::MCompositorNotificationSink() :
- sinkDisabled(false),
- window(new MWindow())
+ sinkDisabled(false), allPreviewsDisabled(false),
+ window(new MWindow)
{
window->setTranslucentBackground(true);
+ window->setAttribute(Qt::WA_X11DoNotAcceptFocus);
window->setAttribute(Qt::WA_X11NetWmWindowTypeNotification);
window->setObjectName("MCompositorNotificationSinkWindow");
+
+ notificationPreviewMode = new MGConfItem(NOTIFICATION_PREVIEW_ENABLED, this);
+ changeNotificationPreviewMode();
+ connect(notificationPreviewMode, SIGNAL(valueChanged()), this, SLOT(changeNotificationPreviewMode()));
+
+ // Clear the mask for the duration of orientation change, because the mask is not rotated along with the notification
+ connect(window->sceneManager(), SIGNAL(orientationAboutToChange(M::Orientation)), this, SLOT(clearWindowMask()));
+ connect(window->sceneManager(), SIGNAL(orientationChangeFinished(M::Orientation)), this, SLOT(updateWindowMask()));
}
MCompositorNotificationSink::~MCompositorNotificationSink()
@@ -47,7 +59,7 @@
return;
}
- if (sinkDisabled) {
+ if ((sinkDisabled && notification.type() != Notification::SystemEvent) || allPreviewsDisabled ) {
emit notificationAdded(notification);
return;
}
@@ -56,46 +68,55 @@
// The notification already exists so update it
updateNotification(notification);
} else {
- window->show();
- currentNotification = notification;
-
- // Create and set up info banner widget
- MInfoBanner *infoBanner = createInfoBanner(currentNotification);
- setupWindowTimer(infoBanner);
+ // Create and set up info banner widget
+ MBanner *banner = createInfoBanner(notification);
+ setupWindowTimer(banner, notification);
// Keep track of the mapping between IDs and private notification information classes
- idToBanner.insert(currentNotification.notificationId(), infoBanner);
- emit notificationAdded(currentNotification);
+ idToBanner.insert(notification.notificationId(), banner);
+ currentBanners.append(banner);
+ emit notificationAdded(notification);
- //TODO: Remove sending fake displaychange events when setTranslucentBackground bug is solved
- connect(window, SIGNAL(displayEntered()), this, SLOT(addInfoBannerToWindow()));
- MOnDisplayChangeEvent* event = new MOnDisplayChangeEvent(true, QRectF(0,0,1,1));
- QApplication::sendEvent(window,event);
+ // Check whether the window was open
+ bool windowWasOpen = window->isVisible();
+
+ // Make sure the window is open now
+ showOrHideWindow();
+
+ if (windowWasOpen) {
+ // If the window was already open the latest banner can directly be added to the window
+ addLatestBannerToWindow();
+ } else {
+ // If the window was not open yet a fake display change event is needed so that the banner will animate (since otherwise it thinks it's not on display)
+ connect(window, SIGNAL(displayEntered()), this, SLOT(addLatestBannerToWindow()));
+ MOnDisplayChangeEvent* event = new MOnDisplayChangeEvent(true, QRectF(0, 0, 1, 1));
+ QApplication::sendEvent(window, event);
+ }
}
}
-void MCompositorNotificationSink::setupWindowTimer(MInfoBanner *infoBanner)
+void MCompositorNotificationSink::setupWindowTimer(MBanner *banner, const Notification ¬ification)
{
- // Create a timer for the info banner; make it a child of the infobanner so it is destroyed automatically
- QTimer *timer = new QTimer(infoBanner);
+ // Create a timer for the banner; make it a child of the banner so it is destroyed automatically
+ QTimer *timer = new QTimer(banner);
connect(timer, SIGNAL(timeout()), this, SLOT(timeout()));
timer->setSingleShot(true);
- timer->setProperty("notificationId", currentNotification.notificationId());
- timer->start(currentNotification.timeout());
+ timer->setProperty("notificationId", notification.notificationId());
+ timer->start(notification.timeout());
}
void MCompositorNotificationSink::updateNotification(const Notification ¬ification)
{
- MInfoBanner *infoBanner = idToBanner.value(notification.notificationId());
+ MBanner *banner = idToBanner.value(notification.notificationId());
- if (infoBanner) {
+ if (banner) {
// Update the info banner widget
- infoBanner->setImageID(notification.parameters().value(NotificationWidgetParameterFactory::imageIdKey()).toString());
- infoBanner->setBodyText(infoBannerBodyText(notification.parameters()));
- infoBanner->setIconID(determineIconId(notification.parameters()));
+ banner->setTitle(infoBannerTitleText(notification.parameters()));
+ banner->setSubtitle(infoBannerSubtitleText(notification.parameters()));
+ banner->setIconID(determineIconId(notification.parameters()));
// Update the info banner's actions
- updateActions(infoBanner, notification.parameters());
+ updateActions(banner, notification.parameters());
}
}
@@ -106,19 +127,52 @@
void MCompositorNotificationSink::notificationDone(uint notificationId, bool notificationIdInUse)
{
- MInfoBanner *infoBanner = idToBanner.take(notificationId);
- if (infoBanner != NULL) {
- window->sceneManager()->disappearSceneWindow(infoBanner);
- connect(infoBanner, SIGNAL(disappeared()), this, SLOT(hideWindow()));
+ MBanner *banner = idToBanner.take(notificationId);
+ if (banner != NULL) {
+ window->sceneManager()->disappearSceneWindow(banner);
+ connect(banner, SIGNAL(disappeared()), this, SLOT(removeBannerFromCurrentBanners()));
}
if (notificationIdInUse) {
idToBanner.insert(notificationId, NULL);
}
}
-void MCompositorNotificationSink::hideWindow()
+void MCompositorNotificationSink::showOrHideWindow()
+{
+ if (window->isVisible() == currentBanners.isEmpty()) {
+ // If the window is visible when there are no banners or is not visible when there are banners something needs to be done
+ if (currentBanners.isEmpty()) {
+ // If there are no banners to be shown the window should not be visible
+ window->hide();
+ } else {
+ // If there is at least one banner to show the window should be visible
+ window->show();
+ }
+ }
+}
+
+void MCompositorNotificationSink::addLatestBannerToWindow()
{
- window->hide();
+ if (!currentBanners.isEmpty()) {
+ // The latest banner should be shown
+ MBanner *banner = currentBanners.last();
+ window->sceneManager()->appearSceneWindow(banner, MSceneWindow::DestroyWhenDone);
+ updateWindowMask();
+ disconnect(window, SIGNAL(displayEntered()), this, SLOT(addLatestBannerToWindow()));
+ } else {
+ // If the window timer has timed out before displayEntered() was sent there is no banner anymore and the window should just be hidden
+ showOrHideWindow();
+ }
+}
+
+void MCompositorNotificationSink::removeBannerFromCurrentBanners()
+{
+ MBanner *banner = qobject_cast<MBanner *>(sender());
+
+ if (banner != NULL) {
+ currentBanners.removeAll(banner);
+ showOrHideWindow();
+ }
}
void MCompositorNotificationSink::timeout()
@@ -142,14 +196,47 @@
sinkDisabled = disabled;
}
-void MCompositorNotificationSink::addInfoBannerToWindow()
+void MCompositorNotificationSink::updateWindowMask()
{
- MInfoBanner *infoBanner = idToBanner.value(currentNotification.notificationId());
- if (infoBanner != NULL) {
- window->sceneManager()->appearSceneWindow(infoBanner, MSceneWindow::DestroyWhenDone);
- disconnect(window, SIGNAL(displayEntered()), this, SLOT(addInfoBannerToWindow()));
- } else {
- // If the window timer has timed out before displayEntered() was sent there is no banner anymore and the window should just be hidden
- window->hide();
+ // Set up window mask so that mouse events are passed on to lower widgets.
+ if (!currentBanners.isEmpty()) {
+ MBanner *banner = currentBanners.last();
+ QSize size = banner->preferredSize().toSize();
+ QPoint origin;
+
+ switch(window->sceneManager()->orientationAngle()) {
+ case M::Angle90:
+ size.transpose();
+ origin.setX(window->width() - size.width() - banner->pos().y());
+ origin.setY(banner->pos().x());
+ break;
+ case M::Angle270:
+ size.transpose();
+ origin.setX(banner->pos().y());
+ origin.setY(-banner->pos().x());
+ break;
+ case M::Angle180:
+ origin.setY(window->height() - size.height() - banner->pos().y());
+ origin.setX(-banner->pos().x());
+ break;
+ default:
+ origin = banner->pos().toPoint();
+ break;
+ }
+ window->setMask(QRegion(QRect(origin, size), QRegion::Rectangle));
}
}
+
+void MCompositorNotificationSink::clearWindowMask()
+{
+ window->clearMask();
+}
+
+void MCompositorNotificationSink::changeNotificationPreviewMode()
+{
+ QVariant gconfValue = notificationPreviewMode->value();
+ if (gconfValue.isValid() && (gconfValue.type() == QVariant::Bool)) {
+ allPreviewsDisabled = !gconfValue.toBool();
+ }
+}
+
--- src/notifications/mcompositornotificationsink.h
+++ src/notifications/mcompositornotificationsink.h
@@ -23,8 +23,8 @@
#include <QHash>
#include "widgetnotificationsink.h"
-class QTimer;
-class MInfoBanner;
+class MBanner;
+class MGConfItem;
/*!
* MCompositorNotificationSink implements the NotificationSink interface for
@@ -73,14 +73,34 @@
void setDisabled(bool disabled);
/*!
- * Adds an infobanner to a fullscreen window which was created earlier.
+ * Shows or hides the fullscreen window based on whether there are banners to be shown in it.
+ */
+ void showOrHideWindow();
+
+ /*!
+ * Adds the latest banner to a fullscreen window which was created earlier.
+ */
+ void addLatestBannerToWindow();
+
+ /*!
+ * Removes a banner from the current banners when it disappears off the screen after timeout.
*/
- void addInfoBannerToWindow();
+ void removeBannerFromCurrentBanners();
/*!
- * Hides window when the infobanner disappears off the screen after timeout.
+ * Enables or disables Notification Previews according to provided GConf key
*/
- void hideWindow();
+ void changeNotificationPreviewMode();
+
+ /*!
+ * Updates the window mask to contain the current notification
+ */
+ void updateWindowMask();
+
+ /*!
+ * Clears the window mask
+ */
+ void clearWindowMask();
private:
/*!
@@ -99,22 +119,34 @@
void notificationDone(uint notificationId, bool notificationIdInUse);
/*!
- * sets up a timer for the window disappearing
- * \param banner MInfoBanner whose disappearance it handles. Timer would be parented to this banner.
+ * Sets up a timer for the banner disappearing
+ *
+ * \param banner MBanner whose disappearance it handles. Timer would be parented to this banner.
+ * \param notification the notification associated with the banner
*/
- void setupWindowTimer(MInfoBanner *banner);
+ void setupWindowTimer(MBanner *banner, const Notification ¬ification);
//! A mapping between notification IDs and info banners
- QHash<uint, MInfoBanner *> idToBanner;
+ QHash<uint, MBanner *> idToBanner;
//! Whether the sink is currently showing notifications or just transferring them
bool sinkDisabled;
+ //! Similar than sinkDisabled, but also system notifications are disabled
+ bool allPreviewsDisabled;
+
//! Full screen window for the notification
MWindow* window;
- //! Current notification which is being shown
- Notification currentNotification;
+ //! GConf item which tracks if notification previews are enabled
+ MGConfItem* notificationPreviewMode;
+
+ //! The banners currently being displayed, oldest first
+ QList<MBanner *> currentBanners;
+
+#ifdef UNIT_TEST
+ friend class Ut_MCompositorNotificationSink;
+#endif
};
#endif /* MCOMPOSITORNOTIFICATIONSINK_H_ */
--- src/notifications/ngfadapter.cpp
+++ src/notifications/ngfadapter.cpp
@@ -67,8 +67,15 @@
{
}
-void NGFAdapter::play(const QString &)
+uint NGFAdapter::play(const QString &id)
{
+ Q_UNUSED (id);
+ return 0;
+}
+
+void NGFAdapter::stop(uint eventId)
+{
+ Q_UNUSED (eventId);
}
bool NGFAdapter::isValid()
--- src/notifications/notificationareasink.cpp
+++ src/notifications/notificationareasink.cpp
@@ -20,7 +20,7 @@
#include "notificationareasink.h"
#include "notificationwidgetparameterfactory.h"
-#include <MInfoBanner>
+#include <MBanner>
#include <MRemoteAction>
NotificationAreaSink::NotificationAreaSink()
@@ -30,17 +30,17 @@
NotificationAreaSink::~NotificationAreaSink()
{
// Destroy the remaining notifications
- foreach(MInfoBanner * n, notificationIdToMInfoBanner) {
+ foreach(MBanner * n, notificationIdToMBanner) {
delete n;
}
// Destroy the remaining groups
- foreach(MInfoBanner * n, groupIdToMInfoBanner) {
+ foreach(MBanner * n, groupIdToMBanner) {
delete n;
}
}
-void NotificationAreaSink::setupInfoBanner(MInfoBanner *infoBanner)
+void NotificationAreaSink::setupInfoBanner(MBanner *infoBanner)
{
// Don't allow the scene manager to destroy the banner
infoBanner->setManagedManually(true);
@@ -49,11 +49,11 @@
connect(infoBanner, SIGNAL(clicked()), this, SIGNAL(bannerClicked()), Qt::QueuedConnection);
}
-MInfoBanner *NotificationAreaSink::updateNotification(MInfoBanner *infoBanner, const NotificationParameters ¶meters)
+MBanner *NotificationAreaSink::updateNotification(MBanner *infoBanner, const NotificationParameters ¶meters)
{
// Update the info banner widget
- infoBanner->setImageID(parameters.value(NotificationWidgetParameterFactory::imageIdKey()).toString());
- infoBanner->setBodyText(infoBannerBodyText(parameters));
+ infoBanner->setTitle(infoBannerTitleText(parameters));
+ infoBanner->setSubtitle(infoBannerSubtitleText(parameters));
infoBanner->setIconID(determineIconId(parameters));
infoBanner->setProperty(USER_REMOVABLE_PROPERTY, determineUserRemovability(parameters));
@@ -64,22 +64,22 @@
void NotificationAreaSink::addGroup(uint groupId, const NotificationParameters ¶meters)
{
- MInfoBanner *infoBanner = groupIdToMInfoBanner.value(groupId);
+ MBanner *infoBanner = groupIdToMBanner.value(groupId);
if (infoBanner != NULL) {
// If the info banner is already in the map, only update it
updateNotification(infoBanner, parameters);
} else {
// Keep track of the mapping between IDs and info banners
- MInfoBanner *infoBanner = createInfoBanner(MInfoBanner::Event, groupId, parameters);
+ MBanner *infoBanner = createInfoBanner(Notification::ApplicationEvent, groupId, parameters);
setupInfoBanner(infoBanner);
- groupIdToMInfoBanner.insert(groupId, infoBanner);
+ groupIdToMBanner.insert(groupId, infoBanner);
}
}
void NotificationAreaSink::removeGroup(uint groupId)
{
- if (groupIdToMInfoBanner.contains(groupId)) {
- MInfoBanner *infoBanner = groupIdToMInfoBanner.take(groupId);
+ if (groupIdToMBanner.contains(groupId)) {
+ MBanner *infoBanner = groupIdToMBanner.take(groupId);
// If the group is already visible, send signal to remove it
if (infoBanner && infoBanner->parentItem()) {
@@ -95,14 +95,14 @@
void NotificationAreaSink::removeGroupBanner(uint groupId)
{
- if (groupIdToMInfoBanner.contains(groupId)) {
- MInfoBanner *infoBanner = groupIdToMInfoBanner.value(groupId);
+ if (groupIdToMBanner.contains(groupId)) {
+ MBanner *infoBanner = groupIdToMBanner.value(groupId);
// If the group is already visible, send signal to remove it
if (infoBanner && infoBanner->parentItem()) {
// Remove from the notification area
emit removeNotification(*infoBanner);
- groupIdToMInfoBanner.insert(groupId,NULL);
+ groupIdToMBanner.insert(groupId,NULL);
// Destroy
delete infoBanner;
deleteGroupFromNotificationCountOfGroup(groupId);
@@ -128,22 +128,22 @@
notificationIdToGroupId.insert(notification.notificationId(), notification.groupId());
}
-MInfoBanner* NotificationAreaSink::reviveGroupBanner(const Notification ¬ification)
+MBanner* NotificationAreaSink::reviveGroupBanner(const Notification ¬ification)
{
- MInfoBanner *infoBanner = createInfoBanner(MInfoBanner::Event, notification.groupId(), notification.parameters());
+ MBanner *infoBanner = createInfoBanner(Notification::ApplicationEvent, notification.groupId(), notification.parameters());
setupInfoBanner(infoBanner);
infoBanner->setParentItem(NULL);
- groupIdToMInfoBanner.insert(notification.groupId(), infoBanner);
+ groupIdToMBanner.insert(notification.groupId(), infoBanner);
return infoBanner;
}
void NotificationAreaSink::addNotificationToGroup(const Notification ¬ification)
{
// Does the group id exist ?
- if(groupIdToMInfoBanner.contains(notification.groupId())) {
+ if(groupIdToMBanner.contains(notification.groupId())) {
increaseNotificationCountOfGroup(notification);
// Yes it does, so get the banner associated with this.
- MInfoBanner *infoBanner = groupIdToMInfoBanner.value(notification.groupId());
+ MBanner *infoBanner = groupIdToMBanner.value(notification.groupId());
if(infoBanner == NULL) {
// Seems like the infoBanner is NULL. So it means that the group banner was removed, but group is alive. Revive the banner.
@@ -162,14 +162,14 @@
void NotificationAreaSink::addStandAloneNotification(const Notification ¬ification)
{
// The notification is not in a group, add it as such to notification area
- MInfoBanner *infoBanner = notificationIdToMInfoBanner.value(notification.notificationId());
+ MBanner *infoBanner = notificationIdToMBanner.value(notification.notificationId());
if (infoBanner != NULL) {
// If the notification is already in the map, only update it
updateNotification(infoBanner, notification.parameters());
} else {
infoBanner = createInfoBanner(notification);
setupInfoBanner(infoBanner);
- notificationIdToMInfoBanner.insert(notification.notificationId(), infoBanner);
+ notificationIdToMBanner.insert(notification.notificationId(), infoBanner);
// Add to the notification area
emit addNotification(*infoBanner);
}
@@ -189,14 +189,14 @@
void NotificationAreaSink::removeNotification(uint notificationId)
{
- if (notificationIdToMInfoBanner.contains(notificationId)) {
- MInfoBanner *infoBanner = notificationIdToMInfoBanner.take(notificationId);
+ if (notificationIdToMBanner.contains(notificationId)) {
+ MBanner *infoBanner = notificationIdToMBanner.take(notificationId);
if (infoBanner != NULL) {
- if (!notificationIdToMInfoBanner.keys(infoBanner).isEmpty()) {
+ if (!notificationIdToMBanner.keys(infoBanner).isEmpty()) {
// The info banner represents a single notification: Remove the notification ID mapping
- foreach(uint key, notificationIdToMInfoBanner.keys(infoBanner)) {
- notificationIdToMInfoBanner.remove(key);
+ foreach(uint key, notificationIdToMBanner.keys(infoBanner)) {
+ notificationIdToMBanner.remove(key);
}
}
// Remove from the notification area
--- src/notifications/notificationareasink.h
+++ src/notifications/notificationareasink.h
@@ -22,7 +22,7 @@
#include "widgetnotificationsink.h"
-class MInfoBanner;
+class MBanner;
/*!
* A notification sink for the NotificationArea.
@@ -54,16 +54,16 @@
/*!
* Adds a notification to a notification area.
*
- * \param notification the MInfoBanner to be added
+ * \param notification the MBanner to be added
*/
- void addNotification(MInfoBanner ¬ification);
+ void addNotification(MBanner ¬ification);
/*!
* Removes a notification from a notification area.
*
- * \param notification the MInfoBanner to be removed
+ * \param notification the MBanner to be removed
*/
- void removeNotification(MInfoBanner ¬ification);
+ void removeNotification(MBanner ¬ification);
/*!
* Signal that notification was clicked .
@@ -75,19 +75,19 @@
*
* \param banner The group banner to which a notification has been added
*/
- void notificationAddedToGroup(MInfoBanner &banner);
+ void notificationAddedToGroup(MBanner &banner);
private:
//! Sets up the info banner can connects its signals
- void setupInfoBanner(MInfoBanner *infoBanner);
+ void setupInfoBanner(MBanner *infoBanner);
//! Updates a notification widget
- MInfoBanner *updateNotification(MInfoBanner *dn, const NotificationParameters ¶meters);
+ MBanner *updateNotification(MBanner *dn, const NotificationParameters ¶meters);
- //! A mapping between notification IDs and MInfoBanner widgets
- QHash<uint, MInfoBanner *> notificationIdToMInfoBanner;
+ //! A mapping between notification IDs and MBanner widgets
+ QHash<uint, MBanner *> notificationIdToMBanner;
- //! A mapping between group IDs and MInfoBanner widgets
- QHash<uint, MInfoBanner *> groupIdToMInfoBanner;
+ //! A mapping between group IDs and MBanner widgets
+ QHash<uint, MBanner *> groupIdToMBanner;
//! A mapping between group and count of notifications belonging to this group
QHash<uint, uint> notificationCountOfGroup;
@@ -101,7 +101,7 @@
//! Increases notification count for the group to which this notification belongs by 1
void increaseNotificationCountOfGroup(const Notification ¬ification);
//! Recreates the banner for group which was clicked and hence lost the banner
- MInfoBanner* reviveGroupBanner(const Notification ¬ification);
+ MBanner* reviveGroupBanner(const Notification ¬ification);
//! Adds a notifications to a group specified by the notification's group id
void addNotificationToGroup(const Notification ¬ification);
//! Adds a notification which has no group id or 0 group id
--- src/notifications/notificationmanager.cpp
+++ src/notifications/notificationmanager.cpp
@@ -51,8 +51,8 @@
context(new ContextFrameworkContext()),
lastUsedNotificationUserId(0),
persistentDataRestored(false)
-#ifdef HAVE_MAEMOSEC
- , persistentStorage(new maemosec::storage("com.meego.core.MNotificationManager", maemosec::storage::vis_private, maemosec::storage::prot_encrypted))
+#ifdef HAVE_AEGIS_CRYPTO
+ , persistentStorage(new aegis::storage("com.meego.core.MNotificationManager", aegis::storage::vis_private, aegis::storage::prot_encrypted))
#endif
{
dBusSource = new DBusInterfaceNotificationSource(*this);
@@ -91,7 +91,7 @@
void NotificationManager::saveStateData()
{
-#ifdef HAVE_MAEMOSEC
+#ifdef HAVE_AEGIS_CRYPTO
if (ensurePersistentDataPath()) {
QBuffer buffer;
buffer.open(QIODevice::WriteOnly);
@@ -116,7 +116,7 @@
void NotificationManager::savePersistentNotifications()
{
-#ifdef HAVE_MAEMOSEC
+#ifdef HAVE_AEGIS_CRYPTO
if (ensurePersistentDataPath()) {
QBuffer buffer;
buffer.open(QIODevice::WriteOnly);
@@ -143,10 +143,10 @@
void NotificationManager::restorePersistentData()
{
-#ifdef HAVE_MAEMOSEC
+#ifdef HAVE_AEGIS_CRYPTO
if (!persistentDataRestored && ensurePersistentDataPath()) {
- unsigned char *data;
- ssize_t dataLength;
+ RAWDATA_PTR data;
+ size_t dataLength;
// The persistent storage automatically verifies the data.
// If the data is corrupted or tampered with, the previous state
@@ -242,16 +242,15 @@
uint NotificationManager::addNotification(uint notificationUserId, const NotificationParameters ¶meters, uint groupId)
{
- bool persistent = determinePersistence(parameters);
restorePersistentData();
if (groupId == 0 || groups.contains(groupId)) {
+ bool persistent = determinePersistence(parameters);
uint notificationId = nextAvailableNotificationID();
- // Mark the notification used
Notification notification(notificationId, groupId, notificationUserId, parameters, determineType(parameters), relayInterval);
+ // Mark the notification used
notifications.insert(notificationId, notification);
- submitNotification(notification);
// If a group is persistent, all the notifications in the group are persistent too
if (persistent || persistentGroups.contains(groupId)) {
@@ -259,6 +258,8 @@
savePersistentNotifications();
}
+ submitNotification(notification);
+
return notificationId;
}
@@ -276,6 +277,12 @@
if (ni != notifications.end()) {
(*ni).setParameters(parameters);
+ // Also checks if the notification's group is persistent
+ if (persistentNotifications.contains(notificationId) ||
+ persistentGroups.contains((*ni).groupId())) {
+ savePersistentNotifications();
+ }
+
int waitQueueIndex = findNotificationFromWaitQueue(notificationId);
if (waitQueueIndex >= 0) {
waitQueue[waitQueueIndex].setParameters(parameters);
@@ -284,12 +291,6 @@
emit notificationUpdated(notifications.value(notificationId));
}
- // Also checks if the notification's group is persistent
- if (persistentNotifications.contains(notificationId) ||
- persistentGroups.contains((*ni).groupId())) {
- savePersistentNotifications();
- }
-
return true;
} else {
return false;
@@ -308,14 +309,6 @@
restorePersistentData();
if (notifications.contains(notificationId)) {
- int waitQueueIndex = findNotificationFromWaitQueue(notificationId);
- if (waitQueueIndex >= 0) {
- waitQueue.removeAt(waitQueueIndex);
- } else {
- // Inform the sinks about the removal
- emit notificationRemoved(notificationId);
- }
-
// Mark the notification unused
notifications.take(notificationId);
@@ -324,6 +317,14 @@
savePersistentNotifications();
}
+ int waitQueueIndex = findNotificationFromWaitQueue(notificationId);
+ if (waitQueueIndex >= 0) {
+ waitQueue.removeAt(waitQueueIndex);
+ } else {
+ // Inform the sinks about the removal
+ emit notificationRemoved(notificationId);
+ }
+
return true;
} else {
return false;
@@ -355,7 +356,6 @@
uint groupID = nextAvailableGroupID();
NotificationGroup group(groupID, notificationUserId, parameters);
groups.insert(groupID, group);
- emit groupUpdated(groupID, parameters);
if (persistent) {
persistentGroups.insert(groupID);
@@ -363,6 +363,8 @@
saveStateData();
+ emit groupUpdated(groupID, parameters);
+
return groupID;
}
@@ -376,10 +378,11 @@
if (gi != groups.end()) {
(*gi).setParameters(parameters);
- emit groupUpdated(groupId, parameters);
saveStateData();
+ emit groupUpdated(groupId, parameters);
+
return true;
} else {
return false;
@@ -397,14 +400,14 @@
}
}
- emit groupRemoved(groupId);
-
if (persistentGroups.contains(groupId)) {
persistentGroups.remove(groupId);
}
saveStateData();
+ emit groupRemoved(groupId);
+
return true;
} else {
return false;
@@ -489,7 +492,6 @@
return persistentVariant.toBool();
}
-
Notification::NotificationType NotificationManager::determineType(const NotificationParameters ¶meters)
{
QVariant classVariant = parameters.value(GenericNotificationParameterFactory::classKey());
@@ -555,3 +557,18 @@
}
return i;
}
+
+void NotificationManager::removeUnseenFlags(bool ignore)
+{
+ if (!ignore) {
+ QHash<uint, Notification>::iterator it = notifications.begin();
+ while (it != notifications.end()) {
+ NotificationParameters newParameters = (*it).parameters();
+ newParameters.add(GenericNotificationParameterFactory::unseenKey(), QVariant(false));
+ (*it).setParameters(newParameters);
+ ++it;
+ }
+ // Change the states in the filestore
+ savePersistentNotifications();
+ }
+}
--- src/notifications/notificationmanager.h
+++ src/notifications/notificationmanager.h
@@ -31,13 +31,12 @@
#include <QSharedPointer>
#include <QBuffer>
-#ifdef HAVE_MAEMOSEC
-#include <maemosec_storage.h>
+#ifdef HAVE_AEGIS_CRYPTO
+#include <aegis_storage.h>
#endif
class ApplicationContext;
class DBusInterfaceNotificationSource;
-class SystemNotificationSource;
class MFileDataStore;
class EventTypeStore;
@@ -76,13 +75,6 @@
*/
void restorePersistentData();
- /*!
- * Loads systemNotificationSource.
- *
- * This must be done after notification manager signals have been connected to sinks.
- */
- void loadSystemNotificationSource();
-
public slots:
//! \reimp
uint addNotification(uint notificationUserId, const NotificationParameters ¶meters = NotificationParameters(), uint groupId = 0);
@@ -183,6 +175,11 @@
* of this object and invoke any entity connected to this NotificationManager.
*/
void relayNextNotification();
+ /*!
+ * Slot for setting unseen flags of all notifications to false.
+ * \param ignore \c true if ignore the call \c false to remove the flags
+ */
+ void removeUnseenFlags(bool ignore);
private:
/*!
@@ -300,9 +297,13 @@
//! Flag to determine if the persistent data has been restored yet
bool persistentDataRestored;
-#ifdef HAVE_MAEMOSEC
+#ifdef HAVE_AEGIS_CRYPTO
//! Secure storage object for storing persistent data
- QSharedPointer<maemosec::storage> persistentStorage;
+ QSharedPointer<aegis::storage> persistentStorage;
+#endif
+
+#ifdef UNIT_TEST
+ friend class Ut_NotificationManager;
#endif
};
--- src/notifications/notificationparameters.cpp
+++ src/notifications/notificationparameters.cpp
@@ -19,9 +19,11 @@
#include "notificationparameters.h"
#include "notificationparameter.h"
+#include "genericnotificationparameterfactory.h"
NotificationParameters::NotificationParameters()
{
+ parameterValues.insert(GenericNotificationParameterFactory::unseenKey(), QVariant(true));
}
NotificationParameters::~NotificationParameters()
@@ -43,7 +45,6 @@
return parameterValues.value(parameter);
}
-
QDataStream &operator<<(QDataStream &datastream, const NotificationParameters ¶meters)
{
return datastream << parameters.parameterValues;
--- src/notifications/notifications.pri
+++ src/notifications/notifications.pri
@@ -19,6 +19,7 @@
$$SYSTEMUI_NOTIFICATIONS_SRC_DIR/ngfadapter.h \
$$SYSTEMUI_NOTIFICATIONS_SRC_DIR/notifiernotificationsink.h \
$$SYSTEMUI_NOTIFICATIONS_SRC_DIR/eventtypestore.h \
+ $$SYSTEMUI_NOTIFICATIONS_SRC_DIR/notificationstatusindicator.h
SOURCES += $$SYSTEMUI_NOTIFICATIONS_SRC_DIR/notificationmanager.cpp \
$$SYSTEMUI_NOTIFICATIONS_SRC_DIR/notificationparameter.cpp \
@@ -35,5 +36,5 @@
$$SYSTEMUI_NOTIFICATIONS_SRC_DIR/ngfnotificationsink.cpp \
$$SYSTEMUI_NOTIFICATIONS_SRC_DIR/ngfadapter.cpp \
$$SYSTEMUI_NOTIFICATIONS_SRC_DIR/notifiernotificationsink.cpp \
- $$SYSTEMUI_NOTIFICATIONS_SRC_DIR/eventtypestore.cpp
-
+ $$SYSTEMUI_NOTIFICATIONS_SRC_DIR/eventtypestore.cpp \
+ $$SYSTEMUI_NOTIFICATIONS_SRC_DIR/notificationstatusindicator.cpp
--- src/notifications/notificationstatusindicator.cpp
+++ src/notifications/notificationstatusindicator.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 "notificationstatusindicator.h"
+#include "statusindicator.h"
+#include "statusindicatormodel.h"
+#include "inputmethodstatusindicatoradaptor.h"
+#include "applicationcontext.h"
+#include "sysuid.h"
+#include "notificationmanager.h"
+#include "notifiernotificationsink.h"
+#include "mcompositornotificationsink.h"
+
+NotificationStatusIndicator::NotificationStatusIndicator(MWidget *parent) :
+ StatusIndicator(parent), notifierSink(new NotifierNotificationSink)
+{
+ setObjectName(QString(metaObject()->className()));
+
+ NotificationManager *notificationManager = &Sysuid::sysuid()->notificationManager();
+
+ // Connect notification signals
+ connect(&Sysuid::sysuid()->compositorNotificationSink(), SIGNAL(notificationAdded(const Notification &)), notifierSink, SLOT(addNotification(const Notification &)));
+ connect(notificationManager, SIGNAL(notificationRemoved(uint)), notifierSink, SLOT(removeNotification(uint)));
+ connect(notifierSink, SIGNAL(notifierSinkActive(bool)), this, SLOT(setActive(bool)));
+ connect(notificationManager, SIGNAL(notificationRestored(const Notification &)), notifierSink, SLOT(addNotification(const Notification &)));
+ connect(notifierSink, SIGNAL(notifierSinkActive(bool)), notificationManager, SLOT(removeUnseenFlags(bool)));
+}
+
+NotificationStatusIndicator::~NotificationStatusIndicator()
+{
+}
+
+void NotificationStatusIndicator::statusIndicatorMenuVisibilityChange(bool visible)
+{
+ // When status menu is opened remove all notifications from the sink
+ if (visible) {
+ notifierSink->clearSink();
+ }
+ // We need to enable/disable notifications from being added to notifier sink when status menu is unvisible/visible
+ notifierSink->disableNotificationAdditions(visible);
+}
+
+void NotificationStatusIndicator::setActive(bool active)
+{
+ if (active) {
+ setObjectName(QString(metaObject()->className()) + "On");
+ } else {
+ setObjectName(QString(metaObject()->className()));
+ }
+}
--- src/notifications/notificationstatusindicator.h
+++ src/notifications/notificationstatusindicator.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.
+**
+****************************************************************************/
+
+#include <MWidgetController>
+#include "statusindicator.h"
+#include "statusindicatormodel.h"
+
+class ApplicationContext;
+class ContextItem;
+class NotifierNotificationSink;
+
+/*!
+ * A status indicator for showing if there are new notifications
+ */
+class NotificationStatusIndicator : public StatusIndicator
+{
+ Q_OBJECT
+ M_CONTROLLER(NotificationStatusIndicator)
+
+public:
+ /*!
+ * Constructs a NotificationStatusIndicator.
+ * \param parent parent MWidget. If parent is NULL, the creating client must take the responsibility to delete the indicator.
+ */
+ explicit NotificationStatusIndicator(MWidget *parent = NULL);
+
+ virtual ~NotificationStatusIndicator();
+
+public slots:
+ //! Slot to listen status indicator menu visibility changes
+ void statusIndicatorMenuVisibilityChange(bool visible);
+
+private slots:
+ //! Slot to listen whether status indicator is acitive(displaying) or not
+ void setActive(bool active);
+
+private:
+ //! The notification sink for the notifier
+ NotifierNotificationSink *notifierSink;
+
+#ifdef UNIT_TEST
+ friend class Ut_NotificationStatusIndicator;
+#endif
+};
--- src/notifications/notifiernotificationsink.cpp
+++ src/notifications/notifiernotificationsink.cpp
@@ -19,107 +19,79 @@
#include "notifiernotificationsink.h"
#include "genericnotificationparameterfactory.h"
+#include "sysuid.h"
+#include "ngfadapter.h"
+
+const QString NotifierNotificationSink::NOTIFIER_NGF_ID = "notifier";
NotifierNotificationSink::NotifierNotificationSink() :
- notificationCount(0)
+ ngfAdapter(new NGFAdapter),
+ notificationCount(0),
+ additionsDisabled(false),
+ ngfEventId(0)
{
+ connect(this, SIGNAL(notifierSinkActive(bool)), this, SLOT(playNotifierNGF(bool)));
}
NotifierNotificationSink::~NotifierNotificationSink()
{
}
-
-void NotifierNotificationSink::addGroup(uint groupId, const NotificationParameters ¶meters)
-{
- // Set the notification count for the group
- notificationCountForGroup.insert(groupId, parameters.value(GenericNotificationParameterFactory::countKey()).toUInt());
-
- updateNotificationCount();
-}
-
-void NotifierNotificationSink::removeGroup(uint groupId)
-{
- // Remove all notifications in the group
- QList<uint> notificationsToRemove;
- foreach(uint notificationId, groupForNotification.keys()) {
- if (groupForNotification.value(notificationId) == groupId) {
- notificationsToRemove.append(notificationId);
- }
- }
-
- foreach(uint notificationId, notificationsToRemove) {
- groupForNotification.remove(notificationId);
- }
-
- // Reset the notification count of the group
- notificationCountForGroup.remove(groupId);
-
- updateNotificationCount();
-}
-
void NotifierNotificationSink::addNotification(const Notification ¬ification)
{
+ if(additionsDisabled) {
+ return;
+ }
if (notification.type() == Notification::SystemEvent) {
// System notifications are not shown by the notifier sink
+ systemNotificationIds.insert(notification.notificationId());
return;
}
-
- // Remove any previous notification with the same ID (so that updates work properly)
- removeNotification(notification.notificationId());
-
- // Create a mapping between the notification ID and its group ID
- groupForNotification.insert(notification.notificationId(), notification.groupId());
-
- // Create a mapping between the notification ID and its notification count
- uint count = notification.parameters().value(GenericNotificationParameterFactory::countKey()).toUInt();
- notificationCountForNotification.insert(notification.notificationId(), count);
-
- // Only the group 0 (no group) notification count is affected by the item count of the notification
- if (notification.groupId() == 0) {
- // Increase the notification count for the "no group" group
- notificationCountForGroup.insert(notification.groupId(), notificationCountForGroup.value(notification.groupId()) + count);
+ if(isUnseen(notification)) {
+ notificationCount++;
+ if(notificationCount == 1) {
+ emit notifierSinkActive(true);
+ }
}
-
- updateNotificationCount();
}
void NotifierNotificationSink::removeNotification(uint notificationId)
{
- if (groupForNotification.contains(notificationId)) {
- // Remove the mapping between the notification ID and its notification count
- uint count = notificationCountForNotification.take(notificationId);
-
- // Remove the mapping between the notification ID and its group ID
- uint groupId = groupForNotification.take(notificationId);
-
- // Only the group 0 (no group) notification count is affected by the item count of the notification
- if (groupId == 0) {
- // Decrease the notification count for the group
- notificationCountForGroup.insert(groupId, notificationCountForGroup.value(groupId) - count);
+ if(systemNotificationIds.contains(notificationId)) {
+ systemNotificationIds.remove(notificationId);
+ return;
+ }
+ if(notificationCount > 0) {
+ notificationCount--;
+ if(notificationCount == 0) {
+ emit notifierSinkActive(false);
}
-
- updateNotificationCount();
}
}
-void NotifierNotificationSink::updateNotificationCount()
+void NotifierNotificationSink::clearSink()
{
- uint count = 0;
-
- foreach(uint groupId, notificationCountForGroup.keys()) {
- uint c = notificationCountForGroup.value(groupId);
+ notificationCount = 0;
+ emit notifierSinkActive(false);
+}
- if (c > 0 && groupForNotification.values().contains(groupId)) {
- // Increase the count if there are notifications in the group
- count += c;
- }
- }
+void NotifierNotificationSink::disableNotificationAdditions(bool disable)
+{
+ additionsDisabled = disable;
+}
- if (count != notificationCount) {
- // The notification count has changed: signal it
- notificationCount = count;
+bool NotifierNotificationSink::isUnseen(const Notification ¬ification)
+{
+ NotificationParameters parameters = notification.parameters();
+ QVariant unseenVariant = parameters.value(GenericNotificationParameterFactory::unseenKey());
+ return unseenVariant.toBool();
+}
- emit notificationCountChanged(notificationCount);
+void NotifierNotificationSink::playNotifierNGF(bool play)
+{
+ if (play) {
+ ngfEventId = ngfAdapter->play(NOTIFIER_NGF_ID);
+ } else {
+ ngfAdapter->stop(ngfEventId);
}
}
--- src/notifications/notifiernotificationsink.h
+++ src/notifications/notifiernotificationsink.h
@@ -21,9 +21,12 @@
#define NOTIFIERNOTIFICATIONSINK_H_
#include "notificationsink.h"
+#include <QSet>
+
+class NGFAdapter;
/*!
- * A notification sink for the Notifier.
+ * A notification sink for the Notifier. Just maintains a count of unseen notifications
*/
class NotifierNotificationSink : public NotificationSink
{
@@ -40,37 +43,66 @@
*/
virtual ~NotifierNotificationSink();
+public slots:
+ /*!
+ * Clears all notifications from the sink.
+ */
+ void clearSink();
+
+ /*!
+ * Sets whether to disable/enable notifications from being added to sink
+ *
+ * \param disable Whether notification additions should be disable or enabled
+ */
+ void disableNotificationAdditions(bool disable);
+
signals:
/*!
- * Signals information about notification count changes.
+ * Signal which specifies the current state of notifiernotification sink
*
- * \param count the number of notifications
+ * \param active \c true when sink is to active(has notifications) \c false otherwise
*/
- void notificationCountChanged(uint count);
+ void notifierSinkActive(bool active);
private slots:
//! \reimp
- virtual void addGroup(uint groupId, const NotificationParameters ¶meters);
- virtual void removeGroup(uint groupId);
virtual void addNotification(const Notification ¬ification);
virtual void removeNotification(uint notificationId);
//! \reimp_end
-private:
- //! The group for each notification
- QHash<uint, uint> groupForNotification;
+ /*!
+ * Play or stop the notier NGF play.
+ * \param play Whether NGF should be played or stopped.
+ */
+ void playNotifierNGF(bool play);
- //! The notification count of each notification
- QHash<uint, uint> notificationCountForNotification;
+private:
+ //! The id for notifier NGF
+ static const QString NOTIFIER_NGF_ID;
- //! The notification count of each group
- QHash<uint, uint> notificationCountForGroup;
+ /*!
+ * The NGF Adapter
+ */
+ NGFAdapter* ngfAdapter;
//! Current notification count
uint notificationCount;
- //! Updates the notification count and signals notificationCountChanged() if it changed
- void updateNotificationCount();
+ //! Whether adding of notifications is disabled
+ bool additionsDisabled;
+
+ //! Checks if the notification is still unseen.
+ bool isUnseen(const Notification ¬ification);
+
+ //! list of system notifications which have arrived here.
+ QSet<uint> systemNotificationIds;
+
+ //! The event id of the currently playing NGF feedback
+ uint ngfEventId;
+
+#ifdef UNIT_TEST
+ friend class Ut_NotifierNotificationSink;
+#endif
};
#endif /* NOTIFIERNOTIFICATIONSINK_H_ */
--- src/notifications/widgetnotificationsink.cpp
+++ src/notifications/widgetnotificationsink.cpp
@@ -25,69 +25,37 @@
#include "eventtypestore.h"
#include <QSettings>
#include <QImageReader>
-#include <QPixmap>
#include <QFileInfo>
const char *WidgetNotificationSink::NOTIFICATION_ID_PROPERTY = "notificationId";
const char *WidgetNotificationSink::GROUP_ID_PROPERTY = "groupId";
const char *WidgetNotificationSink::USER_REMOVABLE_PROPERTY = "userRemovable";
-static const int PIXMAP_WIDTH_MAX = 100;
-static const int PIXMAP_HEIGHT_MAX = 100;
-static const int IMAGE_DEFAULT_SIZE = 64;
-
-
-/*
- Creates QPixmap from absolute path. Images smaller than maximum size 100x100
- are scaled to default size 64x64.
- Takes path to image as an argument, imagePath.
- Returns QPixmap object constructed from the given path.
- In case of error null QPixmap is returned.
-*/
-QPixmap loadAndScalePixmap(const QString &imagePath)
-{
- QImageReader imageReader(imagePath);
- QPixmap pixmap = QPixmap();
-
- if (imageReader.canRead()) {
- QSize size = imageReader.size();
- if (size.height() <= PIXMAP_HEIGHT_MAX && size.width() <= PIXMAP_WIDTH_MAX) {
- size.scale(IMAGE_DEFAULT_SIZE, IMAGE_DEFAULT_SIZE, Qt::KeepAspectRatio);
- imageReader.setScaledSize(size);
-
- QImage image = imageReader.read();
- if (!image.isNull()) {
- pixmap = QPixmap::fromImage(image);
- }
- }
- }
- return pixmap;
-}
QString WidgetNotificationSink::determineIconIdFromEventType(const QString &eventType)
{
- QString iconId;
+ QString iconID;
if (!eventType.isEmpty()) {
NotificationManager ¬ificationManager = Sysuid::sysuid()->notificationManager();
const EventTypeStore &store = notificationManager.eventTypeStore();
const QSettings *settings = store.settingsForEventType(eventType);
if (settings != NULL) {
- iconId = settings->value(NotificationWidgetParameterFactory::iconIdKey()).toString();
+ iconID = settings->value(NotificationWidgetParameterFactory::iconIdKey()).toString();
}
}
- return iconId;
+ return iconID;
}
QString WidgetNotificationSink::determineIconId(const NotificationParameters ¶meters)
{
- QString iconId = parameters.value(NotificationWidgetParameterFactory::iconIdKey()).toString();
- if (iconId.isEmpty()) {
+ QString iconID = parameters.value(NotificationWidgetParameterFactory::iconIdKey()).toString();
+ if (iconID.isEmpty()) {
QString eventType = parameters.value(GenericNotificationParameterFactory::eventTypeKey()).toString();
- iconId = determineIconIdFromEventType(eventType);
- if (iconId.isEmpty()) {
- iconId = "default";
+ iconID = determineIconIdFromEventType(eventType);
+ if (iconID.isEmpty()) {
+ iconID = "default";
}
}
- return iconId;
+ return iconID;
}
bool WidgetNotificationSink::determineUserRemovabilityFromEventType(const QString &eventType)
@@ -117,30 +85,30 @@
}
}
-MInfoBanner *WidgetNotificationSink::createInfoBanner(const Notification ¬ification)
+MBanner *WidgetNotificationSink::createInfoBanner(const Notification ¬ification)
{
- MInfoBanner *infoBanner = createInfoBanner(notification.type() == Notification::ApplicationEvent ? MInfoBanner::Event : MInfoBanner::Information,
- notification.groupId(), notification.parameters());
+ MBanner *infoBanner = createInfoBanner(notification.type(), notification.groupId(), notification.parameters());
infoBanner->setProperty(NOTIFICATION_ID_PROPERTY, notification.notificationId());
return infoBanner;
}
-MInfoBanner *WidgetNotificationSink::createInfoBanner(MInfoBanner::BannerType type, uint groupId, const NotificationParameters ¶meters)
+MBanner *WidgetNotificationSink::createInfoBanner(Notification::NotificationType type, uint groupId, const NotificationParameters ¶meters)
{
- QString imageId = parameters.value(NotificationWidgetParameterFactory::imageIdKey()).toString();
- QString body = infoBannerBodyText(parameters);
- QString iconId = determineIconId(parameters);
- MInfoBanner *infoBanner = new MInfoBanner(type);
-
- if (QFileInfo(imageId).isAbsolute()) {
- infoBanner->setPixmap(loadAndScalePixmap(imageId));
- } else {
- infoBanner->setImageID(imageId);
- }
+ QString title = infoBannerTitleText(parameters);
+ QString subtitle = infoBannerSubtitleText(parameters);
+ QString iconID = determineIconId(parameters);
+ MBanner *infoBanner = new MBanner();
+
+ // Create a banner on the basis of notification type
+ if (type == Notification::ApplicationEvent)
+ {
+ infoBanner->setTitle(title);
+ }
+ // Add subtitle and iconid for both event and system notifications
+ infoBanner->setSubtitle(subtitle);
+ infoBanner->setIconID(iconID);
- infoBanner->setBodyText(body);
- infoBanner->setIconID(iconId);
infoBanner->setProperty(GROUP_ID_PROPERTY, groupId);
infoBanner->setProperty(USER_REMOVABLE_PROPERTY, determineUserRemovability(parameters));
@@ -152,7 +120,7 @@
return infoBanner;
}
-void WidgetNotificationSink::updateActions(MInfoBanner *infoBanner, const NotificationParameters ¶meters)
+void WidgetNotificationSink::updateActions(MBanner *infoBanner, const NotificationParameters ¶meters)
{
// Remove the old actions
foreach(QAction * qAction, infoBanner->actions()) {
@@ -169,31 +137,19 @@
}
}
-QString WidgetNotificationSink::infoBannerBodyText(const NotificationParameters ¶meters)
+QString WidgetNotificationSink::infoBannerTitleText(const NotificationParameters ¶meters)
{
- QString summary = parameters.value(NotificationWidgetParameterFactory::summaryKey()).toString();
- QString body = parameters.value(NotificationWidgetParameterFactory::bodyKey()).toString();
-
- QString text;
-
- if (!summary.isEmpty()) {
- text.append("<p><b>");
- text.append(summary);
- text.append("</b></p>");
- }
-
- if (!body.isEmpty()) {
- text.append("<p>");
- text.append(body);
- text.append("</p>");
- }
+ return parameters.value(NotificationWidgetParameterFactory::summaryKey()).toString();
+}
- return text;
+QString WidgetNotificationSink::infoBannerSubtitleText(const NotificationParameters ¶meters)
+{
+ return parameters.value(NotificationWidgetParameterFactory::bodyKey()).toString();
}
void WidgetNotificationSink::infoBannerClicked()
{
- MInfoBanner *infoBanner = qobject_cast<MInfoBanner *>(sender());
+ MBanner *infoBanner = qobject_cast<MBanner *>(sender());
if (infoBanner != NULL) {
// Trigger each remote action associated with the clicked info banner
--- src/notifications/widgetnotificationsink.h
+++ src/notifications/widgetnotificationsink.h
@@ -21,13 +21,13 @@
#define WIDGETNOTIFICATIONSINK_H
#include "notificationsink.h"
-#include <MInfoBanner>
+#include <MBanner>
/*!
* WidgetNotificationSink is a common base class for all notification sinks that trigger
* visual feedback using a graphics widget.
*
- * WidgetNotificationSink creates MInfoBanner widgets for notifications. When MInfoBanner
+ * WidgetNotificationSink creates MBanner widgets for notifications. When MBanner
* is clicked the action bound to the notification is triggered and notification is removed
* from the notification system signalling notificationRemovalRequested().
*/
@@ -35,6 +35,14 @@
{
Q_OBJECT
+public:
+ //! MBanner property to store the notification ID into
+ static const char *NOTIFICATION_ID_PROPERTY;
+ //! MBanner property to store the group ID into
+ static const char *GROUP_ID_PROPERTY;
+ //! MBanner property to store the user removability into
+ static const char *USER_REMOVABLE_PROPERTY;
+
signals:
/*!
* Requests removal of a notification from the notification system.
@@ -65,41 +73,44 @@
static bool determineUserRemovability(const NotificationParameters ¶meters);
/*!
- * Creates a MInfoBanner widget to represent a notification object.
+ * Creates a MBanner widget to represent a notification object.
* Ownership of the constructed object is passed to the caller.
- * \param notification The notification object to represent with the MInfoBanner.
- * \return Constructed MInfoBanner that represents the notification.
+ * \param notification The notification object to represent with the MBanner.
+ * \return Constructed MBanner that represents the notification.
*/
- MInfoBanner *createInfoBanner(const Notification ¬ification);
+ MBanner *createInfoBanner(const Notification ¬ification);
/*!
- * Creates a MInfoBanner widget from the given notification parameters.
+ * Creates a MBanner widget from the given notification parameters.
* Ownership of the constructed object is passed to the caller.
- * \param type Type of the info banner to be constructed.
+ * \param type Notification type on the basis of which info banner type is to be constructed.
* \param groupId The group ID to be associated with the info banner.
- * \param params NotificationParameters according to which configure the MInfoBanner.
+ * \param params NotificationParameters according to which configure the MBanner.
*/
- MInfoBanner *createInfoBanner(MInfoBanner::BannerType type, uint groupId, const NotificationParameters ¶meters);
+ MBanner *createInfoBanner(Notification::NotificationType type, uint groupId, const NotificationParameters ¶meters);
/*!
* Removes old actions from the given info banner and adds the action
* specified in the notification (if any)
*
- * \param infoBanner the MInfoBanner to update
+ * \param infoBanner the MBanner to update
* \param parameters the NotificationParameters to get the action from
*/
- void updateActions(MInfoBanner *infoBanner, const NotificationParameters ¶meters);
+ void updateActions(MBanner *infoBanner, const NotificationParameters ¶meters);
/*!
- * Creates a body text string from summary and body parameters, suitable for
- * the body text of an MInfoBanner.
- * \param parameters the NotificationParameters to get the body text from
- * \return the body text
+ * Creates a title text string from notification parameters.
+ * \param parameters the NotificationParameters to get the title text from
+ * \return the title text
*/
- QString infoBannerBodyText(const NotificationParameters ¶meters);
+ QString infoBannerTitleText(const NotificationParameters ¶meters);
- //! MInfoBanner property to store the user removability into
- static const char *USER_REMOVABLE_PROPERTY;
+ /*!
+ * Creates a subtitle text string from notification parameters.
+ * \param parameters the NotificationParameters to get the subtitle text from
+ * \return the subtitle text
+ */
+ QString infoBannerSubtitleText(const NotificationParameters ¶meters);
private:
/*!
@@ -117,11 +128,6 @@
*/
static bool determineUserRemovabilityFromEventType(const QString &eventType);
- //! MInfoBanner property to store the notification ID into
- static const char *NOTIFICATION_ID_PROPERTY;
- //! MInfoBanner property to store the group ID into
- static const char *GROUP_ID_PROPERTY;
-
private slots:
/*!
* A slot for catching info banner clicks
--- src/shutdownbusinesslogic.cpp
+++ src/shutdownbusinesslogic.cpp
@@ -29,11 +29,7 @@
#define DEBUG
#include "debug.h"
-#ifndef UNIT_TEST
extern MApplication *exitPtr;
-#else
-MApplication *exitPtr;
-#endif
ShutdownBusinessLogic::ShutdownBusinessLogic (QObject *parent) :
QObject (parent),
@@ -114,53 +110,35 @@
SYS_DEBUG ("Creating a notification & feedback");
/*
- * Creating the feedback.
- */
- MFeedback feedback("IDF_INFORMATION_STRONG");
-
- /*
* Creating a notification.
*/
MNotification notification (
- MNotification::DeviceEvent,
+ "x-nokia.battery.temperature",
"",
//% "Temperature too high. Device shutting down."
qtTrId ("qtn_shut_high_temp"));
- notification.setImage ("icon-m-notification-temperature");
/*
* Playing/publishing them.
*/
notification.publish ();
- feedback.play();
}
void
ShutdownBusinessLogic::batteryShutdown ()
{
- SYS_DEBUG ("Creating a notification & feedback");
+ SYS_DEBUG ("Creating a notification");
/*
- * Creating the feedback.
- */
- MFeedback feedback("IDF_RECHARGE_BATTERY");
-
- /*
* Creating a notification.
*/
MNotification notification (
- MNotification::DeviceEvent,
- //% "Battery empty."
- qtTrId ("qtn_shut_batt_empty"),
- //% "Device will be shut down."
- qtTrId ("qtn_shut_will_shut_down"));
- notification.setImage ("icon-m-energy-management-battery-verylow");
+ "x-nokia.battery.shutdown",
+ "",
+ //% "Battery empty. Device shutting down."
+ qtTrId ("qtn_shut_batt_empty"));
- /*
- * Playing/publishing them.
- */
notification.publish ();
- feedback.play();
}
void
@@ -177,11 +155,11 @@
* Creating a notification.
*/
MNotification notification (
- MNotification::DeviceEvent,
+ /* this has the usb-icon: */
+ MNotification::DeviceAddedEvent,
"",
//% "USB cable plugged in. Unplug the USB cable to shutdown."
qtTrId ("qtn_shut_unplug_usb"));
- notification.setImage ("icon-m-common-usb");
/*
* Playing/publishing them.
--- src/shutdownui.cpp
+++ src/shutdownui.cpp
@@ -25,7 +25,7 @@
#include <QTimer>
#include <QGraphicsLinearLayout>
#include <MSceneManager>
-#include <MImageWidget>
+#include <MStylableWidget>
#include <MLocale>
#ifdef HAVE_QMSYSTEM
@@ -35,18 +35,22 @@
#include "mwidgetcreator.h"
M_REGISTER_WIDGET_NO_CREATE(ShutdownUI)
-
#define DEBUG
#define WARNING
#include "debug.h"
+// For WM_SET_NAME:
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+
ShutdownUI::ShutdownUI () :
m_Realized (false),
m_SceneWindow (0),
m_Timer (new QTimer),
m_Label1 (0),
m_Label2 (0),
- m_Image (0),
+ m_logo (0),
+ m_layout (0),
m_Feedback (0)
{
setObjectName ("ShutdownUIWindow");
@@ -83,53 +87,42 @@
if (m_Realized)
return;
- // FIXME: We need logo for both orientations...
- // FIXME: It seems that this is not working.
- setLandscapeOrientation ();
- lockOrientation ();
-
// Initilaize non-graphical feedback
m_Feedback = new MFeedback (this);
-#ifdef FEEDBACK_SUPPLIED
- m_Feedback->setName ("DF_POWER_OFF");
-#else
- m_Feedback->setName ("press");
-#endif
+ m_Feedback->setName ("power-off");
//% "Shutting down"
m_Label1 = new MLabel (qtTrId ("qtn_shut_down"));
- m_Label1->setObjectName ("shutdownTextBig");
m_Label1->setAlignment (Qt::AlignCenter);
+ m_Label1->setObjectName ("shutdownTextFirst");
//% "Good bye!"
m_Label2 = new MLabel (qtTrId ("qtn_shut_greeting"));
- m_Label2->setObjectName ("shutdownTextSmaller");
m_Label2->setAlignment (Qt::AlignCenter);
+ m_Label2->setObjectName ("shutdownTextSecond");
/*
* A full screen logo that we show when the labels are already gone.
*/
- m_Image = new MImageWidget ("icon-l-startup-nokia-logo");
- m_Image->hide ();
+ m_logo = new MStylableWidget;
+ m_logo->setObjectName ("shutdownLogo");
- QGraphicsLinearLayout *layout
- = new QGraphicsLinearLayout (Qt::Vertical);
+ m_layout = new QGraphicsLinearLayout (Qt::Vertical);
+ m_layout->setContentsMargins (0., 0., 0., 0.);
+ m_layout->setSpacing (0.);
- layout->addStretch ();
- layout->addItem (m_Label1);
- layout->addStretch ();
- layout->addItem (m_Image);
- layout->addStretch ();
- layout->addItem (m_Label2);
- layout->addStretch ();
+ m_layout->addItem (m_Label1);
+ m_layout->addItem (m_Label2);
/*
* Creating a scene window and putting everything into it.
*/
m_SceneWindow = new MSceneWindow;
- m_SceneWindow->setLayout (layout);
+ m_SceneWindow->setObjectName ("shutdownWindow");
+ m_SceneWindow->setContentsMargins (0., 0., 0., 0.);
+ m_SceneWindow->setLayout (m_layout);
m_SceneWindow->appear (this);
-
+
m_Realized = true;
}
@@ -194,12 +187,6 @@
*/
show ();
-#ifdef HAVE_QMSYSTEM
- // Turn on the touchscreen
- Maemo::QmDisplayState display;
- display.set (Maemo::QmDisplayState::On);
-#endif
-
m_Feedback->play ();
// Set the interval and start the timer to the next phase: hiding the labels
@@ -221,10 +208,17 @@
/*
* We hide the labels and show the image.
*/
- m_Label1->hide ();
- m_Label2->hide ();
- m_Image->show ();
- m_Image->setGeometry (QRectF (0., 0., 864., 480.));
+ for (int i = m_layout->count (); i > 0; i--)
+ m_layout->removeAt (0);
+
+ /* Logo available only for portait ATM */
+ sceneManager ()->setOrientationAngle (M::Angle0, MSceneManager::ImmediateTransition);
+ lockOrientation ();
+
+ m_layout->addItem (m_logo);
+
+ delete m_Label1;
+ delete m_Label2;
QTimer::singleShot (2000, this, SLOT (turnOffScreen ()));
}
@@ -269,7 +263,69 @@
setPalette(Palette);
setBackgroundRole (QPalette::Background);
- m_Image->hide ();
+ m_logo->hide ();
+ }
+}
+
+/*
+ * Set the highest stacking layer here
+ * and the window-name for debugging purposes
+ */
+void
+ShutdownUI::showEvent (
+ QShowEvent *event)
+{
+ Q_UNUSED (event);
+
+ Window windowID;
+ Display *display;
+ Atom nameAtom;
+ Atom utf8StringAtom;
+ Atom stackingLayerAtom;
+ const char *windowName = "ShutdownUI";
+ long layer = 1;
+
+ display = QX11Info::display ();
+ if (!display) {
+ SYS_WARNING ("QX11Info::display() failed");
+ return;
+ }
+
+ stackingLayerAtom = XInternAtom (display, "_MEEGO_STACKING_LAYER", False);
+ if (stackingLayerAtom == None) {
+ SYS_WARNING ("Atom '_MEEGO_STACKING_LAYER' does not exists");
+ }
+
+ nameAtom = XInternAtom (display, "_NET_WM_NAME", False);
+ if (nameAtom == None) {
+ SYS_WARNING ("Atom '_NET_WM_NAME' does not exists");
+ }
+
+ utf8StringAtom = XInternAtom (display, "UTF8_STRING", False);
+ if (utf8StringAtom == None) {
+ SYS_WARNING ("Atom 'UTF8_STRING' does not exists");
}
+
+ windowID = internalWinId();
+ if (windowID == None) {
+ SYS_WARNING ("internalWinId() failed");
+ return;
+ }
+ SYS_DEBUG ("*** windowID = 0x%lx", windowID);
+
+ /*
+ * Setting the stacking layer.
+ */
+ if (stackingLayerAtom != None)
+ XChangeProperty (display, windowID, stackingLayerAtom, XA_CARDINAL,
+ 32, PropModeReplace, (unsigned char*)&layer, 1);
+
+ /*
+ * Setting the name.
+ */
+ if (nameAtom != None && utf8StringAtom != None)
+ XChangeProperty (display, windowID, nameAtom, utf8StringAtom,
+ 8, PropModeReplace,
+ (unsigned char *) windowName, strlen(windowName));
}
--- src/shutdownui.h
+++ src/shutdownui.h
@@ -24,7 +24,8 @@
class QTimer;
class MLabel;
class MFeedback;
-class MImageWidget;
+class MStylableWidget;
+class QGraphicsLinearLayout;
/*!
* A full screen window that is shown when the device is shutting down. The
@@ -46,19 +47,24 @@
const QString &text2,
int timeout);
+protected:
+ void showEvent (QShowEvent *event);
+
private slots:
void showLogo ();
void turnOffScreen ();
void realize ();
private:
- bool m_Realized;
- MSceneWindow *m_SceneWindow;
- QTimer *m_Timer;
- MLabel *m_Label1;
- MLabel *m_Label2;
- MImageWidget *m_Image;
- MFeedback *m_Feedback;
+ bool m_Realized;
+ MSceneWindow *m_SceneWindow;
+ QTimer *m_Timer;
+ MLabel *m_Label1;
+ MLabel *m_Label2;
+ MStylableWidget *m_logo;
+ QGraphicsLinearLayout *m_layout;
+ MFeedback *m_Feedback;
+
#ifdef UNIT_TEST
friend class Ft_ShutdownUI;
friend class Ut_ShutdownUI;
--- src/src.pro
+++ src/src.pro
@@ -5,6 +5,7 @@
MGEN_OUTDIR = .gen
OBJECTS_DIR = .obj
QMAKE_LFLAGS_RPATH = -Wl
+QMAKE_LFLAGS = -Wl,--as-needed
TEMPLATE = app
TARGET = sysuid
@@ -18,9 +19,9 @@
DEFINES += NOTIFICATIONS_EVENT_TYPES=\'$$quote(\"$$M_NOTIFICATIONS_EVENT_TYPES_DIR\")\'
contains(cov, true) {
- message("Coverage options enabled")
- QMAKE_CXXFLAGS += --coverage
- QMAKE_LFLAGS += --coverage
+ message("Coverage options enabled")
+ QMAKE_CXXFLAGS += --coverage
+ QMAKE_LFLAGS += --coverage
}
HEADERS += \
@@ -68,23 +69,23 @@
include(../localconfig.pri)
contains(DEFINES, HAVE_CONTEXTSUBSCRIBER) {
- PKGCONFIG += contextsubscriber-1.0
+ PKGCONFIG += contextsubscriber-1.0
}
contains(DEFINES, HAVE_QMSYSTEM) {
- PKGCONFIG += qmsystem
+ PKGCONFIG += qmsystem
}
-contains(DEFINES, HAVE_MAEMOSEC) {
- PKGCONFIG += maemosec
+contains(DEFINES, HAVE_AEGIS_CRYPTO) {
+ PKGCONFIG += aegis-crypto
}
contains(DEFINES, HAVE_LIBRESOURCEQT) {
- PKGCONFIG += libresourceqt1
+ PKGCONFIG += libresourceqt1
}
contains(DEFINES, HAVE_LIBNGF) {
- PKGCONFIG += libngf0
+ PKGCONFIG += libngf0
}
PKGCONFIG += \
--- src/statusarea/notifier.cpp
+++ src/statusarea/notifier.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 "notifier.h"
-#include "notifiernotificationsink.h"
-#include "sysuid.h"
-#include "mcompositornotificationsink.h"
-
-Notifier::Notifier(MWidget *parent) : MLabel("0", parent),
- notifierSink(new NotifierNotificationSink)
-{
- NotificationManager *notificationManager = &Sysuid::sysuid()->notificationManager();
-
- // Connect notification signals
- connect(&Sysuid::sysuid()->compositorNotificationSink(), SIGNAL(notificationAdded(const Notification &)), notifierSink, SLOT(addNotification(const Notification &)));
- connect(notificationManager, SIGNAL(notificationRemoved(uint)), notifierSink, SLOT(removeNotification(uint)));
- connect(notificationManager, SIGNAL(groupUpdated(uint, const NotificationParameters &)), notifierSink, SLOT(addGroup(uint, const NotificationParameters &)));
- connect(notificationManager, SIGNAL(groupRemoved(uint)), notifierSink, SLOT(removeGroup(uint)));
- connect(notifierSink, SIGNAL(notificationCountChanged(uint)), this, SLOT(notificationCountChanged(uint)));
-
- // Set the text of the label in centrally aligned mode
- setAlignment(Qt::AlignCenter);
- hide();
-}
-
-
-Notifier::~Notifier()
-{
-}
-
-void Notifier::notificationCountChanged(uint count)
-{
- if (count > 0) {
- setText(QString().sprintf("%u", count));
- show();
- } else {
- hide();
- setText(QString().sprintf("%u", count));
- }
-}
--- src/statusarea/notifier.h
+++ src/statusarea/notifier.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 NOTIFIER_H_
-#define NOTIFIER_H_
-
-#include <MLabel>
-
-class NotifierNotificationSink ;
-
-/*!
- * The Notifier is a widget that displays the number of
- * notifications that have not been dismissed (if any).
- */
-class Notifier : public MLabel
-{
- Q_OBJECT
-
-public:
- /*!
- * Constructs a new Notifier.
- *
- * \param parent the parent widget
- */
- Notifier(MWidget *parent = NULL);
-
- /*!
- * Destroys the Notifier.
- */
- virtual ~Notifier();
-
-private slots:
- /*!
- * Receives information about notification count changes.
- *
- * \param count the number of notifications
- */
- void notificationCountChanged(uint count);
-
-private:
- //! The notification sink for the notifier
- NotifierNotificationSink *notifierSink;
-};
-
-#endif /* NOTIFIER_H_ */
--- src/statusarea/statusarea.cpp
+++ src/statusarea/statusarea.cpp
@@ -23,6 +23,7 @@
#include <QGraphicsSceneMouseEvent>
#include "statusindicatormenuwindow.h"
#include "statusindicatormenuadaptor.h"
+#include "notificationstatusindicator.h"
const QString StatusArea::STATUS_INDICATOR_MENU_SERVICE_NAME = "com.nokia.mstatusindicatormenu";
@@ -33,6 +34,7 @@
if (statusAreaWindow != NULL) {
connect(statusIndicatorMenuWindow.data(), SIGNAL(visibilityChanged(bool)), statusAreaWindow, SIGNAL(statusIndicatorMenuVisibilityChanged(bool)));
}
+ connect(statusIndicatorMenuWindow.data(), SIGNAL(visibilityChanged(bool)), this, SIGNAL(statusIndicatorMenuVisibilityChanged(bool)));
// Register status indicator menu object on DBus
new StatusIndicatorMenuAdaptor(statusIndicatorMenuWindow.data());
--- src/statusarea/statusarea.h
+++ src/statusarea/statusarea.h
@@ -50,6 +50,10 @@
*/
virtual ~StatusArea();
+signals:
+ //! Signal for status indicator menu visibility changes
+ void statusIndicatorMenuVisibilityChanged(bool);
+
private:
//! The name of the status indicator menu service
static const QString STATUS_INDICATOR_MENU_SERVICE_NAME;
--- src/statusarea/statusarea.pri
+++ src/statusarea/statusarea.pri
@@ -8,7 +8,6 @@
statusarea/statusarearenderer.cpp \
statusarea/clock.cpp \
statusarea/clockview.cpp \
- statusarea/notifier.cpp \
statusarea/statusindicatorlabelview.cpp \
statusarea/statusindicatoranimationview.cpp \
statusarea/statusindicatoriconview.cpp \
@@ -25,7 +24,6 @@
statusarea/clockview.h \
statusarea/clockstyle.h \
statusarea/clockmodel.h \
- statusarea/notifier.h \
statusarea/statusindicatormodel.h \
statusarea/statusindicatorlabelview.h \
statusarea/statusindicatorlabelstyle.h \
--- src/statusarea/statusarearenderer.cpp
+++ src/statusarea/statusarearenderer.cpp
@@ -75,16 +75,11 @@
statusAreaPixmap = new QPixmap(statusAreaWidth, 2*statusAreaHeight);
QApplication::syncX();
- /*!
- * \deprecated Sharing the pixmap handle using temp file is deprecated. Use dbus interface com.meego.core.MStatusBar for getting the handle.
- */
- QFile handleTempFile(QDir::temp().filePath("mstatusbar_pixmap_handle"));
- if (!handleTempFile.open(QIODevice::WriteOnly)) {
+ if (!statusAreaPixmap->isNull()) {
+ return true;
+ } else {
return false;
}
- QDataStream dataStream(&handleTempFile);
- dataStream << static_cast<quint32> (statusAreaPixmap->handle());
- return true;
}
uint StatusAreaRenderer::sharedPixmapHandle()
--- src/statusarea/statusareaview.cpp
+++ src/statusarea/statusareaview.cpp
@@ -20,9 +20,9 @@
#include "statusareaview.h"
#include "statusarea.h"
#include "statusindicator.h"
-#include "notifier.h"
#include "clock.h"
#include "contextframeworkcontext.h"
+#include "notificationstatusindicator.h"
#include <QGraphicsLinearLayout>
#include <QGraphicsAnchorLayout>
#include <QDBusConnection>
@@ -57,8 +57,8 @@
landscapeInputMethodIndicator(new InputMethodStatusIndicator(controller)),
landscapeCallIndicator(new CallStatusIndicator(contextFrameworkContext, controller)),
portraitCallIndicator(new CallStatusIndicator(contextFrameworkContext, controller)),
- landscapeNotifier(new Notifier(controller)),
- portraitNotifier(new Notifier(controller)),
+ landscapeNotificationIndicator(new NotificationStatusIndicator(controller)),
+ portraitNotificationIndicator(new NotificationStatusIndicator(controller)),
landscapeClock(new Clock(controller)),
portraitClock(new Clock(controller))
{
@@ -70,6 +70,9 @@
connect(portraitAlarmIndicator, SIGNAL(alarmSettingChanged(bool)), portraitClock, SLOT(setShortDisplay(bool)));
connect(landscapeAlarmIndicator, SIGNAL(alarmSettingChanged(bool)), landscapeClock, SLOT(setShortDisplay(bool)));
+ connect(controller, SIGNAL(statusIndicatorMenuVisibilityChanged(bool)), landscapeNotificationIndicator, SLOT(statusIndicatorMenuVisibilityChange(bool)));
+ connect(controller, SIGNAL(statusIndicatorMenuVisibilityChanged(bool)), portraitNotificationIndicator, SLOT(statusIndicatorMenuVisibilityChange(bool)));
+
// Set up landscape and portrait widgets and anchor them on top of each other
landscapeWidget->setLayout(createLandscapeLayout());
landscapeWidget->setParent(controller);
@@ -78,6 +81,14 @@
QGraphicsAnchorLayout *compositeLayout = new QGraphicsAnchorLayout;
compositeLayout->setContentsMargins(0, 0, 0, 0);
compositeLayout->setSpacing(0);
+
+ // Add notification indicator and anchor it to middle of landscape and portrait widgets
+ compositeLayout->addAnchor(landscapeNotificationIndicator, Qt::AnchorVerticalCenter, landscapeWidget, Qt::AnchorVerticalCenter);
+ compositeLayout->addAnchor(landscapeNotificationIndicator, Qt::AnchorHorizontalCenter, landscapeWidget, Qt::AnchorHorizontalCenter);
+
+ compositeLayout->addAnchor(portraitNotificationIndicator, Qt::AnchorVerticalCenter, portraitWidget, Qt::AnchorVerticalCenter);
+ compositeLayout->addAnchor(portraitNotificationIndicator, Qt::AnchorHorizontalCenter, portraitWidget, Qt::AnchorHorizontalCenter);
+
compositeLayout->addCornerAnchors(landscapeWidget, Qt::TopLeftCorner, compositeLayout, Qt::TopLeftCorner);
compositeLayout->addCornerAnchors(landscapeWidget, Qt::TopRightCorner, compositeLayout, Qt::TopRightCorner);
compositeLayout->addCornerAnchors(portraitWidget, Qt::TopLeftCorner, landscapeWidget, Qt::BottomLeftCorner);
@@ -94,8 +105,6 @@
void StatusAreaView::setupTestabilityObjectNames()
{
- landscapeNotifier->setObjectName("landscapenotifier");
- portraitNotifier->setObjectName("portraitnotifier");
landscapeClock->setObjectName("landscapeclock");
portraitClock->setObjectName("portraitclock");
}
@@ -124,8 +133,8 @@
landscapeInputMethodIndicator->setParent(landscapeWidget);
landscapeCallIndicator->setParent(landscapeWidget);;
portraitCallIndicator->setParent(portraitWidget);;
- landscapeNotifier->setParent(landscapeWidget);
- portraitNotifier->setParent(portraitWidget);
+ landscapeNotificationIndicator->setParent(landscapeWidget);
+ portraitNotificationIndicator->setParent(portraitWidget);
landscapeClock->setParent(landscapeWidget);;
portraitClock->setParent(portraitWidget);;
}
@@ -163,8 +172,6 @@
layout->addItem(landscapePhoneNetworkTypeIndicator);
layout->addItem(landscapePhoneNetworkIndicator);
layout->addStretch();
- layout->addItem(landscapeNotifier);
- layout->addStretch();
layout->addItem(landscapeInternetConnectionIndicator);
layout->addItem(landscapeBluetoothIndicator);
layout->addItem(landscapeGPSIndicator);
@@ -190,8 +197,6 @@
layout->addItem(portraitPhoneNetworkTypeIndicator);
layout->addItem(portraitPhoneNetworkIndicator);
layout->addStretch();
- layout->addItem(portraitNotifier);
- layout->addStretch();
layout->addItem(portraitInternetConnectionIndicator);
layout->addItem(portraitBluetoothIndicator);
layout->addItem(portraitGPSIndicator);
--- src/statusarea/statusareaview.h
+++ src/statusarea/statusareaview.h
@@ -118,9 +118,9 @@
StatusIndicator *landscapeCallIndicator;
StatusIndicator *portraitCallIndicator;
- //! Notifier
- Notifier *landscapeNotifier;
- Notifier *portraitNotifier;
+ //! Notification indicator
+ StatusIndicator *landscapeNotificationIndicator;
+ StatusIndicator *portraitNotificationIndicator;
//! Clock
Clock *landscapeClock;
--- src/statusarea/statusindicator.cpp
+++ src/statusarea/statusindicator.cpp
@@ -27,6 +27,16 @@
#define WARNING
#include "debug.h"
+// keep these in sync with the context framework!
+static const QString CONTEXT_CALLSTATE_ALERTING = "alerting";
+static const QString CONTEXT_CALLSTATE_KNOCKING = "knocking";
+static const QString CONTEXT_CALLSTATE_ACTIVE = "active";
+
+static const QString BATTERY_MODE_NORMAL = "Level";
+static const QString BATTERY_MODE_CHARGING = "Charging";
+static const QString BATTERY_MODE_POWERSAVE = "PowerSave";
+static const QString BATTERY_MODE_POWERSAVE_AND_CHARGING = "PowerSaveCharging";
+
StatusIndicator::StatusIndicator(MWidget *parent) :
MWidgetController(new StatusIndicatorModel, parent),
animateIfPossible(false),
@@ -109,10 +119,10 @@
{
setObjectName(metaObject()->className());
- signalStrength = createContextItem(context, "Cellular.SignalStrength");
+ signalStrength = createContextItem(context, "Cellular.SignalBars");
connect(signalStrength, SIGNAL(contentsChanged()), this, SLOT(signalStrengthChanged()));
- setValue(0.0);
+ setValue(0);
setDisplay(false);
}
@@ -122,7 +132,7 @@
void PhoneNetworkSignalStrengthStatusIndicator::signalStrengthChanged()
{
- setValue(signalStrength->value().toDouble() * 0.01f);
+ setValue(signalStrength->value().toDouble() * 0.2f );
}
void PhoneNetworkSignalStrengthStatusIndicator::setDisplay(bool display)
@@ -188,7 +198,15 @@
BatteryStatusIndicator::BatteryStatusIndicator(ApplicationContext &context, MWidget *parent) :
StatusIndicator(parent)
{
- setObjectName(QString(metaObject()->className()) + "Level");
+ setObjectName(QString(metaObject()->className()) + BATTERY_MODE_NORMAL);
+
+ batterySaveModeEnabled = false;
+#ifdef HAVE_QMSYSTEM
+ if (qmDeviceMode.getPSMState() == Maemo::QmDeviceMode::PSMStateOn) {
+ setObjectName(QString(metaObject()->className()) + BATTERY_MODE_POWERSAVE);
+ batterySaveModeEnabled = true;
+ }
+#endif
batteryLevel = createContextItem(context, "Battery.ChargePercentage");
connect(batteryLevel, SIGNAL(contentsChanged()), this, SLOT(batteryLevelChanged()));
@@ -196,6 +214,11 @@
batteryCharging = createContextItem(context, "Battery.IsCharging");
connect(batteryCharging, SIGNAL(contentsChanged()), this, SLOT(batteryChargingChanged()));
+#ifdef HAVE_QMSYSTEM
+ connect(&qmDeviceMode, SIGNAL(devicePSMStateChanged(Maemo::QmDeviceMode::PSMState)),
+ this, SLOT(batterySaveModeChanged(Maemo::QmDeviceMode::PSMState)));
+#endif
+
batteryLevelChanged ();
}
@@ -213,10 +236,18 @@
void BatteryStatusIndicator::batteryChargingChanged()
{
if (batteryCharging->value().toBool()) {
- setObjectName(QString(metaObject()->className()) + "Charging");
+ if (batterySaveModeEnabled) {
+ setObjectName(QString(metaObject()->className()) + BATTERY_MODE_POWERSAVE_AND_CHARGING);
+ } else {
+ setObjectName(QString(metaObject()->className()) + BATTERY_MODE_CHARGING);
+ }
animateIfPossible = true;
} else {
- setObjectName(QString(metaObject()->className()) + "Level");
+ if (batterySaveModeEnabled) {
+ setObjectName(QString(metaObject()->className()) + BATTERY_MODE_POWERSAVE);
+ } else {
+ setObjectName(QString(metaObject()->className()) + BATTERY_MODE_NORMAL);
+ }
animateIfPossible = false;
}
@@ -225,12 +256,24 @@
batteryLevelChanged ();
}
+#ifdef HAVE_QMSYSTEM
+void BatteryStatusIndicator::batterySaveModeChanged(Maemo::QmDeviceMode::PSMState state)
+{
+ if (state == Maemo::QmDeviceMode::PSMStateOn) {
+ batterySaveModeEnabled = true;
+ } else {
+ batterySaveModeEnabled = false;
+ }
+ batteryChargingChanged();
+}
+#endif
+
AlarmStatusIndicator::AlarmStatusIndicator(ApplicationContext &context, MWidget *parent) :
StatusIndicator(parent)
{
setObjectName(metaObject()->className());
- alarm = createContextItem(context, "UserAlarm.Present");
+ alarm = createContextItem(context, "Alarm.Present");
connect(alarm, SIGNAL(contentsChanged()), this, SLOT(alarmChanged()));
alarmChanged();
}
@@ -417,18 +460,19 @@
connect(muted, SIGNAL(contentsChanged()), this, SLOT(callOrMutedChanged()));
}
-CallStatusIndicator::~CallStatusIndicator()
+CallStatusIndicator::~CallStatusIndicator()
{
}
void CallStatusIndicator::callOrMutedChanged()
{
- QString callType = call->value().toString();
- if (callType == "ringing" || callType == "knocking") {
+ QString callState = call->value().toString();
+ if (callState == CONTEXT_CALLSTATE_ALERTING
+ || callState == CONTEXT_CALLSTATE_KNOCKING) {
setObjectName(QString(metaObject()->className()) + "Ringing");
setValue(0);
animateIfPossible = true;
- } else if (callType == "active") {
+ } else if (callState == CONTEXT_CALLSTATE_ACTIVE) {
setObjectName(QString(metaObject()->className()) + "Ongoing");
setValue(muted->value().toBool() ? 1 : 0);
animateIfPossible = false;
--- src/statusarea/statusindicator.h
+++ src/statusarea/statusindicator.h
@@ -23,6 +23,10 @@
#include <MWidgetController>
#include "statusindicatormodel.h"
+#ifdef HAVE_QMSYSTEM
+#include <qmdevicemode.h>
+#endif
+
class ApplicationContext;
class ContextItem;
@@ -204,9 +208,21 @@
void batteryLevelChanged();
void batteryChargingChanged();
+#ifdef HAVE_QMSYSTEM
+ void batterySaveModeChanged(Maemo::QmDeviceMode::PSMState state);
+#endif
+
private:
ContextItem *batteryLevel;
ContextItem *batteryCharging;
+#ifdef HAVE_QMSYSTEM
+ Maemo::QmDeviceMode qmDeviceMode;
+#endif
+ bool batterySaveModeEnabled;
+
+#ifdef UNIT_TEST
+ friend class Ut_StatusIndicator;
+#endif
};
/*!
--- src/statusarea/statusindicatoranimationstyle.h
+++ src/statusarea/statusindicatoranimationstyle.h
@@ -29,6 +29,8 @@
//! The number of milliseconds in which the given images are animated
M_STYLE_ATTRIBUTE(int, animationDuration, AnimationDuration)
+ //! If the indicator should size itself according to the icons size. This will override the sizes defined in the style
+ M_STYLE_ATTRIBUTE(bool, useIconSize, UseIconSize)
};
class StatusIndicatorAnimationStyleContainer : public MWidgetStyleContainer
--- src/statusarea/statusindicatoranimationview.cpp
+++ src/statusarea/statusindicatoranimationview.cpp
@@ -16,7 +16,6 @@
** of this file.
**
****************************************************************************/
-
#include "statusindicatoranimationview.h"
#include "statusindicator.h"
#include <MViewCreator>
@@ -32,6 +31,7 @@
MWidgetView(controller),
controller(controller),
animationFrame(0),
+ firstAnimationFrame(0),
animationTimeline(new QTimeLine(0, this))
{
animationTimeline->setCurveShape(QTimeLine::LinearCurve);
@@ -57,15 +57,15 @@
void StatusIndicatorAnimationView::updateData(const QList<const char *>& modifications)
{
MWidgetView::updateData(modifications);
-
const char *member;
foreach(member, modifications) {
if (member == StatusIndicatorModel::Value) {
if (model()->value().type() == QVariant::String) {
- setAnimationFrame(0);
setupImageList(model()->value().toString());
- }
- } else if (member == BatteryStatusIndicatorModel::Animate) {
+ setAnimationFrame(firstAnimationFrame);
+ setupAnimationTimeline();
+ }
+ } else if (member == StatusIndicatorModel::Animate) {
if (model()->animate()) {
startAnimation();
} else {
@@ -86,18 +86,24 @@
void StatusIndicatorAnimationView::setupAnimationTimeline()
{
animationTimeline->setDuration(style()->animationDuration());
- animationTimeline->setFrameRange(0, images.size());
- animationTimeline->setUpdateInterval(style()->animationDuration() / (images.size() > 0 ? images.size() : 1));
+ animationTimeline->setFrameRange(firstAnimationFrame, images.size());
+ animationTimeline->setUpdateInterval(style()->animationDuration() / (images.size() > 0 ? (images.size() - firstAnimationFrame) : 1));
+}
+
+void StatusIndicatorAnimationView::setFirstAnimationFrame(int frame)
+{
+ firstAnimationFrame = qBound(0, frame, images.size() - 1);
+ setupAnimationTimeline();
}
void StatusIndicatorAnimationView::setAnimationFrame(int frame)
{
frame = qBound(0, frame, images.size() - 1);
- if (animationFrame != frame) {
- animationFrame = frame;
- controller->update();
- }
+ animationFrame = frame;
+ loadCurrentFrame();
+ resizeToCurrentFrameIfNeeded();
+ controller->update();
}
void StatusIndicatorAnimationView::startAnimation()
@@ -117,14 +123,10 @@
void StatusIndicatorAnimationView::drawContents(QPainter *painter, const QStyleOptionGraphicsItem *) const
{
if (animationFrame < images.size() && size().width() > 0 && size().height() > 0) {
- if (images[animationFrame] == NULL) {
- // Load the image if it has not been loaded yet
- images[animationFrame] = MTheme::pixmapCopy(imageList.at(animationFrame));
- }
-
if (images[animationFrame] != NULL) {
// Paint the image
- painter->drawPixmap(QPointF(0, 0), *images[animationFrame]);
+ QRect target(QRect(QPoint(0, 0), size().toSize()));
+ painter->drawPixmap(target, *images[animationFrame]);
}
}
}
@@ -152,8 +154,6 @@
// Create an icon list
imageList = iconIDs.trimmed().split(QChar(' '));
images = QVector<const QPixmap *>(imageList.length(), NULL);
-
- setupAnimationTimeline();
} else {
// Use the "no icon" (default) style
style().setModeDefault();
@@ -164,4 +164,30 @@
controller->update();
}
+void StatusIndicatorAnimationView::loadCurrentFrame()
+{
+ if (animationFrame < images.size() && images[animationFrame] == NULL) {
+ // Load the image if it has not been loaded yet
+ images[animationFrame] = MTheme::pixmapCopy(imageList.at(animationFrame));
+ }
+}
+
+void StatusIndicatorAnimationView::resizeToCurrentFrameIfNeeded()
+{
+ if (style()->useIconSize() ) {
+ controller->updateGeometry();
+ }
+}
+
+QSizeF StatusIndicatorAnimationView::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
+{
+ QSizeF size;
+ if (style()->useIconSize() && animationFrame < images.size() && images[animationFrame] != NULL) {
+ size = images[animationFrame]->size();
+ } else {
+ size = MWidgetView::sizeHint(which, constraint);
+ }
+ return size;
+}
+
M_REGISTER_VIEW_NEW(StatusIndicatorAnimationView, StatusIndicator)
--- src/statusarea/statusindicatoranimationview.h
+++ src/statusarea/statusindicatoranimationview.h
@@ -50,6 +50,10 @@
*/
virtual ~StatusIndicatorAnimationView();
+ //! \reimp
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
+ //! \reimp_end
+
protected slots:
//! \reimp
virtual void updateData(const QList<const char *>& modifications);
@@ -70,7 +74,7 @@
*
* \param frame the animation frame to show
*/
- virtual void setAnimationFrame(int frame);
+ void setAnimationFrame(int frame);
protected:
//! \reimp
@@ -85,6 +89,12 @@
void setupAnimationTimeline();
/*!
+ * Sets the first frame for the animation
+ * \param frame the animation frame from which the animation starts
+ */
+ void setFirstAnimationFrame(int frame);
+
+ /*!
* Clears the images list
*/
void clearImageList();
@@ -96,6 +106,7 @@
*/
void setupImageList(const QString &iconIDs);
+
//! The controller for this view
StatusIndicator *controller;
@@ -108,9 +119,19 @@
//! The current animation frame
int animationFrame;
+ //! The animation frame from which the animation starts
+ int firstAnimationFrame;
+
//! Timeline for the animation
QTimeLine *animationTimeline;
+private:
+
+ //! Loads the current animation frame if not already loaded
+ void loadCurrentFrame();
+ //! Resizes this view according to the current pixmap shown if needed.
+ void resizeToCurrentFrameIfNeeded();
+
#ifdef UNIT_TEST
friend class Ut_StatusIndicatorAnimationView;
#endif
--- src/statusarea/statusindicatoriconview.cpp
+++ src/statusarea/statusindicatoriconview.cpp
@@ -50,6 +50,7 @@
model()->value().toDouble());
SYS_DEBUG ("*** calling setAnimationFrame (%d)",
frameNumber);
+ setFirstAnimationFrame(frameNumber);
setAnimationFrame(frameNumber);
}
}
--- src/statusarea/statusindicatormodel.h
+++ src/statusarea/statusindicatormodel.h
@@ -92,4 +92,9 @@
M_MODEL(ProfileStatusIndicatorModel)
};
+class NotificationStatusIndicatorModel : public StatusIndicatorModel
+{
+ M_MODEL(NotificationStatusIndicatorModel)
+};
+
#endif /* STATUSINDICATORMODEL_H_ */
--- src/statusindicatormenu/notificationarea.cpp
+++ src/statusindicatormenu/notificationarea.cpp
@@ -21,7 +21,7 @@
#include "notificationarea.h"
#include "notificationareasink.h"
#include "mcompositornotificationsink.h"
-#include <MInfoBanner>
+#include <MBanner>
#include <QTimer>
NotificationArea::NotificationArea(MWidget *parent) :
@@ -34,14 +34,16 @@
connect(notificationManager, SIGNAL(groupUpdated(uint, const NotificationParameters &)), notificationAreaSink, SLOT(addGroup(uint, const NotificationParameters &)));
connect(notificationManager, SIGNAL(groupRemoved(uint)), notificationAreaSink, SLOT(removeGroup(uint)));
connect(notificationManager, SIGNAL(notificationRemoved(uint)), notificationAreaSink, SLOT(removeNotification(uint)));
- connect(notificationManager, SIGNAL(notificationRestored(Notification)), notificationAreaSink, SLOT(addNotification(Notification)));
+ connect(notificationManager, SIGNAL(notificationRestored(const Notification &)), notificationAreaSink, SLOT(addNotification(const Notification &)));
connect(notificationManager, SIGNAL(notificationUpdated(const Notification &)), notificationAreaSink, SLOT(addNotification(const Notification &)));
- connect(notificationAreaSink, SIGNAL(addNotification(MInfoBanner &)), this, SLOT(addNotification(MInfoBanner &)));
- connect(notificationAreaSink, SIGNAL(removeNotification(MInfoBanner &)), this, SLOT(removeNotification(MInfoBanner &)));
+ connect(notificationAreaSink, SIGNAL(addNotification(MBanner &)), this, SLOT(addNotification(MBanner &)));
+ connect(notificationAreaSink, SIGNAL(removeNotification(MBanner &)), this, SLOT(removeNotification(MBanner &)));
connect(notificationAreaSink, SIGNAL(notificationRemovalRequested(uint)), notificationManager, SLOT(removeNotification(uint)));
connect(notificationAreaSink, SIGNAL(notificationGroupClearingRequested(uint)), notificationManager, SLOT(removeNotificationsInGroup(uint)));
- connect(notificationAreaSink, SIGNAL(notificationAddedToGroup(MInfoBanner &)), this, SLOT(moveNotificationToTop(MInfoBanner &)));
+ connect(notificationAreaSink, SIGNAL(notificationAddedToGroup(MBanner &)), this, SLOT(moveNotificationToTop(MBanner &)));
connect(notificationAreaSink, SIGNAL(bannerClicked()), this, SIGNAL(bannerClicked()));
+ connect(this, SIGNAL(notificationRemovalRequested(uint)), notificationAreaSink, SIGNAL(notificationRemovalRequested(uint)));
+ connect(this, SIGNAL(notificationGroupClearingRequested(uint)), notificationAreaSink, SIGNAL(notificationGroupClearingRequested(uint)));
}
NotificationArea::~NotificationArea()
@@ -49,29 +51,51 @@
delete notificationAreaSink;
}
-void NotificationArea::moveNotificationToTop(MInfoBanner ¬ification)
+void NotificationArea::moveNotificationToTop(MBanner ¬ification)
{
- QList<MInfoBanner *> banners(model()->banners());
+ QList<MBanner *> banners(model()->banners());
if(banners.count() != 0) {
banners.move(banners.indexOf(¬ification), 0);
model()->setBanners(banners);
}
}
-void NotificationArea::addNotification(MInfoBanner ¬ification)
+void NotificationArea::addNotification(MBanner ¬ification)
{
// Put the notification into the model of the notification area
notification.setParentItem(this);
- QList<MInfoBanner *> banners(model()->banners());
+ QList<MBanner *> banners(model()->banners());
banners.push_front(¬ification);
model()->setBanners(banners);
}
-void NotificationArea::removeNotification(MInfoBanner ¬ification)
+void NotificationArea::removeNotification(MBanner ¬ification)
{
// Remove the notification from the model of the notification area
- QList<MInfoBanner *> banners(model()->banners());
+ QList<MBanner *> banners(model()->banners());
banners.removeOne(¬ification);
model()->setBanners(banners);
notification.setParentItem(NULL);
}
+
+void NotificationArea::removeAllRemovableBanners()
+{
+ foreach(MBanner *banner, model()->banners()) {
+ // Remove all user removable banners
+ if (banner->property(WidgetNotificationSink::USER_REMOVABLE_PROPERTY).toBool()) {
+ // Get the notification ID from the info banner
+ bool ok = false;
+ uint notificationId = banner->property(WidgetNotificationSink::NOTIFICATION_ID_PROPERTY).toUInt(&ok);
+ if (ok) {
+ // Request notification removal
+ emit notificationRemovalRequested(notificationId);
+ } else {
+ uint groupId = banner->property(WidgetNotificationSink::GROUP_ID_PROPERTY).toUInt(&ok);
+ if (ok) {
+ // Request notification group clearing
+ emit notificationGroupClearingRequested(groupId);
+ }
+ }
+ }
+ }
+}
--- src/statusindicatormenu/notificationarea.h
+++ src/statusindicatormenu/notificationarea.h
@@ -26,7 +26,7 @@
class NotificationManager;
class NotificationAreaSink;
-class MInfoBanner;
+class MBanner;
class MFlowLayoutPolicy;
/*!
@@ -50,28 +50,44 @@
*/
virtual ~NotificationArea();
+signals:
+ /*!
+ * Requests removal of a notification from the notification system.
+ * \param notificationId Id of the notification to be removed from the system.
+ */
+ void notificationRemovalRequested(uint notificationId);
+
+ /*!
+ * Requests removal of notifications in a group.
+ * \param groupId Id of the group to be cleared.
+ */
+ void notificationGroupClearingRequested(uint groupId);
+
private slots:
/*!
* Adds a notification to the notification area.
*
- * \param notification the MInfoBanner to be added
+ * \param notification the MBanner to be added
*/
- void addNotification(MInfoBanner ¬ification);
+ void addNotification(MBanner ¬ification);
/*!
* Moves the banner to top. Called when relayouting is asked by notification area sink
* when a notification/group is updated.
*
- * \param notification the MInfoBanner to be made top
+ * \param notification the MBanner to be made top
*/
- void moveNotificationToTop(MInfoBanner ¬ification);
+ void moveNotificationToTop(MBanner ¬ification);
/*!
* Removes a notification from the notification area.
*
- * \param notification the MInfoBanner to be removed
+ * \param notification the MBanner to be removed
*/
- void removeNotification(MInfoBanner ¬ification);
+ void removeNotification(MBanner ¬ification);
+
+ //! Requests the sink to remove all notifications that have removable banners in the model
+ void removeAllRemovableBanners();
signals:
/*!
@@ -82,6 +98,10 @@
private:
//! Notification sink for visualizing the notification on the notification area
NotificationAreaSink *notificationAreaSink;
+
+#ifdef UNIT_TEST
+ friend class Ut_NotificationArea;
+#endif
};
#endif /* NOTIFICATIONAREA_H_ */
--- src/statusindicatormenu/notificationareamodel.h
+++ src/statusindicatormenu/notificationareamodel.h
@@ -22,16 +22,16 @@
#include <MWidgetModel>
-class MInfoBanner;
+class MBanner;
-typedef QList<MInfoBanner *> BannerList;
+typedef QList<MBanner *> BannerList;
class NotificationAreaModel : public MWidgetModel
{
Q_OBJECT
M_MODEL(NotificationAreaModel)
- //! Notification MInfoBanner's in statusarea
- M_MODEL_PROPERTY(BannerList, banners, Banners, true, QList<MInfoBanner *>())
+ //! Notification MBanner's in statusarea
+ M_MODEL_PROPERTY(BannerList, banners, Banners, true, QList<MBanner *>())
};
#endif /* NOTIFICATIONAREAMODEL_H_ */
--- src/statusindicatormenu/notificationareaview.cpp
+++ src/statusindicatormenu/notificationareaview.cpp
@@ -19,43 +19,82 @@
#include "notificationareaview.h"
#include "notificationarea.h"
+#include "widgetnotificationsink.h"
#include <MViewCreator>
-#include <MLayout>
-#include <MLinearLayoutPolicy>
-#include <MInfoBanner>
-#include <MContainer>
+#include <MBanner>
+#include <MButton>
#include <QGraphicsLinearLayout>
NotificationAreaView::NotificationAreaView(NotificationArea *controller) :
- MWidgetView(controller)
+ MWidgetView(controller),
+ bannerLayout(new QGraphicsLinearLayout(Qt::Vertical)),
+ clearButtonLayout(new QGraphicsLinearLayout(Qt::Horizontal)),
+ clearButton(NULL)
{
- // Set layout
- layout = new QGraphicsLinearLayout(Qt::Vertical);
- layout->setContentsMargins(0, 0, 0, 0);
- layout->setSpacing(0);
- controller->setLayout(layout);
+ // Set up the main layout
+ QGraphicsLinearLayout *mainLayout = new QGraphicsLinearLayout(Qt::Vertical);
+ mainLayout->setContentsMargins(0, 0, 0, 0);
+ mainLayout->setSpacing(0);
+ mainLayout->addItem(bannerLayout);
+ mainLayout->addItem(clearButtonLayout);
+ controller->setLayout(mainLayout);
+
+ // Set up the banner layout
+ bannerLayout->setContentsMargins(0, 0, 0, 0);
+ bannerLayout->setSpacing(0);
+
+ // Put a clear button into the clear button layout
+ clearButtonLayout->setContentsMargins(0, 0, 0, 0);
+ clearButtonLayout->setSpacing(0);
+
+ //% "Clear"
+ clearButton = new MButton(qtTrId("qtn_noti_clear"));
+ clearButton->setObjectName("NotificationAreaClearButton");
+ connect(clearButton, SIGNAL(clicked()), controller, SLOT(removeAllRemovableBanners()));
+ clearButtonLayout->addStretch();
+ clearButtonLayout->addItem(clearButton);
+ clearButtonLayout->addStretch();
}
NotificationAreaView::~NotificationAreaView()
{
+ // Clear the banner layout
+ while (bannerLayout->count() > 0) {
+ bannerLayout->removeAt(0);
+ }
}
void NotificationAreaView::updateData(const QList<const char *>& modifications)
{
+ MWidgetView::updateData(modifications);
+
const char *member;
foreach(member, modifications) {
if (member == NotificationAreaModel::Banners) {
- // Remove all banners from the layoutpolicy (do not destroy them)
- while (layout->count() > 0) {
- layout->removeAt(0);
+ // Remove all banners from the banner layout (do not destroy them)
+ while (bannerLayout->count() > 0) {
+ bannerLayout->removeAt(0);
}
// Add banners from the model to the layout
- foreach(MInfoBanner * banner, model()->banners()) {
- layout->addItem(banner);
+ bool removableBannersExist = false;
+ foreach(MBanner *banner, model()->banners()) {
+ removableBannersExist |= banner->property(WidgetNotificationSink::USER_REMOVABLE_PROPERTY).toBool();
+ bannerLayout->addItem(banner);
}
+
+ // If removable banners exist make the clear button visible
+ clearButton->setObjectName(removableBannersExist ? "NotificationAreaClearButtonVisible" : "NotificationAreaClearButton");
}
}
}
+void NotificationAreaView::applyStyle()
+{
+ MWidgetView::applyStyle();
+
+ // TODO: Without this the banner layout size did not reflect the new banner sizes. Go figure.
+ bannerLayout->invalidate();
+}
+
M_REGISTER_VIEW_NEW(NotificationAreaView, NotificationArea)
--- src/statusindicatormenu/notificationareaview.h
+++ src/statusindicatormenu/notificationareaview.h
@@ -27,6 +27,7 @@
class NotificationArea;
class QGraphicsLinearLayout;
+class MButton;
class NotificationAreaView : public MWidgetView
{
@@ -49,11 +50,22 @@
protected:
//! \reimp
virtual void updateData(const QList<const char *>& modifications);
+ virtual void applyStyle();
//! \reimp_end
private:
- //! The layout of the notification area
- QGraphicsLinearLayout *layout;
+ //! The layout for the banners
+ QGraphicsLinearLayout *bannerLayout;
+
+ //! A layout for the clear button
+ QGraphicsLinearLayout *clearButtonLayout;
+
+ //! The clear button
+ MButton *clearButton;
+
+#ifdef UNIT_TEST
+ friend class Ut_NotificationAreaView;
+#endif
};
#endif /* NOTIFICATIONAREAVIEW_H_ */
--- src/statusindicatormenu/pluginlist.cpp
+++ src/statusindicatormenu/pluginlist.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 "pluginlist.h"
-#include <MButton>
-#include <QTimer>
-#include <MSceneWindow>
-#include <QStringList>
-#include <QPluginLoader>
-#include <QGraphicsLinearLayout>
-#include <QDebug>
-#include "statusindicatormenuwindow.h"
-
-PluginList::PluginList(StatusIndicatorMenuWindow *window, QGraphicsItem *parent) :
- MWidget(parent),
- mainLayout(new QGraphicsLinearLayout(Qt::Vertical)),
- window(window)
-{
- // Create a widget for laying out the widgets
- mainLayout->setContentsMargins(0, 0, 0, 0);
- setLayout(mainLayout);
-
- pluginsToBeLoaded <<
- "/libprofile.so" <<
- "/libdatetime.so" <<
- "/libclockalarm.so" <<
- "/libconnectivity.so" <<
- "/libpresence.so" <<
- "/libbattery.so" <<
- "/libaccessories.so" <<
- "/libcallui.so" <<
- "/libtransferui.so";
-
- QTimer::singleShot(0, this, SLOT(loadPlugins()));
-}
-
-PluginList::~PluginList()
-{
-}
-
-void PluginList::loadPlugins()
-{
- // Load the plugins
- if (!pluginsToBeLoaded.isEmpty()) {
- const QString fullPath = STATUSINDICATORMENU_PLUGIN_DIR + pluginsToBeLoaded.takeFirst();
-
- qDebug() << "Loading status indicator menu plugin" << fullPath;
- addPlugin (fullPath);
- qDebug() << "Loaded status indicator menu plugin" << fullPath;
-
- QTimer::singleShot(0, this, SLOT(loadPlugins()));
- }
-}
-
-void PluginList::showStatusIndicatorMenu()
-{
- window->showStatusIndicatorMenu();
-}
-
-void PluginList::hideStatusIndicatorMenu()
-{
- window->hideStatusIndicatorMenu();
-}
-
-/*!
- * This function will actually load a plugin.
- */
-void PluginList::addPlugin(const QString &path)
-{
- bool success;
- QObject *object;
- QPluginLoader loader(path);
-
- /*
- * We have to resolve all the symbols early, so we will not abort when there
- * are unresolved symbols in the library. It is really important!
- */
- loader.setLoadHints(QLibrary::ResolveAllSymbolsHint);
- success = loader.load();
- if (!success) {
- qDebug() << "Error loading plugin " << path << ": " << loader.errorString();
- return;
- }
-
- object = loader.instance();
-
- MStatusIndicatorMenuPluginInterface* plugin = qobject_cast<MStatusIndicatorMenuPluginInterface*> (object);
- if (plugin != NULL) {
- MWidget *widget = plugin->constructWidget(*this);
- if (widget != NULL) {
- mainLayout->addItem(widget);
- }
- }
-
- delete object;
-}
--- src/statusindicatormenu/pluginlist.h
+++ src/statusindicatormenu/pluginlist.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 PLUGINLIST_H_
-#define PLUGINLIST_H_
-
-#include <MWidget>
-#include "mstatusindicatormenuplugininterface.h"
-
-class StatusIndicatorMenuWindow;
-class QGraphicsLinearLayout;
-class QStringList;
-
-/*!
- * The plugin list displays a list of plugins instantiated from shared
- * libraries.
- */
-class PluginList : public MWidget, public MStatusIndicatorMenuInterface {
- Q_OBJECT
-
-public:
- /*!
- * Creates a new plugin list.
- *
- * \param window the window to minimize if the application should be hidden
- * \param parent the parent item
- */
- PluginList(StatusIndicatorMenuWindow *window, QGraphicsItem *parent = NULL);
-
- /*!
- * Destroys the plugin list.
- */
- virtual ~PluginList();
-
- //! \reimp
- virtual void showStatusIndicatorMenu();
- //! \reimp_end
-
-public slots:
- //! \reimp
- virtual void hideStatusIndicatorMenu();
- //! \reimp_end
-
-private slots:
- /*!
- * \brief Slot for loading the status-menu plugins when we're idle
- */
- void loadPlugins();
-
-private:
- /*!
- * Adds a plugin to the list.
- *
- * \param path the path of the plugin to load
- */
- void addPlugin(const QString &path);
-
- //! The layout for the list
- QGraphicsLinearLayout *mainLayout;
-
- //! The window to minimize if the menu should be hidden
- StatusIndicatorMenuWindow *window;
-
- //! Stuff to handle sequential delayed plugin loading. Some of the plugins
- //! are loading slow, we have to get a chance to run while they are loading.
- QStringList pluginsToBeLoaded;
-};
-
-#endif /* PLUGINLIST_H_ */
--- src/statusindicatormenu/statusindicatormenu.pri
+++ src/statusindicatormenu/statusindicatormenu.pri
@@ -5,14 +5,12 @@
SOURCES += \
statusindicatormenu/statusindicatormenuwindow.cpp \
statusindicatormenu/statusindicatormenuadaptor.cpp \
- statusindicatormenu/pluginlist.cpp \
statusindicatormenu/notificationarea.cpp \
statusindicatormenu/notificationareaview.cpp
HEADERS += \
statusindicatormenu/statusindicatormenuwindow.h \
statusindicatormenu/statusindicatormenuadaptor.h \
- statusindicatormenu/pluginlist.h \
statusindicatormenu/notificationarea.h \
statusindicatormenu/notificationareamodel.h \
statusindicatormenu/notificationareaview.h \
--- src/statusindicatormenu/statusindicatormenuwindow.cpp
+++ src/statusindicatormenu/statusindicatormenuwindow.cpp
@@ -26,7 +26,6 @@
#include <MApplicationIfProxy>
#include <MPannableViewport>
#include <QGraphicsLinearLayout>
-#include "pluginlist.h"
#include "notificationarea.h"
#include "statusindicatormenuwindow.h"
#include <MWidgetView>
@@ -61,6 +60,11 @@
void PannedWidgetController::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
+ event->accept();
+}
+
+void PannedWidgetController::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
+{
if (bottommostWidget_) {
// Test that the y position of the event is bigger than the bottom edge of the bottommost widget.
// The calculations are done in this widget's coordinate space.
@@ -85,6 +89,20 @@
connect(this, SIGNAL(displayEntered()), this, SLOT(displayActive()));
connect(this, SIGNAL(displayExited()), this, SLOT(displayInActive()));
+#ifdef HAVE_QMSYSTEM
+ /*
+ * We need to receive updates when device lock state changes
+ * to prevent status indicator menu opening when device lock is on
+ */
+ connect (&qmLocks, SIGNAL(stateChanged (Maemo::QmLocks::Lock, Maemo::QmLocks::State)), this,
+ SLOT(setWindowStateAccordingToDeviceLockState(Maemo::QmLocks::Lock, Maemo::QmLocks::State)));
+ if (qmLocks.getState(Maemo::QmLocks::Device) == Maemo::QmLocks::Unlocked) {
+ deviceLocked = false;
+ } else {
+ deviceLocked = true;
+ }
+#endif
+
// Show status bar
sceneManager()->appearSceneWindowNow(statusBar);
@@ -141,7 +159,7 @@
MButton *settingsButton = new MButton(qtTrId("qtn_stat_menu_settings"));
settingsButton->setObjectName("StatusIndicatorMenuTopRowExtensionButton");
settingsButton->setViewType(MButton::iconType);
- settingsButton->setIconID("icon-m-common-settings");
+ settingsButton->setIconID("icon-m-status-menu-settings");
connect(settingsButton, SIGNAL(clicked()), this, SLOT(launchControlPanelAndHide()));
// Put the extension area and the settings button to a horizontal layout
@@ -187,7 +205,6 @@
contentLayout->setSpacing(0);
contentLayout->addItem(extensionArea);
contentLayout->addItem(notificationArea);
- contentLayout->addItem(new PluginList(this, sceneWindow));
MWidgetController *contentWidget = new MWidgetController;
contentWidget->setView(new MWidgetView(contentWidget));
@@ -275,36 +292,28 @@
QGraphicsWidget *pannableWidget = pannableViewport->widget();
// Enable pannability if there is too much content to fit on the screen
- if (pannableViewport->geometry().height() > pannableWidget->effectiveSizeHint(Qt::PreferredSize).height()) {
- pannableViewport->setEnabled(false);
- } else {
- pannableViewport->setEnabled(true);
- }
+ bool viewportShouldBePannable = pannableWidget->effectiveSizeHint(Qt::PreferredSize).height() > pannableViewport->geometry().height();
+ pannableViewport->setEnabled(viewportShouldBePannable);
// Appear or disappear the close button overlay based on close area position
const QGraphicsWidget *closeButtonRow = static_cast<PannedWidgetController *>(pannableViewport->widget())->bottommostWidget();
qreal screenHeight = sceneManager()->visibleSceneSize().height();
- qreal yPos = closeButtonRow->mapToItem(sceneWindow, QPointF(0, closeButtonRow->geometry().height())).y();
+ qreal closeButtonRowBottomYPos = closeButtonRow->mapToItem(sceneWindow, QPointF(0, closeButtonRow->geometry().height())).y();
- if (yPos <= screenHeight) {
+ if (closeButtonRowBottomYPos <= screenHeight) {
sceneManager()->disappearSceneWindowNow(closeButtonOverlay);
} else {
sceneManager()->appearSceneWindowNow(closeButtonOverlay);
}
- // Make pannable area background window to appear when pannable widget is panned
- qreal widgetCurrentYPos = pannableWidget->mapToItem(sceneWindow, pannableWidget->geometry().topLeft()).y();
- qreal widgetOriginalYPos = pannableWidget->mapToItem(sceneWindow, QPointF()).y();
+ // Make the pannable area background window extend from the top of the pannable viewport halfway to the bottom of the close button row
qreal viewPortYPos = pannableViewport->mapToItem(sceneWindow, QPointF()).y();
-
- if (widgetCurrentYPos > widgetOriginalYPos) {
- // Force the size of the background window
- backgroundWidget->setMinimumHeight(sceneManager()->visibleSceneSize().height() - viewPortYPos);
- backgroundWidget->setMaximumHeight(sceneManager()->visibleSceneSize().height() - viewPortYPos);
- } else {
- backgroundWidget->setMinimumHeight(0);
- backgroundWidget->setMaximumHeight(0);
+ qreal backgroundHeight = (closeButtonRowBottomYPos - viewPortYPos) / 2;
+ if (backgroundHeight < 0) {
+ backgroundHeight = 0;
}
+ backgroundWidget->setMinimumHeight(backgroundHeight);
+ backgroundWidget->setMaximumHeight(backgroundHeight);
}
void StatusIndicatorMenuWindow::displayActive()
@@ -316,6 +325,11 @@
{
pannableViewport->updatePosition(QPointF(0,0));
emit visibilityChanged(false);
+ // Hide the window when the it is obscured by another view
+ // Note: Dialogs and notifications won't close it anyways,
+ // as they are not supposed to be full screen and don't completely
+ // obstruct the status menu window fully.
+ hide();
}
void StatusIndicatorMenuWindow::setStatusIndicatorMenuInterface(MApplicationExtensionInterface *extension)
@@ -326,10 +340,14 @@
void StatusIndicatorMenuWindow::makeVisible()
{
+#ifdef HAVE_QMSYSTEM
+ if (deviceLocked) {
+ return;
+ }
+#endif
if (!isVisible()) {
// If status indicator window is not visible, then show it
show();
- showFullScreen();
} else {
// Otherwise, raise it
raise();
@@ -338,6 +356,11 @@
void StatusIndicatorMenuWindow::showStatusIndicatorMenu()
{
+#ifdef HAVE_QMSYSTEM
+ if (deviceLocked) {
+ return;
+ }
+#endif
sceneWindow->appear();
}
@@ -358,3 +381,20 @@
hideStatusIndicatorMenu();
}
+
+#ifdef HAVE_QMSYSTEM
+void StatusIndicatorMenuWindow::setWindowStateAccordingToDeviceLockState(Maemo::QmLocks::Lock what, Maemo::QmLocks::State how)
+{
+ if (what == Maemo::QmLocks::Device) {
+ if (how == Maemo::QmLocks::Unlocked) {
+ deviceLocked = false;
+ } else {
+ deviceLocked = true;
+ if (isVisible()) {
+ hideStatusIndicatorMenu();
+ }
+ }
+ }
+}
+
+#endif
--- src/statusindicatormenu/statusindicatormenuwindow.h
+++ src/statusindicatormenu/statusindicatormenuwindow.h
@@ -27,6 +27,10 @@
#include "mstatusindicatormenuextensioninterface.h"
#include "mstatusbar.h"
+#ifdef HAVE_QMSYSTEM
+#include <qmlocks.h>
+#endif
+
class QGraphicsSceneMouseEvent;
class QGraphicsLinearLayout;
class MPannableViewport;
@@ -82,6 +86,7 @@
//! \reimp
virtual void setGeometry(const QRectF &rect);
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
//! \reimp_end
signals:
@@ -163,7 +168,16 @@
//! Set the pannability and layout based on the size and position of the pannable area
void setPannabilityAndLayout();
-private:
+#ifdef HAVE_QMSYSTEM
+ /*!
+ * \brief Slot for receiving device lock status changes
+ * \param what tells which lockstate has been changed, either Device or TouchScreen/Keyboard
+ * \param how tells to which state lock has been changed, one of Locked, Unlocked or Unknown
+ */
+ void setWindowStateAccordingToDeviceLockState(Maemo::QmLocks::Lock what, Maemo::QmLocks::State how);
+#endif
+
+private: // methods
//! The name of the control panel service
const static QString CONTROL_PANEL_SERVICE_NAME;
@@ -198,6 +212,17 @@
//! Pannable area background widget
MWidgetController *backgroundWidget;
+
+private: // data
+
+#ifdef HAVE_QMSYSTEM
+ //! QmSystem watcher for device lock
+ Maemo::QmLocks qmLocks;
+
+ //! Device lock status
+ bool deviceLocked;
+#endif
+
#ifdef UNIT_TEST
friend class Ut_StatusIndicatorMenuWindow;
#endif
--- src/sysuid.cpp
+++ src/sysuid.cpp
@@ -95,8 +95,6 @@
m_compositorNotificationSink, SLOT (removeNotification (uint)));
connect (m_compositorNotificationSink, SIGNAL (notificationRemovalRequested (uint)),
m_notificationManager, SLOT (removeNotification (uint)));
- connect (m_notificationManager, SIGNAL (notificationRestored (const Notification &)),
- m_compositorNotificationSink, SIGNAL (notificationAdded (Notification)));
// Connect the notification signals for the feedback notification sink
connect (m_notificationManager, SIGNAL (notificationUpdated (const Notification &)),
@@ -137,18 +135,23 @@
SIGNAL (screenIsLocked (bool)),
m_compositorNotificationSink,
SLOT (setDisabled (bool)));
+ connect (m_sysuidRequest->getLockScreenLogic (),
+ SIGNAL (screenIsLocked (bool)),
+ m_UsbUi,
+ SLOT (setDisabled (bool)));
}
/*
* Instantiate the volume-control UI
*/
- new VolumeControlUI (this);
+ m_volumeBar = new VolumeControlUI;
}
Sysuid::~Sysuid ()
{
- m_Sysuid = NULL;
+ m_Sysuid = 0;
delete m_sysuidRequest;
+ delete m_volumeBar;
}
Sysuid* Sysuid::sysuid ()
@@ -191,6 +194,7 @@
locale.installTrCatalog ("shutdown");
locale.installTrCatalog ("profiles");
locale.installTrCatalog ("screenlock");
+ locale.installTrCatalog ("status");
locale.installTrCatalog (TRANSLATION_CATALOG);
MLocale::setDefault (locale);
--- src/sysuid.h
+++ src/sysuid.h
@@ -34,6 +34,7 @@
class NGFNotificationSink;
class UnlockNotificationSink;
class SysUidRequest;
+class VolumeControlUI;
class Sysuid : public QObject
{
@@ -106,6 +107,9 @@
//! The system-bus adaptor class for unlock-screen interface
SysUidRequest *m_sysuidRequest;
+ //! The volume-control ui
+ VolumeControlUI *m_volumeBar;
+
//! Context item for getting information about video recording status
QSharedPointer<ContextItem> useMode;
};
--- src/unlockmissedevents.cpp
+++ src/unlockmissedevents.cpp
@@ -70,7 +70,9 @@
void
UnlockMissedEvents::addNotification (Types type, QString subject)
{
- SYS_DEBUG ("message = '%s'", SYS_STR (subject));
+ SYS_DEBUG ("*** message = %s", SYS_STR (subject));
+ SYS_DEBUG ("*** type = %d", type);
+
lastSubjects[type] = subject;
notificationCounts[type]++;
lastType = type;
--- src/unlocknotifications.cpp
+++ src/unlocknotifications.cpp
@@ -26,12 +26,16 @@
#include <QPixmap>
#include <MImageWidget>
#include <MSceneManager>
+#include <MStylableWidget>
#include <MOrientationChangeEvent>
#define DEBUG
#include "debug.h"
-UnlockNotifications::UnlockNotifications ()
+#define ICON_SIZE 32
+
+UnlockNotifications::UnlockNotifications () :
+ m_vbox (0)
{
m_icon_ids[UnlockMissedEvents::NotifyEmail] =
QString ("icon-m-content-email");
@@ -47,7 +51,7 @@
/*
* Create the "other events area"
*/
- m_otherevents_area = new MSceneWindow;
+ m_otherevents_area = new MStylableWidget;
m_otherevents_area->setObjectName ("LockOtherEventsArea");
m_otherevents_area->setContentsMargins (0., 0., 0., 0.);
@@ -64,10 +68,12 @@
m_mostrecent_layout->setContentsMargins (0., 0., 0., 0.);
m_last_icon = new MImageWidget;
+ m_last_icon->setZoomFactor (1.0);
m_last_icon->setObjectName ("LockMostRecentIcon");
m_last_subject = new MLabel;
m_last_subject->setObjectName ("LockMostRecentLabel");
+ m_last_subject->setTextElide (true);
m_last_subject->setSizePolicy (QSizePolicy::Preferred, QSizePolicy::Maximum);
/* We have to add the last icon / subject to the other events area at first,
@@ -78,7 +84,7 @@
/*
* Create the "most recent area"
*/
- m_mostrecent_area = new MSceneWindow;
+ m_mostrecent_area = new MStylableWidget;
m_mostrecent_area->setObjectName ("LockMostRecentArea");
m_mostrecent_area->setContentsMargins (0., 0., 0., 0.);
@@ -113,6 +119,8 @@
UnlockNotifications::sizeHint (Qt::SizeHint which,
const QSizeF& constraint) const
{
+ if (m_vbox == 0)
+ return QSizeF (0., 0.);
/*
* forward sizeHint queries to main vbox
*/
@@ -120,10 +128,19 @@
}
void
-UnlockNotifications::orientationChangeEvent (MOrientationChangeEvent *event)
+UnlockNotifications::orientationChangeEvent (
+ MOrientationChangeEvent *event)
+{
+ orientationChanged (event->orientation ());
+}
+
+void
+UnlockNotifications::orientationChanged (
+ M::Orientation orientation)
{
- if (event->orientation () == M::Landscape)
+ if (orientation == M::Landscape)
{
+ SYS_DEBUG ("M:Landscape");
/*
* Remove & hide the most recent area from top
*/
@@ -144,6 +161,7 @@
}
else
{
+ SYS_DEBUG ("M:Portrait");
/*
* Remove the most recent event widgets from other events layout
*/
@@ -198,6 +216,14 @@
}
else
{
+ emit needToShow (true);
+ /*
+ * It seems that we don't get the signal, forcing it manually to detect
+ * the orientation.
+ */
+ if (sceneManager())
+ orientationChanged (sceneManager()->orientation());
+
/*
* Check the actually shown most-recent notification
* type... (yeah it is hacky a bit...)
@@ -216,7 +242,8 @@
(mostRecent == UnlockMissedEvents::NotifySms) ||
(mostRecent == UnlockMissedEvents::NotifyCall))
{
- m_last_icon->setImage (m_icon_ids[mostRecent]);
+ m_last_icon->setImage (m_icon_ids[mostRecent],
+ QSize (ICON_SIZE, ICON_SIZE));
QString mostRecentText =
UnlockMissedEvents::getInstance ().getLastSubject (mostRecent);
@@ -268,16 +295,23 @@
*/
m_labels[mostRecent] = new MLabel;
m_labels[mostRecent]->setObjectName ("LockNotifierLabel");
- m_icons[mostRecent] = new MImageWidget (m_icon_ids[mostRecent]);
+ m_icons[mostRecent] = new MImageWidget;
+ m_icons[mostRecent]->setImage (m_icon_ids[mostRecent],
+ QSize (ICON_SIZE, ICON_SIZE));
+ m_icons[mostRecent]->setZoomFactor (1.0);
m_icons[mostRecent]->setObjectName ("LockNotifierIcon");
}
- m_labels.value (mostRecent)->setText (QString ("%L1").arg (eventCount));
+ m_labels[mostRecent]->setText (QString ("%L1").arg (eventCount));
/*
* Most recent area only visible when orientation is portrait
*/
int newIndex = (m_mostrecent_area->isVisible () == false) ? 2 : 0;
+ /* Somehow isVisible sometimes lying at first call :-S */
+ if (m_icon_layout->count () == 0)
+ newIndex = 0;
+ SYS_DEBUG ("newIndex = %d", newIndex);
/*
* Put the new icons to the proper place...
@@ -286,8 +320,6 @@
m_icon_layout->setAlignment (m_labels[mostRecent], Qt::AlignLeft);
m_icon_layout->insertItem (newIndex, m_icons[mostRecent]);
m_icon_layout->setAlignment (m_icons[mostRecent], Qt::AlignLeft);
-
- emit needToShow (true);
}
}
--- src/unlocknotifications.h
+++ src/unlocknotifications.h
@@ -3,13 +3,15 @@
#include <QObject>
#include <QHash>
+#include <MStylableWidget>
#include <MSceneWindow>
class MLabel;
class MImageWidget;
class QGraphicsLinearLayout;
+class QShowEvent;
-class UnlockNotifications : public MSceneWindow
+class UnlockNotifications : public MStylableWidget
{
Q_OBJECT
@@ -25,8 +27,11 @@
protected:
virtual void orientationChangeEvent (MOrientationChangeEvent *event);
+
virtual QSizeF sizeHint (Qt::SizeHint which,
const QSizeF& constraint = QSizeF()) const;
+
+ void orientationChanged (M::Orientation orientation);
private:
/*
@@ -37,7 +42,7 @@
QHash<int, QString> m_icon_ids;
QGraphicsLinearLayout *m_icon_layout;
- MSceneWindow *m_otherevents_area;
+ MStylableWidget *m_otherevents_area;
/*
* for most recent event area:
*/
@@ -45,7 +50,7 @@
MImageWidget *m_last_icon;
QGraphicsLinearLayout *m_mostrecent_layout;
- MSceneWindow *m_mostrecent_area;
+ MStylableWidget *m_mostrecent_area;
/*
* main vbox
*/
@@ -55,6 +60,4 @@
#endif
};
-
-
#endif
--- src/unlocknotificationsink.cpp
+++ src/unlocknotificationsink.cpp
@@ -23,6 +23,9 @@
#include "notifications/genericnotificationparameterfactory.h"
#include "notifications/notificationwidgetparameterfactory.h"
+#undef DEBUG
+#include "debug.h"
+
/*
* Used event-types:
* Please check the /usr/share/meegotouch/notifications/eventtypes directory for
@@ -43,8 +46,8 @@
#define IM_RECEIVED "im.received"
#define MESSAGING_IM "x-nokia.messaging.im"
-#define DEBUG
-#include "debug.h"
+// These notifications will be filtered out.
+#define EVENT_BATTERY "x-nokia.battery"
UnlockNotificationSink::UnlockNotificationSink () :
m_enabled (false)
@@ -66,8 +69,13 @@
UnlockMissedEvents::getInstance ().clearAll ();
}
+/*!
+ * \returns true for the notification that are going to be shown in the
+ * lockscreen.
+ */
bool
-UnlockNotificationSink::canAddNotification (const Notification ¬ification)
+UnlockNotificationSink::canAddNotification (
+ const Notification ¬ification)
{
Q_UNUSED (notification);
@@ -75,33 +83,26 @@
if (m_enabled == false)
return false;
- return true;
-
-#if 0
- // Filtering by notification event-type, not used for now...
- bool retval = false;
-
+ /*
+ * Filtering by notification event-type. Add all the event types that will
+ * not be shown in the lockscreen here.
+ */
+ bool retval = true;
QString event_type =
notification.parameters ().value (
GenericNotificationParameterFactory::eventTypeKey ()).toString ();
- if ((event_type == EVENT_EMAIL) ||
- (event_type == EVENT_MSG) ||
- (event_type == EVENT_CALL) ||
- (event_type == EVENT_IM))
- retval = true;
+ if (event_type.startsWith (EVENT_BATTERY))
+ retval = false;
return retval;
-#endif
}
void
UnlockNotificationSink::addNotification (const Notification ¬ification)
{
// not locked state... skip
- // XXX:
- // Why i called with addNotification when canAddNotification returns false?
- if (m_enabled == false)
+ if ((m_enabled == false) || (canAddNotification (notification) == false))
return;
QString lastSummary;
--- src/unlockwidgets.cpp
+++ src/unlockwidgets.cpp
@@ -25,7 +25,6 @@
#include <QGraphicsLinearLayout>
-#include <MLocale>
#include <MLabel>
#include <MImageWidget>
@@ -88,6 +87,15 @@
*/
setLayout (lockliftBox);
+#ifdef HAVE_QMSYSTEM
+ m_time = new Maemo::QmTime;
+
+ connect (m_time, SIGNAL (timeOrSettingsChanged (Maemo::QmTimeWhatChanged)),
+ this, SLOT (timeSettingsChanged (Maemo::QmTimeWhatChanged)));
+
+ timeSettingsChanged (Maemo::QmTimeOnlySettingsChanged);
+#endif
+
/*
* And initialize the widgets contents
*/
@@ -116,7 +124,6 @@
if ((m_TimeLabel == 0) || (m_DateLabel == 0))
return;
- MLocale locale;
QDateTime now (QDateTime::currentDateTime ());
/*
@@ -127,13 +134,13 @@
* Please note, that this not prevents the updates to happen when the touch
* screen is off, but it lower the updates by the ratio of 1/60.
*/
- text = locale.formatDateTime (now, MLocale::DateNone, MLocale::TimeShort);
+ text = m_locale.formatDateTime (now, MLocale::DateNone, MLocale::TimeShort);
if (text != m_TimeLabel->text()) {
m_TimeLabel->setText (text);
needUpdate = true;
}
- text = locale.formatDateTime (now, MLocale::DateFull, MLocale::TimeNone);
+ text = m_locale.formatDateTime (now, MLocale::DateFull, MLocale::TimeNone);
if (text != m_DateLabel->text()) {
m_DateLabel->setText (text);
needUpdate = true;
@@ -143,26 +150,50 @@
update ();
}
+#ifdef HAVE_QMSYSTEM
+void
+UnlockHeader::timeSettingsChanged (Maemo::QmTimeWhatChanged what)
+{
+ Q_UNUSED (what);
+ bool format24h = m_time->getTimeFormat () == Maemo::QmTime::format24h;
+
+ m_locale.setTimeFormat24h (
+ format24h ?
+ MLocale::TwentyFourHourTimeFormat24h :
+ MLocale::TwelveHourTimeFormat24h);
+
+ updateDateTime ();
+}
+#endif
+
UnlockArea::UnlockArea () :
m_enabled (false),
m_active (false)
{
QGraphicsLinearLayout *layout =
- new QGraphicsLinearLayout;
+ new QGraphicsLinearLayout (Qt::Vertical);
setObjectName ("LockLandArea");
- m_unlock_icon = new MImageWidget;
- m_unlock_icon->setImage ("icon-m-common-unlocked", QSize (32, 32));
- m_unlock_icon->setZoomFactor (1.0);
- m_unlock_icon->setObjectName ("LockScreenUnlockIcon");
+ // Create the unlock icon
+ MImageWidget *unlock_icon;
- layout->addStretch ();
+ unlock_icon = new MImageWidget;
+ unlock_icon->setImage ("icon-m-common-unlocked", QSize (32, 32));
+ unlock_icon->setZoomFactor (1.0);
+ unlock_icon->setObjectName ("LockScreenUnlockIcon");
+
+ m_unlock_icon = new MWidget;
+ QGraphicsLinearLayout *icon_layout =
+ new QGraphicsLinearLayout (Qt::Horizontal);
+ icon_layout->addStretch ();
+ icon_layout->addItem (unlock_icon);
+ icon_layout->addStretch ();
+ m_unlock_icon->setLayout (icon_layout);
// Add the unlock icon centered
+ layout->addStretch ();
layout->addItem (m_unlock_icon);
- layout->setAlignment (m_unlock_icon, Qt::AlignCenter);
-
layout->addStretch ();
setLayout (layout);
--- src/unlockwidgets.h
+++ src/unlockwidgets.h
@@ -21,15 +21,21 @@
#ifndef _UNLOCKWIDGETS_H
#define _UNLOCKWIDGETS_H
-#include <QObject>
-#include <MSceneWindow>
-
class MLabel;
+class MWidget;
class MImageWidget;
+#include <QObject>
+#include <MLocale>
+#include <MStylableWidget>
+
+#ifdef HAVE_QMSYSTEM
+#include <qmtime.h>
+#endif
+
#include "unlocknotifications.h"
-class UnlockHeader : public MSceneWindow
+class UnlockHeader : public MStylableWidget
{
Q_OBJECT
@@ -44,13 +50,21 @@
MImageWidget *m_icon;
MLabel *m_TimeLabel;
MLabel *m_DateLabel;
+ MLocale m_locale;
+
+#ifdef HAVE_QMSYSTEM
+ Maemo::QmTime *m_time;
+
+private slots:
+ void timeSettingsChanged (Maemo::QmTimeWhatChanged what);
+#endif
#ifdef UNIT_TEST
friend class ut_unlockwidgets;
#endif
};
-class UnlockArea : public MSceneWindow
+class UnlockArea : public MStylableWidget
{
Q_OBJECT
@@ -64,7 +78,7 @@
private:
void updateState ();
- MImageWidget *m_unlock_icon;
+ MWidget *m_unlock_icon;
bool m_enabled;
bool m_active;
--- src/usbui.cpp
+++ src/usbui.cpp
@@ -34,7 +34,9 @@
UsbUi::UsbUi (QObject *parent) : QObject (parent),
m_notification (0),
- m_dialog (0)
+ m_dialog (0),
+ m_disabled (false),
+ m_showdialog (false)
{
#ifdef HAVE_QMSYSTEM
m_logic = new Maemo::QmUSBMode (this);
@@ -58,6 +60,38 @@
#endif
}
+void
+UsbUi::setDisabled (bool disable)
+{
+ SYS_DEBUG ("disable = %s", SYS_BOOL (disable));
+
+#if 0
+ SYS_WARNING ("disable = %s, [showdialog = %s]",
+ SYS_BOOL (disable), SYS_BOOL (m_showdialog));
+#endif
+
+ m_disabled = disable;
+
+ if (disable == true)
+ {
+ // Hide the mode-selection dialog
+ if (m_dialog && m_dialog->isVisible ())
+ {
+ m_showdialog = true;
+ m_dialog->reject ();
+ m_dialog->disappear ();
+ }
+ }
+ else // (enable == true)
+ {
+ if (m_showdialog == true)
+ {
+ m_showdialog = false;
+ ShowDialog ();
+ }
+ }
+}
+
// Showing the mode selection dialog
void
UsbUi::ShowDialog ()
@@ -67,6 +101,13 @@
MContentItem *button;
MLabel *label;
+ if (m_disabled == true)
+ {
+ // Do not show the dialog when it is disabled
+ m_showdialog = true;
+ return;
+ }
+
if (m_dialog)
{
m_dialog->appear (MSceneWindow::DestroyWhenDone);
@@ -77,7 +118,7 @@
//% "Connected to USB device"
m_dialog->setTitle (qtTrId ("qtn_usb_connected"));
- m_dialog->setSystemModal (true);
+ m_dialog->setSystem (true);
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout (Qt::Vertical);
@@ -150,6 +191,10 @@
void
UsbUi::currentModeChanged (Maemo::QmUSBMode::Mode mode)
{
+#if 0
+ SYS_WARNING ("mode = %d", (int) mode);
+#endif
+
switch (mode)
{
case Maemo::QmUSBMode::Ask:
@@ -157,6 +202,8 @@
ShowDialog ();
break;
case Maemo::QmUSBMode::Disconnected:
+ m_showdialog = false;
+
// remove the previous notification
if (m_notification)
{
@@ -196,6 +243,10 @@
SYS_DEBUG ("");
QString *mode_text;
+ // no-op when disabled
+ if (m_disabled)
+ return;
+
// remove previous one
if (m_notification)
{
@@ -226,7 +277,6 @@
m_notification =
new MNotification (MNotification::DeviceAddedEvent, "",
qtTrId ("qtn_usb_info_connected").arg (*mode_text));
- m_notification->setImage ("icon-m-common-usb");
m_notification->publish ();
}
--- src/usbui.h
+++ src/usbui.h
@@ -50,6 +50,7 @@
void ShowDialog ();
void initialize ();
+ void setDisabled (bool disable);
private:
void ShowNotification (int id);
@@ -59,6 +60,8 @@
#endif
MNotification *m_notification;
QPointer<MDialog> m_dialog;
+ bool m_disabled;
+ bool m_showdialog;
#ifdef UNIT_TEST
friend class Ut_UsbUi;
--- src/volumecontrol/volumebarlogic.cpp
+++ src/volumecontrol/volumebarlogic.cpp
@@ -132,7 +132,7 @@
// Recurse into the dict_entry [ string, variant(int) ]
dbus_message_iter_recurse (&dict_entry, &in_dict);
{
- char *prop_name;
+ char *prop_name = NULL;
// Get the string value, "property name"
dbus_message_iter_get_basic (&in_dict, &prop_name);
--- src/volumecontrol/volumecontrolui.cpp
+++ src/volumecontrol/volumecontrolui.cpp
@@ -26,13 +26,19 @@
VolumeControlUI::VolumeControlUI (QObject *parent) :
QObject (parent),
m_logic (new VolumeBarLogic),
- m_overlay (0)
+ m_overlay (0),
#ifdef HAVE_QMSYSTEM
- , m_hwkeys (0)
+ m_hwkeys (0),
#endif
+ m_locked (false)
{
#ifdef HAVE_QMSYSTEM
m_hwkeys = new Maemo::QmKeys (this);
+
+ m_locks = new Maemo::QmLocks (this);
+
+ connect (m_locks, SIGNAL (stateChanged(Maemo::QmLocks::Lock, Maemo::QmLocks::State)),
+ this, SLOT (locksChanged(Maemo::QmLocks::Lock, Maemo::QmLocks::State)));
#endif
#ifdef HAVE_LIBRESOURCEQT
@@ -62,6 +68,9 @@
#ifdef HAVE_QMSYSTEM
delete m_hwkeys;
m_hwkeys = 0;
+
+ delete m_locks;
+ m_locks = 0;
#endif
delete m_logic;
@@ -122,6 +131,13 @@
// This sets the volume and update the slider ...
overlayChanged (current_volume);
+ /*
+ * When screen/device is locked, do not show the overlay:
+ */
+ SYS_DEBUG ("Locked: %s", SYS_BOOL (m_locked));
+ if (m_locked == true)
+ return;
+
if (m_overlay == 0)
{
m_overlay = new VolumeOverlay;
@@ -132,6 +148,35 @@
// ... and show the overlay
m_overlay->UpdateVolume (current_volume, max_volume);
}
+
+void
+VolumeControlUI::locksChanged (
+ Maemo::QmLocks::Lock what, Maemo::QmLocks::State how)
+{
+ if (how == Maemo::QmLocks::Locked)
+ {
+ m_locked = true;
+ if (m_overlay)
+ m_overlay->hide ();
+ }
+ else if (how == Maemo::QmLocks::Unlocked)
+ {
+ /*
+ * Check wether all the locks went away...
+ */
+ if ((what == Maemo::QmLocks::Device) &&
+ (m_locks->getState (Maemo::QmLocks::TouchAndKeyboard) ==
+ Maemo::QmLocks::Unlocked))
+ {
+ m_locked = false;
+ }
+ else if (m_locks->getState (Maemo::QmLocks::Device) ==
+ Maemo::QmLocks::Unlocked)
+ {
+ m_locked = false;
+ }
+ }
+}
#endif
void
--- src/volumecontrol/volumecontrolui.h
+++ src/volumecontrol/volumecontrolui.h
@@ -31,6 +31,7 @@
#ifdef HAVE_QMSYSTEM
// For Hw-volume key handling
#include <qmkeys.h>
+#include <qmlocks.h>
#endif
class VolumeControlUI : public QObject
@@ -45,6 +46,7 @@
void overlayChanged (int val);
#ifdef HAVE_QMSYSTEM
void hwKeyEvent (Maemo::QmKeys::Key key, Maemo::QmKeys::State state);
+ void locksChanged (Maemo::QmLocks::Lock what, Maemo::QmLocks::State how);
#endif
void hwKeyResourceAcquired ();
void hwKeyResourceLost ();
@@ -52,14 +54,19 @@
private:
VolumeBarLogic *m_logic;
VolumeOverlay *m_overlay;
-
#ifdef HAVE_QMSYSTEM
Maemo::QmKeys *m_hwkeys;
+ Maemo::QmLocks *m_locks;
#endif
+ bool m_locked;
#ifdef HAVE_LIBRESOURCEQT
ResourcePolicy::ResourceSet *m_hwkeyResource;
#endif
+
+#ifdef UNIT_TEST
+ friend class Ut_VolumeControlUI;
+#endif
};
#endif
--- src/volumecontrol/volumeoverlay.cpp
+++ src/volumecontrol/volumeoverlay.cpp
@@ -46,15 +46,15 @@
void
VolumeOverlay::constructUi ()
{
- QGraphicsLinearLayout *layout =
- new QGraphicsLinearLayout;
+ m_layout = new QGraphicsLinearLayout;
m_slider = new MSlider;
+ m_slider->setObjectName ("CommonSlider");
m_slider->setOrientation (Qt::Vertical);
- m_slider->setMaxLabelIconID (QString ("icon-m-common-volume"));
+ m_slider->setMaxLabelIconID ("icon-m-common-volume");
m_slider->setMaxLabelVisible (true);
- m_slider->setMinLabelIconID (QString ("icon-m-common-volume-off"));
+ m_slider->setMinLabelIconID ("icon-m-common-volume-off");
m_slider->setMinLabelVisible (true);
connect (m_slider, SIGNAL (valueChanged (int)),
@@ -70,19 +70,19 @@
// create a new scene manager
m_window = new MWindow (new MSceneManager);
m_window->setTranslucentBackground (true);
- m_window->setAttribute (Qt::WA_X11NetWmWindowTypeNotification);
+ m_window->setAttribute (Qt::WA_X11NetWmWindowTypeNotification, true);
+ m_window->setAttribute (Qt::WA_X11DoNotAcceptFocus, true);
m_window->setObjectName ("VolumeOverlayWindow");
- connect (m_window,
- SIGNAL (orientationChanged (M::Orientation)),
- this,
- SLOT (orientationChanged (M::Orientation)));
+ connect (m_window->sceneManager (), SIGNAL (orientationAboutToChange(M::Orientation)),
+ this, SLOT (removeMask ()));
+ connect (m_window->sceneManager (), SIGNAL (orientationChangeFinished(M::Orientation)),
+ this, SLOT (updateMask ()));
- layout->addItem (m_slider);
+ m_layout->addItem (m_slider);
+ m_layout->addStretch ();
- setLayout (layout);
-
- orientationChanged (m_window->orientation ());
+ setLayout (m_layout);
}
void
@@ -104,8 +104,8 @@
{
m_window->show ();
m_window->showFullScreen ();
+ updateMask ();
m_window->sceneManager ()->appearSceneWindow (this);
-
}
//TODO: Remove sending fake displaychange events when setTranslucentBackground bug is solved
MOnDisplayChangeEvent* event =
@@ -124,39 +124,68 @@
}
void
-VolumeOverlay::orientationChanged (M::Orientation orientation)
+VolumeOverlay::updateMask ()
{
- QSize viewport (m_window->visibleSceneSize (orientation));
-
- m_slider->setPreferredHeight (viewport.height () < viewport.width () ?
- viewport.height () : viewport.width ());
-
+ /*
+ * Set up window mask so that mouse events are passed on to lower widgets.
+ */
+ M::Orientation orientation =
+ m_window->sceneManager ()->orientation ();
+
+ setPreferredHeight (orientation == M::Landscape ?
+ m_window->height () : m_window->width ());
+ m_layout->invalidate ();
+
+ QSize size = preferredSize().toSize();
+ QPoint origin (0, 0);
+
+ /*
+ * Here scene window coordinates is in use...
+ */
if (orientation == M::Landscape)
setPos (QPointF (0., 0.));
else // Portrait
- setPos (QPointF (viewport.width () - preferredWidth (), 0.));
+ setPos (QPointF (m_window->height () - size.width (), 0.));
- // This breaks the rotation somehow... so disabled for a while...
-#if 0
- // Set up window mask so that mouse events are passed on to lower widgets.
- if (m_window->orientation () == M::Landscape)
- {
- QRegion region(QRect(0, 0,
- preferredSize ().width (),
- preferredSize ().height ()),
- QRegion::Rectangle);
- m_window->setMask(region);
- }
- else
+ m_window->sceneManager ()->appearSceneWindow (this);
+
+ /*
+ * ...but here plain X coordinates is in use:
+ */
+ switch (m_window->sceneManager ()->orientationAngle ())
{
- QRegion region(QRect(0, 0,
- preferredSize ().height (),
- preferredSize ().width ()),
- QRegion::Rectangle);
- m_window->setMask(region);
+ case M::Angle90:
+ SYS_DEBUG ("Angle90");
+ size.transpose ();
+ origin.setX (m_window->width () - size.width ());
+ origin.setY (m_window->height () - size.height ());
+ break;
+
+ case M::Angle270:
+ SYS_DEBUG ("Angle270");
+ size.transpose ();
+ break;
+
+ case M::Angle180:
+ SYS_DEBUG ("Angle180");
+ origin.setX (m_window->width () - size.width ());
+ break;
+
+ default:
+ SYS_DEBUG ("Angle0");
+ break;
}
- m_window->update ();
-#endif
+ m_window->setMask (QRegion (QRect (origin, size), QRegion::Rectangle));
+}
+
+void
+VolumeOverlay::removeMask ()
+{
+ /*
+ * Clear the window-mask during orientation changes
+ */
+ m_window->clearMask ();
+ m_window->sceneManager ()->disappearSceneWindow (this);
}
--- src/volumecontrol/volumeoverlay.h
+++ src/volumecontrol/volumeoverlay.h
@@ -5,6 +5,7 @@
#include <MOverlay>
#include <QObject>
+class QGraphicsLinearLayout;
class MSlider;
class QTimer;
@@ -23,15 +24,24 @@
void UpdateVolume (int val, int max);
private slots:
- void orientationChanged (M::Orientation orientation);
void hideMe ();
+ /*
+ * for window mask handling:
+ */
+ void updateMask ();
+ void removeMask ();
private:
- QTimer *m_timer;
- MSlider *m_slider;
- MWindow *m_window;
+ QTimer *m_timer;
+ MSlider *m_slider;
+ MWindow *m_window;
+ QGraphicsLinearLayout *m_layout;
void constructUi ();
+
+#ifdef UNIT_TEST
+ friend class Ut_VolumeOverlay;
+#endif
};
#endif
--- stub_middleware/unlockscreen_notifications.sh
+++ stub_middleware/unlockscreen_notifications.sh
@@ -20,7 +20,12 @@
#***************************************************************************/
source /tmp/session_bus_address.user
-sysuid -software &
+
+if pgrep sysuid > /dev/null; then
+ echo "sysuid running... already..."
+else
+ sysuid -software &
+fi
SLEEPTIME=6
--- tests/common_top.pri
+++ tests/common_top.pri
@@ -7,13 +7,12 @@
DEPENDPATH = $$INCLUDEPATH
CONFIG += meegotouch link_pkgconfig qmsystem
QT += testlib network gui dbus xml
-exists($$[QT_INSTALL_LIBS]/libQtOpenGL.so):QT += opengl
TEMPLATE = app
DEFINES += UNIT_TEST
LIBS += -L../../lib
contains(DEFINES, HAVE_LIBNGF) {
- PKGCONFIG += libngf0
+ PKGCONFIG += libngf0
}
PKGCONFIG += dbus-1
--- tests/ft_batterybusinesslogic
+++ tests/ft_batterybusinesslogic
+(directory)
--- tests/ft_batterybusinesslogic/ft_batterybusinesslogic.cpp
+++ tests/ft_batterybusinesslogic/ft_batterybusinesslogic.cpp
+/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
+/* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
+/****************************************************************************
+**
+** 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 "ft_batterybusinesslogic.h"
+
+#ifdef HAVE_QMSYSTEM
+#include "qmled_stub.h"
+#include "qmbattery_stub.h"
+#include "qmdevicemode_stub.h"
+#endif
+
+#include <MApplication>
+#include <MNotification>
+#include <MFeedback>
+
+#define DEBUG
+#include "debug.h"
+
+
+void
+debugDumpNotifications ()
+{
+ QList<MNotification *> notifications;
+ int n = 0;
+
+ notifications = MNotification::notifications();
+ foreach (MNotification *notification, notifications) {
+ QString body;
+ QString image;
+ QString summary;
+ QString eventType;
+
+ eventType = notification->eventType ();
+ body = notification->body ();
+ image = notification->image ();
+ summary = notification->summary ();
+ SYS_DEBUG ("************ Notification %d *****************", n);
+ SYS_DEBUG ("*** eventType = %s", SYS_STR(eventType));
+ SYS_DEBUG ("*** summary = %s", SYS_STR(summary));
+ SYS_DEBUG ("*** body = %s", SYS_STR(body));
+ SYS_DEBUG ("*** image = %s", SYS_STR(image));
+ SYS_DEBUG ("*** isPublished = %s",
+ SYS_BOOL(notification->isPublished()));
+
+ ++n;
+ }
+}
+
+static bool
+hasPublishedNotification (
+ const QString &checkEventType,
+ const QString &checkBody = QString(""),
+ const QString &checkIconName = QString(""),
+ const QString &checkSubject = QString(""))
+{
+ QList<MNotification *> notifications;
+
+ notifications = MNotification::notifications();
+ foreach (MNotification *notification, notifications) {
+ QString body;
+ QString image;
+ QString summary;
+ QString eventType;
+
+ eventType = notification->eventType ();
+ body = notification->body ();
+ image = notification->image ();
+ summary = notification->summary ();
+
+ if (!notification->isPublished())
+ continue;
+ if (!checkEventType.isEmpty() && checkEventType != eventType)
+ continue;
+ if (!checkBody.isEmpty() && checkBody != body)
+ continue;
+ if (!checkIconName.isEmpty() && checkIconName != image)
+ continue;
+ if (!checkSubject.isEmpty() && checkSubject != summary)
+ continue;
+
+ /*
+ * We found what we asked to search...
+ */
+ return true;
+ }
+
+ SYS_WARNING ("A notification with the following data should be published.");
+ SYS_WARNING ("*** eventType = %s", SYS_STR(checkEventType));
+ SYS_WARNING ("*** body = %s", SYS_STR(checkBody));
+ SYS_WARNING ("*** icon = %s", SYS_STR(checkIconName));
+ SYS_WARNING ("*** subject = %s", SYS_STR(checkSubject));
+ debugDumpNotifications ();
+ return false;
+}
+
+
+/******************************************************************************
+ * The stub for MFeedback class.
+ */
+static QString nameOfLastFeedback;
+
+MFeedback::MFeedback (
+ const QString &name,
+ QObject *parent) :
+ d_ptr (0)
+{
+ Q_UNUSED (parent);
+
+ SYS_DEBUG ("*** name = %s", SYS_STR(name));
+ nameOfLastFeedback = name;
+}
+
+void
+MFeedback::play () const
+{
+ SYS_DEBUG ("Playing...");
+}
+
+int argc = 1;
+char *argv[] = {
+ (char *) "./ft_batterybusinesslogic",
+ NULL };
+
+void
+Ft_BatteryBusinessLogic::initTestCase ()
+{
+ m_App = new MApplication(argc, argv);
+ m_App->setQuitOnLastWindowClosed (false);
+}
+
+void
+Ft_BatteryBusinessLogic::cleanupTestCase ()
+{
+ m_App->deleteLater ();
+}
+
+
+void
+Ft_BatteryBusinessLogic::init ()
+{
+ /* Testcase initialization... */
+ m_logic = new BatteryBusinessLogic;
+}
+
+void
+Ft_BatteryBusinessLogic::cleanup ()
+{
+ /* Testcase deinitialization... */
+ delete m_logic;
+ m_logic = NULL;
+}
+
+
+void
+Ft_BatteryBusinessLogic::testLowBatteryAlert ()
+{
+#ifdef HAVE_QMSYSTEM
+ m_logic->lowBatteryAlert ();
+ QTest::qWait (10);
+ QVERIFY (hasPublishedNotification(
+ "x-nokia.battery.lowbattery",
+ qtTrId ("qtn_ener_lowbatt"))
+ );
+#endif
+}
+
+void
+Ft_BatteryBusinessLogic::testBatteryStateChanged ()
+{
+#ifdef HAVE_QMSYSTEM
+ gQmBatteryStub->stubReset ();
+ gQmLEDStub->stubReset ();
+
+ /* StateFull */
+ m_logic->batteryStateChanged (Maemo::QmBattery::StateFull);
+ QTest::qWait (10);
+ QVERIFY (hasPublishedNotification(
+ "x-nokia.battery.chargingcomplete",
+ qtTrId ("qtn_ener_charcomp"))
+ );
+
+ /* StateOK */
+ m_logic->batteryStateChanged (Maemo::QmBattery::StateOK);
+
+ QTest::qWait (10);
+ /* no signals/notifications should come, just silently no-op */
+
+ /* StateEmpty */
+ m_logic->batteryStateChanged (Maemo::QmBattery::StateEmpty);
+ QTest::qWait (10);
+ QVERIFY (hasPublishedNotification (
+ "x-nokia.battery.recharge",
+ qtTrId ("qtn_ener_rebatt"))
+ );
+
+ /* StateError */
+ m_logic->batteryStateChanged (Maemo::QmBattery::StateError);
+
+ QTest::qWait (10);
+ /* no signals/notifications should come, just silently no-op */
+
+ /* StateLow and charging */
+ gQmBatteryStub->stubSetReturnValue<Maemo::QmBattery::ChargingState> (
+ "getChargingState", Maemo::QmBattery::StateCharging);
+ m_logic->batteryStateChanged (Maemo::QmBattery::StateLow);
+ QTest::qWait (10);
+ /* no signals/notifications should come, because battery is charging... */
+
+ /* StateLow and not charging */
+ gQmBatteryStub->stubSetReturnValue<Maemo::QmBattery::ChargingState> (
+ "getChargingState", Maemo::QmBattery::StateNotCharging);
+ m_logic->batteryStateChanged (Maemo::QmBattery::StateLow);
+ QTest::qWait (10);
+ QVERIFY (hasPublishedNotification (
+ "x-nokia.battery.lowbattery",
+ qtTrId ("qtn_ener_lowbatt"))
+ );
+#endif
+}
+
+
+void
+Ft_BatteryBusinessLogic::testBatteryChargerEvent ()
+{
+#ifdef HAVE_QMSYSTEM
+ /* Wall charger */
+ m_logic->batteryChargerEvent (Maemo::QmBattery::Wall);
+ QCOMPARE (m_logic->m_ChargerType, Maemo::QmBattery::Wall);
+
+ /* Plug out : charger type = none */
+ m_logic->batteryChargerEvent (Maemo::QmBattery::None);
+ QCOMPARE (m_logic->m_ChargerType, Maemo::QmBattery::None);
+
+ QTest::qWait (10);
+ /* Look for the notification: "Disconnect the charger from..." */
+ QVERIFY (hasPublishedNotification(
+ "x-nokia.battery.removecharger",
+ qtTrId ("qtn_ener_remcha"))
+ );
+
+ /* USB 500mA */
+ m_logic->batteryChargerEvent (Maemo::QmBattery::USB_500mA);
+ QCOMPARE (m_logic->m_ChargerType, Maemo::QmBattery::USB_500mA);
+
+ /* USB 100mA */
+ m_logic->batteryChargerEvent (Maemo::QmBattery::USB_100mA);
+ QCOMPARE (m_logic->m_ChargerType, Maemo::QmBattery::USB_100mA);
+
+ /* Unknown */
+ m_logic->batteryChargerEvent (Maemo::QmBattery::Unknown);
+ QCOMPARE (m_logic->m_ChargerType, Maemo::QmBattery::Unknown);
+#endif
+}
+
+void
+Ft_BatteryBusinessLogic::testPSMStateChanged ()
+{
+#ifdef HAVE_QMSYSTEM
+ /* Entering to power-save mode */
+ m_logic->devicePSMStateChanged (Maemo::QmDeviceMode::PSMStateOn);
+ QTest::qWait (10);
+ QVERIFY (hasPublishedNotification(
+ "x-nokia.battery.enterpsm",
+ qtTrId ("qtn_ener_ent_psnote"))
+ );
+
+ /* Exiting from power-save mode */
+ m_logic->devicePSMStateChanged (Maemo::QmDeviceMode::PSMStateOff);
+ QTest::qWait (10);
+ QVERIFY (hasPublishedNotification(
+ "x-nokia.battery.exitpsm",
+ qtTrId ("qtn_ener_exit_psnote"))
+ );
+#endif
+}
+
+void
+Ft_BatteryBusinessLogic::testLowBatteryNotifierConnection ()
+{
+#ifdef HAVE_QMSYSTEM
+ /* LowBatteryNotifier shouldn't be instantiated at first */
+ QVERIFY (m_logic->m_LowBatteryNotifier == 0);
+
+ /* Simulate battery-state-low change */
+ gQmBatteryStub->stubSetReturnValue<Maemo::QmBattery::ChargingState> (
+ "getChargingState", Maemo::QmBattery::StateNotCharging);
+ m_logic->batteryStateChanged (Maemo::QmBattery::StateLow);
+
+ /* LowBatteryNotifier should be exists now... */
+ QVERIFY (m_logic->m_LowBatteryNotifier != 0);
+ QTest::qWait (10);
+
+ /* And should send a low-battery notification */
+ QVERIFY (hasPublishedNotification(
+ "x-nokia.battery.lowbattery",
+ qtTrId ("qtn_ener_lowbatt"))
+ );
+
+ /* Simulate now a charging event */
+ m_logic->chargingStateChanged (Maemo::QmBattery::StateCharging);
+
+ /* After this call LowBatteryNotifier should be destroyed */
+ QVERIFY (m_logic->m_LowBatteryNotifier == 0);
+#endif
+}
+
+QTEST_APPLESS_MAIN(Ft_BatteryBusinessLogic)
+
--- tests/ft_batterybusinesslogic/ft_batterybusinesslogic.h
+++ tests/ft_batterybusinesslogic/ft_batterybusinesslogic.h
+/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
+/* vim:set et ai sw=4 ts=4 sts=4: tw=80 cino="(0,W2s,i2s,t0,l1,:0" */
+/****************************************************************************
+**
+** 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 FT_BATTERYBUSINESSLOGIC_H
+#define FT_BATTERYBUSINESSLOGIC_H
+
+#include <QtTest/QtTest>
+#include <QObject>
+
+#include "batterybusinesslogic.h"
+
+class MApplication;
+
+/*!
+ * This functional test was created to check the NB #183500.
+ */
+class Ft_BatteryBusinessLogic : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void init ();
+ void cleanup ();
+ void initTestCase ();
+ void cleanupTestCase ();
+
+ void testLowBatteryAlert ();
+ void testBatteryStateChanged ();
+ void testBatteryChargerEvent ();
+ void testPSMStateChanged ();
+ void testLowBatteryNotifierConnection ();
+
+private:
+ MApplication *m_App;
+ BatteryBusinessLogic *m_logic;
+};
+
+#endif
+
--- tests/ft_batterybusinesslogic/ft_batterybusinesslogic.pro
+++ tests/ft_batterybusinesslogic/ft_batterybusinesslogic.pro
+include(../coverage.pri)
+include(../common_top.pri)
+TARGET = ft_batterybusinesslogic
+
+SRC_PREFIX = ../../src
+STUB_PREFIX = ../stubs
+INCLUDEPATH += $$SRC_PREFIX \
+ $$STUB_PREFIX
+
+HEADERS += \
+ ft_batterybusinesslogic.h \
+ $$SRC_PREFIX/debug.h \
+ $$SRC_PREFIX/batterybusinesslogic.h \
+ $$STUB_PREFIX/qmled_stub.h \
+ $$STUB_PREFIX/qmbattery_stub.h \
+ $$STUB_PREFIX/qmdevicemode_stub.h \
+ $$STUB_PREFIX/stubbase.h
+
+SOURCES += \
+ ft_batterybusinesslogic.cpp \
+ $$SRC_PREFIX/debug.cpp \
+ $$SRC_PREFIX/batterybusinesslogic.cpp \
+ $$STUB_PREFIX/stubbase.cpp
+
+include(../common_bot.pri)
--- tests/ft_lockscreenui/ft_lockscreenui.cpp
+++ tests/ft_lockscreenui/ft_lockscreenui.cpp
@@ -22,7 +22,7 @@
#include "ft_lockscreenui.h"
#include "lockscreenui.h"
#include "sysuid_stub.h"
-
+#include "unlockmissedevents.h"
#include <MApplication>
#include <MApplicationWindow>
#include <MSceneManager>
@@ -88,6 +88,7 @@
void
Ft_LockScreenUI::testEventEaterUIShowHide ()
{
+#if 0
Window WindowID;
createEventEaterUI ();
@@ -126,6 +127,7 @@
QVERIFY (!m_EventEaterUI->isVisible());
QVERIFY (m_XChecker.checkWindow(WindowID, XChecker::CheckIsInvisible));
}
+#endif
}
/*!
@@ -135,6 +137,7 @@
void
Ft_LockScreenUI::testLockScreenUIShowHide ()
{
+#if 0
Window WindowID;
createLockScreenUI ();
@@ -171,6 +174,7 @@
QVERIFY (!m_LockScreenUI->isVisible());
QVERIFY (m_XChecker.checkWindow(WindowID, XChecker::CheckIsInvisible));
}
+#endif
}
/*!
@@ -180,10 +184,10 @@
void
Ft_LockScreenUI::testLockScreenUIShowHideWithMainWindow ()
{
+#if 0
Window WindowID;
Window MWindowID;
-
SYS_DEBUG ("Creating main window.");
m_MainWindow = new MApplicationWindow;
@@ -236,6 +240,7 @@
delete m_MainWindow;
m_MainWindow = 0;
+#endif
}
/*!
@@ -246,6 +251,7 @@
void
Ft_LockScreenUI::testEventEaterUIShowHideWithMainWindow ()
{
+#if 0
Window WindowID;
Window MWindowID;
@@ -299,11 +305,13 @@
delete m_MainWindow;
m_MainWindow = 0;
+#endif
}
void
Ft_LockScreenUI::testLockScreenUIWithTSOff ()
{
+#if 0
Window WindowID;
/*
* Turning off the screen first.
@@ -337,8 +345,83 @@
WindowID = m_LockScreenUI->internalWinId();
QVERIFY (m_XChecker.checkWindow(WindowID, XChecker::CheckIsVisible));
QVERIFY (m_XChecker.checkWindow(WindowID, XChecker::CheckIsFullscreen));
+#endif
}
+/*
+ * FIXME: This test is not ready yet. Should check the following bug(s):
+ * 176358 - missed events representation in notification area of lock ui is not proper in portrait orientation.
+ */
+#if 0
+void
+Ft_LockScreenUI::testMissedEvents ()
+{
+ Window WindowID;
+
+ createLockScreenUI ();
+
+ /*
+ * Showing the lockscreenUI window.
+ */
+ SYS_DEBUG ("***************************************************");
+ SYS_DEBUG ("*** Showing lockscreenUI **************************");
+ SYS_DEBUG ("***************************************************");
+ m_LockScreenUI->show ();
+ QTest::qWait (WMDelay);
+ /*
+ * From this point the lock screen should be realized, shown and visible.
+ */
+ UnlockMissedEvents &missedEvents = UnlockMissedEvents::getInstance();
+
+ for (int i = 0; i < 5; ++i) {
+ missedEvents.addNotification (
+ UnlockMissedEvents::NotifyEmail,
+ QString("mailmessage subject"));
+ QTest::qWait (2000);
+ }
+
+ for (int i = 0; i < 5; ++i) {
+ missedEvents.addNotification (
+ UnlockMissedEvents::NotifySms,
+ QString("sms subject"));
+ QTest::qWait (500);
+ }
+
+ for (int i = 0; i < 3; ++i) {
+ missedEvents.addNotification (
+ UnlockMissedEvents::NotifyCall,
+ QString("sms subject"));
+ QTest::qWait (500);
+ }
+
+ for (int i = 0; i < 3; ++i) {
+ missedEvents.addNotification (
+ UnlockMissedEvents::NotifyMessage,
+ QString("sms subject"));
+ QTest::qWait (500);
+ }
+
+ for (int i = 0; i < 3; ++i) {
+ missedEvents.addNotification (
+ UnlockMissedEvents::NotifyOther,
+ QString("sms subject"));
+ QTest::qWait (500);
+ }
+
+ QTest::qWait (DelayBetweenTests);
+ /*
+ * Hiding the window again.
+ */
+ SYS_DEBUG ("***************************************************");
+ SYS_DEBUG ("*** Hiding lockscreenUI ***************************");
+ SYS_DEBUG ("***************************************************");
+ m_LockScreenUI->hide();
+ QTest::qWait (WMDelay);
+ WindowID = m_LockScreenUI->internalWinId();
+ QVERIFY (!m_LockScreenUI->isVisible());
+ QVERIFY (m_XChecker.checkWindow(WindowID, XChecker::CheckIsInvisible));
+}
+#endif
void
Ft_LockScreenUI::createLockScreenUI ()
--- tests/ft_lockscreenui/ft_lockscreenui.h
+++ tests/ft_lockscreenui/ft_lockscreenui.h
@@ -45,6 +45,8 @@
void testLockScreenUIShowHideWithMainWindow ();
void testEventEaterUIShowHideWithMainWindow ();
void testLockScreenUIWithTSOff ();
+ // Not fully implemented yet
+ //void testMissedEvents ();
private:
void createLockScreenUI ();
--- tests/ft_lockscreenui/xchecker.cpp
+++ tests/ft_lockscreenui/xchecker.cpp
@@ -31,8 +31,8 @@
XChecker::XChecker()
{
- Display *dpy = display();
-
+ Display *dpy = display();
+
class_atom = XInternAtom(dpy, "WM_CLASS", False);
name_atom = XInternAtom(dpy, "_NET_WM_NAME", False);
name_atom2 = XInternAtom(dpy, "WM_NAME", False);
@@ -45,7 +45,7 @@
m_CompositorPID = pidof ("mcompositor");
SYS_DEBUG ("pidof mcompositor = %d", m_CompositorPID);
-
+
m_SysuidPID = pidof ("sysuid");
SYS_DEBUG ("pidof sysuid = %d", m_SysuidPID);
}
@@ -57,24 +57,24 @@
// Could be XOpenDisplay(NULL), but we already have a display.
dpy = XOpenDisplay(NULL);
- //dpy = QX11Info::display ();
+ //dpy = QX11Info::display ();
Q_ASSERT (dpy != NULL);
-
+
return dpy;
}
char *
XChecker::get_atom_prop (
- Display *dpy,
- Window w,
+ Display *dpy,
+ Window w,
Atom atom)
-{
+{
Atom type;
int format, rc;
unsigned long items;
unsigned long left;
Atom *value;
- char *copy;
+ char *copy;
rc = XGetWindowProperty (
dpy, w, atom, 0, 1, False, XA_ATOM, &type, &format,
@@ -84,26 +84,26 @@
copy = strdup("");
} else {
char *s = XGetAtomName(dpy, *value);
- copy = strdup(s);
- XFree(s);
+ copy = strdup(s);
+ XFree(s);
}
-
+
return copy;
}
Window
XChecker::get_win_prop (
- Display *dpy,
- Window w,
+ Display *dpy,
+ Window w,
Atom atom)
-{
+{
Atom type;
int format, rc;
unsigned long items;
unsigned long left;
Window *value;
- rc = XGetWindowProperty (dpy, w, atom, 0, 1, False, XA_WINDOW, &type,
+ rc = XGetWindowProperty (dpy, w, atom, 0, 1, False, XA_WINDOW, &type,
&format, &items, &left, (unsigned char**)&value);
if (type == None || rc != Success)
@@ -112,12 +112,12 @@
return *value;
}
-unsigned long
+unsigned long
XChecker::get_card_prop (
- Display *dpy,
- Window w,
+ Display *dpy,
+ Window w,
Atom atom)
-{
+{
Atom type;
int format, rc;
unsigned long items;
@@ -128,19 +128,19 @@
dpy, w, atom, 0, 1, False,
XA_CARDINAL, &type, &format,
&items, &left, (unsigned char**)&value);
-
+
if (type == None || rc != Success)
return 0;
return *value;
}
-long
+long
XChecker::get_int_prop (
- Display *dpy,
- Window w,
+ Display *dpy,
+ Window w,
Atom atom)
-{
+{
Atom type;
int format, rc;
unsigned long items;
@@ -161,10 +161,10 @@
char *
XChecker::get_str_prop(
- Display *dpy,
- Window w,
+ Display *dpy,
+ Window w,
Atom atom)
-{
+{
Atom type;
int format, rc;
unsigned long items;
@@ -174,7 +174,7 @@
rc = XGetWindowProperty (
dpy, w, atom, 0, 200, False, XA_STRING, &type, &format,
&items, &left, (unsigned char**)&value);
-
+
if (type == None || rc != Success) {
return NULL;
} else {
@@ -186,10 +186,10 @@
char *
XChecker::get_utf8_prop (
- Display *dpy,
- Window w,
+ Display *dpy,
+ Window w,
Atom atom)
-{
+{
Atom type;
int format, rc;
unsigned long items;
@@ -197,14 +197,14 @@
char *value;
rc = XGetWindowProperty (dpy, w, atom, 0, 200, False,
- utf8_string_atom, &type, &format,
- &items, &left, (unsigned char**)&value);
+ utf8_string_atom, &type, &format,
+ &items, &left, (unsigned char**)&value);
if (type == None || rc != Success)
- return NULL;
+ return 0;
else
{
char *s = strdup((const char*)value);
- XFree(value);
+ XFree(value);
return s;
}
}
@@ -213,57 +213,58 @@
XChecker::get_map_state (
int state)
{
- switch (state) {
- case IsUnmapped:
- return "IsUnmapped";
- case IsUnviewable:
- return "IsUnviewable";
- case IsViewable:
- return "IsViewable";
- default:
- return "";
- }
+ switch (state) {
+ case IsUnmapped:
+ return "IsUnmapped";
+ case IsUnviewable:
+ return "IsUnviewable";
+ case IsViewable:
+ return "IsViewable";
+ default:
+ return "";
+ }
}
-void
+void
XChecker::pr (
Window highlighted,
- Display *dpy,
- Window WindowID,
- int level,
- int nthWindow)
+ Display *dpy,
+ Window WindowID,
+ unsigned int level,
+ unsigned int nthWindow)
{
QString indent, indent1;
- unsigned int n_children = 0;
- Window *child_l = NULL;
- Window root_ret, parent_ret;
- int i;
- char *wmclass;
+ unsigned int n_children = 0;
+ Window *child_l = NULL;
+ Window root_ret, parent_ret;
+ unsigned int i;
+ char *wmclass;
char *wmname, *wmname2;
- XWindowAttributes attrs = { 0 };
- long hildon_stack;
+ XWindowAttributes attrs;
+ attrs.map_state = IsUnmapped;
int x_return, y_return;
unsigned int width_return, height_return;
unsigned int border_width_return, depth_return;
QString windowName;
- XQueryTree(dpy, WindowID, &root_ret, &parent_ret, &child_l, &n_children);
+ XQueryTree(dpy, WindowID, &root_ret, &parent_ret, &child_l, &n_children);
XGetGeometry (dpy, WindowID, &root_ret,
&x_return, &y_return, &width_return,
&height_return, &border_width_return,
&depth_return);
- for (i = 0; i < level; ++i)
- indent += " ";
- for (i = 3; i >= level; --i)
+ for (i = 0; i < level; ++i)
+ indent += " ";
+
+ for (i = 4; i > level; --i)
indent1 += " ";
- wmclass = get_str_prop(dpy, WindowID, class_atom);
- wmname = get_utf8_prop(dpy, WindowID, name_atom);
- wmname2 = get_str_prop(dpy, WindowID, name_atom2);
- XGetWindowAttributes(dpy, WindowID, &attrs);
+ wmclass = get_str_prop(dpy, WindowID, class_atom);
+ wmname = get_utf8_prop(dpy, WindowID, name_atom);
+ wmname2 = get_str_prop(dpy, WindowID, name_atom2);
+ XGetWindowAttributes(dpy, WindowID, &attrs);
if (wmname && !wmname2)
windowName = wmname;
@@ -271,34 +272,34 @@
windowName = wmname2;
else if (wmname && wmname2)
windowName = QString(wmname) + "/" + wmname2;
- else
+ else
windowName = "(none)";
bool Highlight = highlighted != None && highlighted == WindowID;
const char *HighlightStart = Highlight ? TERM_RED : "";
const char *HighlightEnd = Highlight ? TERM_NORMAL : "";
- SYS_DEBUG ("%03d %s%s0x%06lx%s%s %-12s %3dx%-3d %-16s %s",
+ SYS_DEBUG ("%03d %s%s0x%06lx%s%s %-12s %3dx%-3d %-16s %s",
nthWindow,
- SYS_STR(indent),
+ SYS_STR(indent),
HighlightStart, WindowID, HighlightEnd,
SYS_STR(indent1),
get_map_state(attrs.map_state),
width_return, height_return,
- wmclass ? wmclass : "",
+ wmclass ? wmclass : "",
SYS_STR(windowName));
if (n_children == 0) {
// Nothing
- } else {
+ } else {
for (i = 0; i < n_children; ++i) {
++nthWindow;
- pr (highlighted, dpy, child_l[i], level + 1, nthWindow);
- }
- XFree(child_l);
- }
+ pr (highlighted, dpy, child_l[i], level + 1, nthWindow);
+ }
+ XFree(child_l);
+ }
- free(wmclass);
- free(wmname);
+ free(wmclass);
+ free(wmname);
}
/*!
@@ -307,8 +308,8 @@
*/
bool
XChecker::check_window_rec (
- Display *dpy,
- Window WindowID,
+ Display *dpy,
+ Window WindowID,
const QString &WMName,
XChecker::RequestCode opCode)
{
@@ -317,11 +318,12 @@
unsigned int n_children = 0;
Window *child_l = NULL;
char *wmname;
- XWindowAttributes attrs = { 0 };
+ XWindowAttributes attrs;
+ attrs.map_state = IsUnmapped;
wmname = get_utf8_prop (dpy, WindowID, name_atom);
XGetWindowAttributes(dpy, WindowID, &attrs);
-
+
/*
* With this opcode we check if the window stack has at least one window
* with the given wmname that is trully visible. It is not a perfect test
@@ -333,18 +335,28 @@
* First we check if this window has the wmname in question and it is
* trully visible.
*/
- if (WMName == wmname && attrs.map_state == IsViewable) {
+ if (WMName == wmname && attrs.map_state == IsViewable)
+ {
+ if (wmname != 0)
+ delete[] wmname;
+
return true;
}
+ if (wmname != 0)
+ {
+ delete[] wmname;
+ wmname = 0;
+ }
+
/*
* If not we check all the child windows...
*/
XQueryTree (dpy, WindowID, &rootR, &parentR, &child_l, &n_children);
- for (int i = 0; i < n_children; ++i) {
- if (check_window_rec (dpy, child_l[i], WMName, opCode))
+ for (unsigned int i = 0; i < n_children; ++i) {
+ if (check_window_rec (dpy, child_l[i], WMName, opCode))
return true;
- }
+ }
} else if (opCode == CheckIsInvisible) {
/*
* This case we check all the window with the given wmname, none of
@@ -355,16 +367,27 @@
* First the current window.
*/
if (WMName == wmname && attrs.map_state == IsViewable)
+ {
+ if (wmname != 0)
+ delete[] wmname;
+
return false;
+ }
+
+ if (wmname != 0)
+ {
+ delete[] wmname;
+ wmname = 0;
+ }
/*
* Then all the child windows.
*/
XQueryTree (dpy, WindowID, &rootR, &parentR, &child_l, &n_children);
- for (int i = 0; i < n_children; ++i) {
- if (!check_window_rec (dpy, child_l[i], WMName, opCode))
+ for (unsigned int i = 0; i < n_children; ++i) {
+ if (!check_window_rec (dpy, child_l[i], WMName, opCode))
return false;
- }
+ }
/*
* If none of the windows are visible only then we return true;
@@ -374,6 +397,9 @@
SYS_WARNING ("opCode %d not supported.", opCode);
}
+ if (wmname != 0)
+ delete[] wmname;
+
return false;
}
@@ -403,7 +429,7 @@
"visible.", SYS_STR(WMName));
}
- if (!retval)
+ if (!retval)
debug_dump_windows ();
return retval;
@@ -417,12 +443,14 @@
{
Display *Display = QX11Info::display ();
bool retval = false;
- XWindowAttributes attrs = { 0 };
+ XWindowAttributes attrs;
int x_return, y_return;
unsigned int width_return, height_return;
unsigned int border_width_return, depth_return;
Window root_ret;
+ attrs.map_state = IsUnmapped;
+
/*
* Here are some stuff that we want to check always.
*/
@@ -451,7 +479,7 @@
goto finalize;
}
- if (!XGetWindowAttributes (Display, WindowID, &attrs)) {
+ if (!XGetWindowAttributes (Display, WindowID, &attrs)) {
switch (OpCode) {
case CheckIsFullscreen:
case CheckIsVisible:
@@ -522,29 +550,29 @@
}
finalize:
- if (!retval)
+ if (!retval)
debug_dump_windows (WindowID);
return retval;
}
-void
+void
XChecker::debug_dump_windows(
Window highlighted)
{
- Display *dpy = display();
- Window root;
+ Display *dpy = display();
+ Window root;
SYS_DEBUG (
" # Window MapState Size WMclass Window name");
SYS_DEBUG (
"-----------------------------------------------------------------------------");
-
+
root = XDefaultRootWindow(dpy);
- pr (highlighted, dpy, root, 0, 0);
+ pr (highlighted, dpy, root, 0, 0);
}
-void
+void
XChecker::debugDumpNotifications ()
{
QList<MNotification *> notifications;
@@ -563,7 +591,7 @@
SYS_DEBUG ("*** summary = %s", SYS_STR(summary));
SYS_DEBUG ("*** body = %s", SYS_STR(body));
SYS_DEBUG ("*** image = %s", SYS_STR(image));
- SYS_DEBUG ("*** isPublished = %s",
+ SYS_DEBUG ("*** isPublished = %s",
SYS_BOOL(notification->isPublished()));
++n;
@@ -609,7 +637,7 @@
{
bool retval = true;
int pid;
-
+
pid = pidof ("mcompositor");
if (pid != m_CompositorPID) {
SYS_WARNING (
@@ -624,7 +652,7 @@
" a window (e.g. the lockscreenUI or the EventEater) it is most probably\n"
" because of the mcompositor crash.\n"
"----------------------------------------------------------------------------\n"
-" \n",
+" \n",
m_CompositorPID, pid);
m_CompositorPID = pid;
retval = false;
@@ -667,14 +695,14 @@
if (! success) {
SYS_WARNING ("Turning off the display failed!");
}
-
+
return success;
- #else
+ #else
return true;
- #endif
+ #endif
}
-bool
+bool
XChecker::turnOnDisplay ()
{
#if !defined(__i386__) && defined(HAVE_QMSYSTEM)
@@ -690,9 +718,9 @@
}
return success;
- #else
+ #else
return true;
- #endif
+ #endif
}
--- tests/ft_lockscreenui/xchecker.h
+++ tests/ft_lockscreenui/xchecker.h
@@ -40,7 +40,7 @@
public:
XChecker ();
-
+
typedef enum {
CheckIsVisible,
CheckIsInvisible,
@@ -52,7 +52,7 @@
void debug_dump_windows(Window highlighted = None);
void debugDumpNotifications ();
-
+
bool turnOffDisplay ();
bool turnOnDisplay ();
@@ -60,11 +60,11 @@
Display *display();
bool check_window_rec (
- Display *dpy,
- Window WindowID,
+ Display *dpy,
+ Window WindowID,
const QString &WMClass,
XChecker::RequestCode opCode);
-
+
char *get_atom_prop (Display *dpy, Window w, Atom atom);
Window get_win_prop(Display *dpy, Window w, Atom atom);
unsigned long get_card_prop(Display *dpy, Window w, Atom atom);
@@ -73,11 +73,11 @@
char * get_utf8_prop ( Display *dpy, Window w, Atom atom);
const char * get_map_state ( int state);
void pr (
- Window highlighted,
- Display *dpy,
- Window WindowID,
- int level,
- int nthWindow);
+ Window highlighted,
+ Display *dpy,
+ Window WindowID,
+ unsigned int level,
+ unsigned int nthWindow);
int pidof (const char *program);
bool checkPIDs ();
@@ -85,7 +85,7 @@
private:
Atom class_atom, name_atom, name_atom2,
utf8_string_atom;
-
+
int m_CompositorPID;
int m_SysuidPID;
};
--- tests/ft_shutdownbusinesslogic/ft_shutdownbusinesslogic.cpp
+++ tests/ft_shutdownbusinesslogic/ft_shutdownbusinesslogic.cpp
@@ -33,6 +33,8 @@
#include <MLabel>
#include <MImageWidget>
+MApplication *exitPtr;
+
#define DEBUG
#include "../../src/debug.h"
@@ -90,7 +92,6 @@
Ft_ShutdownBusinessLogic::testThermalState ()
{
ShutdownBusinessLogic *logic;
- Window WindowID;
logic = new ShutdownBusinessLogic;
SYS_DEBUG ("*********************************************");
@@ -117,7 +118,6 @@
Ft_ShutdownBusinessLogic::testShutDownDenied ()
{
ShutdownBusinessLogic *logic;
- Window WindowID;
logic = new ShutdownBusinessLogic;
SYS_DEBUG ("*********************************************");
@@ -144,7 +144,6 @@
Ft_ShutdownBusinessLogic::testBatteryStateEmpty ()
{
ShutdownBusinessLogic *logic;
- Window WindowID;
logic = new ShutdownBusinessLogic;
SYS_DEBUG ("*********************************************");
--- tests/ft_shutdownui/ft_shutdownui.cpp
+++ tests/ft_shutdownui/ft_shutdownui.cpp
@@ -28,7 +28,7 @@
#include <MSceneManager>
#include <MTheme>
#include <MLabel>
-#include <MImageWidget>
+#include <MStylableWidget>
#define DEBUG
#include "../../src/debug.h"
@@ -117,7 +117,7 @@
QVERIFY (m_ShutDownUI->m_Timer != 0);
QVERIFY (m_ShutDownUI->m_Label1 != 0);
QVERIFY (m_ShutDownUI->m_Label2 != 0);
- QVERIFY (m_ShutDownUI->m_Image != 0);
+ QVERIFY (m_ShutDownUI->m_logo != 0);
QVERIFY (m_ShutDownUI->m_Feedback != 0);
@@ -164,8 +164,8 @@
* disappear and the image is shown.
*/
QTest::qWait (2500);
- QVERIFY (m_ShutDownUI->m_Image != 0 &&
- m_ShutDownUI->m_Image->isVisible());
+ QVERIFY (m_ShutDownUI->m_logo != 0 &&
+ m_ShutDownUI->m_logo->isVisible());
/*
* A bit more to see the screen dimming.
--- tests/stubs/batterystatusindicator_stub.h
+++ tests/stubs/batterystatusindicator_stub.h
@@ -22,6 +22,9 @@
#include "statusindicator_stub.h"
#include <stubbase.h>
+#ifdef HAVE_QMSYSTEM
+#include <qmdevicemode.h>
+#endif
// 1. DECLARE STUB
// FIXME - stubgen is not yet finished
@@ -32,6 +35,9 @@
virtual void BatteryStatusIndicatorDestructor();
virtual void batteryLevelChanged();
virtual void batteryChargingChanged();
+#ifdef HAVE_QMSYSTEM
+ virtual void batterySaveModeChanged(Maemo::QmDeviceMode::PSMState state);
+#endif
};
// 2. IMPLEMENT STUB
@@ -55,7 +61,14 @@
stubMethodEntered("batteryChargingChanged");
}
-
+#ifdef HAVE_QMSYSTEM
+void BatteryStatusIndicatorStub::batterySaveModeChanged(Maemo::QmDeviceMode::PSMState state)
+{
+ QList<ParameterBase*> params;
+ params.append( new Parameter<Maemo::QmDeviceMode::PSMState>(state));
+ stubMethodEntered("batterySaveModeChanged",params);
+}
+#endif
// 3. CREATE A STUB INSTANCE
BatteryStatusIndicatorStub gDefaultBatteryStatusIndicatorStub;
@@ -83,5 +96,11 @@
gBatteryStatusIndicatorStub->batteryChargingChanged();
}
-
+#ifdef HAVE_QMSYSTEM
+void BatteryStatusIndicator::batterySaveModeChanged(Maemo::QmDeviceMode::PSMState state)
+{
+ gBatteryStatusIndicatorStub->batterySaveModeChanged(state);
+}
#endif
+
+#endif // BATTERYSTATUSINDICATOR_STUB
--- tests/stubs/lockscreenui_stub.h
+++ tests/stubs/lockscreenui_stub.h
@@ -82,7 +82,11 @@
// 4. CREATE A PROXY WHICH CALLS THE STUB
-LockScreenUI::LockScreenUI() {
+LockScreenUI::LockScreenUI() :
+ m_Realized (false), m_policy (0), m_SceneWindow (0),
+ m_notificationArea (0), m_LockLiftArea (0),
+ m_LockLandArea (0)
+{
gLockScreenUIStub->LockScreenUIConstructor();
}
--- tests/stubs/lockscreenwindow_stub.h
+++ tests/stubs/lockscreenwindow_stub.h
@@ -97,7 +97,10 @@
// 4. CREATE A PROXY WHICH CALLS THE STUB
-LockScreenWindow::LockScreenWindow(MWindow *window, MWidget *locklift, MWidget *lockland) {
+LockScreenWindow::LockScreenWindow(MWindow *window, MWidget *locklift, MWidget *lockland) :
+ m_confBgLandscape (0), m_confBgPortrait (0), m_Window (window),
+ m_DnDicon (0), m_DnDstate (0), m_LockLiftArea (0), m_LockLandArea (0)
+{
gLockScreenWindowStub->LockScreenWindowConstructor(window, locklift, lockland);
}
--- tests/stubs/mcompositornotificationsink_stub.h
+++ tests/stubs/mcompositornotificationsink_stub.h
@@ -34,14 +34,12 @@
virtual void removeNotification(uint notificationId);
virtual void timeout();
virtual void setDisabled(bool disabled);
- virtual void makeNotificationWindow();
virtual void updateNotification(const Notification ¬ification);
virtual void notificationDone(uint notificationId, bool notificationIdInUse);
- virtual void addInfoBannerToWindow();
- virtual void removeWindow();
- bool sinkDisabled ;
- MWindow *window ;
- Notification newNotification ;
+ virtual void showOrHideWindow();
+ virtual void addLatestBannerToWindow();
+ virtual void removeBannerFromCurrentBanners();
+ virtual void changeNotificationPreviewMode();
};
// 2. IMPLEMENT STUB
@@ -74,16 +72,20 @@
stubMethodEntered("setDisabled",params);
}
-void MCompositorNotificationSinkStub::makeNotificationWindow() {
- stubMethodEntered("makeNotificationWindow");
+void MCompositorNotificationSinkStub::showOrHideWindow() {
+ stubMethodEntered("showOrHideWindow");
}
-void MCompositorNotificationSinkStub::addInfoBannerToWindow() {
- stubMethodEntered("addInfoBannerToWindow");
+void MCompositorNotificationSinkStub::addLatestBannerToWindow() {
+ stubMethodEntered("addLatestBannerToWindow");
}
-void MCompositorNotificationSinkStub::removeWindow() {
- stubMethodEntered("removeWindow");
+void MCompositorNotificationSinkStub::removeBannerFromCurrentBanners() {
+ stubMethodEntered("removeBannerFromCurrentBanners");
+}
+
+void MCompositorNotificationSinkStub::changeNotificationPreviewMode() {
+ stubMethodEntered("changeNotificationPreviewMode");
}
void MCompositorNotificationSinkStub::updateNotification(const Notification ¬ification) {
@@ -139,13 +141,26 @@
gMCompositorNotificationSinkStub->notificationDone(notificationId, notificationIdInUse);
}
-void MCompositorNotificationSink::addInfoBannerToWindow() {
- gMCompositorNotificationSinkStub->addInfoBannerToWindow();
+void MCompositorNotificationSink::showOrHideWindow() {
+ gMCompositorNotificationSinkStub->showOrHideWindow();
}
-void MCompositorNotificationSink::hideWindow() {
- gMCompositorNotificationSinkStub->removeWindow();
+void MCompositorNotificationSink::addLatestBannerToWindow() {
+ gMCompositorNotificationSinkStub->addLatestBannerToWindow();
}
+void MCompositorNotificationSink::removeBannerFromCurrentBanners() {
+ gMCompositorNotificationSinkStub->removeBannerFromCurrentBanners();
+}
+
+void MCompositorNotificationSink::changeNotificationPreviewMode() {
+ gMCompositorNotificationSinkStub->changeNotificationPreviewMode();
+}
+
+void MCompositorNotificationSink::updateWindowMask() {
+}
+
+void MCompositorNotificationSink::clearWindowMask() {
+}
#endif
--- tests/stubs/methodcall.h
+++ tests/stubs/methodcall.h
@@ -54,6 +54,7 @@
if (!param) {
QString msg = QString("MethodCall::") + __func__ + ": failed dynamic_cast, check that parameter type matches parameter number";
qFatal(qPrintable(msg));
+ return 0;
}
return param->data;
}
--- tests/stubs/ngfadapter_stub.h
+++ tests/stubs/ngfadapter_stub.h
+#ifndef NGFADAPTER_STUB
+#define NGFADAPTER_STUB
+
+#include "ngfadapter.h"
+#include <stubbase.h>
+
+
+// 1. DECLARE STUB
+// FIXME - stubgen is not yet finished
+class NGFAdapterStub : public StubBase {
+ public:
+ virtual void NGFAdapterConstructor();
+ virtual void NGFAdapterDestructor();
+ virtual uint play(const QString &id);
+ virtual void stop(uint eventId);
+ virtual bool isValid();
+};
+
+// 2. IMPLEMENT STUB
+void NGFAdapterStub::NGFAdapterConstructor() {
+
+}
+void NGFAdapterStub::NGFAdapterDestructor() {
+
+}
+uint NGFAdapterStub::play(const QString &id) {
+ QList<ParameterBase*> params;
+ params.append( new Parameter<const QString & >(id));
+ stubMethodEntered("play",params);
+ return stubReturnValue<uint>("play");
+}
+
+void NGFAdapterStub::stop(uint eventId) {
+ QList<ParameterBase*> params;
+ params.append( new Parameter<uint >(eventId));
+ stubMethodEntered("stop",params);
+}
+
+bool NGFAdapterStub::isValid() {
+ stubMethodEntered("isValid");
+ return stubReturnValue<bool>("isValid");
+}
+
+
+
+// 3. CREATE A STUB INSTANCE
+NGFAdapterStub gDefaultNGFAdapterStub;
+NGFAdapterStub* gNGFAdapterStub = &gDefaultNGFAdapterStub;
+
+
+// 4. CREATE A PROXY WHICH CALLS THE STUB
+NGFAdapter::NGFAdapter() {
+ gNGFAdapterStub->NGFAdapterConstructor();
+}
+
+NGFAdapter::~NGFAdapter() {
+ gNGFAdapterStub->NGFAdapterDestructor();
+}
+
+uint NGFAdapter::play(const QString &id) {
+ return gNGFAdapterStub->play(id);
+}
+
+void NGFAdapter::stop(uint eventId) {
+ gNGFAdapterStub->stop(eventId);
+}
+
+bool NGFAdapter::isValid() {
+ return gNGFAdapterStub->isValid();
+}
+
+
+#endif
--- tests/stubs/notification_stub.h
+++ tests/stubs/notification_stub.h
@@ -73,7 +73,7 @@
const NotificationParameters & NotificationStub::parameters() const {
stubMethodEntered("parameters");
- return stubReturnValue<const NotificationParameters &>("parameters");
+ return stubReturnValueNoDefault<const NotificationParameters &>("parameters");
}
void NotificationStub::setParameters(const NotificationParameters ¶meters) {
@@ -92,8 +92,6 @@
return stubReturnValue<int>("timeout");
}
-
-
// 3. CREATE A STUB INSTANCE
NotificationStub gDefaultNotificationStub;
NotificationStub* gNotificationStub = &gDefaultNotificationStub;
--- tests/stubs/notificationarea_stub.h
+++ tests/stubs/notificationarea_stub.h
@@ -21,16 +21,17 @@
#include <stubbase.h>
#include <notificationarea.h>
-#include <MInfoBanner>
+#include <MBanner>
class NotificationAreaStub : public StubBase
{
public:
virtual void notificationAreaConstructor(NotificationArea *notificationArea, MWidget *parent);
virtual void notificationAreaDestructor();
- virtual void addNotification(MInfoBanner ¬ification);
- virtual void moveNotificationToTop(MInfoBanner ¬ification);
- virtual void removeNotification(MInfoBanner ¬ification);
+ virtual void addNotification(MBanner ¬ification);
+ virtual void moveNotificationToTop(MBanner ¬ification);
+ virtual void removeNotification(MBanner ¬ification);
+ virtual void removeAllRemovableBanners();
};
void NotificationAreaStub::notificationAreaConstructor(NotificationArea *notificationArea, MWidget *parent)
@@ -46,27 +47,32 @@
stubMethodEntered("notificationAreaDestructor");
}
-void NotificationAreaStub::addNotification(MInfoBanner ¬ification)
+void NotificationAreaStub::addNotification(MBanner ¬ification)
{
QList<ParameterBase *> params;
- params.append(new Parameter<MInfoBanner &>(notification));
+ params.append(new Parameter<MBanner &>(notification));
stubMethodEntered("addNotification", params);
}
-void NotificationAreaStub::moveNotificationToTop(MInfoBanner ¬ification)
+void NotificationAreaStub::moveNotificationToTop(MBanner ¬ification)
{
QList<ParameterBase *> params;
- params.append(new Parameter<MInfoBanner &>(notification));
+ params.append(new Parameter<MBanner &>(notification));
stubMethodEntered("moveNotificationToTop",params);
}
-void NotificationAreaStub::removeNotification(MInfoBanner ¬ification)
+void NotificationAreaStub::removeNotification(MBanner ¬ification)
{
QList<ParameterBase *> params;
- params.append(new Parameter<MInfoBanner &>(notification));
+ params.append(new Parameter<MBanner &>(notification));
stubMethodEntered("removeNotification", params);
}
+void NotificationAreaStub::removeAllRemovableBanners()
+{
+ stubMethodEntered("removeAllRemovableBanners");
+}
+
NotificationAreaStub gDefaultNotificationAreaStub;
NotificationAreaStub *gNotificationAreaStub = &gDefaultNotificationAreaStub;
@@ -80,19 +86,24 @@
gNotificationAreaStub->notificationAreaDestructor();
}
-void NotificationArea::addNotification(MInfoBanner ¬ification)
+void NotificationArea::addNotification(MBanner ¬ification)
{
gNotificationAreaStub->addNotification(notification);
}
-void NotificationArea::moveNotificationToTop(MInfoBanner ¬ification)
+void NotificationArea::moveNotificationToTop(MBanner ¬ification)
{
gNotificationAreaStub->moveNotificationToTop(notification);
}
-void NotificationArea::removeNotification(MInfoBanner ¬ification)
+void NotificationArea::removeNotification(MBanner ¬ification)
{
gNotificationAreaStub->removeNotification(notification);
}
+void NotificationArea::removeAllRemovableBanners()
+{
+ gNotificationAreaStub->removeAllRemovableBanners();
+}
+
#endif
--- tests/stubs/notificationareasink_stub.h
+++ tests/stubs/notificationareasink_stub.h
@@ -34,10 +34,10 @@
virtual void removeGroup(uint groupId);
virtual void addNotification(const Notification ¬ification);
virtual void removeNotification(uint notificationId);
- virtual void addNotification(MInfoBanner ¬ification);
- virtual void removeNotification(MInfoBanner ¬ification);
- virtual void setupInfoBanner(MInfoBanner *infoBanner);
- virtual MInfoBanner *updateNotification(MInfoBanner *dn, const NotificationParameters ¶meters);
+ 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 removeGroupBanner(uint groupId);
};
@@ -79,34 +79,34 @@
stubMethodEntered("removeNotification", params);
}
-void NotificationAreaSinkStub::addNotification(MInfoBanner ¬ification)
+void NotificationAreaSinkStub::addNotification(MBanner ¬ification)
{
QList<ParameterBase *> params;
- params.append(new Parameter<MInfoBanner & >(notification));
+ params.append(new Parameter<MBanner & >(notification));
stubMethodEntered("addNotification", params);
}
-void NotificationAreaSinkStub::removeNotification(MInfoBanner ¬ification)
+void NotificationAreaSinkStub::removeNotification(MBanner ¬ification)
{
QList<ParameterBase *> params;
- params.append(new Parameter<MInfoBanner & >(notification));
+ params.append(new Parameter<MBanner & >(notification));
stubMethodEntered("removeNotification", params);
}
-void NotificationAreaSinkStub::setupInfoBanner(MInfoBanner *infoBanner)
+void NotificationAreaSinkStub::setupInfoBanner(MBanner *infoBanner)
{
QList<ParameterBase *> params;
- params.append(new Parameter<MInfoBanner * >(infoBanner));
+ params.append(new Parameter<MBanner * >(infoBanner));
stubMethodEntered("setupInfoBanner", params);
}
-MInfoBanner *NotificationAreaSinkStub::updateNotification(MInfoBanner *dn, const NotificationParameters ¶meters)
+MBanner *NotificationAreaSinkStub::updateNotification(MBanner *dn, const NotificationParameters ¶meters)
{
QList<ParameterBase *> params;
- params.append(new Parameter<MInfoBanner * >(dn));
+ params.append(new Parameter<MBanner * >(dn));
params.append(new Parameter<const NotificationParameters & >(parameters));
stubMethodEntered("updateNotification", params);
- return stubReturnValue<MInfoBanner *>("updateNotification");
+ return stubReturnValue<MBanner *>("updateNotification");
}
void NotificationAreaSinkStub::removeGroupBanner(uint groupId)
@@ -153,12 +153,12 @@
gNotificationAreaSinkStub->removeNotification(notificationId);
}
-void NotificationAreaSink::setupInfoBanner(MInfoBanner *infoBanner)
+void NotificationAreaSink::setupInfoBanner(MBanner *infoBanner)
{
gNotificationAreaSinkStub->setupInfoBanner(infoBanner);
}
-MInfoBanner *NotificationAreaSink::updateNotification(MInfoBanner *dn, const NotificationParameters ¶meters)
+MBanner *NotificationAreaSink::updateNotification(MBanner *dn, const NotificationParameters ¶meters)
{
return gNotificationAreaSinkStub->updateNotification(dn, parameters);
}
--- tests/stubs/notificationgroup_stub.h
+++ tests/stubs/notificationgroup_stub.h
@@ -67,7 +67,7 @@
const NotificationParameters & NotificationGroupStub::parameters() const {
stubMethodEntered("parameters");
- return stubReturnValue<const NotificationParameters &>("parameters");
+ return stubReturnValueNoDefault<const NotificationParameters &>("parameters");
}
void NotificationGroupStub::setParameters(const NotificationParameters ¶meters) {
--- tests/stubs/notificationmanager_stub.h
+++ tests/stubs/notificationmanager_stub.h
@@ -22,8 +22,8 @@
#include "notificationmanager.h"
#include <stubbase.h>
-#ifdef HAVE_MAEMOSEC
-maemosec::storage::~storage()
+#ifdef HAVE_AEGIS_CRYPTO
+aegis::storage::~storage()
{
}
#endif
@@ -35,7 +35,6 @@
virtual void NotificationManagerConstructor(int relayInterval, uint maxWaitQueueSize);
virtual void NotificationManagerDestructor();
virtual void restorePersistentData();
- virtual void loadSystemNotificationSource();
virtual uint addNotification(uint notificationUserId, const NotificationParameters ¶meters, uint groupId);
virtual bool updateNotification(uint notificationUserId, uint notificationId, const NotificationParameters ¶meters);
virtual bool removeNotification(uint notificationUserId, uint notificationId);
@@ -63,7 +62,8 @@
virtual bool ensurePersistentDataPath();
virtual void saveStateData();
virtual void savePersistentNotifications();
-};
+ virtual void removeUnseenFlags(bool ignore);
+ };
// 2. IMPLEMENT STUB
void NotificationManagerStub::NotificationManagerConstructor(int relayInterval, uint maxWaitQueueSize) {
@@ -78,10 +78,6 @@
stubMethodEntered("restorePersistentData");
}
-void NotificationManagerStub::loadSystemNotificationSource() {
- stubMethodEntered("loadSystemNotificationSource");
-}
-
uint NotificationManagerStub::addNotification(uint notificationUserId, const NotificationParameters ¶meters, uint groupId) {
QList<ParameterBase*> params;
params.append( new Parameter<uint >(notificationUserId));
@@ -177,7 +173,7 @@
const EventTypeStore & NotificationManagerStub::eventTypeStore() const {
stubMethodEntered("eventTypeStore");
- return stubReturnValue<const EventTypeStore &>("eventTypeStore");
+ return stubReturnValueNoDefault<const EventTypeStore&>("eventTypeStore");
}
void NotificationManagerStub::removeNotificationsAndGroupsWithEventType(const QString &eventType) {
@@ -254,8 +250,12 @@
stubMethodEntered("savePersistentNotifications");
}
-
-
+void NotificationManagerStub::removeUnseenFlags(bool ignore)
+{
+ QList<ParameterBase*> params;
+ params.append( new Parameter<bool>(ignore));
+ return stubMethodEntered("removeUnseenFlags", params);
+}
// 3. CREATE A STUB INSTANCE
NotificationManagerStub gDefaultNotificationManagerStub;
NotificationManagerStub* gNotificationManagerStub = &gDefaultNotificationManagerStub;
@@ -274,10 +274,6 @@
gNotificationManagerStub->restorePersistentData();
}
-void NotificationManager::loadSystemNotificationSource() {
- gNotificationManagerStub->loadSystemNotificationSource();
-}
-
uint NotificationManager::addNotification(uint notificationUserId, const NotificationParameters ¶meters, uint groupId) {
return gNotificationManagerStub->addNotification(notificationUserId, parameters, groupId);
}
@@ -383,9 +379,8 @@
gNotificationManagerStub->saveStateData();
}
-void NotificationManager::savePersistentNotifications() {
- gNotificationManagerStub->savePersistentNotifications();
+void NotificationManager::removeUnseenFlags(bool ignore)
+{
+ gNotificationManagerStub->removeUnseenFlags(ignore);
}
-
-
#endif
--- tests/stubs/notificationstatusindicator_stub.h
+++ tests/stubs/notificationstatusindicator_stub.h
+#ifndef NOTIFICATIONSTATUSINDICATOR_STUB
+#define NOTIFICATIONSTATUSINDICATOR_STUB
+
+#include "notificationstatusindicator.h"
+#include <stubbase.h>
+
+
+// 1. DECLARE STUB
+// FIXME - stubgen is not yet finished
+class NotificationStatusIndicatorStub : public StubBase {
+ public:
+ virtual void NotificationStatusIndicatorConstructor(MWidget *parent);
+ virtual void NotificationStatusIndicatorDestructor();
+ virtual void statusIndicatorMenuVisibilityChange(bool visible);
+ virtual void setActive(bool active);
+};
+
+// 2. IMPLEMENT STUB
+void NotificationStatusIndicatorStub::NotificationStatusIndicatorConstructor(MWidget *parent) {
+ Q_UNUSED(parent);
+
+}
+void NotificationStatusIndicatorStub::NotificationStatusIndicatorDestructor() {
+
+}
+void NotificationStatusIndicatorStub::statusIndicatorMenuVisibilityChange(bool visible) {
+ QList<ParameterBase*> params;
+ params.append( new Parameter<bool >(visible));
+ stubMethodEntered("statusIndicatorMenuVisibilityChange",params);
+}
+
+void NotificationStatusIndicatorStub::setActive(bool active) {
+ QList<ParameterBase*> params;
+ params.append( new Parameter<bool >(active));
+ stubMethodEntered("setActive",params);
+}
+
+
+// 3. CREATE A STUB INSTANCE
+NotificationStatusIndicatorStub gDefaultNotificationStatusIndicatorStub;
+NotificationStatusIndicatorStub* gNotificationStatusIndicatorStub = &gDefaultNotificationStatusIndicatorStub;
+
+
+// 4. CREATE A PROXY WHICH CALLS THE STUB
+NotificationStatusIndicator::NotificationStatusIndicator(MWidget *parent) {
+ gNotificationStatusIndicatorStub->NotificationStatusIndicatorConstructor(parent);
+}
+
+NotificationStatusIndicator::~NotificationStatusIndicator() {
+ gNotificationStatusIndicatorStub->NotificationStatusIndicatorDestructor();
+}
+
+void NotificationStatusIndicator::statusIndicatorMenuVisibilityChange(bool visible) {
+ gNotificationStatusIndicatorStub->statusIndicatorMenuVisibilityChange(visible);
+}
+
+void NotificationStatusIndicator::setActive(bool active) {
+ gNotificationStatusIndicatorStub->setActive(active);
+}
+
+
+#endif
--- tests/stubs/notifier_stub.h
+++ tests/stubs/notifier_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 NOTIFIER_STUB
-#define NOTIFIER_STUB
-
-#include "notifier.h"
-#include <stubbase.h>
-
-
-// 1. DECLARE STUB
-// FIXME - stubgen is not yet finished
-class NotifierStub : public StubBase
-{
-public:
- virtual void NotifierConstructor(MWidget *parent);
- virtual void NotifierDestructor();
- virtual void notificationCountChanged(uint count);
-};
-
-// 2. IMPLEMENT STUB
-void NotifierStub::NotifierConstructor(MWidget *parent)
-{
- Q_UNUSED(parent);
-
-}
-void NotifierStub::NotifierDestructor()
-{
-
-}
-void NotifierStub::notificationCountChanged(uint count)
-{
- QList<ParameterBase *> params;
- params.append(new Parameter<uint >(count));
- stubMethodEntered("notificationCountChanged", params);
-}
-
-
-
-// 3. CREATE A STUB INSTANCE
-NotifierStub gDefaultNotifierStub;
-NotifierStub *gNotifierStub = &gDefaultNotifierStub;
-
-
-// 4. CREATE A PROXY WHICH CALLS THE STUB
-Notifier::Notifier(MWidget *parent)
-{
- gNotifierStub->NotifierConstructor(parent);
-}
-
-Notifier::~Notifier()
-{
- gNotifierStub->NotifierDestructor();
-}
-
-void Notifier::notificationCountChanged(uint count)
-{
- gNotifierStub->notificationCountChanged(count);
-}
-
-
-#endif
--- tests/stubs/notifiernotificationsink_stub.h
+++ tests/stubs/notifiernotificationsink_stub.h
@@ -33,11 +33,9 @@
virtual void removeGroup(uint groupId);
virtual void addNotification(const Notification ¬ification);
virtual void removeNotification(uint notificationId);
- QHash<uint, uint> groupForNotification ;
- QHash<uint, uint> notificationCountForNotification ;
- QHash<uint, uint> notificationCountForGroup ;
- uint notificationCount ;
- virtual void updateNotificationCount();
+ void clearSink();
+ void disableNotificationAdditions(bool disable);
+ void playNotifierNGF(bool play);
};
// 2. IMPLEMENT STUB
@@ -73,11 +71,23 @@
stubMethodEntered("removeNotification",params);
}
-void NotifierNotificationSinkStub::updateNotificationCount() {
- stubMethodEntered("updateNotificationCount");
+void NotifierNotificationSinkStub::clearSink() {
+ stubMethodEntered("clearSink");
}
+void NotifierNotificationSinkStub::disableNotificationAdditions(bool disable)
+{
+ QList<ParameterBase*> params;
+ params.append( new Parameter<bool >(disable));
+ stubMethodEntered("disableNotificationAdditions", params);
+}
+void NotifierNotificationSinkStub::playNotifierNGF(bool play)
+{
+ QList<ParameterBase*> params;
+ params.append( new Parameter<bool >(play));
+ stubMethodEntered("playNotifierNGF", params);
+}
// 3. CREATE A STUB INSTANCE
NotifierNotificationSinkStub gDefaultNotifierNotificationSinkStub;
@@ -93,14 +103,6 @@
gNotifierNotificationSinkStub->NotifierNotificationSinkDestructor();
}
-void NotifierNotificationSink::addGroup(uint groupId, const NotificationParameters ¶meters) {
- gNotifierNotificationSinkStub->addGroup(groupId, parameters);
-}
-
-void NotifierNotificationSink::removeGroup(uint groupId) {
- gNotifierNotificationSinkStub->removeGroup(groupId);
-}
-
void NotifierNotificationSink::addNotification(const Notification ¬ification) {
gNotifierNotificationSinkStub->addNotification(notification);
}
@@ -109,9 +111,18 @@
gNotifierNotificationSinkStub->removeNotification(notificationId);
}
-void NotifierNotificationSink::updateNotificationCount() {
- gNotifierNotificationSinkStub->updateNotificationCount();
+void NotifierNotificationSink::clearSink() {
+ gNotifierNotificationSinkStub->clearSink();
}
+void NotifierNotificationSink::disableNotificationAdditions(bool disable)
+{
+ gNotifierNotificationSinkStub->disableNotificationAdditions(disable);
+}
+
+void NotifierNotificationSink::playNotifierNGF(bool play)
+{
+ gNotifierNotificationSinkStub->playNotifierNGF(play);
+}
#endif
--- tests/stubs/pannedwidgetcontroller_stub.h
+++ tests/stubs/pannedwidgetcontroller_stub.h
@@ -32,6 +32,7 @@
virtual void PannedWidgetControllerConstructor(QGraphicsItem *parent);
virtual void setGeometry(const QRectF &rect);
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
+ virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
};
// 2. IMPLEMENT STUB
@@ -51,6 +52,12 @@
stubMethodEntered("mousePressEvent", params);
}
+void PannedWidgetControllerStub::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
+ QList<ParameterBase*> params;
+ params.append(new Parameter<QGraphicsSceneMouseEvent*>(event));
+ stubMethodEntered("mouseReleaseEvent", params);
+}
+
// 3. CREATE A STUB INSTANCE
PannedWidgetControllerStub gDefaultPannedWidgetControllerStub;
PannedWidgetControllerStub* gPannedWidgetControllerStub = &gDefaultPannedWidgetControllerStub;
@@ -69,5 +76,8 @@
gPannedWidgetControllerStub->mousePressEvent(event);
}
+void PannedWidgetController::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
+ gPannedWidgetControllerStub->mouseReleaseEvent(event);
+}
#endif
--- tests/stubs/pluginlist_stub.h
+++ tests/stubs/pluginlist_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 PLUGINLIST_STUB
-#define PLUGINLIST_STUB
-
-#include "pluginlist.h"
-#include <stubbase.h>
-
-
-// 1. DECLARE STUB
-// FIXME - stubgen is not yet finished
-class PluginListStub : public StubBase {
-public:
- virtual void PluginListConstructor(StatusIndicatorMenuWindow *window, QGraphicsItem *parent);
- virtual void PluginListDestructor();
- virtual void showStatusIndicatorMenu();
- virtual void hideStatusIndicatorMenu();
- virtual void addPlugin(const QString &path);
-};
-
-// 2. IMPLEMENT STUB
-void PluginListStub::PluginListConstructor(StatusIndicatorMenuWindow *window, QGraphicsItem *parent) {
- Q_UNUSED(window);
- Q_UNUSED(parent);
-
-}
-void PluginListStub::PluginListDestructor() {
-
-}
-
-void PluginListStub::showStatusIndicatorMenu() {
- stubMethodEntered("showStatusIndicatorMenu");
-}
-
-void PluginListStub::hideStatusIndicatorMenu() {
- stubMethodEntered("hideStatusIndicatorMenu");
-}
-
-void PluginListStub::addPlugin(const QString &path) {
- QList<ParameterBase*> params;
- params.append( new Parameter<const QString & >(path));
- stubMethodEntered("addPlugin",params);
-}
-
-
-
-// 3. CREATE A STUB INSTANCE
-PluginListStub gDefaultPluginListStub;
-PluginListStub* gPluginListStub = &gDefaultPluginListStub;
-
-
-// 4. CREATE A PROXY WHICH CALLS THE STUB
-PluginList::PluginList(StatusIndicatorMenuWindow *window, QGraphicsItem *parent) {
- gPluginListStub->PluginListConstructor(window, parent);
-}
-
-PluginList::~PluginList() {
- gPluginListStub->PluginListDestructor();
-}
-
-void PluginList::showStatusIndicatorMenu() {
- gPluginListStub->showStatusIndicatorMenu();
-}
-
-void PluginList::hideStatusIndicatorMenu() {
- gPluginListStub->hideStatusIndicatorMenu();
-}
-
-void PluginList::loadPlugins() {
-
-}
-
-void PluginList::addPlugin(const QString &path) {
- gPluginListStub->addPlugin(path);
-}
-
-#endif
--- tests/stubs/qmbattery_stub.h
+++ tests/stubs/qmbattery_stub.h
@@ -108,6 +108,11 @@
namespace Maemo
{
+class QmBatteryPrivate
+{
+ /* Dummy class... */
+};
+
QmBattery::QmBattery (QObject *parent)
{
Q_UNUSED (parent);
--- tests/stubs/qmdevicemode_stub.h
+++ tests/stubs/qmdevicemode_stub.h
@@ -90,7 +90,7 @@
QmDeviceMode::~QmDeviceMode ()
{
-
+ priv_ptr = 0;
}
QmDeviceMode::PSMState
--- tests/stubs/qmled_stub.h
+++ tests/stubs/qmled_stub.h
@@ -80,6 +80,7 @@
/*
* Do nothing, we don't want to instantiate a real QmLED...
*/
+ priv_ptr = 0;
}
QmLED::~QmLED ()
--- tests/stubs/qmlocks_stub.h
+++ tests/stubs/qmlocks_stub.h
+#ifndef QMLOCKS_STUB
+#define QMLOCKS_STUB
+
+#include <stubbase.h>
+#include <qmlocks.h>
+
+// 1. DECLARE STUB
+// FIXME - stubgen is not yet finished
+class QmLocksStub : public StubBase {
+public:
+ virtual void QmLocksConstructor(QObject *parent = 0);
+ virtual void QmLocksDestructor();
+ virtual Maemo::QmLocks::State getState(Maemo::QmLocks::Lock what) const;
+ virtual bool setState(Maemo::QmLocks::Lock what, Maemo::QmLocks::State how);
+ virtual bool setDeviceAutolockTime(int seconds);
+ virtual int getDeviceAutolockTime();
+};
+
+// 2. IMPLEMENT STUB
+void QmLocksStub::QmLocksConstructor(QObject *parent) {
+ Q_UNUSED(parent)
+}
+
+void QmLocksStub::QmLocksDestructor() {
+
+}
+
+Maemo::QmLocks::State QmLocksStub::getState(Maemo::QmLocks::Lock what) const {
+ QList<ParameterBase*> params;
+ params.append(new Parameter<Maemo::QmLocks::Lock>(what));
+ stubMethodEntered("getState", params);
+ return stubReturnValue<Maemo::QmLocks::State>("getState");
+}
+
+bool QmLocksStub::setState(Maemo::QmLocks::Lock what, Maemo::QmLocks::State how) {
+ QList<ParameterBase*> params;
+ params.append(new Parameter<Maemo::QmLocks::Lock>(what));
+ params.append(new Parameter<Maemo::QmLocks::State>(how));
+ stubMethodEntered("setState", params);
+ return stubReturnValue<bool>("setState");
+}
+
+bool QmLocksStub::setDeviceAutolockTime(int seconds) {
+ QList<ParameterBase*> params;
+ params.append(new Parameter<int>(seconds));
+ stubMethodEntered("setDeviceAutolockTime", params);
+ return stubReturnValue<bool>("setDeviceAutolockTime");
+}
+
+int QmLocksStub::getDeviceAutolockTime() {
+ stubMethodEntered("getDeviceAutolockTime");
+ return stubReturnValue<int>("getDeviceAutolockTime");
+}
+
+// 3. CREATE A STUB INSTANCE
+QmLocksStub gDefaultQmLocksStub;
+QmLocksStub* gQmLocksStub = &gDefaultQmLocksStub;
+
+// 4. CREATE A PROXY WHICH CALLS THE STUB
+namespace Maemo
+{
+
+QmLocks::QmLocks(QObject *parent) {
+ gQmLocksStub->QmLocksConstructor(parent);
+}
+
+QmLocks::~QmLocks() {
+ gQmLocksStub->QmLocksDestructor();
+}
+
+QmLocks::State QmLocks::getState(QmLocks::Lock what) const {
+ return gQmLocksStub->getState(what);
+}
+
+bool QmLocks::setState(QmLocks::Lock what, QmLocks::State how) {
+ return gQmLocksStub->setState(what, how);
+}
+
+bool QmLocks::setDeviceAutolockTime(int seconds) {
+ return gQmLocksStub->setDeviceAutolockTime(seconds);
+}
+
+int QmLocks::getDeviceAutolockTime() {
+ return gQmLocksStub->getDeviceAutolockTime();
+}
+
+}
+#endif // QMLOCKS_STUB
--- tests/stubs/statusindicatoranimationview_stub.h
+++ tests/stubs/statusindicatoranimationview_stub.h
@@ -14,7 +14,9 @@
virtual void updateData(const QList<const char *> &modifications);
virtual void startAnimation();
virtual void stopAnimation();
+ virtual QSizeF sizeHint (Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) const;
virtual void setAnimationFrame(int frame);
+ virtual void setFirstAnimationFrame(int frame);
virtual void drawContents(QPainter *painter, const QStyleOptionGraphicsItem *option) const;
virtual void setupModel();
virtual void applyStyle();
@@ -45,12 +47,27 @@
stubMethodEntered("stopAnimation");
}
+QSizeF StatusIndicatorAnimationViewStub::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const
+{
+ QList<ParameterBase*> params;
+ params.append( new Parameter<Qt::SizeHint>(which));
+ params.append( new Parameter<const QSizeF& > (constraint));
+ stubMethodEntered("sizeHint");
+ return stubReturnValue<QSizeF>("sizeHint");
+}
+
void StatusIndicatorAnimationViewStub::setAnimationFrame(int frame) {
QList<ParameterBase*> params;
params.append( new Parameter<int >(frame));
stubMethodEntered("setAnimationFrame",params);
}
+void StatusIndicatorAnimationViewStub::setFirstAnimationFrame(int frame) {
+ QList<ParameterBase*> params;
+ params.append( new Parameter<int >(frame));
+ stubMethodEntered("setFirstAnimationFrame",params);
+}
+
void StatusIndicatorAnimationViewStub::drawContents(QPainter *painter, const QStyleOptionGraphicsItem *option) const {
QList<ParameterBase*> params;
params.append( new Parameter<QPainter * >(painter));
@@ -108,10 +125,19 @@
gStatusIndicatorAnimationViewStub->stopAnimation();
}
+QSizeF StatusIndicatorAnimationView::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const
+{
+ return gStatusIndicatorAnimationViewStub->sizeHint(which, constraint);
+}
+
void StatusIndicatorAnimationView::setAnimationFrame(int frame) {
gStatusIndicatorAnimationViewStub->setAnimationFrame(frame);
}
+void StatusIndicatorAnimationView::setFirstAnimationFrame(int frame) {
+ gStatusIndicatorAnimationViewStub->setFirstAnimationFrame(frame);
+}
+
void StatusIndicatorAnimationView::drawContents(QPainter *painter, const QStyleOptionGraphicsItem *option) const {
gStatusIndicatorAnimationViewStub->drawContents(painter, option);
}
--- tests/stubs/statusindicatormenuwindow_stub.h
+++ tests/stubs/statusindicatormenuwindow_stub.h
@@ -23,6 +23,9 @@
#include "statusindicatormenuwindow.h"
#include <stubbase.h>
+#ifdef HAVE_QMSYSTEM
+#include <qmlocks.h>
+#endif
// 1. DECLARE STUB
// FIXME - stubgen is not yet finished
@@ -38,6 +41,9 @@
virtual void setStatusIndicatorMenuInterface(MApplicationExtensionInterface *extension);
virtual void launchControlPanelAndHide();
virtual void setPannabilityAndLayout();
+#ifdef HAVE_QMSYSTEM
+ virtual void setWindowStateAccordingToDeviceLockState(Maemo::QmLocks::Lock what, Maemo::QmLocks::State how);
+#endif
};
// 2. IMPLEMENT STUB
@@ -82,6 +88,16 @@
stubMethodEntered("setPannabilityAndLayout");
}
+#ifdef HAVE_QMSYSTEM
+void StatusIndicatorMenuWindowStub::setWindowStateAccordingToDeviceLockState(Maemo::QmLocks::Lock what, Maemo::QmLocks::State how) {
+ QList<ParameterBase*> params;
+ params.append( new Parameter<Maemo::QmLocks::Lock>(what));
+ params.append( new Parameter<Maemo::QmLocks::State>(how));
+ stubMethodEntered("setWindowStateAccordingToDeviceLockState",params);
+}
+#endif
+
+
// 3. CREATE A STUB INSTANCE
StatusIndicatorMenuWindowStub gDefaultStatusIndicatorMenuWindowStub;
StatusIndicatorMenuWindowStub* gStatusIndicatorMenuWindowStub = &gDefaultStatusIndicatorMenuWindowStub;
@@ -128,4 +144,10 @@
gStatusIndicatorMenuWindowStub->setPannabilityAndLayout();
}
+#ifdef HAVE_QMSYSTEM
+void StatusIndicatorMenuWindow::setWindowStateAccordingToDeviceLockState(Maemo::QmLocks::Lock what, Maemo::QmLocks::State how) {
+ gStatusIndicatorMenuWindowStub->setWindowStateAccordingToDeviceLockState(what, how);
+}
+#endif
+
#endif
--- tests/stubs/stubbase.h
+++ tests/stubs/stubbase.h
@@ -50,10 +50,14 @@
template <typename T>
void stubSetReturnValue(const QString &methodName, T value) const;
- // Return the return value set for methodName
+ // Return the return value set for methodName or the default constructed value if no value has been set
template <typename T>
T &stubReturnValue(const QString &methodName) const;
+ // Return the return value set for methodName
+ template <typename T>
+ T &stubReturnValueNoDefault(const QString &methodName) const;
+
// For use by stubs
@@ -80,11 +84,29 @@
template <typename T>
T &StubBase::stubReturnValue(const QString &methodName) const
{
- if (! _stubReturnValues.contains(methodName)) {
+ if (!_stubReturnValues.contains(methodName)) {
stubSetReturnValue<T>(methodName, T());
}
ParameterBase *base = _stubReturnValues[methodName];
+ Parameter<T>* param = dynamic_cast<Parameter<T>*>(base);
+ if (!param) {
+ QString msg = QString("StubBase::") + __func__ + ": failed dynamic_cast, check that return value type matches the method; check also that you have used stubSetReturnValue(" + methodName + ")";
+ qFatal(qPrintable(msg));
+ }
+ return param->data;
+
+}
+
+template <typename T>
+T &StubBase::stubReturnValueNoDefault(const QString &methodName) const
+{
+ if (!_stubReturnValues.contains(methodName)) {
+ QString msg = QString("StubBase::") + __func__ + ": return value for method not found; check that you have used stubSetReturnValue(" + methodName + ")";
+ qFatal(qPrintable(msg));
+ }
+
+ ParameterBase *base = _stubReturnValues[methodName];
Parameter<T>* param = dynamic_cast<Parameter<T>*>(base);
if (!param) {
QString msg = QString("StubBase::") + __func__ + ": failed dynamic_cast, check that return value type matches the method; check also that you have used stubSetReturnValue(" + methodName + ")";
--- tests/stubs/sysuid_stub.h
+++ tests/stubs/sysuid_stub.h
@@ -65,12 +65,12 @@
NotificationManager & SysuidStub::notificationManager() {
stubMethodEntered("notificationManager");
- return stubReturnValue<NotificationManager &>("notificationManager");
+ return *stubReturnValue<NotificationManager *>("notificationManager");
}
MCompositorNotificationSink & SysuidStub::compositorNotificationSink() {
stubMethodEntered("compositorNotificationSink");
- return stubReturnValue<MCompositorNotificationSink &>("compositorNotificationSink");
+ return *stubReturnValue<MCompositorNotificationSink *>("compositorNotificationSink");
}
void SysuidStub::retranslate() {
@@ -88,7 +88,13 @@
// 4. CREATE A PROXY WHICH CALLS THE STUB
-Sysuid::Sysuid(QObject* parent) {
+Sysuid::Sysuid(QObject* parent) :
+ m_BatteryLogic (0), m_ShutdownLogic (0),
+ m_UsbUi (0), m_statusArea (0), m_notificationManager (0),
+ m_compositorNotificationSink (0), m_ngfNotificationSink (0),
+ m_unlockNotificationSink (0), m_sysuidRequest (0),
+ m_volumeBar (0)
+{
gSysuidStub->SysuidConstructor(parent);
}
--- tests/stubs/testnotificationparameters.h
+++ tests/stubs/testnotificationparameters.h
@@ -25,14 +25,11 @@
class TestNotificationParameters : public NotificationParameters
{
public:
- TestNotificationParameters(QString imageId = "", QString summary = "", QString body = "", QString iconId = "", QString action = "");
+ TestNotificationParameters(QString summary = "", QString body = "", QString iconId = "", QString action = "");
};
-TestNotificationParameters::TestNotificationParameters(QString imageId, QString summary, QString body, QString iconId, QString action)
+TestNotificationParameters::TestNotificationParameters(QString summary, QString body, QString iconId, QString action)
{
- if (!imageId.isEmpty()) {
- add(NotificationWidgetParameterFactory::createImageIdParameter(imageId));
- }
if (!summary.isEmpty()) {
add(NotificationWidgetParameterFactory::createSummaryParameter(summary));
}
--- tests/stubs/unlockmissedevents_stub.h
+++ tests/stubs/unlockmissedevents_stub.h
@@ -90,6 +90,9 @@
UnlockMissedEvents::UnlockMissedEvents() {
lastType = NotifyLast;
gUnlockMissedEventsStub->UnlockMissedEventsConstructor();
+
+ for (int i = 0; i < NotifyLast; i++)
+ notificationCounts[i] = 0;
}
UnlockMissedEvents::~UnlockMissedEvents() {
--- tests/stubs/unlocknotificationsinkstub.h
+++ tests/stubs/unlocknotificationsinkstub.h
@@ -5,7 +5,7 @@
UnlockNotificationSink::UnlockNotificationSink ()
{
-
+ m_enabled = true;
}
void
--- tests/stubs/unlockwidgets_stub.h
+++ tests/stubs/unlockwidgets_stub.h
@@ -32,6 +32,11 @@
}
void
+UnlockHeader::timeSettingsChanged (Maemo::QmTimeWhatChanged what) {
+ Q_UNUSED (what);
+}
+
+void
UnlockHeader::setActive (bool active)
{
Q_UNUSED(active);
--- tests/stubs/usbmode_stub.h
+++ tests/stubs/usbmode_stub.h
@@ -27,6 +27,8 @@
QmUSBMode (QObject *parent = 0)
{
Q_UNUSED (parent);
+ testMode = Undefined;
+ testDefaultMode = Undefined;
}
~QmUSBMode ()
{
--- tests/stubs/widgetnotificationsink_stub.h
+++ tests/stubs/widgetnotificationsink_stub.h
@@ -31,9 +31,9 @@
virtual void notificationRemovalRequested(uint notificationId);
virtual void notificationGroupClearingRequested(uint groupId);
virtual QString determineIconId(const NotificationParameters ¶meters);
- virtual MInfoBanner *createInfoBanner(const Notification ¬ification);
- virtual MInfoBanner *createInfoBanner(MInfoBanner::BannerType type, uint groupId, const NotificationParameters ¶meters);
- virtual void updateActions(MInfoBanner *infoBanner, const NotificationParameters ¶meters);
+ virtual MBanner *createInfoBanner(const Notification ¬ification);
+ virtual MBanner *createInfoBanner(Notification::NotificationType type, uint groupId, const NotificationParameters ¶meters);
+ virtual void updateActions(MBanner *infoBanner, const NotificationParameters ¶meters);
virtual QString determineIconIdFromEventType(const QString &eventType);
virtual void infoBannerClicked();
};
@@ -61,28 +61,28 @@
return stubReturnValue<QString>("determineIconId");
}
-MInfoBanner *WidgetNotificationSinkStub::createInfoBanner(const Notification ¬ification)
+MBanner *WidgetNotificationSinkStub::createInfoBanner(const Notification ¬ification)
{
QList<ParameterBase *> params;
params.append(new Parameter<const Notification & >(notification));
stubMethodEntered("createInfoBanner", params);
- return stubReturnValue<MInfoBanner *>("createInfoBanner");
+ return stubReturnValue<MBanner *>("createInfoBanner");
}
-MInfoBanner *WidgetNotificationSinkStub::createInfoBanner(MInfoBanner::BannerType type, uint groupId, const NotificationParameters ¶meters)
+MBanner *WidgetNotificationSinkStub::createInfoBanner(Notification::NotificationType type, uint groupId, const NotificationParameters ¶meters)
{
QList<ParameterBase *> params;
- params.append(new Parameter<MInfoBanner::BannerType >(type));
+ params.append(new Parameter<Notification::NotificationType >(type));
params.append(new Parameter<uint >(groupId));
params.append(new Parameter<const NotificationParameters & >(parameters));
stubMethodEntered("createInfoBanner", params);
- return stubReturnValue<MInfoBanner *>("createInfoBanner");
+ return stubReturnValue<MBanner *>("createInfoBanner");
}
-void WidgetNotificationSinkStub::updateActions(MInfoBanner *infoBanner, const NotificationParameters ¶meters)
+void WidgetNotificationSinkStub::updateActions(MBanner *infoBanner, const NotificationParameters ¶meters)
{
QList<ParameterBase *> params;
- params.append(new Parameter<MInfoBanner * >(infoBanner));
+ params.append(new Parameter<MBanner * >(infoBanner));
params.append(new Parameter<const NotificationParameters & >(parameters));
stubMethodEntered("updateActions", params);
}
@@ -108,22 +108,26 @@
// 4. CREATE A PROXY WHICH CALLS THE STUB
+const char *WidgetNotificationSink::NOTIFICATION_ID_PROPERTY = "notificationId";
+const char *WidgetNotificationSink::GROUP_ID_PROPERTY = "groupId";
+const char *WidgetNotificationSink::USER_REMOVABLE_PROPERTY = "userRemovable";
+
QString WidgetNotificationSink::determineIconId(const NotificationParameters ¶meters)
{
return gWidgetNotificationSinkStub->determineIconId(parameters);
}
-MInfoBanner *WidgetNotificationSink::createInfoBanner(const Notification ¬ification)
+MBanner *WidgetNotificationSink::createInfoBanner(const Notification ¬ification)
{
return gWidgetNotificationSinkStub->createInfoBanner(notification);
}
-MInfoBanner *WidgetNotificationSink::createInfoBanner(MInfoBanner::BannerType type, uint groupId, const NotificationParameters ¶meters)
+MBanner *WidgetNotificationSink::createInfoBanner(Notification::NotificationType type, uint groupId, const NotificationParameters ¶meters)
{
return gWidgetNotificationSinkStub->createInfoBanner(type, groupId, parameters);
}
-void WidgetNotificationSink::updateActions(MInfoBanner *infoBanner, const NotificationParameters ¶meters)
+void WidgetNotificationSink::updateActions(MBanner *infoBanner, const NotificationParameters ¶meters)
{
gWidgetNotificationSinkStub->updateActions(infoBanner, parameters);
}
--- tests/tests.pro
+++ tests/tests.pro
@@ -12,7 +12,7 @@
# Sometimes if is faster like this, when you are working on a single unit
# test for a while.
#
- #SUBDIRS = ut_unlocknotifications
+ #SUBDIRS = ut_volumecontrolui
SUBDIRS = $$system(./unit_tests.sh)
} else {
SUBDIRS = $$system(ls -1d ut_*/*.pro ft_*/*.pro 2>/dev/null | sed 's!/.*!!')
--- tests/ut_batterybusinesslogic/ut_batterybusinesslogic.cpp
+++ tests/ut_batterybusinesslogic/ut_batterybusinesslogic.cpp
@@ -25,10 +25,33 @@
#endif
#include <MNotification>
+#include <MFeedback>
#define DEBUG
#include "debug.h"
+/******************************************************************************
+ * The stub for MFeedback class.
+ */
+static QString nameOfLastFeedback;
+
+MFeedback::MFeedback (
+ const QString &name,
+ QObject *parent) :
+ d_ptr (0)
+{
+ Q_UNUSED (parent);
+
+ SYS_DEBUG ("*** name = %s", SYS_STR(name));
+ nameOfLastFeedback = name;
+}
+
+void
+MFeedback::play () const
+{
+ SYS_DEBUG ("Playing...");
+}
+
/*
* TODO:
* - test the feedback playing also
@@ -84,7 +107,7 @@
Ut_BatteryBusinessLogic::testInitBattery ()
{
#ifdef HAVE_QMSYSTEM
- QSignalSpy spy (m_logic, SIGNAL (notificationSent (QString, QString)));
+ QSignalSpy spy (m_logic, SIGNAL (notificationSent (QString, QString, QString)));
/* Set some ret. values for stubs */
gQmBatteryStub->stubSetReturnValue<Maemo::QmBattery::ChargingState> (
@@ -109,7 +132,7 @@
Ut_BatteryBusinessLogic::testLowBatteryAlert ()
{
#ifdef HAVE_QMSYSTEM
- QSignalSpy spy (m_logic, SIGNAL (notificationSent (QString, QString)));
+ QSignalSpy spy (m_logic, SIGNAL (notificationSent (QString, QString, QString)));
m_logic->lowBatteryAlert ();
@@ -119,8 +142,9 @@
QList<QVariant> arguments = spy.takeFirst ();
- QVERIFY (arguments.at (0).toString () == qtTrId ("qtn_ener_lowbatt"));
- QVERIFY (arguments.at (1).toString () == "icon-m-energy-management-low-battery");
+ QVERIFY (arguments.at (0).toString () == "x-nokia.battery.lowbattery");
+ QVERIFY (arguments.at (1).toString () == qtTrId ("qtn_ener_lowbatt"));
+ QVERIFY (arguments.at (2).toString () == "");
#endif
}
@@ -129,7 +153,7 @@
{
#ifdef HAVE_QMSYSTEM
QList<QVariant> arguments;
- QSignalSpy spy (m_logic, SIGNAL (notificationSent (QString, QString)));
+ QSignalSpy spy (m_logic, SIGNAL (notificationSent (QString, QString, QString)));
gQmBatteryStub->stubReset ();
gQmLEDStub->stubReset ();
@@ -142,8 +166,9 @@
QCOMPARE (spy.count (), 1);
arguments = spy.takeFirst ();
- QVERIFY (arguments.at (0).toString () == qtTrId ("qtn_ener_charcomp"));
- QVERIFY (arguments.at (1).toString () == "icon-m-energy-management-remove-charger");
+ QVERIFY (arguments.at (0).toString () == "x-nokia.battery.chargingcomplete");
+ QVERIFY (arguments.at (1).toString () == qtTrId ("qtn_ener_charcomp"));
+ QVERIFY (arguments.at (2).toString () == "");
QVERIFY (gQmLEDStub->stubLastCallTo ("activate").parameter<QString>(0)
== QString ("PatternBatteryFull"));
@@ -162,8 +187,9 @@
QTest::qWait (10);
QCOMPARE (spy.count (), 1);
arguments = spy.takeFirst ();
- QVERIFY (arguments.at (0).toString () == qtTrId ("qtn_ener_rebatt"));
- QVERIFY (arguments.at (1).toString () == "icon-m-energy-management-recharge");
+ QVERIFY (arguments.at (0).toString () == "x-nokia.battery.recharge");
+ QVERIFY (arguments.at (1).toString () == qtTrId ("qtn_ener_rebatt"));
+ QVERIFY (arguments.at (2).toString () == "");
/* StateError */
spy.clear ();
@@ -193,8 +219,9 @@
QCOMPARE (spy.count (), 1);
arguments = spy.takeFirst ();
- QVERIFY (arguments.at (0).toString () == qtTrId ("qtn_ener_lowbatt"));
- QVERIFY (arguments.at (1).toString () == "icon-m-energy-management-low-battery");
+ QVERIFY (arguments.at (0).toString () == "x-nokia.battery.lowbattery");
+ QVERIFY (arguments.at (1).toString () == qtTrId ("qtn_ener_lowbatt"));
+ QVERIFY (arguments.at (2).toString () == "");
#endif
}
@@ -203,11 +230,14 @@
{
#ifdef HAVE_QMSYSTEM
QList<QVariant> arguments;
- QSignalSpy spy (m_logic, SIGNAL (notificationSent (QString, QString)));
+ QSignalSpy spy (m_logic, SIGNAL (notificationSent (QString, QString, QString)));
gQmBatteryStub->stubReset ();
gQmLEDStub->stubReset ();
+ gQmBatteryStub->stubSetReturnValue (
+ "getChargerType", Maemo::QmBattery::Wall);
+
for (int i = 0; i <= 100; i += 5)
{
/* StateCharging */
@@ -217,8 +247,9 @@
QTest::qWait (1);
QCOMPARE (spy.count (), 1);
arguments = spy.takeFirst ();
- QVERIFY (arguments.at (0).toString () == qtTrId ("qtn_ener_charging"));
- QVERIFY (arguments.at (1).toString () == m_logic->chargingImageId ());
+ QVERIFY (arguments.at (0).toString () == "x-nokia.battery");
+ QVERIFY (arguments.at (1).toString () == qtTrId ("qtn_ener_charging"));
+ QVERIFY (arguments.at (2).toString () == m_logic->chargingImageId ());
QVERIFY (gQmLEDStub->stubLastCallTo ("activate").parameter<QString>(0)
== QString ("PatternBatteryCharging"));
spy.clear ();
@@ -239,8 +270,23 @@
QTest::qWait (10);
QCOMPARE (spy.count (), 1);
arguments = spy.takeFirst ();
- QVERIFY (arguments.at (0).toString () == qtTrId ("qtn_ener_repcharger"));
- QVERIFY (arguments.at (1).toString () == "icon-m-energy-management-replace-charger");
+ QVERIFY (arguments.at (0).toString () == "x-nokia.battery.chargingnotstarted");
+ QVERIFY (arguments.at (1).toString () == qtTrId ("qtn_ener_repcharger"));
+ QVERIFY (arguments.at (2).toString () == "");
+ spy.clear ();
+
+ /* Test "not enough power to charge" situation... */
+ gQmBatteryStub->stubSetReturnValue (
+ "getChargerType", Maemo::QmBattery::USB_100mA);
+ m_logic->chargingStateChanged (Maemo::QmBattery::StateCharging);
+
+ QTest::qWait (10);
+ QCOMPARE (spy.count (), 1);
+ arguments = spy.takeFirst ();
+ QVERIFY (arguments.at (0).toString () == "x-nokia.battery.notenoughpower");
+ QVERIFY (arguments.at (1).toString () == qtTrId ("qtn_ener_nopowcharge"));
+ QVERIFY (arguments.at (2).toString () == "icon-m-energy-management-insufficient-power");
+ spy.clear ();
#endif
}
@@ -249,7 +295,7 @@
{
#ifdef HAVE_QMSYSTEM
QList<QVariant> arguments;
- QSignalSpy spy (m_logic, SIGNAL (notificationSent (QString, QString)));
+ QSignalSpy spy (m_logic, SIGNAL (notificationSent (QString, QString, QString)));
/* Wall charger */
m_logic->batteryChargerEvent (Maemo::QmBattery::Wall);
@@ -263,7 +309,9 @@
QCOMPARE (spy.count (), 1);
arguments = spy.takeFirst ();
/* Look for the notification: "Disconnect the charger from..." */
- QVERIFY (arguments.at (0).toString () == qtTrId ("qtn_ener_remcha"));
+ QVERIFY (arguments.at (0).toString () == "x-nokia.battery.removecharger");
+ QVERIFY (arguments.at (1).toString () == qtTrId ("qtn_ener_remcha"));
+ QVERIFY (arguments.at (2).toString () == "");
spy.clear ();
/* USB 500mA */
@@ -285,7 +333,7 @@
{
#ifdef HAVE_QMSYSTEM
QList<QVariant> arguments;
- QSignalSpy spy (m_logic, SIGNAL (notificationSent (QString, QString)));
+ QSignalSpy spy (m_logic, SIGNAL (notificationSent (QString, QString, QString)));
/* Entering to power-save mode */
m_logic->devicePSMStateChanged (Maemo::QmDeviceMode::PSMStateOn);
@@ -293,7 +341,9 @@
QTest::qWait (10);
QCOMPARE (spy.count (), 1);
arguments = spy.takeFirst ();
- QVERIFY (arguments.at (0).toString () == qtTrId ("qtn_ener_ent_psnote"));
+ QVERIFY (arguments.at (0).toString () == "x-nokia.battery.enterpsm");
+ QVERIFY (arguments.at (1).toString () == qtTrId ("qtn_ener_ent_psnote"));
+ QVERIFY (arguments.at (2).toString () == "");
spy.clear ();
@@ -303,7 +353,9 @@
QTest::qWait (10);
QCOMPARE (spy.count (), 1);
arguments = spy.takeFirst ();
- QVERIFY (arguments.at (0).toString () == qtTrId ("qtn_ener_exit_psnote"));
+ QVERIFY (arguments.at (0).toString () == "x-nokia.battery.exitpsm");
+ QVERIFY (arguments.at (1).toString () == qtTrId ("qtn_ener_exit_psnote"));
+ QVERIFY (arguments.at (2).toString () == "");
#endif
}
@@ -312,7 +364,10 @@
{
#ifdef HAVE_QMSYSTEM
QList<QVariant> arguments;
- QSignalSpy spy (m_logic, SIGNAL (notificationSent (QString, QString)));
+ QSignalSpy spy (m_logic, SIGNAL (notificationSent (QString, QString, QString)));
+
+ gQmBatteryStub->stubSetReturnValue (
+ "getChargerType", Maemo::QmBattery::USB_500mA);
/* LowBatteryNotifier shouldn't be instantiated at first */
QVERIFY (m_logic->m_LowBatteryNotifier == 0);
@@ -329,8 +384,9 @@
/* And should send a low-battery notification */
QCOMPARE (spy.count (), 1);
arguments = spy.takeFirst ();
- QVERIFY (arguments.at (0).toString () == qtTrId ("qtn_ener_lowbatt"));
- QVERIFY (arguments.at (1).toString () == "icon-m-energy-management-low-battery");
+ QVERIFY (arguments.at (0).toString () == "x-nokia.battery.lowbattery");
+ QVERIFY (arguments.at (1).toString () == qtTrId ("qtn_ener_lowbatt"));
+ QVERIFY (arguments.at (2).toString () == "");
/* Simulate now a charging event */
m_logic->chargingStateChanged (Maemo::QmBattery::StateCharging);
--- tests/ut_lockscreenbusinesslogic/ut_lockscreenbusinesslogic.cpp
+++ tests/ut_lockscreenbusinesslogic/ut_lockscreenbusinesslogic.cpp
@@ -82,13 +82,18 @@
#ifdef HAVE_QMSYSTEM
// First try with display off
qmDisplayState = Maemo::QmDisplayState::Off;
+ logic.locksChanged (Maemo::QmLocks::TouchAndKeyboard, Maemo::QmLocks::Locked);
#endif
// When the lock is toggled on, make sure the screen locking signals are sent and the lock UI is shown
logic.toggleScreenLockUI(true);
QTest::qWait (10);
+#ifdef HAVE_QMSYSTEM
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.at(0).at(0).toBool(), true);
+#else
+ spy.clear ();
+#endif
QCOMPARE(logic.lockUI->isVisible(), true);
// Check whether the lock-screen-ui state has be reset to defaults
@@ -110,11 +115,8 @@
QCOMPARE(gLockScreenUIStub->stubCallCount("updateDateTime"), 1);
// When the lock is toggled off, make sure the screen locking signals are sent and the lock UI is hidden
- spy.clear();
logic.toggleScreenLockUI(false);
QTest::qWait (10);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.at(0).at(0).toBool(), false);
QCOMPARE(logic.lockUI->isVisible(), false);
QCOMPARE (logic.timer.isActive (), false);
}
@@ -122,22 +124,16 @@
void Ut_LockScreenBusinessLogic::testToggleEventEater()
{
LockScreenBusinessLogic logic;
- QSignalSpy spy(&logic, SIGNAL(screenIsLocked(bool)));
// Make sure the screen locking signals are sent and the eater UI is shown/hidden
logic.toggleEventEater(true);
QTest::qWait (10);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.at(0).at(0).toBool(), true);
QCOMPARE(logic.eaterUI->isVisible(), true);
// XXX: Stub not really allows us to test this:
// QCOMPARE(logic.eaterUI->isFullScreen(), true);
- spy.clear();
logic.toggleEventEater(false);
QTest::qWait (10);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.at(0).at(0).toBool(), false);
QCOMPARE(logic.eaterUI->isVisible(), false);
}
@@ -147,9 +143,14 @@
QSignalSpy spy(&logic, SIGNAL(screenIsLocked(bool)));
logic.unlockScreen();
+#ifdef HAVE_QMSYSTEM
+ logic.locksChanged (Maemo::QmLocks::TouchAndKeyboard, Maemo::QmLocks::Unlocked);
QTest::qWait (10);
QCOMPARE(spy.count(), 1);
QCOMPARE(spy.at(0).at(0).toBool(), false);
+#else
+ spy.clear ();
+#endif
QCOMPARE(logic.lockUI->isVisible(), false);
QCOMPARE (logic.timer.isActive (), false);
}
@@ -157,12 +158,9 @@
void Ut_LockScreenBusinessLogic::testHideEventEater()
{
LockScreenBusinessLogic logic;
- QSignalSpy spy(&logic, SIGNAL(screenIsLocked(bool)));
logic.hideEventEater();
QTest::qWait (10);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.at(0).at(0).toBool(), false);
QCOMPARE(logic.eaterUI->isVisible(), false);
}
@@ -171,13 +169,20 @@
{
LockScreenBusinessLogic logic;
logic.toggleScreenLockUI(true);
+
+ // When lock-screen-ui is shown reset should be called on it
+ QCOMPARE(gLockScreenUIStub->stubCallCount ("reset"), 1);
+
logic.displayStateChanged(Maemo::QmDisplayState::Off);
QCOMPARE (logic.timer.isActive (), false);
- logic.toggleEventEater(true);
logic.displayStateChanged(Maemo::QmDisplayState::On);
QCOMPARE (logic.timer.isActive (), true);
QCOMPARE (logic.timer.interval (), 1000);
+
+ // Also check whether the reset called on the
+ // lock-screen-ui (after display turn on)
+ QCOMPARE(gLockScreenUIStub->stubCallCount ("reset"), 2);
}
#endif
--- tests/ut_lockscreenbusinesslogicadaptor/ut_lockscreenbusinesslogicadaptor.cpp
+++ tests/ut_lockscreenbusinesslogicadaptor/ut_lockscreenbusinesslogicadaptor.cpp
@@ -50,6 +50,16 @@
const QVariant & arg7,
const QVariant & arg8)
{
+ Q_UNUSED (mode);
+ Q_UNUSED (arg1);
+ Q_UNUSED (arg2);
+ Q_UNUSED (arg3);
+ Q_UNUSED (arg4);
+ Q_UNUSED (arg5);
+ Q_UNUSED (arg6);
+ Q_UNUSED (arg7);
+ Q_UNUSED (arg8);
+
QDBusMessage message;
SYS_DEBUG (">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
SYS_DEBUG ("*** method = %s", SYS_STR(method));
--- tests/ut_lockscreenui/ut_lockscreenui.cpp
+++ tests/ut_lockscreenui/ut_lockscreenui.cpp
@@ -40,23 +40,39 @@
#define GCONF_BG_PORTRAIT \
"/desktop/meego/background/portrait/picture_filename"
-#define BG_FILENAME_PORTRAIT \
- "/usr/share/themes/base/meegotouch/duihome/images/HomeWallpaperPortrait.png"
-
-#define BG_FILENAME_LANDSCAPE \
- "/usr/share/themes/base/meegotouch/duihome/images/HomeWallpaperLandscape.png"
-
#define DEBUG
#include "../../src/debug.h"
-/*********************************************************************************
+/******************************************************************************
+ * The stub for MFeedback class.
+ */
+#include <MFeedback>
+
+static QString nameOfLastFeedback;
+
+void
+MFeedback::play () const
+{
+ /*
+ * Seems that the MWindow sends empty name feedbacks sometimes, we filter
+ * those out. I hope these will not cause problems in the future... but we
+ * can filter them by name too...
+ */
+ if (name().isEmpty())
+ return;
+
+ SYS_DEBUG ("*** name = %s", SYS_STR(name()));
+ nameOfLastFeedback = name();
+}
+
+/******************************************************************************
* Stub for the MGConfItem
*/
QVariant
MGConfItem::value () const
{
SYS_DEBUG ("*** key = %s", SYS_STR(key()));
- return QVariant(QString(""));
+ return QVariant(QString("/some/path/to/image.img"));
}
#if 0
@@ -69,7 +85,7 @@
}
#endif
-/*********************************************************************************
+/******************************************************************************
* Stub for the QPixmap
*/
bool failImageLoads = false;
@@ -87,15 +103,27 @@
if (failImageLoads)
return false;
- if (fileName == BG_FILENAME_PORTRAIT)
- *this = QPixmap (480, 864);
- else if (fileName == BG_FILENAME_LANDSCAPE)
- *this = QPixmap (864, 480);
+ *this = QPixmap (100, 100);
return true;
}
-/*********************************************************************************
+/******************************************************************************
+ * Stub for the QPainter
+ */
+QPixmap* qpainter_pixmap = 0;
+
+void
+QPainter::drawPixmap (const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
+{
+ SYS_DEBUG ("");
+ Q_UNUSED (targetRect);
+ Q_UNUSED (sourceRect);
+
+ qpainter_pixmap = (QPixmap *) &pixmap;
+}
+
+/******************************************************************************
* The helper class to watch the signals.
*/
LockScreenUIEventSink::LockScreenUIEventSink() :
@@ -116,7 +144,7 @@
m_UnlockedCame = true;
}
-/*********************************************************************************
+/******************************************************************************
* The Ut_LockScreenUI implements the unit tests.
*/
void Ut_LockScreenUI::init()
@@ -209,19 +237,19 @@
* QPixmap::load() method is stubbed and so is the MGConfItem, so we can do
* this.
*/
- #ifdef LOT_DEBUG
+// #ifdef LOT_DEBUG
SYS_DEBUG ("*** m_bgLandscape size = %dx%d",
window->m_bgLandscape.width(),
window->m_bgLandscape.height());
SYS_DEBUG ("*** m_bgPortrait size = %dx%d",
window->m_bgPortrait.width(),
window->m_bgPortrait.height());
- #endif
- QVERIFY (window->m_bgLandscape.width() == 864);
- QVERIFY (window->m_bgLandscape.height() == 480);
+// #endif
+ QCOMPARE (window->m_bgLandscape.width(), 100);
+ QCOMPARE (window->m_bgLandscape.height(), 100);
- QVERIFY (window->m_bgPortrait.width() == 480);
- QVERIFY (window->m_bgPortrait.height() == 864);
+ QCOMPARE (window->m_bgPortrait.width(), 100);
+ QCOMPARE (window->m_bgPortrait.height(), 100);
/*
* Creating some mouse events that will be sent to the window.
@@ -229,9 +257,12 @@
QGraphicsSceneMouseEvent *pressEvent;
QGraphicsSceneMouseEvent *moveEvent;
QGraphicsSceneMouseEvent *releaseEvent;
- QPointF pressAt (850, 400);
+ QGraphicsSceneMouseEvent *moveEventNotActive;
+ QPointF pressAt (window->m_LockLiftArea->preferredWidth (),
+ window->m_LockLiftArea->pos ().y ());
+ QPointF moveToNotActive (400, 10);
QPointF moveTo (400, 240);
-
+
/*
* Now we send three mouse events that ultimately will send the unlocked()
* signal from the window.
@@ -242,6 +273,55 @@
moveEvent = new QGraphicsSceneMouseEvent (QEvent::GraphicsSceneMouseMove);
moveEvent->setPos (moveTo);
+ moveEventNotActive = new QGraphicsSceneMouseEvent (QEvent::GraphicsSceneMouseMove);
+ moveEvent->setPos (moveToNotActive);
+
+ releaseEvent = new QGraphicsSceneMouseEvent (
+ QEvent::GraphicsSceneMouseRelease);
+
+ // Sending a press event the place where it should activate the draggable
+ // icon.
+ window->mousePressEvent (pressEvent);
+ QCOMPARE (window->m_DnDstate, (int) LockScreenWindow::STATE_MOVING);
+ QVERIFY (nameOfLastFeedback == "start-dragndrop");
+
+ //
+ // Then we move the mouse right into the middle of the screen
+ window->mouseMoveEvent (moveEvent);
+ QCOMPARE (window->m_DnDstate, (int) LockScreenWindow::STATE_MOVING_ACTIVE);
+ QVERIFY (nameOfLastFeedback == "enter-dragndrop-dropzone");
+
+ // Move back to some non-active place
+ window->mouseMoveEvent (moveEventNotActive);
+ QCOMPARE (window->m_DnDstate, (int) LockScreenWindow::STATE_MOVING);
+ QVERIFY (nameOfLastFeedback == "exit-dragndrop-dropzone");
+
+ // ... again move to active area:
+ window->mouseMoveEvent (moveEvent);
+ QCOMPARE (window->m_DnDstate, (int) LockScreenWindow::STATE_MOVING_ACTIVE);
+ QVERIFY (nameOfLastFeedback == "enter-dragndrop-dropzone");
+
+ //
+ // And then the mouse is released. And this concludes the interaction, the
+ // unlocked() signal should be sent.
+ //
+ window->mouseReleaseEvent (releaseEvent);
+ QVERIFY (m_EventSink.m_UnlockedCame);
+ QVERIFY (nameOfLastFeedback == "release-inside-dragndrop-dropzone");
+
+ /*
+ * Test also the RTL layout direction
+ */
+ lockLiftArea->setLayoutDirection (Qt::RightToLeft);
+
+ pressAt = QPointF (30., 30.);
+
+ pressEvent = new QGraphicsSceneMouseEvent (QEvent::GraphicsSceneMousePress);
+ pressEvent->setPos (pressAt);
+
+ moveEvent = new QGraphicsSceneMouseEvent (QEvent::GraphicsSceneMouseMove);
+ moveEvent->setPos (moveTo);
+
releaseEvent = new QGraphicsSceneMouseEvent (
QEvent::GraphicsSceneMouseRelease);
@@ -249,19 +329,53 @@
// icon.
window->mousePressEvent (pressEvent);
QVERIFY (window->m_DnDstate == LockScreenWindow::STATE_MOVING);
+ QVERIFY (nameOfLastFeedback == "start-dragndrop");
//
// Then we move the mouse right into th emiddle of the screen
window->mouseMoveEvent (moveEvent);
+ QVERIFY (nameOfLastFeedback == "enter-dragndrop-dropzone");
//
// And then the mouse is released. And this concludes the interaction, the
// unlocked() signal should be sent.
//
window->mouseReleaseEvent (releaseEvent);
+ QVERIFY (nameOfLastFeedback == "release-inside-dragndrop-dropzone");
QVERIFY (m_EventSink.m_UnlockedCame);
+ // Set the layout dir. back to LTR
+ lockLiftArea->setLayoutDirection (Qt::LeftToRight);
+
+
+#if 0
+ // FIXME: It seems geometry cannot be changes by some reason
+
+ // Check the packground painter:
+ QPainter painter;
+ window->m_bgLandscape = QPixmap (200, 100);
+ window->m_bgPortrait = QPixmap (100, 200);
+
+ // Landscape:
+ window->setGeometry (QRectF (0, 0, 200, 100));
+
+ window->paint (&painter, 0, 0);
+ QVERIFY (qpainter_pixmap != 0);
+ QCOMPARE (qpainter_pixmap->size ().width (), 200);
+
+ SYS_DEBUG ("size: %2f, %2f", window->geometry ().width (), window->geometry ().height ());
+
+ // Portrait:
+ window->setGeometry (QRectF (0, 0, 100, 200));
+
+ window->paint (&painter, 0, 0);
+ QVERIFY (qpainter_pixmap != 0);
+ QCOMPARE (qpainter_pixmap->size ().width (), 100);
+
+ SYS_DEBUG ("size: %2f, %2f", window->geometry ().width (), window->geometry ().height ());
+#endif
+
delete window;
delete parentWindow;
delete lockLiftArea;
@@ -302,6 +416,19 @@
QVERIFY (m_LockScreenUI->m_LockLandArea != NULL);
QVERIFY (m_LockScreenUI->m_SceneWindow != NULL);
+ /*
+ * Check whether the reset-state of DnD works properly
+ */
+ // Set the DnDstate to icon-moving state...
+ m_LockScreenUI->m_SceneWindow->m_DnDstate =
+ LockScreenWindow::STATE_MOVING;
+
+ // Call reset function
+ m_LockScreenUI->reset ();
+
+ QVERIFY (m_LockScreenUI->m_SceneWindow->m_DnDstate ==
+ LockScreenWindow::STATE_NONE);
+
// FIXME: I will enhance this part...
//m_LockScreenUI->showEvent (NULL);
//considerLockScreenUIVisible = true;
@@ -398,8 +525,6 @@
void
Ut_LockScreenUI::testEventEaterUIWindowName ()
{
- bool connectSuccess;
-
/*
* We need a new event eater widget.
*/
--- tests/ut_lowbatterynotifier/ut_lowbatterynotifier.cpp
+++ tests/ut_lowbatterynotifier/ut_lowbatterynotifier.cpp
@@ -24,6 +24,10 @@
#include <QTime>
#include <QDebug>
+#include <MFeedback>
+
+#define DEBUG
+#include "../../src/debug.h"
namespace
{
@@ -35,6 +39,19 @@
const int aDelay = 1000;
}
+/******************************************************************************
+ * The stub for MFeedback class.
+ */
+static QString nameOfLastFeedback;
+
+void
+MFeedback::play () const
+{
+ SYS_DEBUG ("*** name = %s", SYS_STR(name()));
+ nameOfLastFeedback = name();
+}
+
+
void
LowBatteryHelper::start ()
{
--- tests/ut_mcompositornotificationsink/ut_mcompositornotificationsink.cpp
+++ tests/ut_mcompositornotificationsink/ut_mcompositornotificationsink.cpp
@@ -21,7 +21,7 @@
#include <QtTest/QtTest>
#include <MRemoteAction>
-#include <MInfoBanner>
+#include <MBanner>
#include <MApplication>
#include <MScene>
#include <MSceneManager>
@@ -37,6 +37,9 @@
#include "genericnotificationparameterfactory.h"
#include <QSettings>
#include <MOnDisplayChangeEvent>
+#include <MGConfItem>
+
+static const QString NOTIFICATION_PREVIEW_ENABLED = "/desktop/meego/notifications/previews_enabled";
// Mock notification manager (used by MCompositorNotificationSink)
MockNotificationManager::MockNotificationManager() :
@@ -47,7 +50,12 @@
uint MockNotificationManager::addNotification(uint, const NotificationParameters ¶meters, uint groupId, int timeout)
{
uint notificationId = nextAvailableNotificationID++;
- Notification notification = Notification(notificationId, groupId, 0, parameters, Notification::ApplicationEvent, timeout);
+ Notification notification;
+ if (parameters.value("class") == QString("system")) {
+ notification = Notification(notificationId, groupId, 0, parameters, Notification::SystemEvent, timeout);
+ } else {
+ notification = Notification(notificationId, groupId, 0, parameters, Notification::ApplicationEvent, timeout);
+ }
notifications.append(notification);
emit notificationUpdated(notification);
return notificationId;
@@ -126,40 +134,94 @@
return QList<NotificationGroup>();
}
+bool windowEventFilterCalled = false;
+bool windowEventFilterBlock = false;
+bool WindowEventFilter::eventFilter(QObject *obj, QEvent *event)
+{
+ MOnDisplayChangeEvent *displayChangeEvent = dynamic_cast<MOnDisplayChangeEvent *>(event);
+ if (displayChangeEvent != NULL) {
+ windowEventFilterCalled = true;
+ if (windowEventFilterBlock) {
+ return true;
+ }
+ }
+ return QObject::eventFilter(obj, event);
+}
+
+// MWindow stubs (used by MCompositorNotificationSink)
+bool mWindowSetVisibleValue = false;
+QWidget* mWindowSetVisibleWidget = NULL;
+void MWindow::setVisible(bool visible)
+{
+ mWindowSetVisibleValue = visible;
+ mWindowSetVisibleWidget = this;
+
+ setAttribute(visible ? Qt::WA_WState_Visible : Qt::WA_WState_Hidden);
+}
// QWidget stubs (used by MCompositorNotificationSink)
-bool Ut_WindowShown = false;
-QWidget* notificationWindow = NULL;
-void QWidget::setVisible(bool visible)
+QRegion mWindowMaskRegion;
+void QWidget::setMask(const QRegion ®ion)
{
- Ut_WindowShown = visible;
- notificationWindow = this;
+ MWindow *window = dynamic_cast<MWindow *>(this);
+ if (window != NULL) {
+ mWindowMaskRegion = region;
+ }
}
-MSceneWindow *infoBanner = NULL;
-bool Ut_DestroyWhenDonePolicy = false;
+// MGConfItem stub
+QVariant gconfValue = QVariant();
+
+QVariant MGConfItem::value() const {
+
+ if (key() == "/meegotouch/target/name")
+ return QVariant ("Default");
+
+ return gconfValue;
+}
+
+QVariant MGConfItem::value(const QVariant &def) const {
+ if (gconfValue.isValid())
+ return gconfValue;
+ else
+ return def;
+}
+
+void MGConfItem::set(const QVariant &val) {
+ gconfValue = val;
+}
+
+void MGConfItem::unset() {
+ gconfValue = QVariant();
+}
+
+MSceneWindow *mSceneManagerAppearSceneWindowWindow = NULL;
+bool mSceneManagerAppearSceneWindowPolicy = false;
void MSceneManager::appearSceneWindow(MSceneWindow *sceneWindow, MSceneWindow::DeletionPolicy policy)
{
- infoBanner = sceneWindow;
+ mSceneManagerAppearSceneWindowWindow = sceneWindow;
if(policy == MSceneWindow::DestroyWhenDone) {
- Ut_DestroyWhenDonePolicy = true;
+ mSceneManagerAppearSceneWindowPolicy = true;
}
}
-bool Ut_DisappearSceneWindow= false;
-MSceneWindow *disappearingWindow= NULL;
+MSceneWindow *mSceneManagerDisappearSceneWindowWindow= NULL;
void MSceneManager::disappearSceneWindow(MSceneWindow *sceneWindow)
{
- Ut_DisappearSceneWindow= true;
- disappearingWindow = sceneWindow;
+ mSceneManagerDisappearSceneWindowWindow = sceneWindow;
+}
+
+M::OrientationAngle gCurrentOrientationAngle;
+M::OrientationAngle MSceneManager::orientationAngle() const
+{
+ return gCurrentOrientationAngle;
}
// QTimer stubs (used by MCompositorNotificationSink)
-bool Ut_TimerStarted = false;
-void QTimer::start(int msec)
+bool qTimerStarted = false;
+void QTimer::start(int)
{
- Ut_TimerStarted = true;
- Q_UNUSED(msec);
+ qTimerStarted = true;
}
// MSceneWindow stubs (used by MCompositorNotificationSink)
@@ -183,17 +245,21 @@
void Ut_MCompositorNotificationSink::init()
{
+ gconfValue = QVariant();
notificationManager = new MockNotificationManager();
sink = new MCompositorNotificationSink();
connect(notificationManager, SIGNAL(notificationRemoved(uint)), sink, SLOT(removeNotification(uint)));
connect(notificationManager, SIGNAL(notificationUpdated(Notification)), sink, SLOT(addNotification(Notification)));
- Ut_WindowShown = false;
- notificationWindow = NULL;
- infoBanner = NULL;
- Ut_DestroyWhenDonePolicy = false;
- Ut_TimerStarted = false;
- Ut_DisappearSceneWindow = false;
- disappearingWindow = NULL;
+ gCurrentOrientationAngle = M::Angle0;
+ mWindowSetVisibleValue = false;
+ mWindowSetVisibleWidget = NULL;
+ mSceneManagerAppearSceneWindowWindow = NULL;
+ mSceneManagerAppearSceneWindowPolicy = false;
+ qTimerStarted = false;
+ mSceneManagerDisappearSceneWindowWindow = NULL;
+ windowEventFilterCalled = false;
+ windowEventFilterBlock = false;
+ mWindowMaskRegion = QRegion();
}
void Ut_MCompositorNotificationSink::cleanup()
@@ -202,31 +268,105 @@
delete notificationManager;
}
-void Ut_MCompositorNotificationSink::testAddNotification()
+void Ut_MCompositorNotificationSink::sendOnDisplayChangeEvent()
+{
+ // The rectangle does not make a difference - it just needs to be non-empty.
+ MOnDisplayChangeEvent* event = new MOnDisplayChangeEvent(true, QRectF(0, 0, 1, 1));
+ QApplication::sendEvent(sink->window, event);
+}
+
+NotificationParameters Ut_MCompositorNotificationSink::setupSinkDisabledTests(bool isSystemEvent)
+{
+ connect(this, SIGNAL(statusIndictorMenuVisibilityChanged(bool)), sink, SLOT(setDisabled(bool)));
+ emit statusIndictorMenuVisibilityChanged(true);
+ // Create notification
+ TestNotificationParameters parameters("title0", "subtitle0", "buttonicon0", "content0 0 0 0");
+ if (isSystemEvent) {
+ parameters.add(GenericNotificationParameterFactory::classKey(), "system");
+ }
+ notificationManager->addNotification(0, parameters);
+ return parameters;
+}
+
+void Ut_MCompositorNotificationSink::testNotificationWindowProperties()
+{
+ // Check that the window doesn't request focus
+ QCOMPARE(sink->window->testAttribute(Qt::WA_X11DoNotAcceptFocus), true);
+}
+
+void Ut_MCompositorNotificationSink::testAddNotificationWhenWindowNotOpen()
{
QSignalSpy spy(sink, SIGNAL(notificationAdded(const Notification&)));
+ // Install an event filter for the window and block MOnDisplayChangeEvents but catch them
+ QSharedPointer<WindowEventFilter> windowEventFilter(new WindowEventFilter);
+ sink->window->installEventFilter(windowEventFilter.data());
+ windowEventFilterBlock = true;
+
// Create a notification
- TestNotificationParameters parameters0("icon0", "summary0", "body0", "buttonicon0", "content0 0 0 0");
+ TestNotificationParameters parameters0("title0", "subtitle0", "buttonicon0", "content0 0 0 0");
notificationManager->addNotification(0, parameters0, 0);
- // Check that a MWindow was created and shown(window->show() called)
- QCOMPARE(Ut_WindowShown, true);
+ // Check that a MWindow was shown(window->show() called)
+ QCOMPARE(mWindowSetVisibleWidget, sink->window);
+ QCOMPARE(mWindowSetVisibleValue, true);
+
+ // Check that the MBanner was not yet shown but an MOnDisplayChangeEvent was sent
+ QCOMPARE(windowEventFilterCalled, true);
+ QCOMPARE(mSceneManagerAppearSceneWindowWindow, (MSceneWindow *)NULL);
+
+ // Unblock MOnDisplayChangeEvents and check that sending one will create the banner
+ windowEventFilterBlock = false;
+ sendOnDisplayChangeEvent();
+
+ // Check that a MBanner was created with the given parameters
+ QCOMPARE(mSceneManagerAppearSceneWindowPolicy, true);
+ MBanner *banner = static_cast<MBanner*>(mSceneManagerAppearSceneWindowWindow);
+ QCOMPARE(banner->iconID(), QString("buttonicon0"));
+ QCOMPARE(banner->title(), QString("title0"));
+ QCOMPARE(banner->subtitle(), QString("subtitle0"));
- MOnDisplayChangeEvent* event = new MOnDisplayChangeEvent(true, QRectF(0,0,1,1));
- QApplication::sendEvent(notificationWindow,event);
+ // check that the timeout timer was started
+ QCOMPARE(qTimerStarted, true);
- // Check that a MInfoBanner was created with the given parameters
- QCOMPARE(Ut_DestroyWhenDonePolicy, true);
+ // check that the transfer notification signal was emitted
+ QCOMPARE(spy.count(), 1);
+}
- MInfoBanner *banner = static_cast<MInfoBanner*>(infoBanner);
- QCOMPARE(banner->bannerType(), MInfoBanner::Event);
- QCOMPARE(banner->iconID(), QString("buttonicon0"));
- QCOMPARE(banner->bodyText(), QString("<p><b>summary0</b></p><p>body0</p>"));
- QCOMPARE(banner->imageID(), QString("icon0"));
+void Ut_MCompositorNotificationSink::testAddNotificationWhenWindowAlreadyOpen()
+{
+ // Create a notification: this will create a window
+ TestNotificationParameters parameters0("title0", "subtitle0", "buttonicon0", "content0 0 0 0");
+ notificationManager->addNotification(0, parameters0, 0);
+
+ // Create a banner for the first notification
+ sendOnDisplayChangeEvent();
+
+ // Reset stubs to see what happens next
+ mWindowSetVisibleWidget = NULL;
+ mWindowSetVisibleValue = false;
+ qTimerStarted = false;
+ mSceneManagerAppearSceneWindowWindow = NULL;
+ mSceneManagerAppearSceneWindowPolicy = false;
+ QSignalSpy spy(sink, SIGNAL(notificationAdded(const Notification&)));
+
+ // Create another notification
+ TestNotificationParameters parameters1("title1", "subtitle1", "buttonicon1", "content1 0 0 0");
+ notificationManager->addNotification(1, parameters1, 0);
+
+ // Check that the MWindow was not unnecessarily shown again
+ QCOMPARE(mWindowSetVisibleWidget, (QWidget *)NULL);
+ QCOMPARE(mWindowSetVisibleValue, false);
+
+ // Check that a MBanner was created with the given parameters
+ QCOMPARE(mSceneManagerAppearSceneWindowPolicy, true);
+ MBanner *banner = static_cast<MBanner*>(mSceneManagerAppearSceneWindowWindow);
+ QCOMPARE(banner->iconID(), QString("buttonicon1"));
+ QCOMPARE(banner->title(), QString("title1"));
+ QCOMPARE(banner->subtitle(), QString("subtitle1"));
// check that the timeout timer was started
- QCOMPARE(Ut_TimerStarted, true);
+ QCOMPARE(qTimerStarted, true);
// check that the transfer notification signal was emitted
QCOMPARE(spy.count(), 1);
@@ -235,102 +375,175 @@
void Ut_MCompositorNotificationSink::testUpdateNotification()
{
// Create two notifications
- TestNotificationParameters parameters0("icon0", "summary0", "body0", "buttonicon0", "content0 0 0 0");
+ TestNotificationParameters parameters0("title0", "subtitle0", "buttonicon0", "content0 0 0 0");
notificationManager->addNotification(0, parameters0);
- MOnDisplayChangeEvent* event = new MOnDisplayChangeEvent(true, QRectF(0,0,1,1));
- QApplication::sendEvent(notificationWindow,event);
- MInfoBanner *banner1 = static_cast<MInfoBanner*>(infoBanner);
+ sendOnDisplayChangeEvent();
+ MBanner *banner1 = static_cast<MBanner*>(mSceneManagerAppearSceneWindowWindow);
- TestNotificationParameters parameters1("icon1", "summary1", "body1", "buttonicon1", "content1 1 1 1");
+ TestNotificationParameters parameters1( "title1", "subtitle1", "buttonicon1", "content1 1 1 1");
uint id = notificationManager->addNotification(0, parameters1);
// Window will not drop to displaychange event slot unless window is explicitly hidden
- notificationWindow->hide();
- QApplication::sendEvent(notificationWindow,event);
- MInfoBanner *banner2 = static_cast<MInfoBanner*>(infoBanner);
+ mWindowSetVisibleWidget->hide();
+ sendOnDisplayChangeEvent();
+ MBanner *banner2 = static_cast<MBanner*>(mSceneManagerAppearSceneWindowWindow);
// Update the second notification
- TestNotificationParameters parametersX("iconX", "summaryX", "bodyX", "buttoniconX", "contentX X X X");
+ TestNotificationParameters parametersX("titleX", "subtitleX", "buttoniconX", "contentX X X X");
notificationManager->updateNotification(0, id, parametersX);
- QCOMPARE(banner2->imageID(), QString("iconX"));
- QCOMPARE(banner2->bodyText(), QString("<p><b>summaryX</b></p><p>bodyX</p>"));
+ QCOMPARE(banner2->title(), QString("titleX"));
+ QCOMPARE(banner2->subtitle(), QString("subtitleX"));
QCOMPARE(banner2->iconID(), QString("buttoniconX"));
// Make sure the fist notification banner has still the same content
- QCOMPARE(banner1->imageID(), QString("icon0"));
- QCOMPARE(banner1->bodyText(), QString("<p><b>summary0</b></p><p>body0</p>"));
+ QCOMPARE(banner1->title(), QString("title0"));
+ QCOMPARE(banner1->subtitle(), QString("subtitle0"));
QCOMPARE(banner1->iconID(), QString("buttonicon0"));
}
void Ut_MCompositorNotificationSink::testRemoveNotification()
{
// Create three notifications
- TestNotificationParameters parameters0("icon0", "summary0", "body0", "buttonicon0", "content0 0 0 0");
+ TestNotificationParameters parameters0("title0", "subtitle0", "buttonicon0", "content0 0 0 0");
parameters0.add(GenericNotificationParameterFactory::classKey(), "system");
notificationManager->addNotification(0, parameters0, 0);
- MOnDisplayChangeEvent* event = new MOnDisplayChangeEvent(true, QRectF(0,0,1,1));
- QApplication::sendEvent(notificationWindow,event);
+ sendOnDisplayChangeEvent();
- TestNotificationParameters parameters1("icon1", "summary1", "body1", "buttonicon1", "content1 1 1 1");
+ TestNotificationParameters parameters1("title1", "subtitle1", "buttonicon1", "content1 1 1 1");
uint id = notificationManager->addNotification(0, parameters1);
// Window will not drop to displaychange event slot unless window is explicitly hidden
- notificationWindow->hide();
- QApplication::sendEvent(notificationWindow,event);
- MInfoBanner *banner = static_cast<MInfoBanner*>(infoBanner);
+ mWindowSetVisibleWidget->hide();
+ sendOnDisplayChangeEvent();
+ MBanner *banner = static_cast<MBanner*>(mSceneManagerAppearSceneWindowWindow);
- TestNotificationParameters parameters2("icon2", "summary2", "body2", "buttonicon2", "");
+ TestNotificationParameters parameters2("title2", "subtitle2", "buttonicon2", "");
notificationManager->addNotification(0, parameters2);
// Window will not drop to displaychange event slot unless window is explicitly hidden
- notificationWindow->hide();
- QApplication::sendEvent(notificationWindow,event);
+ mWindowSetVisibleWidget->hide();
+ sendOnDisplayChangeEvent();
// Remove the second one
notificationManager->removeNotification(0, id);
// Check that the window was removed
- QCOMPARE(banner, disappearingWindow);
+ QCOMPARE(banner, mSceneManagerDisappearSceneWindowWindow);
}
void Ut_MCompositorNotificationSink::testTimeout()
{
- TestNotificationParameters parameters0("icon0", "summary0", "body0", "buttonicon0", "content0 0 0 0");
+ TestNotificationParameters parameters0("title0", "subtitle0", "buttonicon0", "content0 0 0 0");
uint notificationId = notificationManager->addNotification(0, parameters0);
- MOnDisplayChangeEvent* event = new MOnDisplayChangeEvent(true, QRectF(0,0,1,1));
- QApplication::sendEvent(notificationWindow,event);
+ sendOnDisplayChangeEvent();
connect(this, SIGNAL(timeout()), sink, SLOT(timeout()));
setProperty("notificationId", notificationId);
emit(timeout());
+
// Check that the window disappeared
- QCOMPARE(infoBanner, disappearingWindow);
- QCOMPARE(Ut_DisappearSceneWindow, true);
+ QVERIFY(mSceneManagerDisappearSceneWindowWindow != NULL);
+ QCOMPARE(mSceneManagerAppearSceneWindowWindow, mSceneManagerDisappearSceneWindowWindow);
}
void Ut_MCompositorNotificationSink::testNotificationWhileApplicationEventsDisabled()
{
// Create notification
- TestNotificationParameters parameters("icon0", "summary0", "body0", "buttonicon0", "content0 0 0 0");
+ TestNotificationParameters parameters("title0", "subtitle0", "buttonicon0", "content0 0 0 0");
sink->setApplicationEventsEnabled(false);
notificationManager->addNotification(0, parameters);
- QCOMPARE(Ut_WindowShown, false);
+ QCOMPARE(mWindowSetVisibleValue, false);
sink->setApplicationEventsEnabled(true);
notificationManager->addNotification(0, parameters);
- QCOMPARE(Ut_WindowShown, true);
+ QCOMPARE(mWindowSetVisibleValue, true);
}
void Ut_MCompositorNotificationSink::testWhenSinkDisableTrueNoBannerCreated()
{
- connect(this, SIGNAL(statusIndictorMenuVisibilityChanged(bool)), sink, SLOT(setDisabled(bool)));
- emit statusIndictorMenuVisibilityChanged(true);
- // Create notification
- TestNotificationParameters parameters("icon0", "summary0", "body0", "buttonicon0", "content0 0 0 0");
- notificationManager->addNotification(0, parameters);
- QCOMPARE(Ut_WindowShown, false);
+ NotificationParameters parameters = setupSinkDisabledTests();
+ QCOMPARE(mWindowSetVisibleValue, false);
emit statusIndictorMenuVisibilityChanged(false);
notificationManager->addNotification(0, parameters);
- MOnDisplayChangeEvent* event = new MOnDisplayChangeEvent(true, QRectF(0,0,1,1));
- QApplication::sendEvent(notificationWindow,event);
- QCOMPARE(Ut_WindowShown, true);
+ sendOnDisplayChangeEvent();
+ QCOMPARE(mWindowSetVisibleValue, true);
+}
+
+void Ut_MCompositorNotificationSink::testWhenSinkIsSetToDisabledSystemNotificationsAreStillGenerated()
+{
+ setupSinkDisabledTests(true);
+ // Check that notification is shown
+ QCOMPARE(mWindowSetVisibleValue, true);
+}
+
+void Ut_MCompositorNotificationSink::testNotificationPreviewsDisabled_data()
+{
+ QTest::addColumn<QVariant>("value");
+ QTest::addColumn<bool>("windowshown");
+
+ QTest::newRow("key not set, notification shown") << QVariant() << true;
+ QTest::newRow("key has garbage value, notification shown") << QVariant(QString("Garbage")) << true;
+ QTest::newRow("key has has previews enabled, window shown") << QVariant(true) << true;
+ QTest::newRow("key has has previews disabled, window not shown") << QVariant(false) << false;
+}
+
+
+void Ut_MCompositorNotificationSink::testNotificationPreviewsDisabled()
+{
+ // Reset previews as not disabled
+ sink->allPreviewsDisabled = false;
+
+ // Check that window is following right gconf key
+ QVERIFY (sink->notificationPreviewMode->key() == NOTIFICATION_PREVIEW_ENABLED);
+
+ QFETCH(QVariant, value);
+ QFETCH(bool, windowshown);
+
+ // Set value from test data to gconf key
+ sink->notificationPreviewMode->set(value);
+ sink->changeNotificationPreviewMode();
+
+ // Create normal notification
+ TestNotificationParameters parameters("title0", "subtitle0", "buttonicon0", "content0 0 0 0");
+
+ // Check that notification is shown/not shown according to test data parameter
+ notificationManager->addNotification(0, parameters);
+ QCOMPARE(mWindowSetVisibleValue, windowshown);
+
+ // Create system notification
+ parameters.add(GenericNotificationParameterFactory::classKey(), "system");
+ notificationManager->addNotification(0, parameters);
+
+ // Check that notification is not shown
+ QCOMPARE(mWindowSetVisibleValue, windowshown);
+}
+
+void Ut_MCompositorNotificationSink::testWindowMasking_data()
+{
+ QTest::addColumn<M::OrientationAngle>("angle");
+ QTest::newRow("0") << M::Angle0;
+ QTest::newRow("90") << M::Angle90;
+ QTest::newRow("180") << M::Angle180;
+ QTest::newRow("270") << M::Angle270;
+}
+
+void Ut_MCompositorNotificationSink::testWindowMasking()
+{
+ QFETCH(M::OrientationAngle, angle);
+ gCurrentOrientationAngle = angle;
+
+ TestNotificationParameters parameters0("title0", "subtitle0", "buttonicon0", "content0 0 0 0");
+ notificationManager->addNotification(0, parameters0, 0);
+
+ sendOnDisplayChangeEvent();
+
+ QRect maskRect;
+ switch(angle) {
+ case M::Angle0: maskRect = QRect(0, 0, mSceneManagerAppearSceneWindowWindow->preferredWidth(), mSceneManagerAppearSceneWindowWindow->preferredHeight()); break;
+ case M::Angle90: maskRect = QRect(sink->window->width() - mSceneManagerAppearSceneWindowWindow->preferredHeight(), 0, mSceneManagerAppearSceneWindowWindow->preferredHeight(), mSceneManagerAppearSceneWindowWindow->preferredWidth()); break;
+ case M::Angle180: maskRect = QRect(0, sink->window->height() - mSceneManagerAppearSceneWindowWindow->preferredHeight(), mSceneManagerAppearSceneWindowWindow->preferredWidth(), mSceneManagerAppearSceneWindowWindow->preferredHeight()); break;
+ case M::Angle270: maskRect = QRect(0, 0, mSceneManagerAppearSceneWindowWindow->preferredHeight(), mSceneManagerAppearSceneWindowWindow->preferredWidth()); break;
+ }
+
+ QRegion region(maskRect, QRegion::Rectangle);
+ QCOMPARE(mWindowMaskRegion, region);
}
QTEST_APPLESS_MAIN(Ut_MCompositorNotificationSink)
--- tests/ut_mcompositornotificationsink/ut_mcompositornotificationsink.h
+++ tests/ut_mcompositornotificationsink/ut_mcompositornotificationsink.h
@@ -23,7 +23,7 @@
#include <QObject>
#include <QList>
#include <QString>
-#include <MInfoBanner>
+#include <MBanner>
#include "notification.h"
#include "notificationgroup.h"
#include "notificationmanagerinterface.h"
@@ -60,6 +60,14 @@
void notificationUpdated(const Notification ¬ification);
};
+class WindowEventFilter : public QObject
+{
+ Q_OBJECT
+
+protected:
+ bool eventFilter(QObject *obj, QEvent *event);
+};
+
class Ut_MCompositorNotificationSink : public QTimer
{
Q_OBJECT
@@ -69,10 +77,15 @@
MApplication *app;
MCompositorNotificationSink *sink;
MockNotificationManager *notificationManager;
+ NotificationParameters setupSinkDisabledTests(bool isSystemEvent = false);
signals:
void statusIndictorMenuVisibilityChanged(bool);
+private:
+ // Helper for sending the display change event
+ void sendOnDisplayChangeEvent();
+
private slots:
// Executed once before every test case
void init();
@@ -83,8 +96,11 @@
// Executed once after last test case
void cleanupTestCase();
- // Test that notifications can be added and no notifications are displayed when desktop is on top
- void testAddNotification();
+ // Test window properties
+ void testNotificationWindowProperties();
+ // Test that notifications can be added
+ void testAddNotificationWhenWindowNotOpen();
+ void testAddNotificationWhenWindowAlreadyOpen();
// Test that updating with an ID updates the correct notification
void testUpdateNotification();
// Test that canceling with an ID cancels the correct notification
@@ -95,6 +111,16 @@
void testNotificationWhileApplicationEventsDisabled();
// Test when sink is set to disabled, no notifications are generated
void testWhenSinkDisableTrueNoBannerCreated();
+ // Test when sink is set to disabled, but system notifications are generated
+ void testWhenSinkIsSetToDisabledSystemNotificationsAreStillGenerated();
+
+ // Tests notification preview disabling with several possible values
+ void testNotificationPreviewsDisabled_data();
+ void testNotificationPreviewsDisabled();
+
+ // Test that the window mask is set correctly in all orientations
+ void testWindowMasking_data();
+ void testWindowMasking();
};
#endif // UT_MCOMPOSITORNOTIFICATIONSINK_H
--- tests/ut_ngfadapter/ut_ngfadapter.cpp
+++ tests/ut_ngfadapter/ut_ngfadapter.cpp
@@ -16,6 +16,7 @@
** of this file.
**
****************************************************************************/
+#include <stdint.h>
#include "ut_ngfadapter.h"
static uint32_t g_ngf_play_id = 0;
--- tests/ut_ngfnotificationsink/ut_ngfnotificationsink.cpp
+++ tests/ut_ngfnotificationsink/ut_ngfnotificationsink.cpp
@@ -65,7 +65,7 @@
{
return true;
}
-
+
QList<QString> Ut_NGFNotificationSink::played;
void Ut_NGFNotificationSink::initTestCase()
@@ -168,6 +168,9 @@
void Ut_NGFNotificationSink::testWithoutEventTypeOrFeedbackId()
{
+ EventTypeStore eventTypeStore("", 0);
+ gNotificationManagerStub->stubSetReturnValue<const EventTypeStore&>("eventTypeStore", eventTypeStore);
+
NotificationParameters parameters;
parameters.add("eventType", "");
parameters.add(FeedbackParameterFactory::createFeedbackIdParameter(""));
--- tests/ut_notificationarea/ut_notificationarea.cpp
+++ tests/ut_notificationarea/ut_notificationarea.cpp
@@ -18,7 +18,8 @@
****************************************************************************/
#include <MApplication>
-#include <MInfoBanner>
+#include <MBanner>
+#include <QSignalSpy>
#include "ut_notificationarea.h"
#include "notificationarea.h"
#include "notificationareaview.h"
@@ -47,11 +48,10 @@
void Ut_NotificationArea::init()
{
m_subject = new NotificationArea();
- m_subject->setView(new NotificationAreaView(m_subject));
- connect(this, SIGNAL(addNotification(MInfoBanner &)), m_subject, SLOT(addNotification(MInfoBanner &)));
- connect(this, SIGNAL(removeNotification(MInfoBanner &)), m_subject, SLOT(removeNotification(MInfoBanner &)));
- connect(this, SIGNAL(notificationUpdated(MInfoBanner &)), m_subject, SLOT(moveNotificationToTop(MInfoBanner &)));
+ connect(this, SIGNAL(addNotification(MBanner &)), m_subject, SLOT(addNotification(MBanner &)));
+ connect(this, SIGNAL(removeNotification(MBanner &)), m_subject, SLOT(removeNotification(MBanner &)));
+ connect(this, SIGNAL(notificationUpdated(MBanner &)), m_subject, SLOT(moveNotificationToTop(MBanner &)));
}
void Ut_NotificationArea::cleanup()
@@ -61,7 +61,7 @@
void Ut_NotificationArea::testAddNotification()
{
- MInfoBanner notification(MInfoBanner::Information);
+ MBanner notification;
emit addNotification(notification);
QVERIFY(notification.parentItem() != NULL);
QVERIFY(m_subject->model()->banners().contains(¬ification));
@@ -69,7 +69,7 @@
void Ut_NotificationArea::testRemoveNotification()
{
- MInfoBanner notification(MInfoBanner::Information);
+ MBanner notification;
emit removeNotification(notification);
QVERIFY(notification.parentItem() == NULL);
QVERIFY(! m_subject->model()->banners().contains(¬ification));
@@ -77,9 +77,9 @@
void Ut_NotificationArea::testAddNotificationLatestComesFirst()
{
- MInfoBanner notification1(MInfoBanner::Information);
+ MBanner notification1;
emit addNotification(notification1);
- MInfoBanner notification2(MInfoBanner::Information);
+ MBanner notification2;
emit addNotification(notification2);
QCOMPARE(m_subject->model()->banners().at(0), ¬ification2);
QCOMPARE(m_subject->model()->banners().at(1), ¬ification1);
@@ -88,14 +88,39 @@
void Ut_NotificationArea::testUpdatedNotificationComesFirst()
{
// Add three notifications
- MInfoBanner notification1(MInfoBanner::Information);
+ MBanner notification1;
emit addNotification(notification1);
- MInfoBanner notification2(MInfoBanner::Information);
+ MBanner notification2;
emit addNotification(notification2);
- MInfoBanner notification3(MInfoBanner::Information);
+ MBanner notification3;
emit addNotification(notification3);
emit notificationUpdated(notification2);
QCOMPARE(m_subject->model()->banners().at(0), ¬ification2);
}
+void Ut_NotificationArea::testRemoveAllRemovableBanners()
+{
+ QSignalSpy notificationSpy(m_subject, SIGNAL(notificationRemovalRequested(uint)));
+ QSignalSpy notificationGroupSpy(m_subject, SIGNAL(notificationGroupClearingRequested(uint)));
+ MBanner removableNotification;
+ MBanner removableGroupNotification;
+ MBanner nonRemovableNotification;
+ MBanner nonRemovableGroupNotification;
+ removableNotification.setProperty(WidgetNotificationSink::USER_REMOVABLE_PROPERTY, true);
+ removableGroupNotification.setProperty(WidgetNotificationSink::USER_REMOVABLE_PROPERTY, true);
+ removableNotification.setProperty(WidgetNotificationSink::NOTIFICATION_ID_PROPERTY, 1);
+ removableGroupNotification.setProperty(WidgetNotificationSink::GROUP_ID_PROPERTY, 2);
+ nonRemovableNotification.setProperty(WidgetNotificationSink::NOTIFICATION_ID_PROPERTY, 3);
+ nonRemovableGroupNotification.setProperty(WidgetNotificationSink::GROUP_ID_PROPERTY, 4);
+ emit addNotification(removableNotification);
+ emit addNotification(removableGroupNotification);
+ emit addNotification(nonRemovableNotification);
+ emit addNotification(nonRemovableGroupNotification);
+ m_subject->removeAllRemovableBanners();
+ QCOMPARE(notificationSpy.count(), 1);
+ QCOMPARE(notificationGroupSpy.count(), 1);
+ QCOMPARE(notificationSpy.at(0).at(0).toInt(), 1);
+ QCOMPARE(notificationGroupSpy.at(0).at(0).toInt(), 2);
+}
+
QTEST_APPLESS_MAIN(Ut_NotificationArea)
--- tests/ut_notificationarea/ut_notificationarea.h
+++ tests/ut_notificationarea/ut_notificationarea.h
@@ -26,7 +26,7 @@
class MApplication;
class NotificationArea;
-class MInfoBanner;
+class MBanner;
class QGraphicsLayoutItem;
class Ut_NotificationArea : public QObject
@@ -51,11 +51,13 @@
void testAddNotificationLatestComesFirst();
// Test when a notification is updated then that banner comes first
void testUpdatedNotificationComesFirst();
+ // Test removing all removable banners
+ void testRemoveAllRemovableBanners();
signals:
- void addNotification(MInfoBanner ¬ification);
- void removeNotification(MInfoBanner ¬ification);
- void notificationUpdated(MInfoBanner ¬ification);
+ void addNotification(MBanner ¬ification);
+ void removeNotification(MBanner ¬ification);
+ void notificationUpdated(MBanner ¬ification);
public:
static QGraphicsLayoutItem *addedItem;
--- tests/ut_notificationarea/ut_notificationarea.pro
+++ tests/ut_notificationarea/ut_notificationarea.pro
@@ -3,7 +3,6 @@
TARGET = ut_notificationarea
INCLUDEPATH += $$SRCDIR/notifications $$SRCDIR/statusindicatormenu
-STYLE_HEADERS += $$SRCDIR/statusindicatormenu/notificationareastyle.h
MODEL_HEADERS += $$SRCDIR/statusindicatormenu/notificationareamodel.h
# unit test and unit
@@ -16,7 +15,6 @@
# service classes
SOURCES += \
- $$SRCDIR/statusindicatormenu/notificationareaview.cpp \
$$STUBSDIR/stubbase.cpp
# unit test and unit
@@ -34,8 +32,6 @@
$$SRCDIR/notifications/notificationsink.h \
$$SRCDIR/notifications/widgetnotificationsink.h \
$$SRCDIR/notifications/notificationareasink.h \
- $$SRCDIR/statusindicatormenu/notificationareaview.h \
- $$SRCDIR/statusindicatormenu/notificationareastyle.h \
$$SRCDIR/sysuid.h
include(../common_bot.pri)
--- tests/ut_notificationareasink/ut_notificationareasink.cpp
+++ tests/ut_notificationareasink/ut_notificationareasink.cpp
@@ -21,7 +21,7 @@
#include "notificationwidgetparameterfactory.h"
#include <QtTest/QtTest>
-#include <MInfoBanner>
+#include <MBanner>
#include <MRemoteAction>
#include <MApplication>
#include "../stubs/testnotificationparameters.h"
@@ -44,33 +44,33 @@
Ut_NotificationAreaSink::contents.append(action);
}
-// MInfoBanner stubs (used by NotificationAreaSink)
-MInfoBanner::~MInfoBanner()
+// MBanner stubs (used by NotificationAreaSink)
+MBanner::~MBanner()
{
Ut_NotificationAreaSink::destroyedNotifications.append(this);
}
-void MInfoBanner::setImageID(const QString &imageId)
+void MBanner::setTitle(const QString &title)
{
int index = Ut_NotificationAreaSink::notifications.indexOf(this);
if (index >= 0) {
- Ut_NotificationAreaSink::icons.replace(index, imageId);
+ Ut_NotificationAreaSink::titles.replace(index, title);
} else {
- Ut_NotificationAreaSink::icons.append(imageId);
+ Ut_NotificationAreaSink::titles.append(title);
}
}
-void MInfoBanner::setBodyText(const QString &body)
+void MBanner::setSubtitle(const QString &subtitle)
{
int index = Ut_NotificationAreaSink::notifications.indexOf(this);
if (index >= 0) {
- Ut_NotificationAreaSink::bodies.replace(index, body);
+ Ut_NotificationAreaSink::subtitles.replace(index, subtitle);
} else {
- Ut_NotificationAreaSink::bodies.append(body);
+ Ut_NotificationAreaSink::subtitles.append(subtitle);
}
}
-void MInfoBanner::setIconID(const QString &iconId)
+void MBanner::setIconID(const QString &iconId)
{
int index = Ut_NotificationAreaSink::notifications.indexOf(this);
if (index >= 0) {
@@ -103,12 +103,12 @@
return QStringList();
}
-QList<QString> Ut_NotificationAreaSink::icons;
-QList<QString> Ut_NotificationAreaSink::bodies;
+QList<QString> Ut_NotificationAreaSink::titles;
+QList<QString> Ut_NotificationAreaSink::subtitles;
QList<QString> Ut_NotificationAreaSink::buttonIcons;
QList<QString> Ut_NotificationAreaSink::contents;
-QList<MInfoBanner *> Ut_NotificationAreaSink::notifications;
-QList<MInfoBanner *> Ut_NotificationAreaSink::destroyedNotifications;
+QList<MBanner *> Ut_NotificationAreaSink::notifications;
+QList<MBanner *> Ut_NotificationAreaSink::destroyedNotifications;
// Tests
void Ut_NotificationAreaSink::initTestCase()
@@ -134,24 +134,24 @@
connect(this, SIGNAL(removeNotification(uint)), sink, SLOT(removeNotification(uint)));
connect(this, SIGNAL(addGroup(uint, const NotificationParameters &)), sink, SLOT(addGroup(uint, const NotificationParameters &)));
connect(this, SIGNAL(removeGroup(uint)), sink, SLOT(removeGroup(uint)));
- connect(sink, SIGNAL(addNotification(MInfoBanner &)), this, SLOT(addNotification(MInfoBanner &)));
- connect(sink, SIGNAL(removeNotification(MInfoBanner &)), this, SLOT(removeNotification(MInfoBanner &)));
+ connect(sink, SIGNAL(addNotification(MBanner &)), this, SLOT(addNotification(MBanner &)));
+ connect(sink, SIGNAL(removeNotification(MBanner &)), this, SLOT(removeNotification(MBanner &)));
}
-void Ut_NotificationAreaSink::addNotification(MInfoBanner ¬ification)
+void Ut_NotificationAreaSink::addNotification(MBanner ¬ification)
{
Ut_NotificationAreaSink::notifications.append(¬ification);
notification.setParentItem(new MWidget());
}
-void Ut_NotificationAreaSink::removeNotification(MInfoBanner ¬ification)
+void Ut_NotificationAreaSink::removeNotification(MBanner ¬ification)
{
int index = Ut_NotificationAreaSink::notifications.indexOf(¬ification);
if (index >= 0) {
- Ut_NotificationAreaSink::icons.removeAt(index);
- Ut_NotificationAreaSink::bodies.removeAt(index);
+ Ut_NotificationAreaSink::titles.removeAt(index);
+ Ut_NotificationAreaSink::subtitles.removeAt(index);
Ut_NotificationAreaSink::buttonIcons.removeAt(index);
Ut_NotificationAreaSink::notifications.removeAt(index);
@@ -162,8 +162,8 @@
void Ut_NotificationAreaSink::cleanup()
{
delete sink;
- icons.clear();
- bodies.clear();
+ titles.clear();
+ subtitles.clear();
buttonIcons.clear();
contents.clear();
notifications.clear();
@@ -172,14 +172,14 @@
void Ut_NotificationAreaSink::testAddNotification()
{
- QSignalSpy addSpy(sink, SIGNAL(addNotification(MInfoBanner &)));
+ QSignalSpy addSpy(sink, SIGNAL(addNotification(MBanner &)));
// Create three notifications - two with a content link and one without
- TestNotificationParameters parameters0("icon0", "summary0", "body0", "buttonicon0", "content0");
+ TestNotificationParameters parameters0("title0", "subtitle0", "buttonicon0", "content0");
emit addNotification(Notification(0, 0, 2, parameters0, Notification::ApplicationEvent, 1000));
- TestNotificationParameters parameters1("icon1", "summary1", "body1", "buttonicon1", "content1");
+ TestNotificationParameters parameters1("title1", "subtitle1", "buttonicon1", "content1");
emit addNotification(Notification(1, 0, 2, parameters1, Notification::SystemEvent, 1000));
- TestNotificationParameters parameters2("icon2", "summary2", "body2", "buttonicon2", "");
+ TestNotificationParameters parameters2("title2", "subtitle2", "buttonicon2", "");
emit addNotification(Notification(2, 0, 2, parameters2, Notification::ApplicationEvent, 1000));
// Check that the addNotification() signal was emitted by the sink two times
@@ -189,13 +189,13 @@
void Ut_NotificationAreaSink::testUpdateNotification()
{
- QSignalSpy addSpy(sink, SIGNAL(addNotification(MInfoBanner &)));
+ QSignalSpy addSpy(sink, SIGNAL(addNotification(MBanner &)));
// Add two notifications with the same id; the second should update the existing one.
- TestNotificationParameters parameters0("icon0", "summary0", "body0", "buttonicon0", "content0");
+ TestNotificationParameters parameters0("title0", "subtitle0", "buttonicon0", "content0");
emit addNotification(Notification(0, 0, 2, parameters0, Notification::ApplicationEvent, 1000));
QCOMPARE(addSpy.count(), 1);
- TestNotificationParameters parameters1("icon1", "summary1", "body1", "buttonicon1", "content1");
+ TestNotificationParameters parameters1("title1", "subtitle1", "buttonicon1", "content1");
emit addNotification(Notification(0, 0, 2, parameters1, Notification::ApplicationEvent, 1000));
QCOMPARE(addSpy.count(), 1);
QCOMPARE(notifications.count(), 1);
@@ -209,15 +209,15 @@
void Ut_NotificationAreaSink::testRemoveNotification()
{
- QSignalSpy addSpy(sink, SIGNAL(addNotification(MInfoBanner &)));
- QSignalSpy removeSpy(sink, SIGNAL(removeNotification(MInfoBanner &)));
+ QSignalSpy addSpy(sink, SIGNAL(addNotification(MBanner &)));
+ QSignalSpy removeSpy(sink, SIGNAL(removeNotification(MBanner &)));
// Create three notifications
- TestNotificationParameters parameters0("icon0", "summary0", "body0", "buttonicon0", "content0");
+ TestNotificationParameters parameters0("title0", "subtitle0", "buttonicon0", "content0");
emit addNotification(Notification(0, 0, 2, parameters0, Notification::SystemEvent, 1000));
- TestNotificationParameters parameters1("icon1", "summary1", "body1", "buttonicon1", "content1");
+ TestNotificationParameters parameters1("title1", "subtitle1", "buttonicon1", "content1");
emit addNotification(Notification(1, 0, 2, parameters1, Notification::ApplicationEvent, 1000));
- TestNotificationParameters parameters2("icon2", "summary2", "body2", "buttonicon2", "");
+ TestNotificationParameters parameters2("title2", "subtitle2", "buttonicon2", "");
emit addNotification(Notification(2, 0, 2, parameters2, Notification::ApplicationEvent, 1000));
// Check that the addNotification() signal was emitted by the sink two times
@@ -234,22 +234,22 @@
// Recreate the second notification and create an additional one
emit addNotification(Notification(1, 0, 2, parameters1, Notification::ApplicationEvent, 1000));
- TestNotificationParameters parameters3("icon3", "summary3", "body3", "buttonicon3", "");
+ TestNotificationParameters parameters3("title3", "subtitle3", "buttonicon3", "");
emit addNotification(Notification(3, 0, 2, parameters3, Notification::SystemEvent, 1000));
// Check that the addNotification() signal was emitted by the sink three times in total
QCOMPARE(addSpy.count(), 3);
- QCOMPARE(icons.length(), 2);
- QCOMPARE(icons[0], QString("icon2"));
- QCOMPARE(icons[1], QString("icon1"));
+ QCOMPARE(buttonIcons.length(), 2);
+ QCOMPARE(buttonIcons[0], QString("buttonicon2"));
+ QCOMPARE(buttonIcons[1], QString("buttonicon1"));
}
void Ut_NotificationAreaSink::testAddGroup()
{
- QSignalSpy addSpy(sink, SIGNAL(addNotification(MInfoBanner &)));
+ QSignalSpy addSpy(sink, SIGNAL(addNotification(MBanner &)));
// Creating a group should not send signals, just create the mnotification
- TestNotificationParameters parameters0("icon0", "summary0", "body0", "buttonicon0", "content0");
+ TestNotificationParameters parameters0("title0", "subtitle0", "buttonicon0", "content0");
emit addGroup(1, parameters0);
QCOMPARE(addSpy.count(), 0);
QCOMPARE(notifications.count(), 0);
@@ -257,16 +257,16 @@
void Ut_NotificationAreaSink::testRemoveGroup()
{
- QSignalSpy remSpy(sink, SIGNAL(removeNotification(MInfoBanner &)));
+ QSignalSpy remSpy(sink, SIGNAL(removeNotification(MBanner &)));
// A signal from removeGroup is not sent if no notification has been added to the group
- TestNotificationParameters parameters0("icon0", "summary0", "body0", "buttonicon0", "content0");
+ TestNotificationParameters parameters0("title0", "subtitle0", "buttonicon0", "content0");
emit addGroup(1, parameters0);
emit removeGroup(1);
QCOMPARE(remSpy.count(), 0);
emit addGroup(1, parameters0);
- TestNotificationParameters parameters1("icon1", "summary1", "body1", "buttonicon1", "content1");
+ TestNotificationParameters parameters1("title1", "subtitle1", "buttonicon1", "content1");
emit addNotification(Notification(0, 1, 2, parameters1, Notification::ApplicationEvent, 1000));
emit removeGroup(1);
QCOMPARE(remSpy.count(), 1);
@@ -274,12 +274,12 @@
void Ut_NotificationAreaSink::testRemovingNotificationsWhenNoNotificationLeftGroupBannerIsRemoved()
{
- QSignalSpy remSpy(sink, SIGNAL(removeNotification(MInfoBanner &)));
+ QSignalSpy remSpy(sink, SIGNAL(removeNotification(MBanner &)));
- TestNotificationParameters parameters0("image0", "summary0", "body0", "icon0", "content0");
+ TestNotificationParameters parameters0("title0", "subtitle0", "icon0", "content0");
emit addGroup(1, parameters0);
// Add two notifications to this group
- TestNotificationParameters parameters1("image1", "summary1", "body1", "icon1", "content1");
+ TestNotificationParameters parameters1("title1", "subtitle1", "icon1", "content1");
emit addNotification(Notification(0, 1, 2, parameters1, Notification::ApplicationEvent, 1000));
emit addNotification(Notification(1, 1, 2, parameters1, Notification::ApplicationEvent, 1000));
// Remove first notification
@@ -293,10 +293,10 @@
void Ut_NotificationAreaSink::testAddNotificationToGroup()
{
- QSignalSpy addSpy(sink, SIGNAL(addNotification(MInfoBanner &)));
- TestNotificationParameters parameters0("image0", "summary0", "body0", "icon0", "content0");
+ QSignalSpy addSpy(sink, SIGNAL(addNotification(MBanner &)));
+ TestNotificationParameters parameters0("title0", "subtitle0", "icon0", "content0");
emit addGroup(1, parameters0);
- TestNotificationParameters parameters1("image1", "summary1", "body1", "icon1", "content1");
+ TestNotificationParameters parameters1("title1", "subtitle1", "icon1", "content1");
emit addNotification(Notification(0, 1, 2, parameters1, Notification::ApplicationEvent, 1000));
QCOMPARE(addSpy.count(), 1);
@@ -305,10 +305,10 @@
void Ut_NotificationAreaSink::testAddNewNotificationToGroupUpdatesNotificationArea()
{
- QSignalSpy updateSpy(sink, SIGNAL(notificationAddedToGroup(MInfoBanner &)));
- TestNotificationParameters parameters0("image0", "summary0", "body0", "icon0", "content0");
+ QSignalSpy updateSpy(sink, SIGNAL(notificationAddedToGroup(MBanner &)));
+ TestNotificationParameters parameters0("title0", "subtitle0", "icon0", "content0");
emit addGroup(1, parameters0);
- TestNotificationParameters parameters1("image1", "summary1", "body1", "icon1", "content1");
+ TestNotificationParameters parameters1("title1", "subtitle1", "icon1", "content1");
emit addNotification(Notification(0, 1, 2, parameters1, Notification::ApplicationEvent, 1000));
QCOMPARE(updateSpy.count(), 0);
emit addNotification(Notification(1, 1, 2, parameters1, Notification::ApplicationEvent, 1000));
@@ -317,15 +317,15 @@
void Ut_NotificationAreaSink::testUpdateGroup()
{
- TestNotificationParameters parameters0("icon0", "summary0", "body0", "buttonicon0", "content0");
+ TestNotificationParameters parameters0("title0", "subtitle0", "buttonicon0", "content0");
emit addGroup(1, parameters0);
- TestNotificationParameters parameters1("icon1", "summary1", "body1", "buttonicon1", "content1");
+ TestNotificationParameters parameters1("title1", "subtitle1", "buttonicon1", "content1");
emit addNotification(Notification(0, 1, 2, parameters1, Notification::ApplicationEvent, 1000));
- QCOMPARE(icons.length(), 1);
- QCOMPARE(icons[0], QString("icon0"));
- QCOMPARE(bodies.length(), 1);
- QCOMPARE(bodies[0], QString("<p><b>summary0</b></p><p>body0</p>"));
+ QCOMPARE(titles.length(), 1);
+ QCOMPARE(titles[0], QString("title0"));
+ QCOMPARE(subtitles.length(), 1);
+ QCOMPARE(subtitles[0], QString("subtitle0"));
QCOMPARE(buttonIcons.length(), 1);
QCOMPARE(buttonIcons[0], QString("buttonicon0"));
QCOMPARE(contents.length(), 1);
@@ -333,10 +333,10 @@
emit addGroup(1, parameters1);
- QCOMPARE(icons.length(), 1);
- QCOMPARE(icons[0], QString("icon1"));
- QCOMPARE(bodies.length(), 1);
- QCOMPARE(bodies[0], QString("<p><b>summary1</b></p><p>body1</p>"));
+ QCOMPARE(titles.length(), 1);
+ QCOMPARE(titles[0], QString("title1"));
+ QCOMPARE(subtitles.length(), 1);
+ QCOMPARE(subtitles[0], QString("subtitle1"));
QCOMPARE(buttonIcons.length(), 1);
QCOMPARE(buttonIcons[0], QString("buttonicon1"));
// TODO: even though contents.length is 2, there's only 1 action in the mnotification
--- tests/ut_notificationareasink/ut_notificationareasink.h
+++ tests/ut_notificationareasink/ut_notificationareasink.h
@@ -23,7 +23,7 @@
#include <QObject>
#include <QList>
#include <QString>
-#include <MInfoBanner>
+#include <MBanner>
#include "notificationareasink.h"
class MApplication;
@@ -34,13 +34,12 @@
Q_OBJECT
public:
- static QList<MInfoBanner::BannerType> types;
- static QList<QString> icons;
- static QList<QString> bodies;
+ static QList<QString> titles;
+ static QList<QString> subtitles;
static QList<QString> buttonIcons;
static QList<QString> contents;
- static QList<MInfoBanner *> notifications;
- static QList<MInfoBanner *> destroyedNotifications;
+ static QList<MBanner *> notifications;
+ static QList<MBanner *> destroyedNotifications;
private:
MApplication *app;
@@ -48,9 +47,9 @@
public slots:
// For faking the addition of a notification to a layout
- void addNotification(MInfoBanner ¬ification);
+ void addNotification(MBanner ¬ification);
// For faking the removal of a notification from a layout
- void removeNotification(MInfoBanner ¬ification);
+ void removeNotification(MBanner ¬ification);
private slots:
// Executed once before every test case
--- tests/ut_notificationareasink/ut_notificationareasink.pro
+++ tests/ut_notificationareasink/ut_notificationareasink.pro
@@ -21,7 +21,7 @@
# helper classes
SOURCES += \
- $$STUBSDIR\stubbase.cpp
+ $$STUBSDIR/stubbase.cpp
# unit test and unit classes
HEADERS += ut_notificationareasink.h \
--- tests/ut_notificationareaview/ut_notificationareaview.cpp
+++ tests/ut_notificationareaview/ut_notificationareaview.cpp
@@ -16,43 +16,44 @@
** of this file.
**
****************************************************************************/
-/***************************************************************************
-**
-** 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 system ui.
-**
-** 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 <QGraphicsLinearLayout>
+#include <QAction>
+#include <QSharedPointer>
+#include <MApplication>
+#include <MButton>
#include "ut_notificationareaview.h"
#include "notificationarea_stub.h"
+#include "widgetnotificationsink_stub.h"
#include "notificationareaview.h"
+QList<MBanner *> bannersClicked;
+void MBanner::click()
+{
+ bannersClicked.append(this);
+}
+
// Tests
void Ut_NotificationAreaView::initTestCase()
{
+ static int argc = 1;
+ static char *app_name = (char *)"./ut_notificationareaview";
+ app = new MApplication(argc, &app_name);
}
void Ut_NotificationAreaView::cleanupTestCase()
{
+ delete app;
}
void Ut_NotificationAreaView::init()
{
notificationArea = new NotificationArea;
+ notificationArea->setModel(new NotificationAreaModel);
m_subject = new NotificationAreaView(notificationArea);
notificationArea->setView(m_subject);
+ bannersClicked.clear();
}
void Ut_NotificationAreaView::cleanup()
@@ -60,4 +61,58 @@
delete m_subject;
}
-QTEST_MAIN(Ut_NotificationAreaView)
+MBanner *createBanner(bool removable)
+{
+ MBanner *banner = new MBanner;
+ banner->setProperty(WidgetNotificationSink::USER_REMOVABLE_PROPERTY, removable);
+ return banner;
+}
+
+void Ut_NotificationAreaView::testClearButtonSignals()
+{
+ QVERIFY(disconnect(m_subject->clearButton, SIGNAL(clicked()), notificationArea, SLOT(removeAllRemovableBanners())));
+}
+
+void Ut_NotificationAreaView::testAddClearButton_data()
+{
+ QTest::addColumn<int>("numRemovableBanners");
+ QTest::addColumn<int>("numNonRemovableBanners");
+ QTest::addColumn<bool>("clearButtonExists");
+
+ QTest::newRow("No banners") << 0 << 0 << false;
+ QTest::newRow("Only non-removable banners") << 0 << 5 << false;
+ QTest::newRow("Only removable banners") << 5 << 0 << true;
+ QTest::newRow("Both removable and non-removable banners") << 5 << 5 << true;
+}
+
+void Ut_NotificationAreaView::testAddClearButton()
+{
+ QFETCH(int, numRemovableBanners);
+ QFETCH(int, numNonRemovableBanners);
+ QFETCH(bool, clearButtonExists);
+
+ BannerList banners;
+ for (int i = 0; i < numRemovableBanners; i++) {
+ banners << createBanner(true);
+ }
+ for (int i = 0; i < numNonRemovableBanners; i++) {
+ banners << createBanner(false);
+ }
+ notificationArea->model()->setBanners(banners);
+
+ QCOMPARE(m_subject->bannerLayout->count(), numRemovableBanners + numNonRemovableBanners);
+ QCOMPARE(m_subject->clearButton->objectName(), clearButtonExists ? QString("NotificationAreaClearButtonVisible") : QString("NotificationAreaClearButton"));
+}
+
+void Ut_NotificationAreaView::testRemoveClearButton()
+{
+ QSharedPointer<MBanner> banner(createBanner(true));
+ BannerList banners;
+ banners << banner.data();
+ notificationArea->model()->setBanners(banners);
+ banners.clear();
+ notificationArea->model()->setBanners(banners);
+ QCOMPARE(m_subject->clearButton->objectName(), QString("NotificationAreaClearButton"));
+}
+
+QTEST_APPLESS_MAIN(Ut_NotificationAreaView)
--- tests/ut_notificationareaview/ut_notificationareaview.h
+++ tests/ut_notificationareaview/ut_notificationareaview.h
@@ -16,31 +16,13 @@
** of this file.
**
****************************************************************************/
-/***************************************************************************
-**
-** 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 system ui.
-**
-** 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_NOTIFICATIONAREAVIEW_H
#define UT_NOTIFICATIONAREAVIEW_H
-#include <QtTest/QtTest>
#include <QObject>
+class MApplication;
class NotificationArea;
class NotificationAreaView;
@@ -59,7 +41,14 @@
void cleanup();
// Test cases
+ void testClearButtonSignals();
+ void testAddClearButton_data();
+ void testAddClearButton();
+ void testRemoveClearButton();
+
private:
+ // Application instance
+ MApplication *app;
// The view being tested
NotificationAreaView *m_subject;
// Controller for the view
--- tests/ut_notificationmanager/ut_notificationmanager.cpp
+++ tests/ut_notificationmanager/ut_notificationmanager.cpp
@@ -65,22 +65,22 @@
{
}
-#ifdef HAVE_MAEMOSEC
-// maemosec stubs
-int maemosec::storage::get_file(const char *pathname, unsigned char **to_buf, ssize_t *bytes)
+#ifdef HAVE_AEGIS_CRYPTO
+// aegis crypto stubs
+int aegis::storage::get_file(const char* pathname, RAWDATA_RPTR to_buf, size_t* bytes)
{
if (QString(pathname).contains("state.data")) {
- *to_buf = (unsigned char *)gStateBuffer.buffer().data();
+ *to_buf = (RAWDATA_PTR)gStateBuffer.buffer().data();
*bytes = gStateBuffer.buffer().size();
} else if (QString(pathname).contains("notifications.data")) {
- *to_buf = (unsigned char *)gNotificationBuffer.buffer().data();
+ *to_buf = (RAWDATA_PTR)gNotificationBuffer.buffer().data();
*bytes = gNotificationBuffer.buffer().size();
}
return 0;
}
-int maemosec::storage::put_file(const char *pathname, unsigned char *data, ssize_t bytes)
+int aegis::storage::put_file(const char* pathname, RAWDATA_PTR data, size_t bytes)
{
if (QString(pathname).contains("state.data")) {
gStateBuffer.close();
@@ -93,37 +93,37 @@
return 0;
}
-void maemosec::storage::release_buffer(unsigned char *data)
+void aegis::storage::release_buffer(RAWDATA_PTR data)
{
Q_UNUSED(data);
gNotificationBuffer.close();
gStateBuffer.close();
}
-bool maemosec::storage::contains_file(const char *pathname)
+bool aegis::storage::contains_file(const char *pathname)
{
Q_UNUSED(pathname);
return true;
}
-void maemosec::storage::remove_file(const char *pathname)
+void aegis::storage::remove_file(const char *pathname)
{
Q_UNUSED(pathname);
}
-void maemosec::storage::commit()
+void aegis::storage::commit()
{
}
-maemosec::storage::storage(const char *name, maemosec::storage::visibility_t visibility, maemosec::storage::protection_t protection)
+aegis::storage::storage(const char *name, aegis::storage::visibility_t visibility, aegis::storage::protection_t protection)
{
Q_UNUSED(name);
Q_UNUSED(visibility);
Q_UNUSED(protection);
}
-maemosec::storage::~storage()
+aegis::storage::~storage()
{
}
#endif
@@ -257,7 +257,7 @@
delete manager;
-#ifdef HAVE_MAEMOSEC
+#ifdef HAVE_AEGIS_CRYPTO
gTestingPersistent = true;
manager = new TestNotificationManager(0);
@@ -362,7 +362,7 @@
QCOMPARE(n.type(), Notification::ApplicationEvent);
QCOMPARE(n.timeout(), 0);
- // TODO this cannot be fully tested until MInfoBanner supports updates
+ // TODO this cannot be fully tested until MBanner supports updates
}
void Ut_NotificationManager::testRemoveNotification()
@@ -935,7 +935,7 @@
QCOMPARE(list.size(), 0);
}
-#ifdef HAVE_MAEMOSEC
+#ifdef HAVE_AEGIS_CRYPTO
void Ut_NotificationManager::testGroupInfoPersistentStorage()
{
gTestingPersistent = true;
@@ -1147,5 +1147,19 @@
QCOMPARE(groupRemovedSpy.takeFirst()[0].toUInt(), id1);
}
+void Ut_NotificationManager::testRemovalOfUnseenFlags()
+{
+ // Create notification
+ NotificationParameters param;
+ uint id = manager->addNotification(0, param);
+ // Notifications are created with unseen params
+ QCOMPARE(manager->notifications.value(id).parameters().value("unseen").toBool(), true);
+
+ connect(this, SIGNAL(notifierSinkActive(bool)), manager, SLOT(removeUnseenFlags(bool)));
+ emit notifierSinkActive(false);
+
+ QCOMPARE(manager->notifications.value(id).parameters().value("unseen").toBool(), false);
+}
+
QTEST_MAIN(Ut_NotificationManager)
--- tests/ut_notificationmanager/ut_notificationmanager.h
+++ tests/ut_notificationmanager/ut_notificationmanager.h
@@ -38,6 +38,9 @@
static QList<int> timerTimeouts;
static QHash<QString, QVariant> dataStore;
+signals:
+ void notifierSinkActive(bool ignore);
+
private:
TestNotificationManager *manager;
@@ -102,7 +105,7 @@
void testNotificationList();
// Test querying the notification group data
void testNotificationGroupList();
-#ifdef HAVE_MAEMOSEC
+#ifdef HAVE_AEGIS_CRYPTO
// Test that the group info is saved to the persistent storage
void testGroupInfoPersistentStorage();
// Test that the persistent notifications are saved to the persistent storage
@@ -114,6 +117,8 @@
void testRemovingNotificationsWithEventType();
// Test the removal of groups based on event type
void testRemovingGroupsWithEventType();
+ // Test removal of unseen flags from notifications
+ void testRemovalOfUnseenFlags();
};
#endif // UT_NOTIFICATIONMANAGER_H
--- tests/ut_notificationparameters/ut_notificationparameters.cpp
+++ tests/ut_notificationparameters/ut_notificationparameters.cpp
@@ -22,6 +22,7 @@
#include "ut_notificationparameters.h"
#include "notificationparameters.h"
#include "notificationparameter.h"
+#include "genericnotificationparameterfactory.h"
class TestSink
{
@@ -45,6 +46,7 @@
void Ut_NotificationParameters::init()
{
parameters = new NotificationParameters();
+ QCOMPARE(parameters->value(GenericNotificationParameterFactory::unseenKey()).toBool(), true);
}
void Ut_NotificationParameters::cleanup()
--- tests/ut_notificationstatusindicator
+++ tests/ut_notificationstatusindicator
+(directory)
--- tests/ut_notificationstatusindicator/ut_notificationstatusindicator.cpp
+++ tests/ut_notificationstatusindicator/ut_notificationstatusindicator.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 "ut_notificationstatusindicator.h"
+#include "notification_stub.h"
+#include "statusindicator.h"
+#include <mapplication.h>
+#include "sysuid_stub.h"
+#include "notificationsink_stub.h"
+#include "notifiernotificationsink_stub.h"
+#include "mcompositornotificationsink_stub.h"
+#include "notificationmanager_stub.h"
+#include "widgetnotificationsink_stub.h"
+#include "inputmethodstatusindicatoradaptor_stub.h"
+#include "notificationgroup_stub.h"
+#include "eventtypestore_stub.h"
+
+void Ut_NotificationStatusIndicator::init()
+{
+ mgr = new NotificationManager;
+ compositorSink = new MCompositorNotificationSink;
+ gSysuidStub->stubSetReturnValue("compositorNotificationSink", compositorSink);
+ gSysuidStub->stubSetReturnValue("notificationManager", mgr);
+ m_subject = new NotificationStatusIndicator;
+}
+
+void Ut_NotificationStatusIndicator::cleanup()
+{
+ gNotifierNotificationSinkStub->stubReset();
+ delete mgr;
+ delete compositorSink;
+ delete m_subject;
+}
+
+void Ut_NotificationStatusIndicator::initTestCase()
+{
+ // MApplications must be created manually these days due to theme system changes
+ static int argc = 1;
+ static char *app_name = (char *)"./Ut_NotificationStatusIndicator";
+ app = new MApplication(argc, &app_name);
+}
+
+void Ut_NotificationStatusIndicator::cleanupTestCase()
+{
+ // Destroy the MApplication
+ delete app;
+}
+
+void Ut_NotificationStatusIndicator::testSetActive()
+{
+ connect(this, SIGNAL(notifierSinkActive(bool)), m_subject, SLOT(setActive(bool)));
+
+ emit notifierSinkActive(true);
+ QVERIFY(m_subject->objectName().indexOf("On") >= 0);
+
+ emit notifierSinkActive(false);
+ QVERIFY(m_subject->objectName().indexOf("On") < 0);
+}
+
+void Ut_NotificationStatusIndicator::testMenuVisibilityChange()
+{
+ // verify that we don't do anything when visibility is false
+ m_subject->statusIndicatorMenuVisibilityChange(false);
+ QCOMPARE(gNotifierNotificationSinkStub->stubCallCount("clearSink"), 0);
+ QCOMPARE(gNotifierNotificationSinkStub->stubCallCount("disableNotificationAdditions"), 1);
+ QCOMPARE(gNotifierNotificationSinkStub->stubLastCallTo("disableNotificationAdditions").parameter<bool>(0), false);
+
+ // verify that sink is cleared when status menu comes visible
+ m_subject->statusIndicatorMenuVisibilityChange(true);
+ QCOMPARE(gNotifierNotificationSinkStub->stubCallCount("clearSink"), 1);
+ QCOMPARE(gNotifierNotificationSinkStub->stubCallCount("disableNotificationAdditions"), 2);
+ QCOMPARE(gNotifierNotificationSinkStub->stubLastCallTo("disableNotificationAdditions").parameter<bool>(0), true);
+}
+
+void Ut_NotificationStatusIndicator::testConnections()
+{
+ NotificationManager *notificationManager = &Sysuid::sysuid()->notificationManager();
+ bool result = m_subject->disconnect(notificationManager, SIGNAL(notificationRestored(const Notification &)), m_subject->notifierSink, SLOT(addNotification(const Notification &)));
+ QCOMPARE(result, true);
+ result = m_subject->disconnect(&Sysuid::sysuid()->compositorNotificationSink(), SIGNAL(notificationAdded(const Notification &)), m_subject->notifierSink, SLOT(addNotification(const Notification &)));
+ QCOMPARE(result, true);
+ result = m_subject->disconnect(notificationManager, SIGNAL(notificationRemoved(uint)), m_subject->notifierSink, SLOT(removeNotification(uint)));
+ QCOMPARE(result, true);
+ result = m_subject->disconnect(m_subject->notifierSink, SIGNAL(notifierSinkActive(bool)), m_subject, SLOT(setActive(bool)));
+ QCOMPARE(result, true);
+ m_subject->disconnect(m_subject->notifierSink, SIGNAL(notifierSinkActive(bool)), notificationManager, SLOT(removeUnseenFlags(bool)));
+ QCOMPARE(result, true);
+}
+
+QTEST_APPLESS_MAIN(Ut_NotificationStatusIndicator)
--- tests/ut_notificationstatusindicator/ut_notificationstatusindicator.h
+++ tests/ut_notificationstatusindicator/ut_notificationstatusindicator.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_NOTIFICATIONSTATUSINDICATOR_
+#define _UT_NOTIFICATIONSTATUSINDICATOR_
+
+#include <QtGui>
+#include <QtTest/QtTest>
+#include <QObject>
+#include "notificationstatusindicator.h"
+
+class MApplication;
+class NotificationManager;
+class MCompositorNotificationSink;
+
+class Ut_NotificationStatusIndicator : public QObject
+{
+ Q_OBJECT
+
+private:
+ MApplication *app;
+ NotificationStatusIndicator *m_subject;
+ NotificationManager *mgr;
+ MCompositorNotificationSink *compositorSink;
+
+signals:
+ void notifierSinkActive(bool);
+
+private slots:
+ // Executed once before every test case
+ void init();
+
+ // Executed once after every test case
+ void cleanup();
+
+ // Executed once before first test case
+ void initTestCase();
+
+ // Executed once after last test case
+ void cleanupTestCase();
+
+ // Tests active state of status indicator
+ void testSetActive();
+ // Tests notification status indicator when status indicator menu visibility changes
+ void testMenuVisibilityChange();
+ // Test that notification manager is connected to notifier sink
+ void testConnections();
+};
+
+#endif //_UT_NOTIFICATIONSTATUSINDICATOR_
--- tests/ut_notificationstatusindicator/ut_notificationstatusindicator.pro
+++ tests/ut_notificationstatusindicator/ut_notificationstatusindicator.pro
+include(../coverage.pri)
+include(../common_top.pri)
+TARGET = ut_notificationstatusindicator
+
+INCLUDEPATH += $$SRCDIR/statusarea $$SRCDIR/notifications $$SRCDIR
+
+MODEL_HEADERS += $$SRCDIR/statusarea/statusindicatormodel.h
+
+# unit test and unit classes
+HEADERS += ut_notificationstatusindicator.h \
+ $$SRCDIR/notifications/notificationstatusindicator.h \
+ $$SRCDIR/statusarea/statusindicator.h \
+ $$SRCDIR/statusarea/inputmethodstatusindicatoradaptor.h \
+ $$SRCDIR/notifications/notificationsink.h \
+ $$SRCDIR/notifications/notifiernotificationsink.h \
+ $$SRCDIR/notifications/mcompositornotificationsink.h \
+ $$SRCDIR/notifications/widgetnotificationsink.h \
+ $$SRCDIR/sysuid.h \
+ $$SRCDIR/statusarea/statusindicatormodel.h \
+ $$SRCDIR/notifications/notificationmanager.h \
+ $$SRCDIR/notifications/notificationparameters.h \
+ $$SRCDIR/notifications/notificationparameter.h \
+ $$SRCDIR/notifications/notification.h \
+ $$SRCDIR/notifications/notificationgroup.h \
+ $$SRCDIR/notifications/eventtypestore.h
+
+# unit test and unit classes
+SOURCES += ut_notificationstatusindicator.cpp \
+ $$SRCDIR/notifications/notificationstatusindicator.cpp \
+ $$SRCDIR/statusarea/statusindicator.cpp \
+ $$SRCDIR/notifications/notificationparameters.cpp \
+ $$SRCDIR/notifications/notificationparameter.cpp
+
+# helper classes
+SOURCES += \
+ $$STUBSDIR/stubbase.cpp
--- tests/ut_notifier
+++ tests/ut_notifier
-(directory)
--- tests/ut_notifier/ut_notifier.cpp
+++ tests/ut_notifier/ut_notifier.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 <MApplication>
-#include "ut_notifier.h"
-#include "notifier.h"
-#include "notificationsink_stub.h"
-#include "notifiernotificationsink_stub.h"
-#include "sysuid_stub.h"
-
-void Ut_Notifier::initTestCase()
-{
- static int argc = 1;
- static char *app_name = (char *)"./ut_notifier";
- app = new MApplication(argc, &app_name);
-}
-
-void Ut_Notifier::cleanupTestCase()
-{
- delete app;
-}
-
-void Ut_Notifier::init()
-{
- m_subject = new Notifier();
- connect(this, SIGNAL(notificationCountChanged(uint)), m_subject, SLOT(notificationCountChanged(uint)));
-}
-
-void Ut_Notifier::cleanup()
-{
- delete m_subject;
-}
-
-void Ut_Notifier::testNotificationCountChanged()
-{
- // The notifier should be visible when there are notifications
- emit notificationCountChanged(5);
- QCOMPARE(m_subject->text(), QString("5"));
- QVERIFY(m_subject->isVisible());
-
- // The notifier should not be visible when there are no notifications
- emit notificationCountChanged(0);
- QCOMPARE(m_subject->text(), QString("0"));
- QVERIFY(!m_subject->isVisible());
-}
-
-QTEST_APPLESS_MAIN(Ut_Notifier)
--- tests/ut_notifier/ut_notifier.h
+++ tests/ut_notifier/ut_notifier.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_NOTIFIER_H
-#define UT_NOTIFIER_H
-
-#include <QtTest/QtTest>
-#include <QObject>
-
-class MApplication;
-class Notifier;
-
-class Ut_Notifier : public QObject
-{
- Q_OBJECT
-
-private slots:
- // Called before the first testfunction is executed
- void initTestCase();
- // Called after the last testfunction was executed
- void cleanupTestCase();
- // Called before each testfunction is executed
- void init();
- // Called after every testfunction
- void cleanup();
-
- // Test cases
- void testNotificationCountChanged();
-
-signals:
- void notificationCountChanged(uint count);
-
-private:
- // MApplication
- MApplication *app;
- // The object being tested
- Notifier *m_subject;
-};
-
-#endif
--- tests/ut_notifier/ut_notifier.pro
+++ tests/ut_notifier/ut_notifier.pro
-include(../coverage.pri)
-include(../common_top.pri)
-TARGET = ut_notifier
-INCLUDEPATH += $$SRCDIR/statusarea $$SRCDIR/notifications
-
-# unit test and unit
-SOURCES += \
- ut_notifier.cpp \
- $$SRCDIR/statusarea/notifier.cpp
-
-# base classes
-SOURCES += \
-
-# helper classes
-SOURCES += \
- $$STUBSDIR\stubbase.cpp
-
-# unit test and unit
-HEADERS += \
- ut_notifier.h \
- $$SRCDIR/statusarea/notifier.h
-
-# base classes
-HEADERS += \
- $$SRCDIR/notifications/notificationsink.h \
- $$SRCDIR/notifications/notifiernotificationsink.h \
- $$SRCDIR/sysuid.h
-
-include(../common_bot.pri)
--- tests/ut_notifiernotificationsink/ut_notifiernotificationsink.cpp
+++ tests/ut_notifiernotificationsink/ut_notifiernotificationsink.cpp
@@ -20,6 +20,12 @@
#include "ut_notifiernotificationsink.h"
#include "notifiernotificationsink.h"
#include "notification.h"
+#include "sysuid_stub.h"
+#include "notificationmanager_stub.h"
+#include "eventtypestore_stub.h"
+#include "notificationgroup_stub.h"
+#include "genericnotificationparameterfactory.h"
+#include "ngfadapter_stub.h"
void Ut_NotifierNotificationSink::initTestCase()
{
@@ -34,8 +40,10 @@
m_subject = new NotifierNotificationSink();
connect(this, SIGNAL(addNotification(const Notification &)), m_subject, SLOT(addNotification(const Notification &)));
connect(this, SIGNAL(removeNotification(uint)), m_subject, SLOT(removeNotification(uint)));
- connect(this, SIGNAL(addGroup(uint, const NotificationParameters &)), m_subject, SLOT(addGroup(uint, const NotificationParameters &)));
connect(this, SIGNAL(removeGroup(uint)), m_subject, SLOT(removeGroup(uint)));
+
+ gNotificationManagerStub->stubReset();
+ gNGFAdapterStub->stubReset();
}
void Ut_NotifierNotificationSink::cleanup()
@@ -45,35 +53,25 @@
void Ut_NotifierNotificationSink::testAddNotification()
{
- QSignalSpy spy(m_subject, SIGNAL(notificationCountChanged(uint)));
+ QSignalSpy spy(m_subject, SIGNAL(notifierSinkActive(bool)));
// Adding a notification should cause a notification count change
NotificationParameters notification1Parameters;
- notification1Parameters.add("count", QVariant((uint)5));
Notification notification1(1, 0, 2, notification1Parameters, Notification::ApplicationEvent, 0);
emit addNotification(notification1);
QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.at(0).at(0).toInt(), 5);
-
- // Adding a new notification should cause a notification count change
- NotificationParameters notification2Parameters;
- notification2Parameters.add("count", QVariant((uint)8));
- Notification notification2(2, 0, 2, notification2Parameters, Notification::ApplicationEvent, 0);
- emit addNotification(notification2);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.at(1).at(0).toInt(), 13);
+ QList<QVariant> arguments = spy.at(0);
+ QCOMPARE(arguments.at(0).toBool(), true);
- // Updating the same notification should cause a notification count change
- notification2Parameters.add("count", QVariant((uint)6));
- notification2.setParameters(notification2Parameters);
+ // Adding a new notification should not send further signals
+ Notification notification2(2, 0, 2, notification1Parameters, Notification::ApplicationEvent, 0);
emit addNotification(notification2);
- QCOMPARE(spy.count(), 4);
- QCOMPARE(spy.at(3).at(0).toInt(), 11);
+ QCOMPARE(spy.count(), 1);
}
void Ut_NotifierNotificationSink::testAddSystemNotification()
{
- QSignalSpy spy(m_subject, SIGNAL(notificationCountChanged(uint)));
+ QSignalSpy spy(m_subject, SIGNAL(notifierSinkActive(bool)));
// Adding a system notification should cause no notification count change
NotificationParameters notification1Parameters;
@@ -85,78 +83,121 @@
void Ut_NotifierNotificationSink::testRemoveNotification()
{
- QSignalSpy spy(m_subject, SIGNAL(notificationCountChanged(uint)));
+ QSignalSpy spy(m_subject, SIGNAL(notifierSinkActive(bool)));
+
+ // Adding a notification should cause a notification count change
+ NotificationParameters notification1Parameters;
+ notification1Parameters.add("count", QVariant((uint)5));
+ Notification notification1(1, 0, 2, notification1Parameters, Notification::ApplicationEvent, 0);
+ Notification notification2(2, 0, 2, notification1Parameters, Notification::ApplicationEvent, 0);
+ emit addNotification(notification1);
+ emit addNotification(notification2);
+ QCOMPARE(m_subject->notificationCount, uint(2));
- // Removing an inexisting notification should do nothing
+ // Removing one notification does not do anything just changes the notification count
emit removeNotification(1);
- QCOMPARE(spy.count(), 0);
+ QCOMPARE(spy.count(), 1); // Only add sent a signal
+ QCOMPARE(m_subject->notificationCount, uint(1));
+
+ emit removeNotification(2);
+ QCOMPARE(spy.count(), 2); // Now a signal was sent as all notifications are removed
+ QCOMPARE(m_subject->notificationCount, uint(0));
+ QList<QVariant> arguments = spy.at(1);
+ QCOMPARE(arguments.at(0).toBool(), false);
+}
- // Removing an existing notification should inform about the change in notification count
+void Ut_NotifierNotificationSink::testClearSink()
+{
+ QSignalSpy spy(m_subject, SIGNAL(notifierSinkActive(bool)));
+
+ // Add two notifications
NotificationParameters notification1Parameters;
notification1Parameters.add("count", QVariant((uint)5));
Notification notification1(1, 0, 2, notification1Parameters, Notification::ApplicationEvent, 0);
+ NotificationParameters notification2Parameters;
+ notification2Parameters.add("count", QVariant((uint)8));
+ Notification notification2(2, 0, 2, notification2Parameters, Notification::ApplicationEvent, 0);
emit addNotification(notification1);
- emit removeNotification(1);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.at(1).at(0).toInt(), 0);
+ emit addNotification(notification2);
+ QCOMPARE(m_subject->notificationCount, uint(2));
- // Removing a notification should really remove the notification
- emit removeNotification(1);
- QCOMPARE(spy.count(), 2);
+ m_subject->clearSink();
+
+ QCOMPARE(spy.count(), 2); // One for addition and one for clear
+ QList<QVariant> arguments = spy.at(1);
+ QCOMPARE(arguments.at(0).toBool(), false); // check that the last call was for setting notifier inactive
+ QCOMPARE(m_subject->notificationCount, uint(0));
}
-void Ut_NotifierNotificationSink::testNotificationsInGroups()
+void Ut_NotifierNotificationSink::testDisablingNotificationAdditions()
{
- QSignalSpy spy(m_subject, SIGNAL(notificationCountChanged(uint)));
+ QSignalSpy spy(m_subject, SIGNAL(notifierSinkActive(bool)));
- // Creating a notification group should do nothing
- NotificationParameters parameters;
- parameters.add("count", QVariant((uint)8));
- emit addGroup(1, parameters);
- QCOMPARE(spy.count(), 0);
+ m_subject->disableNotificationAdditions(true);
- // Adding a notification into the group should cause a notification count change so that the group's count is used
+ // Try to add a notification while disabled
NotificationParameters notification1Parameters;
notification1Parameters.add("count", QVariant((uint)5));
- Notification notification1(1, 1, 2, notification1Parameters, Notification::ApplicationEvent, 0);
+ Notification notification1(1, 0, 2, notification1Parameters, Notification::ApplicationEvent, 0);
emit addNotification(notification1);
- QCOMPARE(spy.count(), 1);
- QCOMPARE(spy.at(0).at(0).toInt(), 8);
- // Adding a new notification into the same group should not cause a notification count change
+ QCOMPARE(spy.count(), 0);
+
+ m_subject->disableNotificationAdditions(false);
+
+ // Add a notification when enabled
NotificationParameters notification2Parameters;
notification2Parameters.add("count", QVariant((uint)8));
- Notification notification2(2, 1, 2, notification2Parameters, Notification::ApplicationEvent, 0);
+ Notification notification2(2, 0, 2, notification2Parameters, Notification::ApplicationEvent, 0);
emit addNotification(notification2);
- QCOMPARE(spy.count(), 1);
- // Updating the same notification should not cause a notification count change
- notification2Parameters.add("count", QVariant((uint)6));
- notification2.setParameters(notification2Parameters);
- emit addNotification(notification2);
QCOMPARE(spy.count(), 1);
+}
- // Updating the notification group should cause a notification count change
- parameters.add("count", QVariant((uint)13));
- emit addGroup(1, parameters);
- QCOMPARE(spy.count(), 2);
- QCOMPARE(spy.at(1).at(0).toInt(), 13);
-
- // Removing the second notification should not cause a notification count change
- emit removeNotification(2);
- QCOMPARE(spy.count(), 2);
+void Ut_NotifierNotificationSink::testSeenNotificationAddedThenNotifierNotUpdated()
+{
+ QSignalSpy spy(m_subject, SIGNAL(notifierSinkActive(bool)));
- // Removing the first notification should cause a notification count change
- emit removeNotification(1);
- QCOMPARE(spy.count(), 3);
- QCOMPARE(spy.at(2).at(0).toInt(), 0);
+ // Adding a seen notification should not cause a notification count change
+ NotificationParameters params;
+ params.add(GenericNotificationParameterFactory::unseenKey(), false);
+ Notification notification1(1, 0, 2, params, Notification::ApplicationEvent, 0);
+ emit addNotification(notification1);
+ QCOMPARE(spy.count(), 0);
+}
- // Removing a notification group with notifications in it should cause a notification count change
+void Ut_NotifierNotificationSink::addSystemNotification()
+{
+ NotificationParameters params;
+ Notification notification1(1, 0, 2, params, Notification::SystemEvent, 0);
emit addNotification(notification1);
- emit addNotification(notification2);
- emit removeGroup(1);
- QCOMPARE(spy.count(), 5);
- QCOMPARE(spy.at(4).at(0).toInt(), 0);
+}
+
+void Ut_NotifierNotificationSink::testWhenAddSystemNotificationNotificationIdIsStored()
+{
+ addSystemNotification();
+ QCOMPARE(m_subject->systemNotificationIds.count(), 1);
+}
+
+void Ut_NotifierNotificationSink::testWhenRemoveSystemNotificationNotificationIdIsRemoved()
+{
+ addSystemNotification();
+ m_subject->removeNotification(1);
+ QCOMPARE(m_subject->systemNotificationIds.count(), 0);
+}
+
+void Ut_NotifierNotificationSink::testNGFEvents()
+{
+ // Test that NGF start is called when notification is added
+ NotificationParameters notificationParameters;
+ notificationParameters.add("count", QVariant((uint)1));
+ Notification notification(1, 0, 2, notificationParameters, Notification::ApplicationEvent, 0);
+ emit addNotification(notification);
+ QCOMPARE(gNGFAdapterStub->stubCallCount("play"), 1);
+
+ // Test that NGF stop is called when last notification is removed
+ emit removeNotification(1);
+ QCOMPARE(gNGFAdapterStub->stubCallCount("stop"), 1);
}
QTEST_APPLESS_MAIN(Ut_NotifierNotificationSink)
--- tests/ut_notifiernotificationsink/ut_notifiernotificationsink.h
+++ tests/ut_notifiernotificationsink/ut_notifiernotificationsink.h
@@ -45,7 +45,12 @@
void testAddNotification();
void testAddSystemNotification();
void testRemoveNotification();
- void testNotificationsInGroups();
+ void testClearSink();
+ void testDisablingNotificationAdditions();
+ void testSeenNotificationAddedThenNotifierNotUpdated();
+ void testWhenAddSystemNotificationNotificationIdIsStored();
+ void testWhenRemoveSystemNotificationNotificationIdIsRemoved();
+ void testNGFEvents();
signals:
void addNotification(const Notification ¬ification);
@@ -56,6 +61,7 @@
private:
// The object being tested
NotifierNotificationSink *m_subject;
+ void addSystemNotification();
};
#endif
--- tests/ut_notifiernotificationsink/ut_notifiernotificationsink.pro
+++ tests/ut_notifiernotificationsink/ut_notifiernotificationsink.pro
@@ -15,16 +15,27 @@
$$SRCDIR/notifications/notificationparameter.cpp \
$$SRCDIR/notifications/notificationparameters.cpp
+# service classes
+SOURCES += $$STUBSDIR/stubbase.cpp
+
# unit test and unit
HEADERS += \
ut_notifiernotificationsink.h \
- $$SRCDIR/notifications/notifiernotificationsink.h \
+ $$SRCDIR/notifications/notifiernotificationsink.h
# base classes
HEADERS += \
$$SRCDIR/notifications/notificationsink.h \
$$SRCDIR/notifications/notification.h \
$$SRCDIR/notifications/notificationparameter.h \
- $$SRCDIR/notifications/notificationparameters.h
+ $$SRCDIR/notifications/notificationparameters.h \
+ $$SRCDIR/sysuid.h \
+ $$SRCDIR/notifications/notificationmanager.h \
+ $$SRCDIR/notifications/notificationgroup.h \
+ $$SRCDIR/notifications/eventtypestore.h \
+ $$SRCDIR/notifications/ngfadapter.h
+
+# service classes
+HEADERS += $$STUBSDIR/stubbase.h
include(../common_bot.pri)
--- tests/ut_pluginlist
+++ tests/ut_pluginlist
-(directory)
--- tests/ut_pluginlist/ut_pluginlist.cpp
+++ tests/ut_pluginlist/ut_pluginlist.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 <MApplication>
-#include <MSceneWindow>
-#include <MButton>
-#include <QGraphicsLinearLayout>
-#include "ut_pluginlist.h"
-#include "pluginlist.h"
-#include "pannedwidgetcontroller_stub.h"
-#include "statusindicatormenuwindow_stub.h"
-
-// QPluginLoader stubs (used by PluginList)
-QObject *QPluginLoader::instance()
-{
- if(!QFileInfo(fileName()).absolutePath().endsWith(APPLICATION_EXTENSION_DIR)) {
- Ut_PluginList::loadedPlugins.append(fileName());
- }
-
- return new TestPlugin;
-}
-
-bool QPluginLoader::load()
-{
- return true;
-}
-
-MWidget *TestPlugin::constructWidget(MStatusIndicatorMenuInterface &)
-{
- return new MWidget;
-}
-
-bool Ut_PluginList::windowMinimized;
-QStringList Ut_PluginList::loadedPlugins;
-
-void Ut_PluginList::initTestCase()
-{
- static int argc = 1;
- static char *app_name = (char *)"./ut_pluginlist";
- app = new MApplication(argc, &app_name);
- window = new StatusIndicatorMenuWindow;
-}
-
-void Ut_PluginList::cleanupTestCase()
-{
- delete window;
- delete app;
-}
-
-void Ut_PluginList::init()
-{
- gStatusIndicatorMenuWindowStub->stubReset();
- loadedPlugins.clear();
- pluginList = new PluginList(window);
-}
-
-void Ut_PluginList::cleanup()
-{
- delete pluginList;
-}
-
-void Ut_PluginList::testInitialization()
-{
- for (int i = 0; i < 9; i++) {
- // Process the delayed loading timer events
- QCoreApplication::processEvents();
- }
-
- // The layout should contain a widget for each plugin plus one for the top row
- QGraphicsLinearLayout *layout = dynamic_cast<QGraphicsLinearLayout *>(pluginList->layout());
- QVERIFY(layout != NULL);
- QCOMPARE(loadedPlugins.count(), 9);
- QCOMPARE(layout->count(), loadedPlugins.count());
-}
-
-void Ut_PluginList::testShowStatusIndicatorMenu()
-{
- pluginList->showStatusIndicatorMenu();
-
- QCOMPARE(gStatusIndicatorMenuWindowStub->stubCallCount("showStatusIndicatorMenu"), 1);
-}
-
-void Ut_PluginList::testHideStatusIndicatorMenu()
-{
- pluginList->hideStatusIndicatorMenu();
-
- QCOMPARE(gStatusIndicatorMenuWindowStub->stubCallCount("hideStatusIndicatorMenu"), 1);
-}
-
-QTEST_APPLESS_MAIN(Ut_PluginList)
--- tests/ut_pluginlist/ut_pluginlist.h
+++ tests/ut_pluginlist/ut_pluginlist.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_PLUGINLIST_H
-#define UT_PLUGINLIST_H
-
-#include <QtTest/QtTest>
-#include <QObject>
-#include <MStatusIndicatorMenuPluginInterface>
-
-class MApplication;
-class StatusIndicatorMenuWindow;
-class PluginList;
-
-class TestPlugin : public QObject, MStatusIndicatorMenuPluginInterface
-{
- Q_OBJECT
- Q_INTERFACES(MStatusIndicatorMenuPluginInterface)
-
-public:
- virtual MWidget *constructWidget(MStatusIndicatorMenuInterface &);
-};
-
-class Ut_PluginList : public QObject
-{
- Q_OBJECT
-
-public:
- static bool windowMinimized;
- static QStringList loadedPlugins;
-
-private slots:
- // Called before the first testfunction is executed
- void initTestCase();
- // Called after the last testfunction was executed
- void cleanupTestCase();
- // Called before each testfunction is executed
- void init();
- // Called after every testfunction
- void cleanup();
-
- // Test initialization
- void testInitialization();
- // Test returning from a subpage
- void testShowStatusIndicatorMenu();
- // Test hiding the application
- void testHideStatusIndicatorMenu();
-
-private:
- // MApplication
- MApplication *app;
- // Window for testing
- StatusIndicatorMenuWindow *window;
- // The object being tested
- PluginList *pluginList;
-};
-
-#endif
--- tests/ut_pluginlist/ut_pluginlist.pro
+++ tests/ut_pluginlist/ut_pluginlist.pro
-include(../coverage.pri)
-include(../common_top.pri)
-TARGET = ut_pluginlist
-
-INCLUDEPATH += $$SRCDIR/statusindicatormenu
-
-# unit test and unit
-SOURCES += \
- $$SRCDIR/debug.cpp \
- ut_pluginlist.cpp \
- $$SRCDIR/statusindicatormenu/pluginlist.cpp
-
-# unit test and unit
-HEADERS += \
- $$SRCDIR/debug.h \
- ut_pluginlist.h \
- $$SRCDIR/statusindicatormenu/pluginlist.h \
-
-
-# service classes
-SOURCES += \
- $$STUBSDIR/stubbase.cpp
-
-# service classes
-HEADERS += \
- $$SRCDIR/statusindicatormenu/statusindicatormenuwindow.h
-
-include(../common_bot.pri)
--- tests/ut_shutdownbusinesslogic/ut_shutdownbusinesslogic.cpp
+++ tests/ut_shutdownbusinesslogic/ut_shutdownbusinesslogic.cpp
@@ -28,6 +28,7 @@
#include <MNotification>
#include <MFeedback>
+MApplication *exitPtr;
#define DEBUG
#include "../../src/debug.h"
@@ -37,6 +38,7 @@
*/
ShutdownUI::ShutdownUI ()
{
+ m_Delay = 0;
}
bool
@@ -66,6 +68,8 @@
{
SYS_DEBUG ("*** body = %s", SYS_STR(body()));
bodyOfLastNotification = body();
+
+ return true;
}
/******************************************************************************
@@ -123,12 +127,12 @@
QVERIFY (m_Api->m_Ui->m_Delay == 50);
}
+#ifdef HAVE_QMSYSTEM
void
Ut_ShutdownBusinessLogic::testSystemStateChanged ()
{
m_Api->systemStateChanged (Maemo::QmSystemState::BatteryStateEmpty);
- QVERIFY (bodyOfLastNotification == "qtn_shut_will_shut_down");
- QVERIFY (nameOfLastFeedback == "IDF_RECHARGE_BATTERY");
+ QVERIFY (bodyOfLastNotification == "qtn_shut_batt_empty");
m_Api->systemStateChanged (Maemo::QmSystemState::ShutdownDeniedUSB);
QVERIFY (bodyOfLastNotification == "qtn_shut_unplug_usb");
@@ -136,13 +140,13 @@
m_Api->systemStateChanged (Maemo::QmSystemState::ThermalStateFatal);
QVERIFY (bodyOfLastNotification == "qtn_shut_high_temp");
- QVERIFY (nameOfLastFeedback == "IDF_INFORMATION_STRONG");
m_Api->systemStateChanged (Maemo::QmSystemState::Shutdown);
QVERIFY (m_Api->m_Ui->m_Text1.isEmpty());
QVERIFY (m_Api->m_Ui->m_Text2.isEmpty());
QVERIFY (m_Api->m_Ui->m_Delay == 2000);
}
+#endif
QTEST_APPLESS_MAIN(Ut_ShutdownBusinessLogic)
--- tests/ut_shutdownbusinesslogic/ut_shutdownbusinesslogic.h
+++ tests/ut_shutdownbusinesslogic/ut_shutdownbusinesslogic.h
@@ -24,7 +24,6 @@
#include <QtTest/QtTest>
#include <QObject>
#include <QPointer>
-#include "../ft_lockscreenui/xchecker.h"
class MApplication;
class MApplicationWindow;
@@ -54,10 +53,11 @@
void cleanupTestCase();
void testShowUI ();
+#ifdef HAVE_QMSYSTEM
void testSystemStateChanged ();
+#endif
private:
- XChecker m_XChecker;
MApplication *m_App;
QPointer <ShutdownBusinessLogic> m_Api;
};
--- tests/ut_shutdownbusinesslogic/ut_shutdownbusinesslogic.pro
+++ tests/ut_shutdownbusinesslogic/ut_shutdownbusinesslogic.pro
@@ -10,13 +10,11 @@
$$STUB_PREFIX
SOURCES += \
- ../ft_lockscreenui/xchecker.cpp \
ut_shutdownbusinesslogic.cpp \
$$SRC_PREFIX/debug.cpp \
$$SRC_PREFIX/shutdownbusinesslogic.cpp
HEADERS += \
- ../ft_lockscreenui/xchecker.h \
ut_shutdownbusinesslogic.h \
$$SRC_PREFIX/debug.h \
$$SRC_PREFIX/shutdownbusinesslogic.h
--- tests/ut_shutdownui/ut_shutdownui.cpp
+++ tests/ut_shutdownui/ut_shutdownui.cpp
@@ -26,7 +26,6 @@
#include <MApplication>
#include <MWindow>
#include <MNotification>
-#include <MFeedback>
#ifdef HAVE_QMSYSTEM
#include <qmdisplaystate.h>
@@ -44,14 +43,19 @@
QmDisplayState::set(
DisplayState state)
{
+ Q_UNUSED (state);
+
SYS_DEBUG ("*************");
//m_State = state;
return dimmingShouldSucceed;
}
#endif
+
/******************************************************************************
* The stub for MFeedback class.
*/
+#include <MFeedback>
+
static QString nameOfLastFeedback;
void
@@ -103,7 +107,7 @@
QVERIFY (m_Api->m_Feedback);
QVERIFY (m_Api->m_Label1);
QVERIFY (m_Api->m_Label2);
- QVERIFY (m_Api->m_Image);
+ QVERIFY (m_Api->m_logo);
QVERIFY (m_Api->m_SceneWindow);
/*
@@ -115,7 +119,9 @@
m_Api->turnOffScreen ();
+#ifdef HAVE_QMSYSTEM
dimmingShouldSucceed = false;
+#endif
m_Api->turnOffScreen ();
}
@@ -139,8 +145,9 @@
QVERIFY (m_Api->m_Feedback);
QVERIFY (m_Api->m_Label1);
QVERIFY (m_Api->m_Label2);
- QVERIFY (m_Api->m_Image);
+ QVERIFY (m_Api->m_logo);
QVERIFY (m_Api->m_SceneWindow);
+ QVERIFY (nameOfLastFeedback == "power-off");
}
QTEST_APPLESS_MAIN(Ut_ShutdownUI)
--- tests/ut_statusarearenderer/ut_statusarearenderer.h
+++ tests/ut_statusarearenderer/ut_statusarearenderer.h
@@ -54,6 +54,8 @@
void cleanupTestCase();
// Test scene changed events render the scene
void testSceneChanged();
+ // Test shared pixmap handle
+ void testSharedPixmapHandle();
#ifdef HAVE_QMSYSTEM
// Test rendering happens when display state is on
void testSceneRenderControlDisplayStateOn();
@@ -63,8 +65,6 @@
void testSceneRenderControlDisplayStateDimmed();
// Test MOnDisplayChangeEvent dispatching
void testMOnDisplayChangeEvent();
- // Test shared pixmap handle
- void testSharedPixmapHandle();
#endif
};
--- tests/ut_statusareaview/ut_statusareaview.cpp
+++ tests/ut_statusareaview/ut_statusareaview.cpp
@@ -20,7 +20,6 @@
#include "statusareaview.h"
#include "statusarea.h"
#include "clock_stub.h"
-#include "notifier_stub.h"
#include "contextframeworkcontext_stub.h"
#include "alarmstatusindicator_stub.h"
#include "batterystatusindicator_stub.h"
@@ -36,6 +35,7 @@
#include "callstatusindicator_stub.h"
#include "profilestatusindicator_stub.h"
#include "notificationarea_stub.h"
+#include "notificationstatusindicator_stub.h"
#include "statusindicatormenuadaptor_stub.h"
#include <MSceneWindow>
#include <QGraphicsLayout>
--- tests/ut_statusareaview/ut_statusareaview.pro
+++ tests/ut_statusareaview/ut_statusareaview.pro
@@ -13,8 +13,7 @@
ut_statusareaview.cpp \
$$SRCDIR/statusarea/statusareaview.cpp \
$$SRCDIR/statusarea/statusarea.cpp \
- $$SRCDIR/statusindicatormenu/statusindicatormenuwindow.cpp \
- $$SRCDIR/statusindicatormenu/pluginlist.cpp
+ $$SRCDIR/statusindicatormenu/statusindicatormenuwindow.cpp
# service classes
SOURCES += ../stubs/stubbase.cpp
@@ -27,12 +26,11 @@
$$SRCDIR/statusarea/statusareamodel.h \
$$SRCDIR/statusarea/statusareaview.h \
$$SRCDIR/statusarea/statusarea.h \
- $$SRCDIR/statusarea/notifier.h \
$$SRCDIR/statusarea/clock.h \
$$SRCDIR/statusarea/statusindicator.h \
$$SRCDIR/statusindicatormenu/statusindicatormenuwindow.h \
$$SRCDIR/statusindicatormenu/statusindicatormenuadaptor.h \
- $$SRCDIR/statusindicatormenu/pluginlist.h
+ $$SRCDIR/notifications/notificationstatusindicator.h
# service classes
HEADERS += \
--- tests/ut_statusindicator/ut_statusindicator.cpp
+++ tests/ut_statusindicator/ut_statusindicator.cpp
@@ -17,6 +17,7 @@
**
****************************************************************************/
+#include <QtTest/QtTest>
#include <MOnDisplayChangeEvent>
#include "ut_statusindicator.h"
#include "statusindicator.h"
@@ -24,6 +25,10 @@
#include "testcontextitem.h"
#include "inputmethodstatusindicatoradaptor_stub.h"
+#ifdef HAVE_QMSYSTEM
+#include <qmdevicemode_stub.h>
+#endif
+
QHash<QString, TestContextItem *> testContextItems;
// Test context
@@ -71,8 +76,7 @@
void Ut_StatusIndicator::cleanup()
{
- if (m_subject)
- delete m_subject;
+ delete m_subject;
delete testContext;
}
@@ -104,7 +108,7 @@
// When the application is not visible the model should not be updated
qApp->sendEvent(m_subject, &exitDisplayEvent);
m_subject->setValue(QVariant(false));
- QCOMPARE(m_subject->model()->value(), QVariant(1));
+ QCOMPARE(m_subject->model()->value(), QVariant(1));
// When the application becomes visible the model should be updated
qApp->sendEvent(m_subject, &enterDisplayEvent);
@@ -154,7 +158,7 @@
statusIndicator->setView(new TestStatusIndicatorIconView(statusIndicator));
m_subject = statusIndicator;
- testContextItems["Cellular.SignalStrength"]->setValue(QVariant(100));
+ testContextItems["Cellular.SignalBars"]->setValue(QVariant(5));
QVERIFY(statusIndicator->model()->value().type() == QVariant::Double);
QCOMPARE(qRound(statusIndicator->model()->value().toDouble() * 100), 100);
@@ -209,14 +213,45 @@
QVERIFY(m_subject->objectName().indexOf("Charging") >= 0);
}
+#ifdef HAVE_QMSYSTEM
+void Ut_StatusIndicator::testBatteryWhenQmSystemAvailable()
+{
+ // tests all possible four combinations of states for testContext
+ m_subject = new BatteryStatusIndicator(*testContext);
+
+ // battery not charging and power save off
+ testContextItems["Battery.IsCharging"]->setValue(QVariant(false));
+ qobject_cast<BatteryStatusIndicator*>(m_subject)->batterySaveModeChanged(Maemo::QmDeviceMode::PSMStateOff);
+ QVERIFY(m_subject->objectName().indexOf("Level") >= 0);
+
+ // battery not charging, but power save on
+ testContextItems["Battery.IsCharging"]->setValue(QVariant(false));
+ qobject_cast<BatteryStatusIndicator*>(m_subject)->batterySaveModeChanged(Maemo::QmDeviceMode::PSMStateOn);
+ QVERIFY(m_subject->objectName().indexOf("PowerSave") >= 0);
+ QVERIFY(m_subject->objectName().indexOf("Charging") < 0);
+
+ // battery charging, but power save off
+ testContextItems["Battery.IsCharging"]->setValue(QVariant(true));
+ qobject_cast<BatteryStatusIndicator*>(m_subject)->batterySaveModeChanged(Maemo::QmDeviceMode::PSMStateOff);
+ QVERIFY(m_subject->objectName().indexOf("Charging") >= 0);
+ QVERIFY(m_subject->objectName().indexOf("PowerSave") < 0);
+
+ // battery charging and power save on
+ testContextItems["Battery.IsCharging"]->setValue(QVariant(true));
+ qobject_cast<BatteryStatusIndicator*>(m_subject)->batterySaveModeChanged(Maemo::QmDeviceMode::PSMStateOn);
+ QVERIFY(m_subject->objectName().indexOf("PowerSaveCharging") >= 0);
+}
+#endif
+
+
void Ut_StatusIndicator::testAlarm()
{
m_subject = new AlarmStatusIndicator(*testContext);
- testContextItems["UserAlarm.Present"]->setValue(QVariant(false));
+ testContextItems["Alarm.Present"]->setValue(QVariant(false));
QVERIFY(m_subject->objectName().indexOf("Set") < 0);
- testContextItems["UserAlarm.Present"]->setValue(QVariant(true));
+ testContextItems["Alarm.Present"]->setValue(QVariant(true));
QVERIFY(m_subject->objectName().indexOf("Set") >= 0);
}
@@ -352,45 +387,75 @@
QCOMPARE(statusIndicator->model()->value(), QVariant("test"));
}
+// keep these in sync with the context framework!
+static const QString CONTEXT_CALLSTATE_ALERTING = "alerting";
+static const QString CONTEXT_CALLSTATE_KNOCKING = "knocking";
+static const QString CONTEXT_CALLSTATE_ACTIVE = "active";
+static const QString CONTEXT_CALLSTATE_INACTIVE = "inactive";
+
+void Ut_StatusIndicator::testCall_data()
+{
+ QTest::addColumn<QVariant>("stateToSet");
+ QTest::addColumn<QVariant>("modelValue");
+ QTest::addColumn<bool>("ringingStyleEnabled");
+ QTest::addColumn<bool>("ongoingStyleEnabled");
+ QTest::addColumn<QVariant>("muted");
+
+ QTest::newRow("inactive") << QVariant(CONTEXT_CALLSTATE_INACTIVE)
+ << QVariant(0)
+ << false << false << QVariant(false);
+
+ QTest::newRow("alerting") << QVariant(CONTEXT_CALLSTATE_ALERTING)
+ << QVariant(0)
+ << true << false << QVariant(false);
+
+ QTest::newRow("active") << QVariant(CONTEXT_CALLSTATE_ACTIVE)
+ << QVariant(0)
+ << false << true << QVariant(false);
+
+ QTest::newRow("knocking") << QVariant(CONTEXT_CALLSTATE_KNOCKING)
+ << QVariant(0)
+ << true << false << QVariant(false);
+
+ QTest::newRow("inactive_muted") << QVariant(CONTEXT_CALLSTATE_INACTIVE)
+ << QVariant(0)
+ << false << false << QVariant(true);
+
+ QTest::newRow("alerting_muted") << QVariant(CONTEXT_CALLSTATE_ALERTING)
+ << QVariant(0)
+ << true << false << QVariant(true);
+
+ QTest::newRow("active_muted") << QVariant(CONTEXT_CALLSTATE_ACTIVE)
+ << QVariant(1)
+ << false << true << QVariant(true);
+
+ QTest::newRow("knocking_muted") << QVariant(CONTEXT_CALLSTATE_KNOCKING)
+ << QVariant(0)
+ << true << false << QVariant(true);
+}
+
void Ut_StatusIndicator::testCall()
{
m_subject = new CallStatusIndicator(*testContext);
- testContextItems["Phone.Call"]->setValue(QVariant("inactive"));
- QVERIFY(m_subject->model()->value().type() == QVariant::Int);
- QCOMPARE(m_subject->model()->value(), QVariant(0));
- QVERIFY(m_subject->objectName().indexOf("Ringing") < 0);
- QVERIFY(m_subject->objectName().indexOf("Ongoing") < 0);
+ QFETCH(QVariant, stateToSet);
+ testContextItems["Phone.Call"]->setValue(stateToSet);
- testContextItems["Phone.Call"]->setValue(QVariant("ringing"));
- QVERIFY(m_subject->objectName().indexOf("Ringing") >= 0);
- QCOMPARE(m_subject->model()->value(), QVariant(0));
+ QFETCH(QVariant, muted);
+ testContextItems["Phone.Muted"]->setValue(muted);
- testContextItems["Phone.Call"]->setValue(QVariant("active"));
- QVERIFY(m_subject->objectName().indexOf("Ongoing") >= 0);
- QCOMPARE(m_subject->model()->value(), QVariant(0));
+ QCOMPARE(m_subject->model()->value().type(), QVariant::Int);
- testContextItems["Phone.Call"]->setValue(QVariant("knocking"));
- QVERIFY(m_subject->objectName().indexOf("Ringing") >= 0);
- QCOMPARE(m_subject->model()->value(), QVariant(0));
-
- testContextItems["Phone.Call"]->setValue(QVariant("inactive"));
- testContextItems["Phone.Muted"]->setValue(QVariant(true));
- QVERIFY(m_subject->objectName().indexOf("Ringing") < 0);
- QVERIFY(m_subject->objectName().indexOf("Ongoing") < 0);
- QCOMPARE(m_subject->model()->value(), QVariant(0));
+ QFETCH(QVariant, modelValue);
+ QCOMPARE(m_subject->model()->value(), modelValue);
- testContextItems["Phone.Call"]->setValue(QVariant("ringing"));
- QVERIFY(m_subject->objectName().indexOf("Ringing") >= 0);
- QCOMPARE(m_subject->model()->value(), QVariant(0));
+ QFETCH(bool, ringingStyleEnabled);
+ QCOMPARE((bool)m_subject->objectName().contains("Ringing"),
+ ringingStyleEnabled);
- testContextItems["Phone.Call"]->setValue(QVariant("active"));
- QVERIFY(m_subject->objectName().indexOf("Ongoing") >= 0);
- QCOMPARE(m_subject->model()->value(), QVariant(1));
-
- testContextItems["Phone.Call"]->setValue(QVariant("knocking"));
- QVERIFY(m_subject->objectName().indexOf("Ringing") >= 0);
- QCOMPARE(m_subject->model()->value(), QVariant(0));
+ QFETCH(bool, ongoingStyleEnabled);
+ QCOMPARE((bool)m_subject->objectName().contains("Ongoing"),
+ ongoingStyleEnabled);
}
void Ut_StatusIndicator::testProfile()
--- tests/ut_statusindicator/ut_statusindicator.h
+++ tests/ut_statusindicator/ut_statusindicator.h
@@ -77,6 +77,9 @@
void testPhoneNetworkSignalStrength();
void testPhoneNetworkType();
void testBattery();
+#ifdef HAVE_QMSYSTEM
+ void testBatteryWhenQmSystemAvailable();
+#endif
void testAlarm();
void testBluetooth();
void testPresence();
@@ -84,6 +87,7 @@
void testAnimation();
void testPhoneNetwork();
void testInputMethod();
+ void testCall_data();
void testCall();
void testProfile();
void testGPS();
--- tests/ut_statusindicator/ut_statusindicator.pro
+++ tests/ut_statusindicator/ut_statusindicator.pro
@@ -16,7 +16,6 @@
$$SRCDIR/statusarea/statusindicatoranimationview.cpp \
$$SRCDIR/statusarea/statusindicatorlabelview.cpp \
$$SRCDIR/statusarea/statusindicatoriconview.cpp
-
# helper classes
SOURCES += \
$$STUBSDIR/testcontextitem.cpp \
@@ -30,7 +29,7 @@
$$SRCDIR/statusarea/statusindicatoranimationstyle.h \
$$SRCDIR/statusarea/statusindicatorlabelstyle.h \
$$SRCDIR/statusarea/statusindicatoriconstyle.h \
- $$SRCDIR/statusarea/statusindicatormodel.h \
+ $$SRCDIR/statusarea/statusindicatormodel.h
# helper classes
HEADERS += \
--- tests/ut_statusindicatoranimationview/ut_statusindicatoranimationview.cpp
+++ tests/ut_statusindicatoranimationview/ut_statusindicatoranimationview.cpp
@@ -16,7 +16,6 @@
** of this file.
**
****************************************************************************/
-
#include <QtTest/QtTest>
#include <MApplication>
#include "ut_statusindicatoranimationview.h"
@@ -52,23 +51,32 @@
return s;
}
+void TestStatusIndicatorAnimationView::setModeIcon()
+{
+ StatusIndicatorAnimationStyleContainer &sc = style();
+ sc.setModeIcon();
+}
+
// MTheme stubs
QHash<QPixmap *, QString> mThemePixmapPixmaps;
+QHash<QString, QSize> mThemePixmapSizes;
+
QPixmap *MTheme::pixmapCopy(const QString &id, const QSize &)
{
- QPixmap *p = new QPixmap;
+ QPixmap *p = new QPixmap(mThemePixmapSizes[id]);
mThemePixmapPixmaps[p] = id;
-
return p;
}
// QPainter stubs
-QList<QPointF> qPainterDrawPixmapPoints;
+QList<QRectF> qPainterDrawPixmapRects;
QList<const QPixmap *> qPainterDrawPixmapPixmaps;
-void QPainter::drawPixmap(const QPointF &point, const QPixmap &pixmap)
+
+void QPainter::drawPixmap ( const QRectF & target, const QPixmap & pixmap, const QRectF & source )
{
- qPainterDrawPixmapPoints.append(point);
+ Q_UNUSED(source)
qPainterDrawPixmapPixmaps.append(&pixmap);
+ qPainterDrawPixmapRects.append(target);
}
// QTimeLine stubs
@@ -121,7 +129,8 @@
void Ut_StatusIndicatorAnimationView::init()
{
mThemePixmapPixmaps.clear();
- qPainterDrawPixmapPoints.clear();
+ mThemePixmapSizes.clear();
+ qPainterDrawPixmapRects.clear();
qPainterDrawPixmapPixmaps.clear();
qTimeLineDuration = -1;
qTimeLineFrameRange = qMakePair(-1, -1);
@@ -151,7 +160,7 @@
{
m_subject->getModel()->setValue("1 2");
// Check that images are not loaded until they are used
- QCOMPARE(mThemePixmapPixmaps.size(), 0);
+ QCOMPARE(mThemePixmapPixmaps.size(), 1);
}
void Ut_StatusIndicatorAnimationView::testSetAnimationFrame()
@@ -159,12 +168,18 @@
// Test that the latest image list is used
controller->setGeometry(QRectF(0, 0, 50, 50));
m_subject->getModel()->setValue("3 4");
+
+ // Since the setValue call will delete the images created
+ // by this test we must make sure that our internal QHash
+ // stays in sync as well
+ mThemePixmapPixmaps.clear();
m_subject->getModel()->setValue("1 2");
+
QPainter painter;
// Check that correct images get loaded from the theme and drawn
- m_subject->setAnimationFrame(0);
m_subject->callableDrawContents(&painter, NULL);
+
QCOMPARE(mThemePixmapPixmaps.size(), 1);
QVERIFY(mThemePixmapPixmaps.key("1") != NULL);
QCOMPARE(qPainterDrawPixmapPixmaps.size(), 1);
@@ -173,6 +188,8 @@
qPainterDrawPixmapPixmaps.clear();
m_subject->setAnimationFrame(1);
m_subject->callableDrawContents(&painter, NULL);
+
+ // Now there are two images loaded since we advanced the frame
QCOMPARE(mThemePixmapPixmaps.size(), 2);
QVERIFY(mThemePixmapPixmaps.key("2") != NULL);
QCOMPARE(qPainterDrawPixmapPixmaps.size(), 1);
@@ -238,6 +255,9 @@
QCOMPARE(qTimeLineDuration, 33);
QCOMPARE(qTimeLineFrameRange, qMakePair(0, 3));
QCOMPARE(qTimeLineUpdateInterval, 11);
+ m_subject->setFirstAnimationFrame(1);
+ QCOMPARE(qTimeLineFrameRange, qMakePair(1, 3));
+ QCOMPARE(qTimeLineUpdateInterval, 16);
}
void Ut_StatusIndicatorAnimationView::testChangingAnimate()
@@ -271,11 +291,48 @@
m_subject->getModel()->setValue("1 2");
QPainter painter;
- // Nothing should be loaded or drawn
+ // Setting the animation frame causes the current frame to be loaded
+ // -> first image loaded, but nothing drawn
m_subject->setAnimationFrame(0);
m_subject->callableDrawContents(&painter, NULL);
- QCOMPARE(mThemePixmapPixmaps.size(), 0);
+ QCOMPARE(mThemePixmapPixmaps.size(), 1);
QCOMPARE(qPainterDrawPixmapPixmaps.size(), 0);
}
+void Ut_StatusIndicatorAnimationView::testSizeHintWhenUsingIconSizes()
+{
+ // Set up the theme part...
+ m_subject->setModeIcon();
+ m_subject->modifiableStyle()->setUseIconSize(true);
+
+ int size = 10;
+ QString imageKey("my-icon");
+ QSizeF imageSize(size, size);
+ QRectF imageRect(QPointF(0, 0), imageSize);
+
+
+ mThemePixmapSizes[imageKey] = imageSize.toSize();
+ QVERIFY(m_subject->modifiableStyle()->useIconSize());
+ m_subject->getModel()->setValue(imageKey);
+
+ m_subject->sizeHint(Qt::PreferredSize, QSizeF());
+
+ // Test the widgets size
+ QCOMPARE(m_subject->sizeHint(Qt::PreferredSize, QSizeF()), imageSize);
+
+ QCOMPARE(mThemePixmapPixmaps.size(), 1);
+ QVERIFY(mThemePixmapPixmaps.key(imageKey) != NULL);
+
+ QCOMPARE(mThemePixmapPixmaps.key(imageKey)->size().width(), size);
+ QCOMPARE(mThemePixmapPixmaps.key(imageKey)->size().height(), size);
+
+ // Test that the painting happens correctly
+ controller->setGeometry(imageRect);
+
+ QPainter painter;
+ m_subject->callableDrawContents(&painter, NULL);
+
+ QCOMPARE(qPainterDrawPixmapRects[0], imageRect);
+}
+
QTEST_APPLESS_MAIN(Ut_StatusIndicatorAnimationView)
--- tests/ut_statusindicatoranimationview/ut_statusindicatoranimationview.h
+++ tests/ut_statusindicatoranimationview/ut_statusindicatoranimationview.h
@@ -42,6 +42,7 @@
StatusIndicatorAnimationStyle *modifiableStyle();
+ void setModeIcon();
};
class TestStyleContainer : public MStyleContainer
@@ -73,7 +74,7 @@
void testSetAnimationDuration();
void testChangingAnimate();
void testPaintingWhenSizeIsZero();
-
+ void testSizeHintWhenUsingIconSizes();
private:
// MApplication
MApplication *app;
--- tests/ut_statusindicatoranimationview/ut_statusindicatoranimationview.pro
+++ tests/ut_statusindicatoranimationview/ut_statusindicatoranimationview.pro
@@ -2,7 +2,7 @@
include(../common_top.pri)
TARGET = ut_statusindicatoranimationview
-INCLUDEPATH += $$SRCDIR/statusarea
+INCLUDEPATH += $$SRCDIR/statusarea $$SRCDIR/notifications $$SRCDIR
STYLE_HEADERS += $$SRCDIR/statusarea/statusindicatoranimationstyle.h
MODEL_HEADERS += $$SRCDIR/statusarea/statusindicatormodel.h
--- tests/ut_statusindicatoriconview/ut_statusindicatoriconview.cpp
+++ tests/ut_statusindicatoriconview/ut_statusindicatoriconview.cpp
@@ -91,6 +91,8 @@
emit updateData(modifications);
QCOMPARE(gStatusIndicatorAnimationViewStub->stubCallCount("setAnimationFrame"), 1);
QCOMPARE(gStatusIndicatorAnimationViewStub->stubLastCallTo("setAnimationFrame").parameter<int>(0), 3);
+ QCOMPARE(gStatusIndicatorAnimationViewStub->stubCallCount("setFirstAnimationFrame"), 1);
+ QCOMPARE(gStatusIndicatorAnimationViewStub->stubLastCallTo("setFirstAnimationFrame").parameter<int>(0), 3);
}
void Ut_StatusIndicatorIconView::testApplyStyle()
--- tests/ut_statusindicatormenuwindow/ut_statusindicatormenuwindow.cpp
+++ tests/ut_statusindicatormenuwindow/ut_statusindicatormenuwindow.cpp
@@ -1,3 +1,4 @@
+
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
@@ -27,11 +28,14 @@
#include <MOverlay>
#include <MButton>
#include <QGraphicsLinearLayout>
-#include "pluginlist_stub.h"
#include "notificationarea_stub.h"
#include <MPannableViewport>
#include "x11wrapper_stub.h"
+#ifdef HAVE_QMSYSTEM
+#include "qmlocks_stub.h"
+#endif
+
// MApplicationIfProxy stubs (used by StatusIndicatorMenuWindow)
bool mApplicationIfProxyLaunchCalled = false;
QDBusPendingReply<> MApplicationIfProxy::launch()
@@ -107,6 +111,9 @@
statusIndicatorMenuWindow = new StatusIndicatorMenuWindow;
gSetVisible.first = 0;
gSetVisible.second = false;
+#ifdef HAVE_QMSYSTEM
+ gQmLocksStub->stubSetReturnValue("getState", Maemo::QmLocks::Unlocked);
+#endif
mApplicationIfProxyLaunchCalled = false;
connect(this, SIGNAL(settingsButtonClicked()), statusIndicatorMenuWindow, SLOT(launchControlPanelAndHide()));
connect(this, SIGNAL(positionOrSizeChanged()), statusIndicatorMenuWindow, SLOT(setPannabilityAndLayout()));
@@ -134,6 +141,14 @@
statusIndicatorMenuWindow->hide();
QVERIFY(gSetVisible.first == statusIndicatorMenuWindow && !gSetVisible.second);
statusIndicatorMenuWindow->makeVisible();
+
+#ifdef HAVE_QMSYSTEM
+ if (statusIndicatorMenuWindow->deviceLocked) {
+ QVERIFY(gSetVisible.first == statusIndicatorMenuWindow && !gSetVisible.second);
+ return;
+ }
+#endif
+
QVERIFY(gSetVisible.first == statusIndicatorMenuWindow && gSetVisible.second);
}
@@ -184,8 +199,13 @@
QGraphicsSceneMouseEvent event;
// Set the event position close to the bottom edge, just inside the widget
event.setPos(QPointF(0, pannedWidget->geometry().height() - 1));
+
+ // Check that if the mouse is pressed but not released, then window is not closed
pannedWidget->mousePressEvent(&event);
+ QVERIFY(gSetVisible.first != statusIndicatorMenuWindow && !gSetVisible.second);
+ // Check that window is closed when mouse is released
+ pannedWidget->mouseReleaseEvent(&event);
QVERIFY(gSetVisible.first == statusIndicatorMenuWindow && !gSetVisible.second);
}
@@ -224,16 +244,25 @@
void Ut_StatusIndicatorMenuWindow::testPannableAreaBackgroundWidget()
{
- // When the pannable viewport has not been panned the background height should be 0
- statusIndicatorMenuWindow->pannableViewport->widget()->setPos(0, 0);
+ const QGraphicsWidget *closeButtonRow = static_cast<PannedWidgetController *>(statusIndicatorMenuWindow->pannableViewport->widget())->bottommostWidget();
+
+ // When the pannable viewport has been panned above extension area, the background height should be 0
+ statusIndicatorMenuWindow->pannableViewport->widget()->setPos(0, -statusIndicatorMenuWindow->pannableViewport->geometry().height());
emit positionOrSizeChanged();
QCOMPARE(statusIndicatorMenuWindow->backgroundWidget->minimumHeight(), qreal(0));
QCOMPARE(statusIndicatorMenuWindow->backgroundWidget->maximumHeight(), qreal(0));
- // When the pannable viewport has been panned the background height should reach the bottom of the screen
- statusIndicatorMenuWindow->pannableViewport->widget()->setPos(0, 10);
+ // When the pannable viewport has not been panned the background height should reach the bottom of the screen
+ statusIndicatorMenuWindow->pannableViewport->widget()->setPos(0, 0);
emit positionOrSizeChanged();
- qreal expectedHeight = statusIndicatorMenuWindow->sceneManager()->visibleSceneSize().height() - statusIndicatorMenuWindow->pannableViewport->mapToItem(statusIndicatorMenuWindow->sceneWindow, QPointF()).y();
+ qreal expectedHeight = (closeButtonRow->mapToItem(statusIndicatorMenuWindow->sceneWindow, QPointF(0, closeButtonRow->geometry().height())).y() - statusIndicatorMenuWindow->pannableViewport->mapToItem(statusIndicatorMenuWindow->sceneWindow, QPointF()).y()) / 2;
+ QCOMPARE(statusIndicatorMenuWindow->backgroundWidget->minimumHeight(), expectedHeight);
+ QCOMPARE(statusIndicatorMenuWindow->backgroundWidget->maximumHeight(), expectedHeight);
+
+ // When the pannable viewport has been panned below the extension area the background widget should also be there
+ statusIndicatorMenuWindow->pannableViewport->widget()->setPos(0, statusIndicatorMenuWindow->pannableViewport->geometry().height());
+ emit positionOrSizeChanged();
+ expectedHeight = (closeButtonRow->mapToItem(statusIndicatorMenuWindow->sceneWindow, QPointF(0, closeButtonRow->geometry().height())).y() - statusIndicatorMenuWindow->pannableViewport->mapToItem(statusIndicatorMenuWindow->sceneWindow, QPointF()).y()) / 2;
QCOMPARE(statusIndicatorMenuWindow->backgroundWidget->minimumHeight(), expectedHeight);
QCOMPARE(statusIndicatorMenuWindow->backgroundWidget->maximumHeight(), expectedHeight);
}
@@ -253,4 +282,61 @@
QCOMPARE(mApplicationExtensionAreaVerticalOrderDuringInit, ((QStringList() << "statusindicatormenu-call.desktop" << "statusindicatormenu-transfer.desktop")));
}
+void Ut_StatusIndicatorMenuWindow::testWhenFullScreenWindowComesOnTopStatusMenuIsClosed()
+{
+ connect(this, SIGNAL(displayExited()), statusIndicatorMenuWindow, SLOT(displayInActive()));
+ emit displayExited();
+ QVERIFY(gSetVisible.first == statusIndicatorMenuWindow && !gSetVisible.second);
+}
+
+#ifdef HAVE_QMSYSTEM
+void Ut_StatusIndicatorMenuWindow::testQmLocksSignalConnectionWhenDeviceLocked()
+{
+ bool connectionExisted = disconnect(&statusIndicatorMenuWindow->qmLocks, SIGNAL(stateChanged (Maemo::QmLocks::Lock, Maemo::QmLocks::State)), statusIndicatorMenuWindow,
+ SLOT(setWindowStateAccordingToDeviceLockState(Maemo::QmLocks::Lock, Maemo::QmLocks::State)));
+ QCOMPARE(connectionExisted, true);
+}
+
+void Ut_StatusIndicatorMenuWindow::testWhenDeviceLockedMenuIsNotVisible()
+{
+ // test when device lock state is locked
+ statusIndicatorMenuWindow->hide();
+ statusIndicatorMenuWindow->deviceLocked = true;
+ QVERIFY(gSetVisible.first == statusIndicatorMenuWindow && !gSetVisible.second);
+ statusIndicatorMenuWindow->makeVisible();
+ QVERIFY(gSetVisible.first == statusIndicatorMenuWindow && !gSetVisible.second);
+}
+
+void Ut_StatusIndicatorMenuWindow::testWhenDeviceUnlockedMenuIsVisible()
+{
+ // test when device lock state is unlocked
+ statusIndicatorMenuWindow->hide();
+ statusIndicatorMenuWindow->deviceLocked = false;
+ QVERIFY(gSetVisible.first == statusIndicatorMenuWindow && !gSetVisible.second);
+ statusIndicatorMenuWindow->makeVisible();
+ QVERIFY(gSetVisible.first == statusIndicatorMenuWindow && gSetVisible.second);
+}
+
+void Ut_StatusIndicatorMenuWindow::testWhenDeviceLockStateChangesFromLockedToUnlockedWindowActivates()
+{
+ // change status from locked to unlocked
+ statusIndicatorMenuWindow->deviceLocked = true;
+ statusIndicatorMenuWindow->setWindowStateAccordingToDeviceLockState(
+ Maemo::QmLocks::Device, Maemo::QmLocks::Unlocked);
+ QCOMPARE(statusIndicatorMenuWindow->deviceLocked, false);
+}
+
+void Ut_StatusIndicatorMenuWindow::testWhenDeviceLockStateChangesFromUnlockedToLockedWindowDeactivates()
+{
+ // change status from unlocked to locked and test if menu closes
+ statusIndicatorMenuWindow->sceneWindow->appear();
+ statusIndicatorMenuWindow->deviceLocked = false;
+ statusIndicatorMenuWindow->setWindowStateAccordingToDeviceLockState(
+ Maemo::QmLocks::Device, Maemo::QmLocks::Locked);
+ QCOMPARE(statusIndicatorMenuWindow->deviceLocked, true);
+ QCOMPARE(statusIndicatorMenuWindow->isVisible(), false);
+}
+
+#endif
+
QTEST_APPLESS_MAIN(Ut_StatusIndicatorMenuWindow)
--- tests/ut_statusindicatormenuwindow/ut_statusindicatormenuwindow.h
+++ tests/ut_statusindicatormenuwindow/ut_statusindicatormenuwindow.h
@@ -35,6 +35,7 @@
void settingsButtonClicked();
void clicked(QPointF point);
void positionOrSizeChanged();
+ void displayExited();
private:
StatusIndicatorMenuWindow *statusIndicatorMenuWindow;
@@ -61,6 +62,14 @@
void testPannableAreaBackgroundWidget();
void testTopRowInitialization();
void testVerticalExtensionArea();
+ void testWhenFullScreenWindowComesOnTopStatusMenuIsClosed();
+#ifdef HAVE_QMSYSTEM
+ void testQmLocksSignalConnectionWhenDeviceLocked();
+ void testWhenDeviceLockedMenuIsNotVisible();
+ void testWhenDeviceUnlockedMenuIsVisible();
+ void testWhenDeviceLockStateChangesFromLockedToUnlockedWindowActivates();
+ void testWhenDeviceLockStateChangesFromUnlockedToLockedWindowDeactivates();
+#endif
};
#endif //_UT_STATUSINDICATORMENUWINDOW_
--- tests/ut_statusindicatormenuwindow/ut_statusindicatormenuwindow.pro
+++ tests/ut_statusindicatormenuwindow/ut_statusindicatormenuwindow.pro
@@ -16,7 +16,6 @@
HEADERS += \
ut_statusindicatormenuwindow.h \
$$SRCDIR/statusindicatormenu/statusindicatormenuwindow.h \
- $$SRCDIR/statusindicatormenu/pluginlist.h \
$$SRCDIR/statusindicatormenu/notificationarea.h \
-
+ $$STUBSDIR/qmlocks_stub.h
include(../common_bot.pri)
--- tests/ut_sysuid/ut_sysuid.cpp
+++ tests/ut_sysuid/ut_sysuid.cpp
@@ -39,6 +39,9 @@
#include "unlocknotificationsinkstub.h"
#include "pannedwidgetcontroller_stub.h"
+MApplication *exitPtr;
+
+
Notification::~Notification()
{
}
--- tests/ut_unlocknotifications/ut_unlocknotifications.cpp
+++ tests/ut_unlocknotifications/ut_unlocknotifications.cpp
@@ -31,6 +31,7 @@
#include <MOrientationChangeEvent>
#include <QGraphicsLinearLayout>
+#include <MStylableWidget>
#include <MImageWidget>
#include <MLabel>
--- tests/ut_unlockwidgets/ut_unlockwidgets.cpp
+++ tests/ut_unlockwidgets/ut_unlockwidgets.cpp
@@ -74,7 +74,7 @@
{
UnlockArea *area = new UnlockArea;
- MImageWidget *icon = area->m_unlock_icon;
+ MWidget *icon = area->m_unlock_icon;
QVERIFY (icon != 0);
--- tests/ut_volumebarlogic/ut_volumebarlogic.cpp
+++ tests/ut_volumebarlogic/ut_volumebarlogic.cpp
@@ -18,6 +18,164 @@
****************************************************************************/
#include "ut_volumebarlogic.h"
#include <volumebarlogic.h>
+extern "C"
+{
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib-lowlevel.h>
+}
+
+bool Ut_VolumeBarLogic::dbus_message_new_method_call = false;
+bool Ut_VolumeBarLogic::dbus_message_append_args = false;
+bool Ut_VolumeBarLogic::dbus_connection_send_with_reply_and_block = false;
+bool Ut_VolumeBarLogic::dbus_message_iter_recurse = false;
+bool Ut_VolumeBarLogic::dbus_message_iter_get_arg_type = false;
+bool Ut_VolumeBarLogic::dbus_message_iter_get_basic = false;
+bool Ut_VolumeBarLogic::dbus_message_iter_next = false;
+bool Ut_VolumeBarLogic::dbus_connection_get_is_connected = false;
+
+// Dbus Stubs
+extern "C" {
+ typedef double DBusMessageRealIter;
+
+ int counter = 0;
+
+ DBusMessage *
+ dbus_message_new_method_call(const char *bus_name,
+ const char *path,
+ const char *interface,
+ const char *method)
+ {
+ Q_UNUSED(bus_name);
+ Q_UNUSED(path);
+ Q_UNUSED(interface);
+ Q_UNUSED(method);
+ Ut_VolumeBarLogic::dbus_message_new_method_call = true;
+ DBusMessage *dbm = dbus_message_new (DBUS_MESSAGE_TYPE_METHOD_CALL);
+ if(dbm == 0)
+ QTest::qWarn("DBusMessage == NULL");
+ return dbm;
+ }
+
+
+ DBusConnection *
+ dbus_connection_open (const char *address,
+ DBusError *error)
+ {
+ Q_UNUSED(address);
+ Q_UNUSED(error);
+ QString addr;
+ dbus_error_init(error);
+ /**
+ * we need to find out if we are in the scratchbox or on the tablet
+ * because the dbus-socket's location is different
+ * and we need a dbus connection what is not null
+ */
+ FILE *lsofFile_p = popen("set | grep SBOX | wc -l", "r");
+
+ if (!lsofFile_p) { return NULL; }
+
+ char buffer[1024];
+ char *line_p = fgets(buffer, sizeof(buffer), lsofFile_p);
+ pclose(lsofFile_p);
+ if(atoi(line_p) > 0)
+ {
+ // in scratchbox
+ addr = "unix:path=/var/run/dbus/system_bus_socket";
+ }
+ else
+ {
+ // on tablet
+ addr = "unix:path=/var/run/pulse/dbus-socket";
+ }
+ DBusConnection *dbc = dbus_connection_open_private(addr.toAscii(), NULL);;
+ return dbc;
+ }
+
+ dbus_bool_t
+ dbus_message_has_member(DBusMessage *message, const char *member)
+ {
+ Q_UNUSED(message);
+ Q_UNUSED(member);
+ return 1;
+ }
+
+ dbus_bool_t
+ dbus_message_append_args(DBusMessage *message,
+ int first_arg_type,
+ ...)
+ {
+ Q_UNUSED(message);
+ Q_UNUSED(first_arg_type);
+ Ut_VolumeBarLogic::dbus_message_append_args = true;
+ return 1;
+ }
+
+ DBusMessage *
+ dbus_connection_send_with_reply_and_block (DBusConnection *connection,
+ DBusMessage *message,
+ int timeout_milliseconds,
+ DBusError *error)
+ {
+ Q_UNUSED(connection);
+ Q_UNUSED(message);
+ Q_UNUSED(timeout_milliseconds);
+ Q_UNUSED(error);
+ Ut_VolumeBarLogic::dbus_connection_send_with_reply_and_block = true;
+ return dbus_message_new (DBUS_MESSAGE_TYPE_METHOD_RETURN);
+ }
+
+ void
+ dbus_message_iter_recurse (DBusMessageIter *iter,
+ DBusMessageIter *sub)
+ {
+ Q_UNUSED(iter);
+ Q_UNUSED(sub);
+ Ut_VolumeBarLogic::dbus_message_iter_recurse = true;
+ return;
+ }
+
+ int dbus_message_iter_get_arg_type (DBusMessageIter *iter)
+ {
+ Q_UNUSED(iter);
+ Ut_VolumeBarLogic::dbus_message_iter_get_arg_type = true;
+ if(counter < 2)
+ {
+ counter++;
+ return DBUS_TYPE_INT32;
+ }
+ else
+ {
+ return DBUS_TYPE_INVALID;
+ }
+ }
+
+ void
+ dbus_message_iter_get_basic (DBusMessageIter *iter,
+ void *value)
+ {
+ Q_UNUSED(iter);
+ Q_UNUSED(value);
+ QTest::qWarn("dbus_message_iter_get_basic");
+ Ut_VolumeBarLogic::dbus_message_iter_get_basic = true;
+ return;
+ }
+
+ dbus_bool_t
+ dbus_message_iter_next (DBusMessageIter *iter)
+ {
+ Q_UNUSED(iter);
+ Ut_VolumeBarLogic::dbus_message_iter_next = true;
+ return 1;
+ }
+
+ dbus_bool_t
+ dbus_connection_get_is_connected (DBusConnection *connection)
+ {
+ Q_UNUSED(connection);
+ Ut_VolumeBarLogic::dbus_connection_get_is_connected = true;
+ return 0;
+ }
+}
void
Ut_VolumeBarLogic::init ()
@@ -34,14 +192,23 @@
{
m_Api = new VolumeBarLogic;
m_Api->stepsUpdated (30, 100);
+ resetStubs();
}
void
-Ut_VolumeBarLogic::cleanupTestCase ()
+Ut_VolumeBarLogic::testInitValues()
{
- delete m_Api;
+ m_Api->initValues ();
+ QVERIFY(dbus_message_append_args);
+ QVERIFY(dbus_connection_send_with_reply_and_block);
+ QVERIFY(dbus_message_iter_recurse);
+ QVERIFY(dbus_message_iter_get_arg_type);
+ QVERIFY(dbus_message_iter_get_basic);
+ QVERIFY(dbus_message_iter_next);
+ resetStubs();
}
+
// Check if setting / getting works correctly
void
Ut_VolumeBarLogic::testVolumeSetGet ()
@@ -66,7 +233,8 @@
// Check the current ...
QVERIFY (m_Api->getVolume () == currentstep);
// .. and the maximal values
- QVERIFY (m_Api->getMaxVolume () == stepcount);
+ QVERIFY (m_Api
+ ->getMaxVolume () == stepcount);
}
void
@@ -90,4 +258,36 @@
QVERIFY (arguments.at (1).toUInt () == stepcount);
}
+void
+Ut_VolumeBarLogic::testPing()
+{
+ QSignalSpy spy (m_Api, SIGNAL (volumeChanged (quint32, quint32, bool)));
+
+ m_Api->ping();
+
+ QList<QVariant> arguments = spy.takeFirst ();
+
+ QVERIFY (arguments.at (0).toUInt () == m_Api->getVolume ());
+ QVERIFY (arguments.at (1).toUInt () == m_Api->getMaxVolume ());
+}
+
+void
+Ut_VolumeBarLogic::cleanupTestCase ()
+{
+ delete m_Api;
+}
+
+void Ut_VolumeBarLogic::resetStubs()
+{
+ counter = 0;
+ dbus_message_new_method_call = false;
+ dbus_message_append_args = false;
+ dbus_connection_send_with_reply_and_block = false;
+ dbus_message_iter_recurse = false;
+ dbus_message_iter_get_arg_type = false;
+ dbus_message_iter_get_basic = false;
+ dbus_message_iter_next = false;
+ dbus_connection_get_is_connected = false;
+}
+
QTEST_MAIN(Ut_VolumeBarLogic)
--- tests/ut_volumebarlogic/ut_volumebarlogic.h
+++ tests/ut_volumebarlogic/ut_volumebarlogic.h
@@ -27,7 +27,7 @@
class QCoreApplication;
class VolumeBarLogic;
-class Ut_VolumeBarLogic : public QObject
+class Ut_VolumeBarLogic : public QObject
{
Q_OBJECT
@@ -35,14 +35,26 @@
void init ();
void cleanup ();
void initTestCase ();
- void cleanupTestCase ();
-
+ void testInitValues ();
void testVolumeSetGet ();
void testVolumeChangeByPa ();
void testSignaling ();
+ void testPing ();
+ void cleanupTestCase ();
private:
VolumeBarLogic *m_Api;
+ void resetStubs ();
+
+public:
+ static bool dbus_message_new_method_call;
+ static bool dbus_message_append_args;
+ static bool dbus_connection_send_with_reply_and_block;
+ static bool dbus_message_iter_recurse;
+ static bool dbus_message_iter_get_arg_type;
+ static bool dbus_message_iter_get_basic;
+ static bool dbus_message_iter_next;
+ static bool dbus_connection_get_is_connected;
};
#endif
--- tests/ut_volumecontrolui
+++ tests/ut_volumecontrolui
+(directory)
--- tests/ut_volumecontrolui/ut_volumecontrolui.cpp
+++ tests/ut_volumecontrolui/ut_volumecontrolui.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 "ut_volumecontrolui.h"
+#include "../../src/volumecontrol/volumecontrolui.h"
+#include <volumebarlogic.h>
+#include <volumeoverlay.h>
+#include <QGraphicsItem>
+#include <MWindow>
+#include <MOverlay>
+#include <QDebug>
+
+#ifdef HAVE_LIBRESOURCEQT
+#include <policy/resource-set.h>
+/*********************************************************************************
+ * Stub for ResourcePolicy
+ */
+
+namespace ResourcePolicy
+{
+ ResourceSet::ResourceSet(const QString&, QObject*)
+ {
+ }
+
+ bool
+ ResourceSet::setAlwaysReply ()
+ {
+ return true;
+ }
+
+
+ ScaleButtonResource::ScaleButtonResource()
+ {
+ }
+
+ void
+ ResourceSet::addResourceObject (ResourcePolicy::Resource* rsc)
+ {
+ Q_UNUSED(rsc);
+ return;
+ }
+
+ bool
+ ResourceSet::acquire ()
+ {
+ return true;
+ }
+
+ void
+ ResourceSet::deleteResource (ResourcePolicy::ResourceType)
+ {
+ return;
+ }
+}
+#endif // HAVE_LIBRESOURCEQT
+
+
+#ifdef HAVE_QMSYSTEM
+// For Hw-volume key handling
+#include <qmkeys.h>
+/*********************************************************************************
+ * Stub for Maemo::QmKeys && Maemo::QmLocks
+ */
+namespace Maemo
+{
+ QmKeys::QmKeys(QObject *parent)
+ {
+ Q_UNUSED(parent);
+ QTest::qWarn("Maemo::QmKeys");
+ }
+
+ QmKeys::~QmKeys()
+ {
+ QTest::qWarn("Maemo::~QmKeys");
+ }
+
+ QmLocks::State qmlocksStubRetval;
+
+ QmLocks::QmLocks(QObject *parent)
+ {
+ Q_UNUSED(parent);
+ QTest::qWarn("Maemo::QmLocks");
+
+ qmlocksStubRetval = Maemo::QmLocks::Unlocked;
+ }
+
+ QmLocks::~QmLocks()
+ {
+ QTest::qWarn("Maemo::~QmLocks");
+ }
+
+ QmLocks::State
+ QmLocks::getState(QmLocks::Lock what) const
+ {
+ Q_UNUSED(what);
+ return qmlocksStubRetval;
+ }
+}
+#endif
+
+/*********************************************************************************
+ * Stub for VolumeOverlay
+ */
+VolumeOverlay::VolumeOverlay(QGraphicsItem *parent)
+{
+ Q_UNUSED(parent);
+}
+
+VolumeOverlay::~VolumeOverlay()
+{
+
+}
+
+void
+VolumeOverlay::UpdateVolume (int val, int max)
+{
+ Q_UNUSED(val);
+ Q_UNUSED(max);
+}
+
+void
+VolumeOverlay::hideMe ()
+{
+
+}
+
+void
+VolumeOverlay::updateMask ()
+{
+
+}
+
+void
+VolumeOverlay::removeMask ()
+{
+
+}
+
+/*********************************************************************************
+ * Stub for VolumeBarLogic
+ */
+VolumeBarLogic::VolumeBarLogic ()
+{
+ m_currentvolume = 20;
+}
+
+VolumeBarLogic::~VolumeBarLogic ()
+{
+}
+
+quint32
+VolumeBarLogic::getVolume ()
+{
+ return m_currentvolume;
+}
+
+quint32
+VolumeBarLogic::getMaxVolume ()
+{
+ return 100;
+}
+
+void
+VolumeBarLogic::ping ()
+{
+}
+
+void
+VolumeBarLogic::setVolume (quint32 value)
+{
+ m_currentvolume = value;
+}
+
+void
+VolumeBarLogic::stepsUpdated (quint32 value, quint32 maxvalue)
+{
+ Q_UNUSED(value);
+ Q_UNUSED(maxvalue);
+}
+
+void
+VolumeBarLogic::initValues ()
+{
+}
+
+void
+VolumeBarLogic::addSignalMatch ()
+{
+}
+
+void
+VolumeBarLogic::openConnection (bool init)
+{
+ Q_UNUSED(init);
+}
+
+
+/*********************************************************************************
+ * The Ut_VolumeControlUI implements the unit tests.
+ */
+void
+Ut_VolumeControlUI::initTestCase ()
+{
+ m_Api = new VolumeControlUI;
+ QVERIFY(m_Api->m_logic != 0);
+#ifdef HAVE_QMSYSTEM
+ QVERIFY(m_Api->m_hwkeys != 0);
+ QVERIFY(m_Api->m_locks != 0);
+#endif
+}
+
+void
+Ut_VolumeControlUI::testOverlayChanged()
+{
+ m_Api->overlayChanged(32);
+ QVERIFY(m_Api->m_logic->getVolume() == 32);
+}
+
+#ifdef HAVE_QMSYSTEM
+void
+Ut_VolumeControlUI::testHwKeyEvent()
+{
+ // when current_volume >= max_volume
+ m_Api->overlayChanged(120);
+ m_Api->hwKeyEvent(Maemo::QmKeys::VolumeUp, Maemo::QmKeys::KeyDown);
+ QCOMPARE(m_Api->m_logic->getVolume(), 99u);
+
+ // Turn up the volume
+ m_Api->overlayChanged(20);
+ m_Api->hwKeyEvent(Maemo::QmKeys::VolumeUp, Maemo::QmKeys::KeyDown);
+ QCOMPARE(m_Api->m_logic->getVolume(), 21u);
+
+ // Turn down the volume
+ m_Api->overlayChanged(20);
+ m_Api->hwKeyEvent(Maemo::QmKeys::VolumeDown, Maemo::QmKeys::KeyDown);
+ QCOMPARE(m_Api->m_logic->getVolume(), 19u);
+
+ m_Api->overlayChanged(20);
+ m_Api->hwKeyEvent(Maemo::QmKeys::VolumeUp, Maemo::QmKeys::KeyUp);
+ QCOMPARE(m_Api->m_logic->getVolume(), 20u);
+
+ // push some other hw key
+ m_Api->overlayChanged(20);
+ m_Api->hwKeyEvent(Maemo::QmKeys::Camera, Maemo::QmKeys::KeyDown);
+ QCOMPARE(m_Api->m_logic->getVolume(), 20u);
+}
+
+void
+Ut_VolumeControlUI::testLocking()
+{
+ // Device locked
+ m_Api->locksChanged (Maemo::QmLocks::Device, Maemo::QmLocks::Locked);
+ QCOMPARE (m_Api->m_locked, true);
+
+ /*
+ * Volume controlling should work,
+ * but overlay should not be shown:
+ */
+ if (m_Api->m_overlay != 0)
+ {
+ delete m_Api->m_overlay;
+ m_Api->m_overlay = 0;
+ }
+
+ // Turn up the volume
+ m_Api->overlayChanged(20);
+ m_Api->hwKeyEvent(Maemo::QmKeys::VolumeUp, Maemo::QmKeys::KeyDown);
+ QCOMPARE(m_Api->m_logic->getVolume(), 21u);
+
+ // Check m_overlay, should not be instantiated
+ QVERIFY(m_Api->m_overlay == 0);
+
+ // Turn down the volume
+ m_Api->overlayChanged(20);
+ m_Api->hwKeyEvent(Maemo::QmKeys::VolumeDown, Maemo::QmKeys::KeyDown);
+ QCOMPARE(m_Api->m_logic->getVolume(), 19u);
+
+ // Check m_overlay, should not be instantiated
+ QVERIFY(m_Api->m_overlay == 0);
+
+ // Lock also the touchscreen & keyboard
+ m_Api->locksChanged (Maemo::QmLocks::TouchAndKeyboard, Maemo::QmLocks::Locked);
+ QCOMPARE (m_Api->m_locked, true);
+
+ // Unlock only the device
+ /* TouchscreenAndKeyboard is still locked: */
+ Maemo::qmlocksStubRetval = Maemo::QmLocks::Locked;
+ m_Api->locksChanged (Maemo::QmLocks::Device, Maemo::QmLocks::Unlocked);
+ QCOMPARE (m_Api->m_locked, true);
+
+ // And now unlock the touch-screen also:
+ /* Device is unlocked already:: */
+ Maemo::qmlocksStubRetval = Maemo::QmLocks::Unlocked;
+ m_Api->locksChanged (Maemo::QmLocks::TouchAndKeyboard, Maemo::QmLocks::Unlocked);
+ QCOMPARE (m_Api->m_locked, false);
+
+ /* Press a volume down key */
+ m_Api->hwKeyEvent(Maemo::QmKeys::VolumeUp, Maemo::QmKeys::KeyDown);
+ /* Overlay should be instantiated: */
+ QVERIFY (m_Api->m_overlay != 0);
+}
+#endif
+
+void
+Ut_VolumeControlUI::cleanupTestCase ()
+{
+ delete m_Api;
+}
+
+QTEST_MAIN(Ut_VolumeControlUI)
--- tests/ut_volumecontrolui/ut_volumecontrolui.h
+++ tests/ut_volumecontrolui/ut_volumecontrolui.h
+/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
+/* vim:set et sw=4 ts=4 sts=4: */
+/****************************************************************************
+**
+** 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_VOLUMECONTROLUI_H
+#define UT_VOLUMECONTROLUI_H
+
+#include <QtTest/QtTest>
+#include <QObject>
+
+class QCoreApplication;
+class VolumeControlUI;
+class VolumeBarLogic;
+class VolumeOverlay;
+
+class Ut_VolumeControlUI : public QObject
+{
+Q_OBJECT
+
+private slots:
+ void initTestCase ();
+ void testOverlayChanged ();
+#ifdef HAVE_QMSYSTEM
+ void testHwKeyEvent ();
+ void testLocking ();
+#endif
+ void cleanupTestCase ();
+
+private:
+ VolumeControlUI *m_Api;
+
+};
+
+#endif
--- tests/ut_volumecontrolui/ut_volumecontrolui.pro
+++ tests/ut_volumecontrolui/ut_volumecontrolui.pro
+include(../coverage.pri)
+include(../common_top.pri)
+TARGET = ut_volumecontrolui
+
+SRC_PREFIX = ../../src
+INCLUDEPATH += $$SRC_PREFIX \
+ $$SRC_PREFIX/volumecontrol \
+ /usr/include/resource/qt4
+
+CONFIG += link_pkgconfig
+
+PKGCONFIG += libresourceqt1
+PKGCONFIG += qmsystem
+
+HEADERS += \
+ $$SRC_PREFIX/debug.h \
+ ut_volumecontrolui.h \
+ $$SRC_PREFIX/volumecontrol/volumecontrolui.h \
+ $$SRC_PREFIX/volumecontrol/volumebarlogic.h \
+ $$SRC_PREFIX/volumecontrol/volumeoverlay.h
+
+
+SOURCES += \
+ $$SRC_PREFIX/debug.cpp \
+ ut_volumecontrolui.cpp \
+ $$SRC_PREFIX/volumecontrol/volumecontrolui.cpp
+
+include(../common_bot.pri)
--- tests/ut_volumeoverlay
+++ tests/ut_volumeoverlay
+(directory)
--- tests/ut_volumeoverlay/ut_volumeoverlay.cpp
+++ tests/ut_volumeoverlay/ut_volumeoverlay.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 "ut_volumeoverlay.h"
+#include <volumeoverlay.h>
+#include <QDebug>
+#include <MSceneWindow>
+#include <MSlider>
+#include <MApplication>
+#include <MSceneManager>
+#include <QGraphicsLinearLayout>
+#include <MWindow>
+
+int argc = 1;
+char *argv[] = {
+ (char *) "./ut_volumeoverlay",
+ NULL };
+
+/*********************************************************************************
+ * Stub for QTimer
+ */
+int t_interval = 0;
+bool t_isStarted = false;
+
+QTimer::QTimer(QObject *parent)
+{
+ Q_UNUSED(parent);
+ QTest::qWarn("QTimer::QTimer");
+}
+
+void
+QTimer::setInterval(int msec)
+{
+ t_interval = msec;
+ QTest::qWarn("QTimer::setInterval");
+}
+
+void
+QTimer::start()
+{
+ t_isStarted = true;
+ QTest::qWarn("QTimer::start");
+}
+
+void
+QTimer::stop()
+{
+ t_isStarted = false;
+ QTest::qWarn("QTimer::stop");
+}
+
+/*********************************************************************************
+ * Stub for MSlider
+ */
+int ms_value = 0;
+int ms_minrange = 0;
+int ms_maxrange = 0;
+
+void
+MSlider::setOrientation(Qt::Orientation direction)
+{
+ Q_UNUSED(direction);
+ QTest::qWarn("MSlider::setOrientation");
+}
+
+void
+MSlider::setMaxLabelIconID(const QString &iconID)
+{
+ Q_UNUSED(iconID);
+ QTest::qWarn("MSlider::setMaxLabelIconID");
+}
+
+void
+MSlider::setMaxLabelVisible(bool visible)
+{
+ Q_UNUSED(visible);
+ QTest::qWarn("MSlider::setMaxLabelVisible");
+}
+
+void
+MSlider::setMinLabelIconID(const QString &iconID)
+{
+ Q_UNUSED(iconID);
+ QTest::qWarn("MSlider::setMinLabelIconID");
+}
+
+void
+MSlider::setMinLabelVisible(bool visible)
+{
+ Q_UNUSED(visible);
+ QTest::qWarn("MSlider::setMinLabelVisible");
+}
+
+void
+MSlider::setValue(int value)
+{
+ ms_value = value;
+ QTest::qWarn("MSlider::setMinLabelVisible");
+}
+
+void
+MSlider::setRange(int minimum, int maximum)
+{
+ ms_minrange = minimum;
+ ms_maxrange = maximum;
+}
+
+/*********************************************************************************
+ * Stub for MWindow
+ */
+M::Orientation mw_orientation = M::Portrait;
+QSize
+MWindow::visibleSceneSize(M::Orientation orientation) const
+{
+ mw_orientation = orientation;
+ QTest::qWarn("MWindow::visibleSceneSize");
+
+ return QSize (100, 100);
+}
+
+/*********************************************************************************
+ * The Ut_VolumeOverlay implements the unit tests.
+ */
+void
+Ut_VolumeOverlay::init ()
+{
+ ms_value = 0;
+ ms_minrange = 0;
+ ms_maxrange = 0;
+ t_interval = 0;
+ t_isStarted = false;
+ mw_orientation = M::Portrait;
+}
+
+void
+Ut_VolumeOverlay::cleanup ()
+{
+
+}
+
+void
+Ut_VolumeOverlay::initTestCase ()
+{
+ QTest::qWarn("+++ Creating application.");
+ m_App = new MApplication(argc, argv);
+ m_App->setQuitOnLastWindowClosed (false);
+
+ m_Api = new VolumeOverlay();
+ QVERIFY(m_Api->m_timer != NULL);
+ QVERIFY(m_Api->m_slider != NULL);
+ QVERIFY(m_Api->m_window != NULL);
+}
+
+void
+Ut_VolumeOverlay::testUpdateVolume ()
+{
+ m_Api->UpdateVolume(20, 100);
+ QVERIFY(ms_value = 20);
+ QVERIFY(ms_value = 99);
+ QVERIFY(t_isStarted);
+}
+
+void
+Ut_VolumeOverlay::testHideMe()
+{
+ t_isStarted = true;
+ m_Api->hideMe();
+ QVERIFY(t_isStarted == false);
+}
+
+void
+Ut_VolumeOverlay::cleanupTestCase ()
+{
+ delete m_Api;
+}
+
+QTEST_APPLESS_MAIN(Ut_VolumeOverlay)
--- tests/ut_volumeoverlay/ut_volumeoverlay.h
+++ tests/ut_volumeoverlay/ut_volumeoverlay.h
+/* -*- Mode: C; indent-tabs-mode: s; c-basic-offset: 4; tab-width: 4 -*- */
+/* vim:set et sw=4 ts=4 sts=4: */
+/****************************************************************************
+**
+** 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_VOLUMEOVERLAY_H
+#define UT_VOLUMEOVERLAY_H
+
+#include <QtTest/QtTest>
+#include <QObject>
+class VolumeOverlay;
+class MApplication;
+
+class Ut_VolumeOverlay : public QObject
+{
+Q_OBJECT
+
+private slots:
+ void init ();
+ void cleanup ();
+ void initTestCase ();
+ void testUpdateVolume ();
+ void testHideMe ();
+ void cleanupTestCase ();
+
+private:
+ VolumeOverlay *m_Api;
+ MApplication *m_App;
+
+};
+
+#endif
--- tests/ut_volumeoverlay/ut_volumeoverlay.pro
+++ tests/ut_volumeoverlay/ut_volumeoverlay.pro
+include(../coverage.pri)
+include(../common_top.pri)
+TARGET = ut_volumeoverlay
+
+SRC_PREFIX = ../../src
+INCLUDEPATH += $$SRC_PREFIX \
+ $$SRC_PREFIX/volumecontrol \
+ /usr/include/resource/qt4
+
+CONFIG += link_pkgconfig
+
+
+HEADERS += \
+ $$SRC_PREFIX/debug.h \
+ ut_volumeoverlay.h \
+ $$SRC_PREFIX/volumecontrol/volumeoverlay.h
+
+
+SOURCES += \
+ $$SRC_PREFIX/debug.cpp \
+ ut_volumeoverlay.cpp \
+ $$SRC_PREFIX/volumecontrol/volumeoverlay.cpp
+
+include(../common_bot.pri)
--- tests/ut_widgetnotificationsink/ut_widgetnotificationsink.cpp
+++ tests/ut_widgetnotificationsink/ut_widgetnotificationsink.cpp
@@ -39,20 +39,20 @@
class TestWidgetNotificationSink : public WidgetNotificationSink
{
public:
- MInfoBanner *createInfoBanner(const Notification &);
- MInfoBanner *createInfoBanner(MInfoBanner::BannerType, uint groupId, const NotificationParameters &);
+ MBanner *createInfoBanner(const Notification &);
+ MBanner *createInfoBanner(Notification::NotificationType, uint groupId, const NotificationParameters &);
void addNotification(const Notification &);
void removeNotification(uint);
QString determineIconId(const NotificationParameters &);
- void updateActions(MInfoBanner *infoBanner, const Notification ¬ification);
+ void updateActions(MBanner *infoBanner, const Notification ¬ification);
};
-MInfoBanner *TestWidgetNotificationSink::createInfoBanner(const Notification &n)
+MBanner *TestWidgetNotificationSink::createInfoBanner(const Notification &n)
{
return WidgetNotificationSink::createInfoBanner(n);
}
-MInfoBanner *TestWidgetNotificationSink::createInfoBanner(MInfoBanner::BannerType type, uint groupId, const NotificationParameters ¶meters)
+MBanner *TestWidgetNotificationSink::createInfoBanner(Notification::NotificationType type, uint groupId, const NotificationParameters ¶meters)
{
return WidgetNotificationSink::createInfoBanner(type, groupId, parameters);
}
@@ -70,7 +70,7 @@
return WidgetNotificationSink::determineIconId(params);
}
-void TestWidgetNotificationSink::updateActions(MInfoBanner *infoBanner, const Notification ¬ification)
+void TestWidgetNotificationSink::updateActions(MBanner *infoBanner, const Notification ¬ification)
{
WidgetNotificationSink::updateActions(infoBanner, notification.parameters());
}
@@ -228,6 +228,8 @@
QSettings *settings = new QSettings;
settings->setValue(NotificationWidgetParameterFactory::iconIdKey(), "Icon-messages");
gEventTypeStoreStub->stubSetReturnValue("settingsForEventType", settings);
+ EventTypeStore eventTypeStore("", 0);
+ gNotificationManagerStub->stubSetReturnValue<const EventTypeStore&>("eventTypeStore", eventTypeStore);
TestNotificationParameters parameters;
parameters.add(GenericNotificationParameterFactory::eventTypeKey(), "message-received");
@@ -260,7 +262,7 @@
notification.setParameters(parameters);
// Create an info banner with one action
- MInfoBanner infoBanner(MInfoBanner::Event);
+ MBanner infoBanner;
QAction *action = new QAction(&infoBanner);
infoBanner.addAction(action);
@@ -288,7 +290,7 @@
QApplication::processEvents();
TestNotificationParameters parameters;
parameters.add(NotificationWidgetParameterFactory::createActionParameter("content0 0 0 0"));
- MInfoBanner *infoBanner = m_subject->createInfoBanner(Notification(notificationID, 0, 1, parameters, Notification::ApplicationEvent, 1000));
+ MBanner *infoBanner = m_subject->createInfoBanner(Notification(notificationID, 0, 1, parameters, Notification::ApplicationEvent, 1000));
// Listen to triggered signals of info banner action
QCOMPARE(actions.count(), 1);
@@ -317,7 +319,7 @@
uint groupID = 1;
TestNotificationParameters groupParameters;
groupParameters.add(NotificationWidgetParameterFactory::createActionParameter("content1 1 1 1"));
- infoBanner = m_subject->createInfoBanner(MInfoBanner::Information, groupID, groupParameters);
+ infoBanner = m_subject->createInfoBanner(Notification::ApplicationEvent, groupID, groupParameters);
// Listen to triggered signals of info banner action
QCOMPARE(actions.count(), 2);
@@ -347,7 +349,7 @@
QApplication::processEvents();
uint notificationID = 0;
parameters.add(NotificationWidgetParameterFactory::createActionParameter("content0 0 0 0"));
- MInfoBanner *infoBanner = m_subject->createInfoBanner(Notification(notificationID, 0, 1, parameters, Notification::ApplicationEvent, 1000));
+ MBanner *infoBanner = m_subject->createInfoBanner(Notification(notificationID, 0, 1, parameters, Notification::ApplicationEvent, 1000));
// Listen to triggered signals of info banner action
QCOMPARE(actions.count(), 1);
@@ -393,12 +395,11 @@
void Ut_WidgetNotificationSink::testInfoBannerCreationWithRemoteAction()
{
- TestNotificationParameters parameters("icon0", "summary0", "body0", "buttonicon0", "content0 0 0 0");
+ TestNotificationParameters parameters("title0", "subtitle0", "buttonicon0", "content0 0 0 0");
- MInfoBanner *infoBanner = m_subject->createInfoBanner(Notification(3, 1, 0, parameters, Notification::ApplicationEvent, 1020));
- QCOMPARE(infoBanner->bannerType(), MInfoBanner::Event);
- QCOMPARE(infoBanner->imageID(), QString("icon0"));
- QCOMPARE(infoBanner->bodyText(), QString("<p><b>summary0</b></p><p>body0</p>"));
+ MBanner *infoBanner = m_subject->createInfoBanner(Notification(3, 1, 0, parameters, Notification::ApplicationEvent, 1020));
+ QCOMPARE(infoBanner->title(), QString("title0"));
+ QCOMPARE(infoBanner->subtitle(), QString("subtitle0"));
QCOMPARE(infoBanner->iconID(), QString("buttonicon0"));
QCOMPARE(infoBanner->actions().count(), 1);
MRemoteAction *remoteAction = dynamic_cast<MRemoteAction *>(infoBanner->actions().at(0));
@@ -409,11 +410,22 @@
void Ut_WidgetNotificationSink::testInfoBannerCreationWithoutRemoteAction()
{
- TestNotificationParameters parameters("icon1", "summary1", "body1", "buttonicon1", "");
- MInfoBanner *infoBanner = m_subject->createInfoBanner(Notification(3, 1, 0, parameters, Notification::SystemEvent, 1020));
- QCOMPARE(infoBanner->bannerType(), MInfoBanner::Information);
- QCOMPARE(infoBanner->imageID(), QString("icon1"));
- QCOMPARE(infoBanner->bodyText(), QString("<p><b>summary1</b></p><p>body1</p>"));
+ TestNotificationParameters parameters("title1", "subtitle1", "buttonicon1");
+ MBanner *infoBanner = m_subject->createInfoBanner(Notification(3, 1, 0, parameters, Notification::ApplicationEvent, 1020));
+ QCOMPARE(infoBanner->title(), QString("title1"));
+ QCOMPARE(infoBanner->subtitle(), QString("subtitle1"));
+ QCOMPARE(infoBanner->iconID(), QString("buttonicon1"));
+ QCOMPARE(infoBanner->actions().count(), 0);
+ delete infoBanner;
+}
+
+void Ut_WidgetNotificationSink::testInfoBannerCreationWithSystemEvent()
+{
+ TestNotificationParameters parameters("title1", "subtitle1", "buttonicon1");
+ MBanner *infoBanner = m_subject->createInfoBanner(Notification(3, 1, 0, parameters, Notification::SystemEvent, 1020));
+ // Check that title is not set for system event
+ QCOMPARE(infoBanner->title(), QString(""));
+ QCOMPARE(infoBanner->subtitle(), QString("subtitle1"));
QCOMPARE(infoBanner->iconID(), QString("buttonicon1"));
QCOMPARE(infoBanner->actions().count(), 0);
delete infoBanner;
@@ -421,11 +433,10 @@
void Ut_WidgetNotificationSink::testInfoBannerCreationWithNotificationParameters()
{
- TestNotificationParameters parameters("icon3", "summary3", "body3", "buttonicon3", "content1 2 3 4");
- MInfoBanner *infoBanner = m_subject->createInfoBanner(MInfoBanner::Event, 1, parameters);
- QCOMPARE(infoBanner->bannerType(), MInfoBanner::Event);
- QCOMPARE(infoBanner->imageID(), QString("icon3"));
- QCOMPARE(infoBanner->bodyText(), QString("<p><b>summary3</b></p><p>body3</p>"));
+ TestNotificationParameters parameters("title3", "subtitle3", "buttonicon3", "content1 2 3 4");
+ MBanner *infoBanner = m_subject->createInfoBanner(Notification::ApplicationEvent, 1, parameters);
+ QCOMPARE(infoBanner->title(), QString("title3"));
+ QCOMPARE(infoBanner->subtitle(), QString("subtitle3"));
QCOMPARE(infoBanner->iconID(), QString("buttonicon3"));
QCOMPARE(infoBanner->actions().count(), 1);
MRemoteAction *remoteAction = dynamic_cast<MRemoteAction *>(infoBanner->actions().at(0));
@@ -434,120 +445,4 @@
delete infoBanner;
}
-void Ut_WidgetNotificationSink::testLoadIconDefaultSize()
-{
- imageReaderCanRead = true;
- initImage(imageStrBase64, ICON_DEFAULT_SIZE, ICON_DEFAULT_SIZE);
-
- TestNotificationParameters parameters("/path/image.png");
- MInfoBanner *infoBanner = m_subject->createInfoBanner(MInfoBanner::Event, 1, parameters);
- QCOMPARE(infoBanner->pixmap().size(), QSize(ICON_DEFAULT_SIZE, ICON_DEFAULT_SIZE));
- delete infoBanner;
-}
-
-void Ut_WidgetNotificationSink::testLoadIconSmallerThanDefault()
-{
- imageReaderCanRead = true;
- initImage(imageStrBase64, ICON_SMALL_SIZE, ICON_SMALL_SIZE);
-
- TestNotificationParameters parameters("/path/image.png");
- MInfoBanner *infoBanner = m_subject->createInfoBanner(MInfoBanner::Event, 1, parameters);
- QCOMPARE(infoBanner->pixmap().size(), QSize(ICON_DEFAULT_SIZE, ICON_DEFAULT_SIZE));
- delete infoBanner;
-}
-
-void Ut_WidgetNotificationSink::testLoadIconScaleDownToFit()
-{
- imageReaderCanRead = true;
- initImage(imageStrBase64, ICON_BIG_SIZE, ICON_BIG_SIZE);
-
- TestNotificationParameters parameters("/path/image.png");
- MInfoBanner *infoBanner = m_subject->createInfoBanner(MInfoBanner::Event, 1, parameters);
- QCOMPARE(infoBanner->pixmap().size(), QSize(ICON_DEFAULT_SIZE, ICON_DEFAULT_SIZE));
- delete infoBanner;
-}
-
-void Ut_WidgetNotificationSink::testLoadIconScaleToFitBigHeight()
-{
- imageReaderCanRead = true;
- initImage(imageStrBase64, ICON_DEFAULT_SIZE, ICON_BIG_SIZE);
-
- QSize testSize = testImage->size();
- testSize.scale(ICON_DEFAULT_SIZE, ICON_DEFAULT_SIZE, Qt::KeepAspectRatio);
-
- TestNotificationParameters parameters("/path/image.png");
- MInfoBanner *infoBanner = m_subject->createInfoBanner(MInfoBanner::Event, 1, parameters);
- QCOMPARE(infoBanner->pixmap().size(), testSize);
- delete infoBanner;
-}
-
-void Ut_WidgetNotificationSink::testLoadIconScaleToFitBigWidth()
-{
- imageReaderCanRead = true;
- initImage(imageStrBase64, ICON_BIG_SIZE, ICON_DEFAULT_SIZE);
-
- QSize testSize = testImage->size();
- testSize.scale(ICON_DEFAULT_SIZE, ICON_DEFAULT_SIZE, Qt::KeepAspectRatio);
-
- TestNotificationParameters parameters("/path/image.png");
- MInfoBanner *infoBanner = m_subject->createInfoBanner(MInfoBanner::Event, 1, parameters);
- QCOMPARE(infoBanner->pixmap().size(), testSize);
- delete infoBanner;
-}
-
-void Ut_WidgetNotificationSink::testLoadIconTooBig()
-{
- imageReaderCanRead = true;
- initImage(imageStrBase64, ICON_TOO_BIG_SIZE, ICON_TOO_BIG_SIZE);
-
- TestNotificationParameters parameters("/path/image.png");
- MInfoBanner *infoBanner = m_subject->createInfoBanner(MInfoBanner::Event, 1, parameters);
- QCOMPARE(infoBanner->pixmap().isNull(), true);
- delete infoBanner;
-}
-
-void Ut_WidgetNotificationSink::testLoadIconHeightTooBig()
-{
- imageReaderCanRead = true;
- initImage(imageStrBase64, ICON_DEFAULT_SIZE, ICON_TOO_BIG_SIZE);
-
- TestNotificationParameters parameters("/path/image.png");
- MInfoBanner *infoBanner = m_subject->createInfoBanner(MInfoBanner::Event, 1, parameters);
- QCOMPARE(infoBanner->pixmap().isNull(), true);
- delete infoBanner;
-}
-
-void Ut_WidgetNotificationSink::testLoadIconWidthTooBig()
-{
- imageReaderCanRead = true;
- initImage(imageStrBase64, ICON_TOO_BIG_SIZE, ICON_DEFAULT_SIZE);
-
- TestNotificationParameters parameters("/path/image.png");
- MInfoBanner *infoBanner = m_subject->createInfoBanner(MInfoBanner::Event, 1, parameters);
- QCOMPARE(infoBanner->pixmap().isNull(), true);
- delete infoBanner;
-}
-
-void Ut_WidgetNotificationSink::testLoadIconBrokenImage()
-{
- imageReaderCanRead = true;
- initImage(badImageStrBase64, ICON_DEFAULT_SIZE, ICON_DEFAULT_SIZE);
-
- TestNotificationParameters parameters("/path/image.png");
- MInfoBanner *infoBanner = m_subject->createInfoBanner(MInfoBanner::Event, 1, parameters);
- QCOMPARE(infoBanner->pixmap().isNull(), true);
- delete infoBanner;
-}
-
-void Ut_WidgetNotificationSink::testLoadIconCannotReadImage()
-{
- imageReaderCanRead = false;
- initImage(imageStrBase64, ICON_DEFAULT_SIZE, ICON_DEFAULT_SIZE);
-
- TestNotificationParameters parameters("/path/image.png");
- MInfoBanner *infoBanner = m_subject->createInfoBanner(MInfoBanner::Event, 1, parameters);
- QCOMPARE(infoBanner->pixmap().isNull(), true);
- delete infoBanner;
-}
-
QTEST_APPLESS_MAIN(Ut_WidgetNotificationSink)
--- tests/ut_widgetnotificationsink/ut_widgetnotificationsink.h
+++ tests/ut_widgetnotificationsink/ut_widgetnotificationsink.h
@@ -65,17 +65,7 @@
void testInfoBannerCreationWithRemoteAction();
void testInfoBannerCreationWithoutRemoteAction();
void testInfoBannerCreationWithNotificationParameters();
-
- void testLoadIconDefaultSize();
- void testLoadIconSmallerThanDefault();
- void testLoadIconScaleDownToFit();
- void testLoadIconScaleToFitBigHeight();
- void testLoadIconScaleToFitBigWidth();
- void testLoadIconTooBig();
- void testLoadIconWidthTooBig();
- void testLoadIconHeightTooBig();
- void testLoadIconBrokenImage();
- void testLoadIconCannotReadImage();
+ void testInfoBannerCreationWithSystemEvent();
private:
// Helper for the "test clicking when not user removable" cases
--- tests/ut_widgetnotificationsink/ut_widgetnotificationsink.pro
+++ tests/ut_widgetnotificationsink/ut_widgetnotificationsink.pro
@@ -16,7 +16,7 @@
# helper classes
SOURCES += \
- $$STUBSDIR\stubbase.cpp
+ $$STUBSDIR/stubbase.cpp
# unit test and unit
HEADERS += \
--- themes/feedbacks
+++ themes/feedbacks
+(directory)
--- themes/feedbacks/enter-dragndrop-dropzone
+++ themes/feedbacks/enter-dragndrop-dropzone
+(directory)
--- themes/feedbacks/exit-dragndrop-dropzone
+++ themes/feedbacks/exit-dragndrop-dropzone
+(directory)
--- themes/feedbacks/feedbacks.pro
+++ themes/feedbacks/feedbacks.pro
+include(../../mconfig.pri)
+
+TEMPLATE = subdirs
+
+# Touch-screen-unlock UI feedbacks
+
+startdnd.files = \
+ start-dragndrop/*
+
+startdnd.path = $$SYSTEMUI_THEMES_DIR/feedbacks/start-dragndrop
+
+enterdnddrop.files = \
+ enter-dragndrop-dropzone/*
+
+enterdnddrop.path = $$SYSTEMUI_THEMES_DIR/feedbacks/enter-dragndrop-dropzone
+
+exitdnddrop.files = \
+ exit-dragndrop-dropzone/*
+
+exitdnddrop.path = $$SYSTEMUI_THEMES_DIR/feedbacks/exit-dragndrop-dropzone
+
+releasein.files = \
+ release-inside-dragndrop-dropzone/*
+
+releasein.path = $$SYSTEMUI_THEMES_DIR/feedbacks/release-inside-dragndrop-dropzone
+
+releaseout.files = \
+ release-outside-dragndrop-dropzone/*
+
+releaseout.path = $$SYSTEMUI_THEMES_DIR/feedbacks/release-outside-dragndrop-dropzone
+
+# Power-off feedback
+
+poweroff.files = \
+ power-off/*
+
+poweroff.path = $$SYSTEMUI_THEMES_DIR/feedbacks/power-off
+
+INSTALLS += \
+ startdnd \
+ enterdnddrop \
+ exitdnddrop \
+ releasein \
+ releaseout \
+ poweroff
+
+QMAKE_EXTRA_TARGETS += check
+check.commands = $$system(true)
+QMAKE_EXTRA_TARGETS += check-xml
+check-xml.commands = $$system(true)
--- themes/feedbacks/power-off
+++ themes/feedbacks/power-off
+(directory)
--- themes/feedbacks/release-inside-dragndrop-dropzone
+++ themes/feedbacks/release-inside-dragndrop-dropzone
+(directory)
--- themes/feedbacks/release-outside-dragndrop-dropzone
+++ themes/feedbacks/release-outside-dragndrop-dropzone
+(directory)
--- themes/feedbacks/start-dragndrop
+++ themes/feedbacks/start-dragndrop
+(directory)
--- themes/style/default.css
+++ themes/style/default.css
@@ -1,5 +1,6 @@
@import "unlockscreen.css";
@import "volumecontrol.css";
+ at import "shutdownscreen.css";
MSceneWindowStyle#StatusIndicatorMenuWindow {
/* Add top padding so that the status indicator menu window does not go under the status area */
@@ -17,7 +18,7 @@
}
MWidgetStyle#CloseButtonArea {
- background-image: "duistatusmenuclose-background";
+ background-image: "meegotouch-statusmenuclose-background";
}
MWidgetStyle#StatusIndicatorMenuWindowBackground {
@@ -28,14 +29,33 @@
NotificationAreaStyle {
minimum-size: 100% 0;
+ maximum-size: 100% -1;
margin-left: 0;
margin-top: 0;
margin-right: 0;
margin-bottom: 0;
}
+MButtonStyle#NotificationAreaClearButton {
+ margin-left: 0;
+ margin-right: 0;
+ margin-top: 0;
+ margin-bottom: 0;
+ maximum-size: $SIZE_BUTTON 0;
+}
+
+MButtonStyle#NotificationAreaClearButtonVisible {
+ margin-left: $MARGIN_MEDIUM;
+ margin-right: $MARGIN_MEDIUM;
+ margin-top: $MARGIN_MEDIUM;
+ margin-bottom: $MARGIN_MEDIUM;
+ minimum-size: 46mm $SIZE_BUTTON;
+ maximum-size: 46mm $SIZE_BUTTON;
+}
+
MButtonIconStyle#StatusIndicatorMenuTopRowExtensionButton {
font: $FONT_XSMALL;
+ text-color: $COLOR_FOREGROUND;
minimum-size: 8.8mm 7.3mm;
preferred-size: 8.8mm 7.3mm;
maximum-size: 8.8mm 7.3mm;
@@ -63,15 +83,6 @@
padding-bottom: 0;
}
-MLabelStyle#Notifier {
- background-image: icon-s-status-notifier 9px 9px 9px 9px;
- font: $FONT_XSMALL;
- color: #FFFFFF;
- preferred-size: 3.6mm 1.8mm;
- minimum-size: 3.6mm 1.8mm;
- maximum-size: 3.6mm 1.8mm;
-}
-
ClockStyle {
margin-left: 0.6mm;
margin-right: 0.6mm;
@@ -125,20 +136,20 @@
maximum-size: 0 1.8mm;
/* The number of milliseconds in which the images in imageList are animated */
animation-duration: 3000;
+ use-icon-size: false;
}
StatusIndicatorAnimationStyle:icon {
/* This style is used when there is an icon ID defined (width is 14) */
- margin-left: 0.6mm;
- margin-right: 0.6mm;
+ margin-left: 0.35mm;
+ margin-right: 0.35mm;
preferred-size: 1.4mm 1.8mm;
minimum-size: 1.4mm 1.8mm;
maximum-size: 1.4mm 1.8mm;
}
+
StatusIndicatorAnimationStyle#InputMethodStatusIndicator {
- preferred-size: 2.4mm 1.8mm;
- minimum-size: 2.4mm 1.8mm;
- maximum-size: 2.4mm 1.8mm;
+ use-icon-size: true;
}
StatusIndicatorLabelStyle {
@@ -246,6 +257,23 @@
animation-duration: 10000;
}
+StatusIndicatorIconStyle#BatteryStatusIndicatorPowerSave {
+ /* The list of IDs of the images to be shown in the status indicator separated by spaces */
+ image-list: "icon-s-status-powersave-verylow icon-s-status-powersave-low icon-s-status-powersave1 icon-s-status-powersave2 icon-s-status-powersave3 icon-s-status-powersave4 icon-s-status-powersave5 icon-s-status-powersave6 icon-s-status-powersave7 icon-s-status-powersave8";
+ preferred-size: 2.9mm 1.8mm;
+ minimum-size: 2.9mm 1.8mm;
+ maximum-size: 2.9mm 1.8mm;
+}
+
+StatusIndicatorIconStyle#BatteryStatusIndicatorPowerSaveCharging {
+ /* The list of IDs of the images to be shown in the status indicator separated by spaces */
+ image-list: "icon-s-status-powersave-verylow icon-s-status-powersave-low icon-s-status-powersave1 icon-s-status-powersave2 icon-s-status-powersave3 icon-s-status-powersave4 icon-s-status-powersave5 icon-s-status-powersave6 icon-s-status-powersave7 icon-s-status-powersave8";
+ preferred-size: 2.9mm 1.8mm;
+ minimum-size: 2.9mm 1.8mm;
+ maximum-size: 2.9mm 1.8mm;
+ animation-duration: 10000;
+}
+
StatusIndicatorIconStyle#AlarmStatusIndicator {
/* The list of IDs of the images to be shown in the status indicator separated by spaces */
image-list: "";
@@ -324,8 +352,7 @@
StatusIndicatorIconStyle#InternetConnectionStatusIndicatorPacketDataConnecting {
/* The list of IDs of the images to be shown in the status indicator separated by spaces */
/* TODO: use the following image list when the icons are available in the theme */
- /* image-list: "icon-s-status-packetdata-connecting-1 icon-s-status-packetdata-connecting-2 icon-s-status-packetdata-connecting-3 icon-s-status-packetdata-connecting-4"; */
- image-list: "";
+ 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;
@@ -334,8 +361,7 @@
StatusIndicatorIconStyle#InternetConnectionStatusIndicatorWLANConnecting {
/* The list of IDs of the images to be shown in the status indicator separated by spaces */
/* TODO: use the following image list when the icons are available in the theme */
- /* image-list: "icon-s-status-wlan-connecting-1 icon-s-status-wlan-connecting-2 icon-s-status-wlan-connecting-3 icon-s-status-wlan-connecting-4"; */
- image-list: "";
+ 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;
@@ -412,14 +438,6 @@
maximum-size: 1.8mm 1.8mm;
}
-#shutdownTextBig {
- font: $FONT_XLARGE;
-}
-
-#shutdownTextSmaller {
- font: $FONT_LARGE;
-}
-
StatusIndicatorIconStyle#GPSStatusIndicator {
/* The list of IDs of the images to be shown in the status indicator separated by spaces */
image-list: "";
@@ -444,6 +462,20 @@
maximum-size: 2.4mm 1.8mm;
}
+StatusIndicatorIconStyle#NotificationStatusIndicatorOn {
+ image-list: "icon-s-status-notifier";
+ preferred-size: 4.8mm 1.8mm;
+ minimum-size: 4.8mm 1.8mm;
+ maximum-size: 4.8mm 1.8mm;
+}
+
+StatusIndicatorIconStyle#NotificationStatusIndicator {
+ image-list: "";
+ preferred-size: 0mm 1.8mm;
+ minimum-size: 0mm 1.8mm;
+ maximum-size: 0mm 1.8mm;
+}
+
MButtonStyle#StatusIndicatorMenuCloseButton {
icon-size: $SIZE_ICON_LARGE $SIZE_ICON_LARGE;
preferred-size: 6.4mm 6.4mm;
--- themes/style/shutdownscreen.css
+++ themes/style/shutdownscreen.css
+MSceneWindowStyle#shutdownWindow {
+ /*
+ * The shutdown-screen window
+ * can be customized here
+ */
+}
+
+MLabelStyle#shutdownTextFirst {
+ font: $FONT_XLARGE;
+
+ preferred-size: 100% 50%;
+}
+
+MLabelStyle#shutdownTextSecond {
+ font: $FONT_LARGE;
+
+ preferred-size: 100% 50%;
+}
+
+MWidgetStyle#shutdownLogo {
+ background-image: "icon-l-startup-nokia-logo";
+ background-opacity: 1.0;
+
+ vertical-align: top;
+ horizontal-align: left;
+
+ minimum-size: 100% 100%;
+ preferred-size: 100% 100%;
+ maximum-size: 100% 100%;
+}
+
--- themes/style/unlockscreen.css
+++ themes/style/unlockscreen.css
@@ -3,27 +3,26 @@
horizontal-align: left;
}
-MSceneWindowStyle#LockMostRecentArea {
- background-image: "lockscreen-recent-event-area-background" 0 0 0 0;
+MWidgetStyle#LockMostRecentArea {
+ background-image: "lockscreen-recent-event-area-background" 12 12 12 12;
background-opacity: 1.0;
- padding-top: 0.8mm;
+ padding-top: 1.0mm;
minimum-size: 100% 7.9mm;
preferred-size: 100% 7.9mm;
maximum-size: 100% 7.9mm;
}
-MLabelStyle#LockMostRecentLabel {
+MWidgetStyle#LockMostRecentLabel {
color: $COLOR_INVERTED_FOREGROUND;
font: "Nokia Standard Bold" 28;
/* or "Nokia Standard Light" ??? */
margin-top: 1.4mm;
- margin-left: 2.9mm;
margin-right: $MARGIN_XLARGE;
}
MImageWidgetStyle#LockMostRecentIcon {
- margin-top: 1.4mm;
+ margin-top: 1.2mm;
margin-left: 2.9 mm;
margin-right: $MARGIN_DOUBLE;
@@ -32,16 +31,17 @@
maximum-size: 3.6mm 3.6mm;
}
-MSceneWindowStyle#LockOtherEventsArea {
- background-image: "lockscreen-notification-area-background" 0 0 0 0;
+MWidgetStyle#LockOtherEventsArea {
+ background-image: "lockscreen-notification-area-background" 12 12 12 12;
background-opacity: 1.0;
+ padding-top: 0.5mm;
minimum-size: 100% 4.9mm;
maximum-size: 100% 7mm;
}
MImageWidgetStyle#LockNotifierIcon {
- margin-top: 1.4mm;
+ margin-top: 1.2mm;
margin-left: 2.9mm;
minimum-size: 3.6mm 3.6mm;
@@ -49,8 +49,9 @@
maximum-size: 3.6mm 3.6mm;
}
-MImageWidgetStyle#LockNotifierLabel {
- font: "Nokia Standard Light" 24;
+MLabelStyle#LockNotifierLabel {
+ color: $COLOR_INVERTED_FOREGROUND;
+ font: "Nokia Standard Light" 28;
margin-top: 1.4mm;
margin-left: $MARGIN_LARGE;
@@ -58,7 +59,7 @@
}
-MSceneWindowStyle#LockLiftArea {
+MWidgetStyle#LockLiftArea {
background-image: "lockscreen-lock-lift-area-background" 0 380 0 0;
background-opacity: 0.9;
@@ -94,22 +95,20 @@
maximum-size: 10mm 10mm;
}
-MSceneWindowStyle#LockLandArea {
+MWidgetStyle#LockLandArea {
background-image: none;
minimum-size: 100% 100;
}
-MSceneWindowStyle#LockLandAreaDragged {
- background-image: "lockscreen-lock-land-area-background-dragged" 20 20 20 20;
-/* background-opacity: 0.9; */
+MWidgetStyle#LockLandAreaDragged {
+ background-image: "lockscreen-lock-land-area-background-dragged" 25 25 25 25;
minimum-size: 100% 100;
}
-MSceneWindowStyle#LockLandAreaActive {
- background-image: "lockscreen-lock-land-area-background-active" 20 20 20 20;
-/* background-opacity: 0.9; */
+MWidgetStyle#LockLandAreaActive {
+ background-image: "lockscreen-lock-land-area-background-active" 25 25 25 25;
minimum-size: 100% 100;
}
@@ -134,12 +133,10 @@
MImageWidgetStyle#LockScreenUnlockIcon {
background-image: "lockscreen-lock-land-area-center-background";
- background-opacity: 0.0;
+ background-opacity: 1.0;
-/*
preferred-size: 10mm 10mm;
minimum-size: 10mm 10mm;
maximum-size: 10mm 10mm;
- */
}
--- themes/style/volumecontrol.css
+++ themes/style/volumecontrol.css
@@ -5,9 +5,25 @@
padding-bottom: 10px;
minimum-size: -1 400;
- preferred-size: -1 -1;
maximum-size: 100% 100%;
- background-image : "meegotouch-notification-event-background" 10px 10px 10px 10px;
+ background-color: black;
+ background-opacity: 0.8;
+}
+
+#VolumeOverlay.Landscape MWidgetSlideAnimationStyle#In {
+ origin: "left";
+}
+
+#VolumeOverlay.Landscape MWidgetSlideAnimationStyle#Out {
+ origin: "left";
+}
+
+#VolumeOverlay.Portrait MWidgetSlideAnimationStyle#In {
+ origin: "right";
+}
+
+#VolumeOverlay.Portrait MWidgetSlideAnimationStyle#Out {
+ origin: "right";
}
--- themes/svg/icon-s-status-notifier.svg
+++ themes/svg/icon-s-status-notifier.svg
-<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363) -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg version="1.1" id="icon-s-status-notifier-layer"
- xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="36px" height="18px"
- viewBox="0 0 36 18" style="enable-background:new 0 0 36 18;" xml:space="preserve">
-<g id="icon-s-status-notifier">
- <path style="fill:#FFFFFF;" d="M26.869,18H9.13C4.096,18,0,13.963,0,9s4.096-9,9.13-9h17.739C31.904,0,36,4.037,36,9
- S31.904,18,26.869,18L26.869,18z M9.13,1.543C4.959,1.543,1.564,4.889,1.564,9s3.395,7.457,7.565,7.457h17.739
- c4.172,0,7.566-3.346,7.566-7.457s-3.396-7.457-7.566-7.457H9.13L9.13,1.543z"/>
-</g>
-</svg>
--- themes/svg/test.svg
+++ themes/svg/test.svg
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:xlink="http://www.w3.org/1999/xlink"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="64px"
- height="64px"
- id="svg8833"
- sodipodi:version="0.32"
- inkscape:version="0.46"
- sodipodi:docname="test.svg"
- inkscape:output_extension="org.inkscape.output.svg.inkscape">
- <defs
- id="defs8835">
- <linearGradient
- id="linearGradient4604">
- <stop
- style="stop-color:#006900;stop-opacity:1;"
- offset="0"
- id="stop4606" />
- <stop
- style="stop-color:#00a7ff;stop-opacity:0;"
- offset="1"
- id="stop4608" />
- </linearGradient>
- <inkscape:perspective
- sodipodi:type="inkscape:persp3d"
- inkscape:vp_x="-0.54545455 : 26.909091 : 1"
- inkscape:vp_y="6.1230318e-14 : 1000 : 0"
- inkscape:vp_z="64.181818 : 24.909091 : 1"
- inkscape:persp3d-origin="31.454545 : 16.242424 : 1"
- id="perspective8841" />
- <linearGradient
- inkscape:collect="always"
- xlink:href="#linearGradient4604"
- id="linearGradient4612"
- x1="0"
- y1="31.5"
- x2="65"
- y2="31.5"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(0.9843129,3.0474016e-4,0,0.9846177,1.97267e-2,-63.015716)" />
- </defs>
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="5.5"
- inkscape:cx="-0.36363636"
- inkscape:cy="32"
- inkscape:current-layer="Kuutio"
- showgrid="true"
- inkscape:document-units="px"
- inkscape:grid-bbox="true"
- inkscape:window-width="1600"
- inkscape:window-height="1066"
- inkscape:window-x="0"
- inkscape:window-y="33" />
- <metadata
- id="metadata8838">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g
- id="UnlockSliderTemp"
- inkscape:label="Layer 1"
- inkscape:groupmode="layer">
- <rect
- style="opacity:1;fill:url(#linearGradient4612);fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:0.98446506px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
- id="rect2388"
- width="62.996037"
- height="63.015545"
- x="0.51188326"
- y="-63.507778"
- transform="matrix(0,1,-1,3.0940516e-4,0,0)" />
- </g>
-</svg>
--- themes/themes.pro
+++ themes/themes.pro
@@ -2,6 +2,7 @@
TEMPLATE = subdirs
SUBDIRS = \
+ feedbacks \
style \
svg
++++++ meegotouch-systemui.yaml
--- meegotouch-systemui.yaml
+++ meegotouch-systemui.yaml
@@ -1,48 +1,39 @@
Name: meegotouch-systemui
Summary: System UI daemon
-Version: 0.16.6
+Version: 0.16.13
Release: 1
Group: System/Desktop
-License: LGPL v2.1
-URL: http://meego.org
+License: LGPLv2.1
+URL: http://meego.gitorious.org/meegotouch/meegotouch-systemui
Sources:
- "%{name}-%{version}.tar.bz2"
- - meegotouch-systemui.desktop
+ - "%{name}.desktop"
- lock.desktop
Patches:
- 0001-Initial-buildable-version-against-MeeGo.patch
- systemui-fix-profile-compile.patch
-# - disable_unlockConfirmed_call.patch
- - fix_build_issues.patch
Description: System UI daemon
-
-PkgBR:
- - fdupes
PkgConfigBR:
- - QtCore >= 4.6.0
- QtGui
- - messageserver
- - icu
- - meegotouch
- - dbus-1
- contextsubscriber-1.0
- - xcomposite
- - xdamage
- - glib-2.0
+ - dbus-1
- dbus-glib-1
+ - glib-2.0
+ - meegotouch
- x11
+ - xcomposite
+ - xdamage
Provides :
- duistatusindicatormenu > 0.18.1
- systemui > 0.1
Obsoletes:
- duistatusindicatormenu <= 0.18.1
- systemui <= 0.1
-
Configure: none
-Builder: make
+Builder: qmake
+RunFdupes: "%{_datadir}"
SubPackages:
- Name: devel
Summary: System UI daemon
Group: Development/System
Description: System UI daemon
-
++++++ deleted files:
--- disable_unlockConfirmed_call.patch
--- fix_build_issues.patch
More information about the MeeGo-commits
mailing list