on xenial help sign in
Added back button
f7e72c4Nick Dedekind
Panel/Indicators/client/IndicatorsPage.qml+35−7
@@ -22,7 +22,7 @@ import Ubuntu.Components 0.1
22import Ubuntu.Components.ListItems 0.1 as ListItem
22import Ubuntu.Components.ListItems 0.1 as ListItem
23
23
24Page {
24Page {
25− id: _page
25+ id: page
26
26
27 title: indicatorProperties && indicatorProperties.title ? indicatorProperties.title : ""
27 title: indicatorProperties && indicatorProperties.title ? indicatorProperties.title : ""
28 property variant indicatorProperties
28 property variant indicatorProperties
@@ -31,11 +31,10 @@ Page {
31 anchors.fill: parent
31 anchors.fill: parent
32
32
33 ListItem.Standard {
33 ListItem.Standard {
34− id: button
34+ id: visualCheckItem
35−
36 text: "Enable Visual Representation"
35 text: "Enable Visual Representation"
37 control: Switch {
36 control: Switch {
38− id: checked
37+ id: visualCheck
39 checked: true
38 checked: true
40 }
39 }
41 }
40 }
@@ -45,13 +44,14 @@ Page {
45 objectName: "page_loader"
44 objectName: "page_loader"
46
45
47 anchors {
46 anchors {
48− top: button.bottom
47+ top: visualCheckItem.bottom
49 left: parent.left
48 left: parent.left
50 right: parent.right
49 right: parent.right
51− bottom: parent.bottom
50+ bottom: buttons.top
52 topMargin: units.gu(2)
51 topMargin: units.gu(2)
52+ bottomMargin: units.gu(2)
53 }
53 }
54− source : checked.checked ? _page.pageSource : "IndicatorsTree.qml"
54+ source : visualCheck.checked ? page.pageSource : "IndicatorsTree.qml"
55
55
56 onLoaded: {
56 onLoaded: {
57 for(var pName in indicatorProperties) {
57 for(var pName in indicatorProperties) {
@@ -62,4 +62,32 @@ Page {
62 item.start();
62 item.start();
63 }
63 }
64 }
64 }
65+
66+ Item {
67+ id: buttons
68+ anchors {
69+ left: parent.left
70+ right: parent.right
71+ bottom: parent.bottom
72+ margins: units.gu(1)
73+ }
74+ height: childrenRect.height
75+
76+ Button {
77+ anchors {
78+ left: parent.left
79+ }
80+ text: "Back"
81+ onClicked: page.pageStack.reset()
82+ }
83+ Button {
84+ id: refresh
85+ visible: !visualCheck.checked
86+ anchors {
87+ right: parent.right
88+ }
89+ text: "Refresh"
90+ onClicked: page_loader.item.refresh()
91+ }
92+ }
65}
93}
Panel/Indicators/client/IndicatorsTree.qml+5−25
@@ -39,6 +39,10 @@ Page {
39 menuModel.start();
39 menuModel.start();
40 }
40 }
41
41
42+ function refresh() {
43+ all_data.text = printer.getString();
44+ }
45+
42 QDBusMenuModel {
46 QDBusMenuModel {
43 id: menuModel
47 id: menuModel
44 objectPath: page.deviceMenuObjectPath
48 objectPath: page.deviceMenuObjectPath
@@ -51,17 +55,8 @@ Page {
51 onSourceChanged: page.refresh()
55 onSourceChanged: page.refresh()
52 }
56 }
53
57
54− function refresh() {
55− all_data.text = printer.getString();
56− }
57−
58 Flickable {
58 Flickable {
59− anchors {
59+ anchors.fill: parent
60− top: parent.top
61− left: parent.left
62− right: parent.right
63− bottom: button.top
64− }
65 contentHeight: all_data.height
60 contentHeight: all_data.height
66 clip:true
61 clip:true
67 Text {
62 Text {
@@ -69,19 +64,4 @@ Page {
69 color: "white"
64 color: "white"
70 }
65 }
71 }
66 }
72−
73− ListItem.Standard {
74− id: button
75− anchors {
76− left: parent.left
77− right: parent.right
78− bottom: parent.bottom
79− }
80−
81− text: ""
82− control: Button {
83− text: "Refresh"
84− onClicked: page.refresh()
85− }
86− }
87}
67}