on 83fd0fa help sign in
unity8/Panel/Indicators/client/IndicatorsPage.qml
94 lines 2.6 kB history raw
1/*
2 * Copyright 2013 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
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 Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Renato Araujo Oliveira Filho <renato@canonical.com>
18 * Nick Dedekind <nick.dedekind@canonical.com>
19 */
21import QtQuick 2.0
22import Ubuntu.Components 0.1
23import Ubuntu.Components.ListItems 0.1 as ListItem
25Page {
26 id: page
28 title: indicatorProperties && indicatorProperties.title ? indicatorProperties.title : ""
29 property variant indicatorProperties
30 property string pageSource : pageLoader.source
32 anchors.fill: parent
34 ListItem.Standard {
35 id: visualCheckItem
36 text: "Enable Visual Representation"
37 control: Switch {
38 id: visualCheck
39 checked: true
40 }
41 }
43 Loader {
44 id: pageLoader
45 objectName: "pageLoader"
47 anchors {
48 top: visualCheckItem.bottom
49 left: parent.left
50 right: parent.right
51 bottom: buttons.top
52 topMargin: units.gu(2)
53 bottomMargin: units.gu(2)
54 }
55 source : visualCheck.checked ? page.pageSource : "IndicatorsTree.qml"
57 onLoaded: {
58 for(var pName in indicatorProperties) {
59 if (item.hasOwnProperty(pName)) {
60 item[pName] = indicatorProperties[pName];
61 }
62 }
63 item.start();
64 }
65 }
67 Item {
68 id: buttons
69 anchors {
70 left: parent.left
71 right: parent.right
72 bottom: parent.bottom
73 margins: units.gu(1)
74 }
75 height: childrenRect.height
77 Button {
78 anchors {
79 left: parent.left
80 }
81 text: "Back"
82 onClicked: page.pageStack.reset()
83 }
84 Button {
85 id: refresh
86 visible: !visualCheck.checked
87 anchors {
88 right: parent.right
89 }
90 text: "Refresh"
91 onClicked: pageLoader.item.refresh()
92 }
93 }