@@ -33,15 +33,6 @@ MouseArea {
34 // to be set from outside, useful mostly for testing purposes
34 // to be set from outside, useful mostly for testing purposes
35 property var unitySessionService: DBusUnitySessionService
35 property var unitySessionService: DBusUnitySessionService
36− property var closeAllApps: function() {
38− var app = ApplicationManager.get(0);
42− ApplicationManager.stopApplication(app.appId);
45 property string usageScenario
36 property string usageScenario
46 property size screenSize: Qt.size(Screen.width, Screen.height)
37 property size screenSize: Qt.size(Screen.width, Screen.height)
47 property bool hasKeyboard: false
38 property bool hasKeyboard: false
@@ -52,6 +43,15 @@ MouseArea {
52 d.showPowerDialog();
43 d.showPowerDialog();
46+ property var doOnClosedAllWindows: function() {}
48+ target: topLevelSurfaceList
50+ onClosedAllWindows: {
51+ doOnClosedAllWindows();
55 onUsageScenarioChanged: {
55 onUsageScenarioChanged: {
56 // if we let the user switch manually to desktop mode, don't display the warning dialog
56 // if we let the user switch manually to desktop mode, don't display the warning dialog
57 // see MenuItemFactory.qml, for the Desktop Mode switch logic
57 // see MenuItemFactory.qml, for the Desktop Mode switch logic
@@ -222,9 +222,11 @@ MouseArea {
222 focus: true
222 focus: true
223 text: i18n.tr("Yes")
223 text: i18n.tr("Yes")
224 onClicked: {
224 onClicked: {
225− root.closeAllApps();
225+ topLevelSurfaceList.closeAllWindows();
226+ doOnClosedAllWindows = function() {
226− unitySessionService.reboot();
227+ unitySessionService.reboot();
227− rebootDialog.hide();
228+ rebootDialog.hide();
229 color: theme.palette.normal.negative
231 color: theme.palette.normal.negative
230 Component.onCompleted: if (root.hasKeyboard) forceActiveFocus(Qt.TabFocusReason)
232 Component.onCompleted: if (root.hasKeyboard) forceActiveFocus(Qt.TabFocusReason)
@@ -243,9 +245,11 @@ MouseArea {
243 focus: true
245 focus: true
244 text: i18n.ctr("Button: Power off the system", "Power off")
246 text: i18n.ctr("Button: Power off the system", "Power off")
245 onClicked: {
247 onClicked: {
246− root.closeAllApps();
248+ topLevelSurfaceList.closeAllWindows();
249+ doOnClosedAllWindows = function() {
247− powerDialog.hide();
250+ powerDialog.hide();
248− root.powerOffClicked();
251+ root.powerOffClicked();
250 color: theme.palette.normal.negative
254 color: theme.palette.normal.negative
251 Component.onCompleted: if (root.hasKeyboard) forceActiveFocus(Qt.TabFocusReason)
255 Component.onCompleted: if (root.hasKeyboard) forceActiveFocus(Qt.TabFocusReason)
@@ -254,9 +258,11 @@ MouseArea {
254 width: parent.width
258 width: parent.width
255 text: i18n.ctr("Button: Restart the system", "Restart")
259 text: i18n.ctr("Button: Restart the system", "Restart")
256 onClicked: {
260 onClicked: {
257− root.closeAllApps();
261+ topLevelSurfaceList.closeAllWindows();
262+ doOnClosedAllWindows = function() {
258− unitySessionService.reboot();
263+ unitySessionService.reboot();
259− powerDialog.hide();
264+ powerDialog.hide();
@@ -296,9 +302,11 @@ MouseArea {
298 onLogoutReady: {
304 onLogoutReady: {
299− root.closeAllApps();
305+ topLevelSurfaceList.closeAllWindows();
306+ doOnClosedAllWindows = function() {
300− Qt.quit();
307+ Qt.quit();
301− unitySessionService.endSession();
308+ unitySessionService.endSession();