Merge lp:~unity-team/unity8/wizard-auto-shutdown into lp:unity8

Proposed by Michał Sawicz
Status: Work in progress
Proposed branch: lp:~unity-team/unity8/wizard-auto-shutdown
Merge into: lp:unity8
Diff against target: 189 lines (+84/-0)
8 files modified
qml/Wizard/Pages.qml (+2/-0)
qml/Wizard/Wizard.qml (+10/-0)
tests/mocks/Unity/CMakeLists.txt (+1/-0)
tests/mocks/Unity/Session/CMakeLists.txt (+1/-0)
tests/mocks/Unity/Session/DBusUnitySessionService.qml (+24/-0)
tests/mocks/Unity/Session/Session.qmltypes (+22/-0)
tests/mocks/Unity/Session/qmldir (+3/-0)
tests/qmltests/Wizard/tst_Wizard.qml (+21/-0)
To merge this branch: bzr merge lp:~unity-team/unity8/wizard-auto-shutdown
Reviewer Review Type Date Requested Status
Andrea Cimitan (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Michael Terry Approve
Review via email: mp+248902@code.launchpad.net

Commit message

Shut down the phone if the wizard does not see interaction for 2 minutes

To post a comment you must log in.
1595. By Michał Sawicz

Fix version and revert plugin changes

1596. By Michał Sawicz

The lowercase methods don't exist on the real implementation

1597. By Michał Sawicz

Fix qmltypes

1598. By Michał Sawicz

And make it a QtObject

1599. By Michał Sawicz

Fix better, and tweak the test a bit

1600. By Michał Sawicz

Move signal emission up

Revision history for this message
Michael Terry (mterry) wrote :

Looks great!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrea Cimitan (cimi) wrote :

Jenkins approved, so I top approve

Revision history for this message
Andrea Cimitan (cimi) wrote :

 * Are there any related MPs required for this MP to build/function as expected? Please list.
no
 * Did you perform an exploratory manual test run of your code change and any related functionality?
y
 * Did you make sure that your branch does not contain spurious tags?
y
 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
n/a
 * If you changed the UI, has there been a design review?
n/a

review: Approve
Revision history for this message
Michał Sawicz (saviq) wrote :

Actually this got a bit less pressing, so some additional UX/UI work on this will happen.

Unmerged revisions

1600. By Michał Sawicz

Move signal emission up

1599. By Michał Sawicz

Fix better, and tweak the test a bit

1598. By Michał Sawicz

And make it a QtObject

1597. By Michał Sawicz

Fix qmltypes

1596. By Michał Sawicz

The lowercase methods don't exist on the real implementation

1595. By Michał Sawicz

Fix version and revert plugin changes

1594. By Michał Sawicz

Shut down the phone if the wizard does not see interaction for 2 minutes

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Wizard/Pages.qml'
2--- qml/Wizard/Pages.qml 2015-01-28 21:25:45 +0000
3+++ qml/Wizard/Pages.qml 2015-02-06 13:48:24 +0000
4@@ -29,6 +29,7 @@
5 property string background
6
7 signal quit()
8+ signal pageLoaded(int index)
9
10 // These should be set by a security page and we apply the settings when
11 // the user exits the wizard.
12@@ -109,6 +110,7 @@
13 // First load it invisible, check that we should actually use
14 // this page, and either skip it or continue.
15 push(path, {"opacity": 0, "enabled": false})
16+ root.pageLoaded(pageList.index)
17
18 // Check for immediate skip or not. We may have to wait for
19 // skipValid to be assigned (see Connections object below)
20
21=== modified file 'qml/Wizard/Wizard.qml'
22--- qml/Wizard/Wizard.qml 2014-11-24 17:56:44 +0000
23+++ qml/Wizard/Wizard.qml 2015-02-06 13:48:24 +0000
24@@ -16,6 +16,7 @@
25
26 import QtQuick 2.3
27 import Ubuntu.Components 1.1
28+import Unity.Session 0.1
29 import Wizard 0.1
30 import "../Components"
31
32@@ -35,6 +36,14 @@
33 }
34 }
35
36+ Timer {
37+ id: idleTimer
38+ objectName: "idleTimer"
39+ interval: 120000
40+ running: true
41+ onTriggered: DBusUnitySessionService.shutdown()
42+ }
43+
44 Loader {
45 id: loader
46 anchors.fill: parent
47@@ -50,6 +59,7 @@
48 Connections {
49 target: loader.item
50 onQuit: root.hide()
51+ onPageLoaded: if (index > 0) idleTimer.stop()
52 }
53 }
54 }
55
56=== modified file 'tests/mocks/Unity/CMakeLists.txt'
57--- tests/mocks/Unity/CMakeLists.txt 2015-02-04 13:22:27 +0000
58+++ tests/mocks/Unity/CMakeLists.txt 2015-02-06 13:48:24 +0000
59@@ -4,6 +4,7 @@
60 add_subdirectory(Launcher)
61 add_subdirectory(Notifications)
62 add_subdirectory(DashCommunicator)
63+add_subdirectory(Session)
64
65 pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
66 pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=5)
67
68=== added directory 'tests/mocks/Unity/Session'
69=== added file 'tests/mocks/Unity/Session/CMakeLists.txt'
70--- tests/mocks/Unity/Session/CMakeLists.txt 1970-01-01 00:00:00 +0000
71+++ tests/mocks/Unity/Session/CMakeLists.txt 2015-02-06 13:48:24 +0000
72@@ -0,0 +1,1 @@
73+add_unity8_mock(Unity.Session 0.1 Unity/Session)
74
75=== added file 'tests/mocks/Unity/Session/DBusUnitySessionService.qml'
76--- tests/mocks/Unity/Session/DBusUnitySessionService.qml 1970-01-01 00:00:00 +0000
77+++ tests/mocks/Unity/Session/DBusUnitySessionService.qml 2015-02-06 13:48:24 +0000
78@@ -0,0 +1,24 @@
79+/*
80+ * Copyright (C) 2015 Canonical, Ltd.
81+ *
82+ * This program is free software: you can redistribute it and/or modify it under
83+ * the terms of the GNU Lesser General Public License version 3, as published by
84+ * the Free Software Foundation.
85+ *
86+ * This program is distributed in the hope that it will be useful, but WITHOUT
87+ * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
88+ * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
89+ * Lesser General Public License for more details.
90+ *
91+ * You should have received a copy of the GNU Lesser General Public License
92+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
93+ */
94+
95+pragma Singleton
96+import QtQuick 2.3
97+
98+QtObject {
99+ signal logout
100+ signal reboot
101+ signal shutdown
102+}
103
104=== added file 'tests/mocks/Unity/Session/Session.qmltypes'
105--- tests/mocks/Unity/Session/Session.qmltypes 1970-01-01 00:00:00 +0000
106+++ tests/mocks/Unity/Session/Session.qmltypes 2015-02-06 13:48:24 +0000
107@@ -0,0 +1,22 @@
108+import QtQuick.tooling 1.1
109+
110+// This file describes the plugin-supplied types contained in the library.
111+// It is used for QML tooling purposes only.
112+//
113+// This file was auto-generated by:
114+// 'qmlplugindump -notrelocatable Unity.Session 0.1 tests/mocks'
115+
116+Module {
117+ Component {
118+ prototype: "QObject"
119+ name: "DBusUnitySessionService"
120+ exports: ["DBusUnitySessionService -1.-1"]
121+ exportMetaObjectRevisions: [-1]
122+ isComposite: true
123+ isCreatable: false
124+ isSingleton: true
125+ Signal { name: "logout" }
126+ Signal { name: "reboot" }
127+ Signal { name: "shutdown" }
128+ }
129+}
130
131=== added file 'tests/mocks/Unity/Session/qmldir'
132--- tests/mocks/Unity/Session/qmldir 1970-01-01 00:00:00 +0000
133+++ tests/mocks/Unity/Session/qmldir 2015-02-06 13:48:24 +0000
134@@ -0,0 +1,3 @@
135+module Unity.Session
136+typeinfo UnitySession.qmltypes
137+singleton DBusUnitySessionService 0.1 DBusUnitySessionService.qml
138
139=== modified file 'tests/qmltests/Wizard/tst_Wizard.qml'
140--- tests/qmltests/Wizard/tst_Wizard.qml 2014-12-11 14:10:18 +0000
141+++ tests/qmltests/Wizard/tst_Wizard.qml 2015-02-06 13:48:24 +0000
142@@ -21,6 +21,7 @@
143 import QMenuModel 0.1
144 import Ubuntu.Components 1.1
145 import Ubuntu.SystemSettings.SecurityPrivacy 1.0
146+import Unity.Session 0.1
147 import Unity.Test 0.1 as UT
148 import Wizard 0.1
149 import "../../../qml/Wizard"
150@@ -69,6 +70,12 @@
151 signalName: "activated"
152 }
153
154+ SignalSpy {
155+ id: sessionSpy
156+ target: DBusUnitySessionService
157+ signalName: "shutdown"
158+ }
159+
160 function setup() {
161 AccountsService.hereEnabled = false;
162 AccountsService.hereLicensePath = Qt.resolvedUrl("licenses");
163@@ -129,6 +136,7 @@
164 var pages = findChild(wizard, "wizardPages");
165 var security = findInvisibleChild(pages, "securityPrivacy");
166 setSecuritySpy.target = security;
167+ sessionSpy.clear();
168
169 setup();
170 }
171@@ -499,5 +507,18 @@
172 tap(findChild(page, "backButton"));
173 waitForPage("locationPage");
174 }
175+
176+ function test_idleTimer() {
177+ var timer = findInvisibleChild(wizard, "idleTimer");
178+ timer.triggered();
179+ sessionSpy.wait();
180+ }
181+
182+ function test_notIdleTimer() {
183+ goToPage("simPage");
184+ var timer = findInvisibleChild(wizard, "idleTimer");
185+ verify(!timer.running, "Idle timer should be stopped");
186+ compare(sessionSpy.count, 0, "Shutdown should not have been called");
187+ }
188 }
189 }

Subscribers

People subscribed via source and target branches