@@ -19,7 +19,6 @@ import AccountsService 0.1
19import GSettings 1.0
19import GSettings 1.0
20import Unity.Application 0.1
20import Unity.Application 0.1
21import Ubuntu.Components 0.1
21import Ubuntu.Components 0.1
22−import Ubuntu.Components.Popups 0.1
23import Ubuntu.Gestures 0.1
22import Ubuntu.Gestures 0.1
24import Unity.Launcher 0.1
23import Unity.Launcher 0.1
25import Utils 0.1
24import Utils 0.1
@@ -95,9 +94,7 @@ Item {
96 Keys.onPressed: {
95 Keys.onPressed: {
97 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
96 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
98− if (!powerKeyTimer.running) {
97+ dialogs.onPowerKeyPressed();
99− powerKeyTimer.start();
101 event.accepted = true;
98 event.accepted = true;
103 event.accepted = false;
100 event.accepted = false;
@@ -106,7 +103,7 @@ Item {
107 Keys.onReleased: {
104 Keys.onReleased: {
108 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
105 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
109− powerKeyTimer.stop();
106+ dialogs.onPowerKeyReleased();
110 event.accepted = true;
107 event.accepted = true;
112 event.accepted = false;
109 event.accepted = false;
@@ -162,170 +159,6 @@ Item {
165− property bool dialogShown: false
172− text: "Are you sure that you want to logout?"
176− PopupUtils.close(dialogueLogout);
177− stages.dialogShown = false;
183− DBusUnitySessionService.Logout();
184− PopupUtils.close(dialogueLogout);
185− stages.dialogShown = false;
194− id: dialogueShutdown
196− text: "Are you sure that you want to shutdown?"
200− PopupUtils.close(dialogueShutdown);
201− stages.dialogShown = false;
207− dBusUnitySessionServiceConnection.closeAllApps();
208− DBusUnitySessionService.Shutdown();
209− PopupUtils.close(dialogueShutdown);
210− stages.dialogShown = false;
221− text: "Are you sure that you want to reboot?"
225− PopupUtils.close(dialogueReboot)
226− stages.dialogShown = false;
232− dBusUnitySessionServiceConnection.closeAllApps();
233− DBusUnitySessionService.Reboot();
234− PopupUtils.close(dialogueReboot);
235− stages.dialogShown = false;
246− text: i18n.tr("Are you sure you would like to turn power off?")
248− text: i18n.tr("Power off")
250− dBusUnitySessionServiceConnection.closeAllApps();
251− PopupUtils.close(dialoguePower);
252− stages.dialogShown = false;
253− shutdownFadeOutRectangle.enabled = true;
254− shutdownFadeOutRectangle.visible = true;
255− shutdownFadeOut.start();
259− text: i18n.tr("Restart")
261− dBusUnitySessionServiceConnection.closeAllApps();
262− DBusUnitySessionService.Reboot();
263− PopupUtils.close(dialoguePower);
264− stages.dialogShown = false;
268− text: i18n.tr("Cancel")
270− PopupUtils.close(dialoguePower);
271− stages.dialogShown = false;
277− function showPowerDialog() {
278− if (!stages.dialogShown) {
279− stages.dialogShown = true;
280− PopupUtils.open(powerDialog);
285− id: dBusUnitySessionServiceConnection
286− objectName: "dBusUnitySessionServiceConnection"
287− target: DBusUnitySessionService
289− function closeAllApps() {
291− var app = ApplicationManager.get(0);
295− ApplicationManager.stopApplication(app.appId);
299− onLogoutRequested: {
300− // Display a dialog to ask the user to confirm.
301− if (!stages.dialogShown) {
302− stages.dialogShown = true;
303− PopupUtils.open(logoutDialog);
307− onShutdownRequested: {
308− // Display a dialog to ask the user to confirm.
309− if (!stages.dialogShown) {
310− stages.dialogShown = true;
311− PopupUtils.open(shutdownDialog);
315− onRebootRequested: {
316− // Display a dialog to ask the user to confirm.
317− if (!stages.dialogShown) {
318− stages.dialogShown = true;
319− PopupUtils.open(rebootDialog);
330 id: applicationsDisplayLoader
163 id: applicationsDisplayLoader
331 anchors.fill: parent
164 anchors.fill: parent
@@ -702,11 +535,22 @@ Item {
702 value: "unity8"
535 value: "unity8"
540+ anchors.fill: parent
542+ onPowerOffClicked: {
543+ shutdownFadeOutRectangle.enabled = true;
544+ shutdownFadeOutRectangle.visible = true;
545+ shutdownFadeOut.start();
706 id: alphaDisclaimerLabel
550 id: alphaDisclaimerLabel
707 anchors.centerIn: parent
551 anchors.centerIn: parent
708 visible: ApplicationManager.fake ? ApplicationManager.fake : false
552 visible: ApplicationManager.fake ? ApplicationManager.fake : false
709− z: overlay.z + 10
553+ z: dialogs.z + 10
710 text: "EARLY ALPHA\nNOT READY FOR USE"
554 text: "EARLY ALPHA\nNOT READY FOR USE"
711 color: "lightgrey"
555 color: "lightgrey"
712 opacity: 0.2
556 opacity: 0.2
@@ -732,19 +576,9 @@ Item {
732 onShowHome: showHome()
576 onShowHome: showHome()
739− triggeredOnStart: false
742− stages.showPowerDialog();
746 Rectangle {
579 Rectangle {
747 id: shutdownFadeOutRectangle
580 id: shutdownFadeOutRectangle
748 enabled: false
582 enabled: false
749 visible: false
583 visible: false
750 color: "black"
584 color: "black"
@@ -761,4 +595,5 @@ Item {