@@ -1,5 +1,5 @@
2− * Copyright (C) 2014 Canonical, Ltd.
2+ * Copyright (C) 2014-2015 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
5 * it under the terms of the GNU General Public License as published by
@@ -21,6 +21,7 @@ import Unity.Session 0.1
21import GlobalShortcut 1.0
21import GlobalShortcut 1.0
22import Ubuntu.Components 1.3
22import Ubuntu.Components 1.3
23import Unity.Platform 1.0
23import Unity.Platform 1.0
24import "../Greeter"
25import "../Greeter"
@@ -45,6 +46,31 @@ Item {
45 d.showPowerDialog();
46 d.showPowerDialog();
49+ onUsageScenarioChanged: {
50+ if (usageScenario != "desktop" && legacyAppsModel.count > 0 && !d.modeSwitchWarningPopup) {
51+ var comp = Qt.createComponent(Qt.resolvedUrl("ModeSwitchWarningDialog.qml"))
52+ d.modeSwitchWarningPopup = comp.createObject(root, {model: legacyAppsModel});
53+ d.modeSwitchWarningPopup.forceClose.connect(function() {
54+ while (legacyAppsModel.count > 0) {
55+ ApplicationManager.stopApplication(legacyAppsModel.get(0).appId);
57+ d.modeSwitchWarningPopup.hide();
58+ d.modeSwitchWarningPopup.destroy();
59+ d.modeSwitchWarningPopup = null;
61+ } else if (usageScenario == "desktop" && d.modeSwitchWarningPopup) {
62+ d.modeSwitchWarningPopup.hide();
63+ d.modeSwitchWarningPopup.destroy();
64+ d.modeSwitchWarningPopup = null;
68+ ApplicationsFilterModel {
70+ applicationsModel: ApplicationManager
71+ filterTouchApps: true
48 GlobalShortcut { // reboot/shutdown dialog
74 GlobalShortcut { // reboot/shutdown dialog
49 shortcut: Qt.Key_PowerDown
75 shortcut: Qt.Key_PowerDown
50 active: Platform.isPC
76 active: Platform.isPC
@@ -91,6 +117,8 @@ Item {
91 id: d // private stuff
117 id: d // private stuff
92 objectName: "dialogsPrivate"
118 objectName: "dialogsPrivate"
120+ property var modeSwitchWarningPopup: null
94 function showPowerDialog() {
122 function showPowerDialog() {
95 if (!dialogLoader.active) {
123 if (!dialogLoader.active) {
96 dialogLoader.sourceComponent = powerDialogComponent;
124 dialogLoader.sourceComponent = powerDialogComponent;
@@ -270,5 +298,4 @@ Item {
270 unitySessionService.endSession();
298 unitySessionService.endSession();