@@ -94,9 +94,7 @@ Item {
95 Keys.onPressed: {
95 Keys.onPressed: {
96 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
96 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
97− if (!powerKeyTimer.running) {
97+ dialogs.onPowerKeyPressed();
98− powerKeyTimer.start();
100 event.accepted = true;
98 event.accepted = true;
102 event.accepted = false;
100 event.accepted = false;
@@ -105,7 +103,7 @@ Item {
106 Keys.onReleased: {
104 Keys.onReleased: {
107 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
105 if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
108− powerKeyTimer.stop();
106+ dialogs.onPowerKeyReleased();
109 event.accepted = true;
107 event.accepted = true;
111 event.accepted = false;
109 event.accepted = false;
@@ -271,170 +269,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
273 id: applicationsDisplayLoader
440 anchors.fill: parent
274 anchors.fill: parent
@@ -812,11 +646,22 @@ Item {
812 value: "unity8"
646 value: "unity8"
651+ anchors.fill: parent
653+ onPowerOffClicked: {
654+ shutdownFadeOutRectangle.enabled = true;
655+ shutdownFadeOutRectangle.visible = true;
656+ shutdownFadeOut.start();
816 id: alphaDisclaimerLabel
661 id: alphaDisclaimerLabel
817 anchors.centerIn: parent
662 anchors.centerIn: parent
818 visible: ApplicationManager.fake ? ApplicationManager.fake : false
663 visible: ApplicationManager.fake ? ApplicationManager.fake : false
819− z: overlay.z + 10
664+ z: dialogs.z + 10
820 text: "EARLY ALPHA\nNOT READY FOR USE"
665 text: "EARLY ALPHA\nNOT READY FOR USE"
821 color: "lightgrey"
666 color: "lightgrey"
822 opacity: 0.2
667 opacity: 0.2
@@ -843,19 +688,9 @@ Item {
843 onShowHome: showHome()
688 onShowHome: showHome()
850− triggeredOnStart: false
853− stages.showPowerDialog();
857 Rectangle {
691 Rectangle {
858 id: shutdownFadeOutRectangle
692 id: shutdownFadeOutRectangle
859 enabled: false
694 enabled: false
860 visible: false
695 visible: false
861 color: "black"
696 color: "black"
@@ -872,4 +707,5 @@ Item {