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
56 anchors.fill: dashContent
57 source: root.width > root.height ? "Dash/graphics/paper_landscape.png" : "Dash/graphics/paper_portrait.png"
58 fillMode: Image.PreserveAspectCrop
59 horizontalAlignment: Image.AlignRight
60 verticalAlignment: Image.AlignTop
66 property var scope: scopes.getScope(currentIndex)
92 anchors { fill: parent; margins: units.gu(1) }
101 anchors { left: parent.left; right: parent.right }
103 onTextChanged: dashContent.scope.searchQuery = text
106 target: dashContent.scope
107 onSearchQueryChanged: searchField.text = dashContent.scope.searchQuery
114 verticalAlignment: Text.AlignBottom
119 anchors { left: parent.left; right: parent.right }
120 model: dashContent.scope ? dashContent.scope.categories : null
122 property Item selectedItem
124 delegate: OptionSelectorDelegate {
127 property string categoryId: model.categoryId
128 property string template: JSON.stringify(JSON.parse(model.rawRendererTemplate), null, " ");
130 onSelectedChanged: if (selected) categorySelector.selectedItem = categoryDelegate
139 text: categorySelector.selectedItem && categorySelector.selectedItem.template
144 text: "Override category"
146 PopupUtils.open(categoryEditor)
157 title: "Editing category definition"
160 id: categoryEditorArea
162 wrapMode: Text.WordWrap
163 text: categoryJson.text
166 onCancelClicked: PopupUtils.close(sheet)
168 PopupUtils.close(sheet);
169 dashContent.scope.categories.overrideCategoryJson(categorySelector.selectedItem.categoryId, categoryEditorArea.text);