@@ -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
@@ -94,9 +93,7 @@ Item {
95 Keys.onPressed: {
94 Keys.onPressed: {
96 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
95 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
97− if (!powerKeyTimer.running) {
96+ dialogs.onPowerKeyPressed();
98− powerKeyTimer.start();
100 event.accepted = true;
97 event.accepted = true;
102 event.accepted = false;
99 event.accepted = false;
@@ -105,7 +102,7 @@ Item {
106 Keys.onReleased: {
103 Keys.onReleased: {
107 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
104 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
108− powerKeyTimer.stop();
105+ dialogs.onPowerKeyReleased();
109 event.accepted = true;
106 event.accepted = true;
111 event.accepted = false;
108 event.accepted = false;
@@ -271,170 +268,6 @@ Item {
274− property bool dialogShown: false
281− text: "Are you sure that you want to logout?"
285− PopupUtils.close(dialogueLogout);
286− stages.dialogShown = false;
292− DBusUnitySessionService.Logout();
293− PopupUtils.close(dialogueLogout);
294− stages.dialogShown = false;
303− id: dialogueShutdown
305− text: "Are you sure that you want to shutdown?"
309− PopupUtils.close(dialogueShutdown);
310− stages.dialogShown = false;
316− dBusUnitySessionServiceConnection.closeAllApps();
317− DBusUnitySessionService.Shutdown();
318− PopupUtils.close(dialogueShutdown);
319− stages.dialogShown = false;
330− text: "Are you sure that you want to reboot?"
334− PopupUtils.close(dialogueReboot)
335− stages.dialogShown = false;
341− dBusUnitySessionServiceConnection.closeAllApps();
342− DBusUnitySessionService.Reboot();
343− PopupUtils.close(dialogueReboot);
344− stages.dialogShown = false;
355− text: i18n.tr("Are you sure you would like to turn power off?")
357− text: i18n.tr("Power off")
359− dBusUnitySessionServiceConnection.closeAllApps();
360− PopupUtils.close(dialoguePower);
361− stages.dialogShown = false;
362− shutdownFadeOutRectangle.enabled = true;
363− shutdownFadeOutRectangle.visible = true;
364− shutdownFadeOut.start();
368− text: i18n.tr("Restart")
370− dBusUnitySessionServiceConnection.closeAllApps();
371− DBusUnitySessionService.Reboot();
372− PopupUtils.close(dialoguePower);
373− stages.dialogShown = false;
377− text: i18n.tr("Cancel")
379− PopupUtils.close(dialoguePower);
380− stages.dialogShown = false;
386− function showPowerDialog() {
387− if (!stages.dialogShown) {
388− stages.dialogShown = true;
389− PopupUtils.open(powerDialog);
394− id: dBusUnitySessionServiceConnection
395− objectName: "dBusUnitySessionServiceConnection"
396− target: DBusUnitySessionService
398− function closeAllApps() {
400− var app = ApplicationManager.get(0);
404− ApplicationManager.stopApplication(app.appId);
408− onLogoutRequested: {
409− // Display a dialog to ask the user to confirm.
410− if (!stages.dialogShown) {
411− stages.dialogShown = true;
412− PopupUtils.open(logoutDialog);
416− onShutdownRequested: {
417− // Display a dialog to ask the user to confirm.
418− if (!stages.dialogShown) {
419− stages.dialogShown = true;
420− PopupUtils.open(shutdownDialog);
424− onRebootRequested: {
425− // Display a dialog to ask the user to confirm.
426− if (!stages.dialogShown) {
427− stages.dialogShown = true;
428− PopupUtils.open(rebootDialog);
439 id: applicationsDisplayLoader
272 id: applicationsDisplayLoader
440 anchors.fill: parent
273 anchors.fill: parent
@@ -812,11 +645,22 @@ Item {
812 value: "unity8"
645 value: "unity8"
650+ anchors.fill: parent
652+ onPowerOffClicked: {
653+ shutdownFadeOutRectangle.enabled = true;
654+ shutdownFadeOutRectangle.visible = true;
655+ shutdownFadeOut.start();
816 id: alphaDisclaimerLabel
660 id: alphaDisclaimerLabel
817 anchors.centerIn: parent
661 anchors.centerIn: parent
818 visible: ApplicationManager.fake ? ApplicationManager.fake : false
662 visible: ApplicationManager.fake ? ApplicationManager.fake : false
819− z: overlay.z + 10
663+ z: dialogs.z + 10
820 text: "EARLY ALPHA\nNOT READY FOR USE"
664 text: "EARLY ALPHA\nNOT READY FOR USE"
821 color: "lightgrey"
665 color: "lightgrey"
822 opacity: 0.2
666 opacity: 0.2
@@ -843,19 +687,9 @@ Item {
843 onShowHome: showHome()
687 onShowHome: showHome()
850− triggeredOnStart: false
853− stages.showPowerDialog();
857 Rectangle {
690 Rectangle {
858 id: shutdownFadeOutRectangle
691 id: shutdownFadeOutRectangle
859 enabled: false
693 enabled: false
860 visible: false
694 visible: false
861 color: "black"
695 color: "black"
@@ -872,4 +706,5 @@ Item {