@@ -21,6 +21,7 @@ import Unity.Session 0.1
2121import Ubuntu.Components 1.1
2222import GlobalShortcut 1.0
2323import Unity.Platform 1.0
24+import Utils 0.1
2425import "../Greeter"
2526
2627Item {
@@ -45,6 +46,28 @@ Item {
4546 d.showPowerDialog();
4647 }
4748
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(shell, {model: legacyAppsModel});
53+ d.modeSwitchWarningPopup.forceClose.connect(function() {
54+ while (legacyAppsModel.count > 0) {
55+ ApplicationManager.stopApplication(legacyAppsModel.get(0).appId);
56+ }
57+ })
58+ } else if (usageScenario == "desktop" && d.modeSwitchWarningPopup) {
59+ d.modeSwitchWarningPopup.hide();
60+ d.modeSwitchWarningPopup.destroy();
61+ d.modeSwitchWarningPopup = null;
62+ }
63+ }
64+
65+ ApplicationsFilterModel {
66+ id: legacyAppsModel
67+ applicationsModel: ApplicationManager
68+ filterTouchApps: true
69+ }
70+
4871 GlobalShortcut { // reboot/shutdown dialog
4972 shortcut: Qt.Key_PowerDown
5073 active: Platform.isPC
@@ -91,6 +114,8 @@ Item {
91114 id: d // private stuff
92115 objectName: "dialogsPrivate"
93116
117+ property var modeSwitchWarningPopup: null
118+
94119 function showPowerDialog() {
95120 if (!dialogLoader.active) {
96121 dialogLoader.sourceComponent = powerDialogComponent;
@@ -270,5 +295,4 @@ Item {
270295 unitySessionService.endSession();
271296 }
272297 }
273−
274298}