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
=== modified file 'qml/Wizard/Pages.qml'
--- qml/Wizard/Pages.qml 2015-01-28 21:25:45 +0000
+++ qml/Wizard/Pages.qml 2015-02-06 13:48:24 +0000
@@ -29,6 +29,7 @@
29 property string background29 property string background
3030
31 signal quit()31 signal quit()
32 signal pageLoaded(int index)
3233
33 // These should be set by a security page and we apply the settings when34 // These should be set by a security page and we apply the settings when
34 // the user exits the wizard.35 // the user exits the wizard.
@@ -109,6 +110,7 @@
109 // First load it invisible, check that we should actually use110 // First load it invisible, check that we should actually use
110 // this page, and either skip it or continue.111 // this page, and either skip it or continue.
111 push(path, {"opacity": 0, "enabled": false})112 push(path, {"opacity": 0, "enabled": false})
113 root.pageLoaded(pageList.index)
112114
113 // Check for immediate skip or not. We may have to wait for115 // Check for immediate skip or not. We may have to wait for
114 // skipValid to be assigned (see Connections object below)116 // skipValid to be assigned (see Connections object below)
115117
=== modified file 'qml/Wizard/Wizard.qml'
--- qml/Wizard/Wizard.qml 2014-11-24 17:56:44 +0000
+++ qml/Wizard/Wizard.qml 2015-02-06 13:48:24 +0000
@@ -16,6 +16,7 @@
1616
17import QtQuick 2.317import QtQuick 2.3
18import Ubuntu.Components 1.118import Ubuntu.Components 1.1
19import Unity.Session 0.1
19import Wizard 0.120import Wizard 0.1
20import "../Components"21import "../Components"
2122
@@ -35,6 +36,14 @@
35 }36 }
36 }37 }
3738
39 Timer {
40 id: idleTimer
41 objectName: "idleTimer"
42 interval: 120000
43 running: true
44 onTriggered: DBusUnitySessionService.shutdown()
45 }
46
38 Loader {47 Loader {
39 id: loader48 id: loader
40 anchors.fill: parent49 anchors.fill: parent
@@ -50,6 +59,7 @@
50 Connections {59 Connections {
51 target: loader.item60 target: loader.item
52 onQuit: root.hide()61 onQuit: root.hide()
62 onPageLoaded: if (index > 0) idleTimer.stop()
53 }63 }
54 }64 }
55}65}
5666
=== modified file 'tests/mocks/Unity/CMakeLists.txt'
--- tests/mocks/Unity/CMakeLists.txt 2015-02-04 13:22:27 +0000
+++ tests/mocks/Unity/CMakeLists.txt 2015-02-06 13:48:24 +0000
@@ -4,6 +4,7 @@
4add_subdirectory(Launcher)4add_subdirectory(Launcher)
5add_subdirectory(Notifications)5add_subdirectory(Notifications)
6add_subdirectory(DashCommunicator)6add_subdirectory(DashCommunicator)
7add_subdirectory(Session)
78
8pkg_search_module(GOBJECT gobject-2.0 REQUIRED)9pkg_search_module(GOBJECT gobject-2.0 REQUIRED)
9pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=5)10pkg_check_modules(SCOPES_API REQUIRED unity-shell-scopes=5)
1011
=== added directory 'tests/mocks/Unity/Session'
=== added file 'tests/mocks/Unity/Session/CMakeLists.txt'
--- tests/mocks/Unity/Session/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ tests/mocks/Unity/Session/CMakeLists.txt 2015-02-06 13:48:24 +0000
@@ -0,0 +1,1 @@
1add_unity8_mock(Unity.Session 0.1 Unity/Session)
02
=== added file 'tests/mocks/Unity/Session/DBusUnitySessionService.qml'
--- tests/mocks/Unity/Session/DBusUnitySessionService.qml 1970-01-01 00:00:00 +0000
+++ tests/mocks/Unity/Session/DBusUnitySessionService.qml 2015-02-06 13:48:24 +0000
@@ -0,0 +1,24 @@
1/*
2 * Copyright (C) 2015 Canonical, Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License version 3, as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY,
10 * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17pragma Singleton
18import QtQuick 2.3
19
20QtObject {
21 signal logout
22 signal reboot
23 signal shutdown
24}
025
=== added file 'tests/mocks/Unity/Session/Session.qmltypes'
--- tests/mocks/Unity/Session/Session.qmltypes 1970-01-01 00:00:00 +0000
+++ tests/mocks/Unity/Session/Session.qmltypes 2015-02-06 13:48:24 +0000
@@ -0,0 +1,22 @@
1import QtQuick.tooling 1.1
2
3// This file describes the plugin-supplied types contained in the library.
4// It is used for QML tooling purposes only.
5//
6// This file was auto-generated by:
7// 'qmlplugindump -notrelocatable Unity.Session 0.1 tests/mocks'
8
9Module {
10 Component {
11 prototype: "QObject"
12 name: "DBusUnitySessionService"
13 exports: ["DBusUnitySessionService -1.-1"]
14 exportMetaObjectRevisions: [-1]
15 isComposite: true
16 isCreatable: false
17 isSingleton: true
18 Signal { name: "logout" }
19 Signal { name: "reboot" }
20 Signal { name: "shutdown" }
21 }
22}
023
=== added file 'tests/mocks/Unity/Session/qmldir'
--- tests/mocks/Unity/Session/qmldir 1970-01-01 00:00:00 +0000
+++ tests/mocks/Unity/Session/qmldir 2015-02-06 13:48:24 +0000
@@ -0,0 +1,3 @@
1module Unity.Session
2typeinfo UnitySession.qmltypes
3singleton DBusUnitySessionService 0.1 DBusUnitySessionService.qml
04
=== modified file 'tests/qmltests/Wizard/tst_Wizard.qml'
--- tests/qmltests/Wizard/tst_Wizard.qml 2014-12-11 14:10:18 +0000
+++ tests/qmltests/Wizard/tst_Wizard.qml 2015-02-06 13:48:24 +0000
@@ -21,6 +21,7 @@
21import QMenuModel 0.121import QMenuModel 0.1
22import Ubuntu.Components 1.122import Ubuntu.Components 1.1
23import Ubuntu.SystemSettings.SecurityPrivacy 1.023import Ubuntu.SystemSettings.SecurityPrivacy 1.0
24import Unity.Session 0.1
24import Unity.Test 0.1 as UT25import Unity.Test 0.1 as UT
25import Wizard 0.126import Wizard 0.1
26import "../../../qml/Wizard"27import "../../../qml/Wizard"
@@ -69,6 +70,12 @@
69 signalName: "activated"70 signalName: "activated"
70 }71 }
7172
73 SignalSpy {
74 id: sessionSpy
75 target: DBusUnitySessionService
76 signalName: "shutdown"
77 }
78
72 function setup() {79 function setup() {
73 AccountsService.hereEnabled = false;80 AccountsService.hereEnabled = false;
74 AccountsService.hereLicensePath = Qt.resolvedUrl("licenses");81 AccountsService.hereLicensePath = Qt.resolvedUrl("licenses");
@@ -129,6 +136,7 @@
129 var pages = findChild(wizard, "wizardPages");136 var pages = findChild(wizard, "wizardPages");
130 var security = findInvisibleChild(pages, "securityPrivacy");137 var security = findInvisibleChild(pages, "securityPrivacy");
131 setSecuritySpy.target = security;138 setSecuritySpy.target = security;
139 sessionSpy.clear();
132140
133 setup();141 setup();
134 }142 }
@@ -499,5 +507,18 @@
499 tap(findChild(page, "backButton"));507 tap(findChild(page, "backButton"));
500 waitForPage("locationPage");508 waitForPage("locationPage");
501 }509 }
510
511 function test_idleTimer() {
512 var timer = findInvisibleChild(wizard, "idleTimer");
513 timer.triggered();
514 sessionSpy.wait();
515 }
516
517 function test_notIdleTimer() {
518 goToPage("simPage");
519 var timer = findInvisibleChild(wizard, "idleTimer");
520 verify(!timer.running, "Idle timer should be stopped");
521 compare(sessionSpy.count, 0, "Shutdown should not have been called");
522 }
502 }523 }
503}524}

Subscribers

People subscribed via source and target branches