on xenial help sign in
Use addSpecialCategory for apps scope
commit1e80a662846ae911cfb62e520d8368ab595fd47d authorAlbert Astals <albert.astals@canonical.com> dateTue 11 Feb 2014, 11:56 (13 years ago) parentb6f5b31
3 files changed+15−9
qml/Dash/DashApps.qml+6−5 qml/Dash/GenericScopeView.qml+8−3 qml/Dash/ScopeDelegateMapper.qml+1−1
qml/Dash/DashApps.qml+6−5
@@ -38,10 +38,6 @@ GenericScopeView {
3838 SortFilterProxyModel {
3939 id: runningApplicationsModel
4040
41− property var firstModel: mainStageApplicationsModel
42− property var secondModel: sideStageApplicationModel
43− property bool canEnableTerminationMode: scopeView.isCurrent
44−
4541 model: dummyVisibilityModifier
4642 filterRole: 0
4743 filterRegExp: invertMatch ? ((mainStageApplicationsModel.count === 0 &&
@@ -49,8 +45,13 @@ GenericScopeView {
4945 invertMatch: scopeView.scope.searchQuery.length == 0
5046 }
5147
48+ QtObject {
49+ id: countObject
50+ property int count: runningApplicationsModel.count
51+ }
52+
5253 onScopeChanged: {
53− scopeView.scope.categories.overrideResults("recent", runningApplicationsModel);
54+ scopeView.scope.categories.addSpecialCategory("running.apps.category", "Running Apps", "", "{ \"template\": { \"category-layout\": \"running-apps\" } }", countObject);
5455 enableHeightBehaviorOnNextCreation = (mainStageApplicationsModel.count + sideStageApplicationModel.count == 0)
5556 }
5657}
qml/Dash/GenericScopeView.qml+8−3
@@ -159,9 +159,10 @@ FocusScope {
159159 scopeView.enableHeightBehaviorOnNextCreation = false;
160160 }
161161 if (source.toString().indexOf("Apps/RunningApplicationsGrid.qml") != -1) {
162− // TODO: the running apps grid doesn't support standard scope results model yet
163− item.firstModel = Qt.binding(function() { return results.firstModel })
164− item.secondModel = Qt.binding(function() { return results.secondModel })
162+ // TODO: this is still a kludge :D
163+ console.log("MOOOO", mainStageApplicationsModel, sideStageApplicationModel);
164+ item.firstModel = Qt.binding(function() { return mainStageApplicationsModel })
165+ item.secondModel = Qt.binding(function() { return sideStageApplicationModel })
165166 item.canEnableTerminationMode = Qt.binding(function() { return scopeView.isCurrent })
166167 } else {
167168 item.model = Qt.binding(function() { return results })
@@ -316,6 +317,10 @@ FocusScope {
316317 function getRenderer(template, results) {
317318 var layout = template["category-layout"];
318319
320+ if (layout == "running-apps") {
321+ return "Apps/RunningApplicationsGrid.qml";
322+ }
323+
319324 if (layout === "carousel") {
320325 // TODO: Selectively disable carousel, 4 is fixed for now, should change depending on form factor
321326 if (results.count <= 4) layout = "grid";
qml/Dash/ScopeDelegateMapper.qml+1−1
@@ -17,7 +17,7 @@
1717import QtQuick 2.0
1818
1919QtObject {
20− property var scopeDelegateMapping: {"applications.scope": "DashApps.qml",
20+ property var scopeDelegateMapping: {"clickscope": "DashApps.qml",
2121 "home.scope": "DashHome.qml"
2222 }
2323 property string genericScope: "GenericScopeView.qml"