on xenial help sign in
Use full DashContent, not just GenericScopeView in ScopeTool.qml.
commitc17b2c55e4c4ddd9368e23c2aba4a55576110224 authorMichał Sawicz <michal.sawicz@canonical.com> dateFri 10 Jan 2014, 10:58 (13 years ago) parent040e106
1 file changed+25−29
qml/ScopeTool.qml+25−29
qml/ScopeTool.qml+25−29
@@ -17,6 +17,7 @@
1717import QtQuick 2.0
1818import Ubuntu.Components 0.1
1919import Ubuntu.Components.Popups 0.1
20+import Utils 0.1
2021import Unity 0.1
2122import "Dash"
2223
@@ -43,18 +44,27 @@ Rectangle {
4344 signal searchClicked
4445 }
4546
47+ SortFilterProxyModel {
48+ id: filteredScopes
49+ model: Scopes {
50+ id: scopes
51+ }
52+ dynamicSortFilter: true
4653
47− Scopes {
48− id: scopes
54+ filterRole: Scopes.RoleVisible
55+ filterRegExp: RegExp("^true$")
4956 }
5057
5158 Rectangle {
52− anchors.fill: scopeView
59+ anchors.fill: dashContent
5360 color: "#FCFCFC"
5461 }
5562
56− GenericScopeView {
57− id: scopeView
63+ DashContent {
64+ id: dashContent
65+
66+ model: filteredScopes
67+ property Scope scope: scopes.get(currentIndex)
5868
5969 anchors {
6070 top: parent.top
@@ -62,8 +72,6 @@ Rectangle {
6272 left: parent.left
6373 right: controls.left
6474 }
65−
66− scope: scopes.loaded ? scopes.get(scopeSelector.selectedIndex) : undefined
6775 }
6876
6977 Rectangle {
@@ -76,6 +84,10 @@ Rectangle {
7684 right: parent.right
7785 }
7886
87+ MouseArea {
88+ anchors.fill: parent
89+ }
90+
7991 Column {
8092 anchors { fill: parent; margins: units.gu(1) }
8193 spacing: units.gu(1)
@@ -88,27 +100,11 @@ Rectangle {
88100 id: searchField
89101 anchors { left: parent.left; right: parent.right }
90102
91− onTextChanged: scopeView.scope.searchQuery = text
103+ onTextChanged: dashContent.scope.searchQuery = text
92104
93105 Connections {
94− target: scopeView.scope
95− onSearchQueryChanged: searchField.text = scopeView.scope.searchQuery
96− }
97− }
98−
99− Label {
100− text: "Scope selection"
101− height: units.gu(4)
102− verticalAlignment: Text.AlignBottom
103− }
104−
105− OptionSelector {
106− id: scopeSelector
107− anchors { left: parent.left; right: parent.right }
108−
109− model: scopes
110− delegate: OptionSelectorDelegate {
111− text: model.title
106+ target: dashContent.scope
107+ onSearchQueryChanged: searchField.text = dashContent.scope.searchQuery
112108 }
113109 }
114110
@@ -121,7 +117,7 @@ Rectangle {
121117 OptionSelector {
122118 id: categorySelector
123119 anchors { left: parent.left; right: parent.right }
124− model: scopeView.scope ? scopeView.scope.categories : null
120+ model: dashContent.scope ? dashContent.scope.categories : null
125121
126122 property Item selectedItem
127123
@@ -140,7 +136,7 @@ Rectangle {
140136 width: parent.width
141137 autoSize: true
142138 readOnly: true
143− text: categorySelector.selectedItem && categorySelector.selectedItem.template
139+ text: categorySelector.selectedItem > 0 && categorySelector.selectedItem.template
144140 }
145141
146142 Button {
@@ -170,7 +166,7 @@ Rectangle {
170166 onCancelClicked: PopupUtils.close(sheet)
171167 onConfirmClicked: {
172168 PopupUtils.close(sheet);
173− scopeView.scope.categories.overrideCategoryJson(categorySelector.selectedItem.categoryId, categoryEditorArea.text);
169+ dashContent.scope.categories.overrideCategoryJson(categorySelector.selectedItem.categoryId, categoryEditorArea.text);
174170 }
175171 }
176172 }