on xenial help sign in
Merge lp:~aacid/unity8/apps-special-category
commit42e7231786fcd9313d7cff553c6cac116bd8b7d2 authorMichal Hruby <michal.mhr@gmail.com> dateWed 12 Feb 2014, 09:44 (13 years ago) parentfbc09dfa016445
3 files changed+13−23
qml/Dash/DashApps.qml+4−19 qml/Dash/GenericScopeView.qml+8−3 qml/Dash/ScopeDelegateMapper.qml+1−1
qml/Dash/DashApps.qml+4−19
@@ -29,28 +29,13 @@ GenericScopeView {
2929 property var mainStageApplicationsModel: shell.applicationManager.mainStageApplications
3030 property var sideStageApplicationModel: shell.applicationManager.sideStageApplications
3131
32− ListModel {
33− id: dummyVisibilityModifier
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
32+ QtObject {
33+ id: countObject
34+ property int count: scopeView.scope.searchQuery.length == 0 ? (mainStageApplicationsModel.count + sideStageApplicationModel.count) : 0
5035 }
5136
5237 onScopeChanged: {
53− scopeView.scope.categories.overrideResults("recent", runningApplicationsModel);
38+ scopeView.scope.categories.addSpecialCategory("running.apps.category", "Running Apps", "", "{ \"template\": { \"category-layout\": \"running-apps\" } }", countObject);
5439 enableHeightBehaviorOnNextCreation = (mainStageApplicationsModel.count + sideStageApplicationModel.count == 0)
5540 }
5641}
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 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
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 })
@@ -318,6 +319,10 @@ FocusScope {
318319 function getRenderer(template, results) {
319320 var layout = template["category-layout"];
320321
322+ if (layout == "running-apps") {
323+ return "Apps/RunningApplicationsGrid.qml";
324+ }
325+
321326 if (layout === "carousel") {
322327 // TODO: Selectively disable carousel, 4 is fixed for now, should change depending on form factor
323328 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"