on xenial help sign in
Use addSpecialCategory for apps scope
1e80a66Albert Astals
qml/Dash/DashApps.qml+6−5
@@ -38,10 +38,6 @@ GenericScopeView {
38 SortFilterProxyModel {
38 SortFilterProxyModel {
39 id: runningApplicationsModel
39 id: runningApplicationsModel
40
40
41− property var firstModel: mainStageApplicationsModel
42− property var secondModel: sideStageApplicationModel
43− property bool canEnableTerminationMode: scopeView.isCurrent
44−
45 model: dummyVisibilityModifier
41 model: dummyVisibilityModifier
46 filterRole: 0
42 filterRole: 0
47 filterRegExp: invertMatch ? ((mainStageApplicationsModel.count === 0 &&
43 filterRegExp: invertMatch ? ((mainStageApplicationsModel.count === 0 &&
@@ -49,8 +45,13 @@ GenericScopeView {
49 invertMatch: scopeView.scope.searchQuery.length == 0
45 invertMatch: scopeView.scope.searchQuery.length == 0
50 }
46 }
51
47
48+ QtObject {
49+ id: countObject
50+ property int count: runningApplicationsModel.count
51+ }
52+
52 onScopeChanged: {
53 onScopeChanged: {
53− scopeView.scope.categories.overrideResults("recent", runningApplicationsModel);
54+ scopeView.scope.categories.addSpecialCategory("running.apps.category", "Running Apps", "", "{ \"template\": { \"category-layout\": \"running-apps\" } }", countObject);
54 enableHeightBehaviorOnNextCreation = (mainStageApplicationsModel.count + sideStageApplicationModel.count == 0)
55 enableHeightBehaviorOnNextCreation = (mainStageApplicationsModel.count + sideStageApplicationModel.count == 0)
55 }
56 }
56}
57}
qml/Dash/GenericScopeView.qml+8−3
@@ -159,9 +159,10 @@ FocusScope {
159 scopeView.enableHeightBehaviorOnNextCreation = false;
159 scopeView.enableHeightBehaviorOnNextCreation = false;
160 }
160 }
161 if (source.toString().indexOf("Apps/RunningApplicationsGrid.qml") != -1) {
161 if (source.toString().indexOf("Apps/RunningApplicationsGrid.qml") != -1) {
162− // TODO: the running apps grid doesn't support standard scope results model yet
162+ // TODO: this is still a kludge :D
163+ console.log("MOOOO", mainStageApplicationsModel, sideStageApplicationModel);
163− item.firstModel = Qt.binding(function() { return results.firstModel })
164+ item.firstModel = Qt.binding(function() { return mainStageApplicationsModel })
164− item.secondModel = Qt.binding(function() { return results.secondModel })
165+ item.secondModel = Qt.binding(function() { return sideStageApplicationModel })
165 item.canEnableTerminationMode = Qt.binding(function() { return scopeView.isCurrent })
166 item.canEnableTerminationMode = Qt.binding(function() { return scopeView.isCurrent })
166 } else {
167 } else {
167 item.model = Qt.binding(function() { return results })
168 item.model = Qt.binding(function() { return results })
@@ -316,6 +317,10 @@ FocusScope {
316 function getRenderer(template, results) {
317 function getRenderer(template, results) {
317 var layout = template["category-layout"];
318 var layout = template["category-layout"];
318
319
320+ if (layout == "running-apps") {
321+ return "Apps/RunningApplicationsGrid.qml";
322+ }
323+
319 if (layout === "carousel") {
324 if (layout === "carousel") {
320 // TODO: Selectively disable carousel, 4 is fixed for now, should change depending on form factor
325 // TODO: Selectively disable carousel, 4 is fixed for now, should change depending on form factor
321 if (results.count <= 4) layout = "grid";
326 if (results.count <= 4) layout = "grid";
qml/Dash/ScopeDelegateMapper.qml+1−1
@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18
18
19QtObject {
19QtObject {
20− property var scopeDelegateMapping: {"applications.scope": "DashApps.qml",
20+ property var scopeDelegateMapping: {"clickscope": "DashApps.qml",
21 "home.scope": "DashHome.qml"
21 "home.scope": "DashHome.qml"
22 }
22 }
23 property string genericScope: "GenericScopeView.qml"
23 property string genericScope: "GenericScopeView.qml"