on xenial help sign in
Merge lp:~aacid/unity8/apps-special-category
42e7231Michal Hruby
qml/Dash/DashApps.qml+4−19
@@ -29,28 +29,13 @@ GenericScopeView {
29 property var mainStageApplicationsModel: shell.applicationManager.mainStageApplications
29 property var mainStageApplicationsModel: shell.applicationManager.mainStageApplications
30 property var sideStageApplicationModel: shell.applicationManager.sideStageApplications
30 property var sideStageApplicationModel: shell.applicationManager.sideStageApplications
31
31
32− ListModel {
32+ QtObject {
33− id: dummyVisibilityModifier
33+ id: countObject
34−
35− ListElement { name: "running-apps" }
36− }
37−
38− SortFilterProxyModel {
39− id: runningApplicationsModel
40−
41− property var firstModel: mainStageApplicationsModel
42− property var secondModel: sideStageApplicationModel
43− property bool canEnableTerminationMode: scopeView.isCurrent
44−
45− model: dummyVisibilityModifier
46− filterRole: 0
47− filterRegExp: invertMatch ? ((mainStageApplicationsModel.count === 0 &&
48− sideStageApplicationModel.count === 0) ? RegExp("running-apps") : RegExp("")) : RegExp("disabled")
49− invertMatch: scopeView.scope.searchQuery.length == 0
34+ property int count: scopeView.scope.searchQuery.length == 0 ? (mainStageApplicationsModel.count + sideStageApplicationModel.count) : 0
50 }
35 }
51
36
52 onScopeChanged: {
37 onScopeChanged: {
53− scopeView.scope.categories.overrideResults("recent", runningApplicationsModel);
38+ scopeView.scope.categories.addSpecialCategory("running.apps.category", "Running Apps", "", "{ \"template\": { \"category-layout\": \"running-apps\" } }", countObject);
54 enableHeightBehaviorOnNextCreation = (mainStageApplicationsModel.count + sideStageApplicationModel.count == 0)
39 enableHeightBehaviorOnNextCreation = (mainStageApplicationsModel.count + sideStageApplicationModel.count == 0)
55 }
40 }
56}
41}
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 Ideally add some kind of hook so that we
163+ // can do this from DashApps.qml or think a better way that needs no special casing
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 })
@@ -318,6 +319,10 @@ FocusScope {
318 function getRenderer(template, results) {
319 function getRenderer(template, results) {
319 var layout = template["category-layout"];
320 var layout = template["category-layout"];
320
321
322+ if (layout == "running-apps") {
323+ return "Apps/RunningApplicationsGrid.qml";
324+ }
325+
321 if (layout === "carousel") {
326 if (layout === "carousel") {
322 // TODO: Selectively disable carousel, 4 is fixed for now, should change depending on form factor
327 // TODO: Selectively disable carousel, 4 is fixed for now, should change depending on form factor
323 if (results.count <= 4) layout = "grid";
328 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"