on xenial help sign in
Fix Power off dialog show on display state change.
8dc6b19Ying-Chun Liu
qml/Components/Dialogs.qml+7−11
@@ -18,15 +18,18 @@ import QtQuick 2.0
18
18
19import Unity.Application 0.1
19import Unity.Application 0.1
20import Unity.Session 0.1
20import Unity.Session 0.1
21−import Ubuntu.Components 0.1
21+import Ubuntu.Components 1.1
22import Ubuntu.Components.Popups 0.1
22import Ubuntu.Components.Popups 0.1
23
23
24Item {
24Item {
25 id: root
25 id: root
26
26
27 function onPowerKeyPressed() {
27 function onPowerKeyPressed() {
28+ // FIXME: event.isAutoRepeat is always false on Nexus 4.
29+ // So we use powerKeyTimer.running to avoid the PowerOff key repeat
30+ // https://launchpad.net/bugs/1349416
28 if (!powerKeyTimer.running) {
31 if (!powerKeyTimer.running) {
29− powerKeyTimer.start();
32+ powerKeyTimer.restart();
30 }
33 }
31 }
34 }
32
35
@@ -148,15 +151,7 @@ Item {
148 d.dialogShown = false;
151 d.dialogShown = false;
149 root.powerOffClicked();
152 root.powerOffClicked();
150 }
153 }
151− }
154+ color: UbuntuColors.red
152− Button {
153− text: i18n.tr("Restart")
154− onClicked: {
155− dBusUnitySessionServiceConnection.closeAllApps();
156− DBusUnitySessionService.Reboot();
157− PopupUtils.close(dialoguePower);
158− d.dialogShown = false;
159− }
160 }
155 }
161 Button {
156 Button {
162 text: i18n.tr("Cancel")
157 text: i18n.tr("Cancel")
@@ -164,6 +159,7 @@ Item {
164 PopupUtils.close(dialoguePower);
159 PopupUtils.close(dialoguePower);
165 d.dialogShown = false;
160 d.dialogShown = false;
166 }
161 }
162+ color: UbuntuColors.coolGrey
167 }
163 }
168 }
164 }
169 }
165 }
qml/Shell.qml+4
@@ -508,6 +508,10 @@ Item {
508 } else if (status == Powerd.On) {
508 } else if (status == Powerd.On) {
509 edgeDemo.paused = false;
509 edgeDemo.paused = false;
510 }
510 }
511+
512+ // Stop the timer to avoid displaying the power dialog when display
513+ // state is changed.
514+ dialogs.onPowerKeyReleased();
511 }
515 }
512 }
516 }
513
517