@@ -278,6 +278,8 @@ FocusScope {
281+ property bool dialogShown: false
281 Component {
283 Component {
282 id: logoutDialog
284 id: logoutDialog
@@ -286,13 +288,17 @@ FocusScope {
286 text: "Are you sure that you want to logout?"
288 text: "Are you sure that you want to logout?"
288 text: "Cancel"
290 text: "Cancel"
289− onClicked: PopupUtils.close(dialogueLogout)
292+ PopupUtils.close(dialogueLogout);
293+ stages.dialogShown = false;
292 text: "Yes"
297 text: "Yes"
293 onClicked: {
298 onClicked: {
294 DBusUnitySessionService.Logout();
299 DBusUnitySessionService.Logout();
295 PopupUtils.close(dialogueLogout);
300 PopupUtils.close(dialogueLogout);
301+ stages.dialogShown = false;
@@ -306,7 +312,10 @@ FocusScope {
306 text: "Are you sure that you want to shutdown?"
312 text: "Are you sure that you want to shutdown?"
308 text: "Cancel"
314 text: "Cancel"
309− onClicked: PopupUtils.close(dialogueShutdown)
316+ PopupUtils.close(dialogueShutdown);
317+ stages.dialogShown = false;
312 text: "Yes"
321 text: "Yes"
@@ -314,6 +323,7 @@ FocusScope {
314 dBusUnitySessionServiceConnection.closeAllApps();
323 dBusUnitySessionServiceConnection.closeAllApps();
315 DBusUnitySessionService.Shutdown();
324 DBusUnitySessionService.Shutdown();
316 PopupUtils.close(dialogueShutdown);
325 PopupUtils.close(dialogueShutdown);
326+ stages.dialogShown = false;
@@ -327,7 +337,10 @@ FocusScope {
327 text: "Are you sure that you want to reboot?"
337 text: "Are you sure that you want to reboot?"
329 text: "Cancel"
339 text: "Cancel"
330− onClicked: PopupUtils.close(dialogueReboot)
341+ PopupUtils.close(dialogueReboot)
342+ stages.dialogShown = false;
333 text: "Yes"
346 text: "Yes"
@@ -335,6 +348,7 @@ FocusScope {
335 dBusUnitySessionServiceConnection.closeAllApps();
348 dBusUnitySessionServiceConnection.closeAllApps();
336 DBusUnitySessionService.Reboot();
349 DBusUnitySessionService.Reboot();
337 PopupUtils.close(dialogueReboot);
350 PopupUtils.close(dialogueReboot);
351+ stages.dialogShown = false;
@@ -356,17 +370,26 @@ FocusScope {
357 onLogoutRequested: {
371 onLogoutRequested: {
358 // Display a dialog to ask the user to confirm.
372 // Display a dialog to ask the user to confirm.
373+ if (!stages.dialogShown) {
374+ stages.dialogShown = true;
359− PopupUtils.open(logoutDialog);
375+ PopupUtils.open(logoutDialog);
362 onShutdownRequested: {
379 onShutdownRequested: {
363 // Display a dialog to ask the user to confirm.
380 // Display a dialog to ask the user to confirm.
381+ if (!stages.dialogShown) {
382+ stages.dialogShown = true;
364− PopupUtils.open(shutdownDialog);
383+ PopupUtils.open(shutdownDialog);
367 onRebootRequested: {
387 onRebootRequested: {
368 // Display a dialog to ask the user to confirm.
388 // Display a dialog to ask the user to confirm.
389+ if (!stages.dialogShown) {
390+ stages.dialogShown = true;
369− PopupUtils.open(rebootDialog);
391+ PopupUtils.open(rebootDialog);
372 onLogoutReady: {
395 onLogoutReady: {
@@ -759,4 +782,31 @@ FocusScope {
759 target: SessionBroadcast
782 target: SessionBroadcast
760 onShowHome: showHome()
783 onShowHome: showHome()
787+ if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
788+ if (!powerKeyTimer.running) {
789+ powerKeyTimer.start();
791+ event.accepted = true;
796+ if (event.key == Qt.Key_PowerOff || event.key == Qt.Key_PowerDown) {
797+ powerKeyTimer.stop();
799+ event.accepted = true;
806+ triggeredOnStart: false
809+ DBusUnitySessionService.RequestShutdown();