2 * Copyright (C) 2013 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 import Ubuntu.Components 1.3
19 import Ubuntu.Components.Popups 1.3
20 import Ubuntu.Thumbnailer 0.1 // Register support for image://thumbnailer/ and image://albumart/
37 // Fake greeter object
51 anchors.fill: dashContent
58 property var scope: scopes.getScope(currentIndex)
84 anchors { fill: parent; margins: units.gu(1) }
93 anchors { left: parent.left; right: parent.right }
95 onTextChanged: dashContent.scope.searchQuery = text
98 target: dashContent.scope
99 onSearchQueryChanged: searchField.text = dashContent.scope.searchQuery
106 verticalAlignment: Text.AlignBottom
111 anchors { left: parent.left; right: parent.right }
112 model: dashContent.scope ? dashContent.scope.categories : null
114 property Item selectedItem
116 delegate: OptionSelectorDelegate {
119 property string categoryId: model.categoryId
120 property string template: JSON.stringify(JSON.parse(model.rawRendererTemplate), null, " ");
122 onSelectedChanged: if (selected) categorySelector.selectedItem = categoryDelegate
131 text: categorySelector.selectedItem && categorySelector.selectedItem.template
136 text: "Override category"
138 PopupUtils.open(categoryEditor)
149 title: "Editing category definition"
152 id: categoryEditorArea
154 wrapMode: Text.WordWrap
155 text: categoryJson.text
158 onCancelClicked: PopupUtils.close(sheet)
160 PopupUtils.close(sheet);
161 dashContent.scope.categories.overrideCategoryJson(categorySelector.selectedItem.categoryId, categoryEditorArea.text);