2
import Ubuntu.Components 0.1
3
import Ubuntu.Components.Popups 0.1
18
// Fake greeter object
36
anchors.fill: scopeView
50
scope: scopes.loaded ? scopes.get(scopeSelector.selectedIndex) : undefined
64
anchors { fill: parent; margins: units.gu(1) }
73
anchors { left: parent.left; right: parent.right }
75
onTextChanged: scopeView.scope.searchQuery = text
78
target: scopeView.scope
79
onSearchQueryChanged: searchField.text = scopeView.scope.searchQuery
84
text: "Scope selection"
86
verticalAlignment: Text.AlignBottom
91
anchors { left: parent.left; right: parent.right }
94
delegate: OptionSelectorDelegate {
102
verticalAlignment: Text.AlignBottom
107
anchors { left: parent.left; right: parent.right }
109
model: scopeView.scope ? scopeView.scope.categories : null
110
delegate: OptionSelectorDelegate {
114
onSelectedIndexChanged: {
115
categoryJson.refreshText();
121
model: categorySelector.model
123
property var data: model.rawRendererTemplate
124
property var categoryId: model.categoryId
126
if (model.index != categorySelector.selectedIndex) return;
127
categoryJson.refreshText();
130
onItemAdded: categoryJson.refreshText()
138
function refreshText() {
139
if (categoryRepeater.count > categorySelector.selectedIndex) {
140
var item = categoryRepeater.itemAt(categorySelector.selectedIndex);
141
if (item == null) return;
142
categoryJson.text = JSON.stringify(JSON.parse(item.data), null, " ");
149
text: "Override category"
151
PopupUtils.open(categoryEditor)
162
title: "Editing category definition"
165
id: categoryEditorArea
167
wrapMode: Text.WordWrap
168
text: categoryJson.text
171
onCancelClicked: PopupUtils.close(sheet)
173
PopupUtils.close(sheet);
174
var categoryId = categoryRepeater.itemAt(categorySelector.selectedIndex).categoryId;
175
scopeView.scope.categories.overrideCategoryJson(categoryId, categoryEditorArea.text);