on xenial help sign in
Merge pull request #195 from ubports/xenial_-_edge_-_fixreboot3
652a3c2Marius Gripsgard
plugins/WindowManager/TopLevelWindowModel.cpp+6
@@ -736,6 +736,12 @@ void TopLevelWindowModel::closeAllWindows()
736 for (auto win : m_windowModel) {
736 for (auto win : m_windowModel) {
737 win.window->close();
737 win.window->close();
738 }
738 }
739+
740+ // This is done after the for loop in the unlikely event that
741+ // an app starts in between this
742+ if (m_windowModel.isEmpty()) {
743+ Q_EMIT closedAllWindows();
744+ }
739}
745}
740
746
741void TopLevelWindowModel::rootFocus(bool focus)
747void TopLevelWindowModel::rootFocus(bool focus)
qml/Components/Dialogs.qml+24−16
@@ -222,11 +222,13 @@ MouseArea {
222 focus: true
222 focus: true
223 text: i18n.tr("Yes")
223 text: i18n.tr("Yes")
224 onClicked: {
224 onClicked: {
225+ doOnClosedAllWindows = function(unitySessionService, rebootDialog) {
226+ return function() {
227+ unitySessionService.reboot();
228+ rebootDialog.hide();
229+ }
230+ }(unitySessionService, rebootDialog);
225 topLevelSurfaceList.closeAllWindows();
231 topLevelSurfaceList.closeAllWindows();
226− doOnClosedAllWindows = function() {
227− unitySessionService.reboot();
228− rebootDialog.hide();
229− }
230 }
232 }
231 color: theme.palette.normal.negative
233 color: theme.palette.normal.negative
232 Component.onCompleted: if (root.hasKeyboard) forceActiveFocus(Qt.TabFocusReason)
234 Component.onCompleted: if (root.hasKeyboard) forceActiveFocus(Qt.TabFocusReason)
@@ -245,11 +247,13 @@ MouseArea {
245 focus: true
247 focus: true
246 text: i18n.ctr("Button: Power off the system", "Power off")
248 text: i18n.ctr("Button: Power off the system", "Power off")
247 onClicked: {
249 onClicked: {
250+ doOnClosedAllWindows = function(root, powerDialog) {
251+ return function() {
252+ powerDialog.hide();
253+ root.powerOffClicked();
254+ }
255+ }(root, powerDialog);
248 topLevelSurfaceList.closeAllWindows();
256 topLevelSurfaceList.closeAllWindows();
249− doOnClosedAllWindows = function() {
250− powerDialog.hide();
251− root.powerOffClicked();
252− }
253 }
257 }
254 color: theme.palette.normal.negative
258 color: theme.palette.normal.negative
255 Component.onCompleted: if (root.hasKeyboard) forceActiveFocus(Qt.TabFocusReason)
259 Component.onCompleted: if (root.hasKeyboard) forceActiveFocus(Qt.TabFocusReason)
@@ -258,11 +262,13 @@ MouseArea {
258 width: parent.width
262 width: parent.width
259 text: i18n.ctr("Button: Restart the system", "Restart")
263 text: i18n.ctr("Button: Restart the system", "Restart")
260 onClicked: {
264 onClicked: {
265+ doOnClosedAllWindows = function(unitySessionService, powerDialog) {
266+ return function() {
267+ unitySessionService.reboot();
268+ powerDialog.hide();
269+ }
270+ }(unitySessionService, powerDialog);
261 topLevelSurfaceList.closeAllWindows();
271 topLevelSurfaceList.closeAllWindows();
262− doOnClosedAllWindows = function() {
263− unitySessionService.reboot();
264− powerDialog.hide();
265− }
266 }
272 }
267 }
273 }
268 Button {
274 Button {
@@ -302,11 +308,13 @@ MouseArea {
302 }
308 }
303
309
304 onLogoutReady: {
310 onLogoutReady: {
311+ doOnClosedAllWindows = function(unitySessionService) {
312+ return function() {
313+ Qt.quit();
314+ unitySessionService.endSession();
315+ }
316+ }(unitySessionService);
305 topLevelSurfaceList.closeAllWindows();
317 topLevelSurfaceList.closeAllWindows();
306− doOnClosedAllWindows = function() {
307− Qt.quit();
308− unitySessionService.endSession();
309− }
310 }
318 }
311 }
319 }
312}
320}