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

Proposed by Michael Terry
Status: Merged
Approved by: Michael Terry
Approved revision: 1135
Merged at revision: 1172
Proposed branch: lp:~mterry/ubuntu-system-settings/shutdown-dialog-in-wizard
Merge into: lp:ubuntu-system-settings
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
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Daniel d'Andrada (community) Approve
Ubuntu Touch System Settings Pending
Review via email: mp+238497@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.

This will need a slight change in unity8 to set the domain explicitly for translations, so it can be imported from the wizard like this.

== 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?
 I guess that's me

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Please add "focus: true" to the root item, even if it doesn't work without the "root.forceActiveFocus();" hack.

Other than that, it looks ok to me.

wizard shares or copies a lot of code from unity8 (InputMethod, notifications and now dialogs). We should figure out a clean solution for that at some point...

review: Approve
1134. By Michael Terry

Fix focus more nicely

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

Daniel, fixed focus with "focus: true" and using a FocusScope.

As for sharing code, I think maybe the best long term plan is to move the wizard into unity8 code... We'll figure something out.

1135. By Michael Terry

Drop FocusScope

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

Even cleaner now

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

It's perfect now. Thanks!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

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-20 13:58:14 +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