Merge lp:~mterry/ubuntu-system-settings/shutdown-dialog-in-wizard-rtm into lp:ubuntu-system-settings/rtm-14.09

Proposed by Michael Terry
Status: Merged
Approved by: Ken VanDine
Approved revision: 932
Merged at revision: 940
Proposed branch: lp:~mterry/ubuntu-system-settings/shutdown-dialog-in-wizard-rtm
Merge into: lp:ubuntu-system-settings/rtm-14.09
Diff against target: 74 lines (+52/-0)
1 file modified
wizard/qml/main.qml (+52/-0)
To merge this branch: bzr merge lp:~mterry/ubuntu-system-settings/shutdown-dialog-in-wizard-rtm
Reviewer Review Type Date Requested Status
Ubuntu Touch System Settings Pending
Review via email: mp+240272@code.launchpad.net

Commit message

When the power button is held down, show the shutdown dialog like we do in the unity8 shell.

Description of the change

When the power button is held down, show the shutdown dialog like we do in the unity8 shell.

== Checklist ==

 * Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)
 Yes

 * Did you build your software in a clean sbuild/pbuilder chroot or ppa?
 NA, just qml changes

 * Did you build your software in a clean sbuild/pbuilder armhf chroot or ppa?
 NA, just qml changes

 * Has your component "TestPlan” been executed successfully on emulator, N4?
 Yes

 * Has a 5 minute exploratory testing run been executed on N4?
 Yes

 * If you changed the packaging (debian), did you subscribe a core-dev to this MP?
 NA

 * If you changed the UI, did you subscribe the design-reviewers to this MP?
 NA

 * What components might get impacted by your changes?
 Just the wizard

 * Have you requested review by the teams of these owning components?
 Yup

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'wizard/qml/main.qml'
2--- wizard/qml/main.qml 2014-09-29 20:45:30 +0000
3+++ wizard/qml/main.qml 2014-10-31 14:21:33 +0000
4@@ -20,13 +20,16 @@
5 import Ubuntu.SystemSettings.SecurityPrivacy 1.0
6 import Unity.Application 0.1
7 import Unity.Notifications 1.0 as NotificationBackend
8+import Unity.Session 0.1
9 import "Components"
10 import "file:///usr/share/unity8/Notifications" as Notifications // FIXME This should become a module or go away
11+import "file:///usr/share/unity8/Components" as UnityComponents
12
13 Item {
14 id: root
15 width: units.gu(40)
16 height: units.gu(71)
17+ focus: true
18
19 // These should be set by a security page and we apply the settings when
20 // the user exits the wizard.
21@@ -191,4 +194,53 @@
22 }
23 ]
24 }
25+
26+ UnityComponents.Dialogs {
27+ id: dialogs
28+ anchors.fill: parent
29+ z: 10
30+ onPowerOffClicked: {
31+ shutdownFadeOutRectangle.enabled = true;
32+ shutdownFadeOutRectangle.visible = true;
33+ shutdownFadeOut.start();
34+ }
35+ }
36+
37+ Rectangle {
38+ id: shutdownFadeOutRectangle
39+ z: dialogs.z + 10
40+ enabled: false
41+ visible: false
42+ color: "black"
43+ anchors.fill: parent
44+ opacity: 0.0
45+ NumberAnimation on opacity {
46+ id: shutdownFadeOut
47+ from: 0.0
48+ to: 1.0
49+ onStopped: {
50+ if (shutdownFadeOutRectangle.enabled && shutdownFadeOutRectangle.visible) {
51+ DBusUnitySessionService.Shutdown();
52+ }
53+ }
54+ }
55+ }
56+
57+ Keys.onPressed: {
58+ if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
59+ dialogs.onPowerKeyPressed();
60+ event.accepted = true;
61+ } else {
62+ event.accepted = false;
63+ }
64+ }
65+
66+ Keys.onReleased: {
67+ if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
68+ dialogs.onPowerKeyReleased();
69+ event.accepted = true;
70+ } else {
71+ event.accepted = false;
72+ }
73+ }
74 }

Subscribers

People subscribed via source and target branches