on xenial help sign in
Added back button
commitf7e72c4c8f1f911fd5dfba5e61c777c6280e3c56 authorNick Dedekind <nicholas.dedekind@gmail.com> dateTue 23 Jul 2013, 10:41 (13 years ago) parent940f47f
2 files changed+40−32
Panel/Indicators/client/IndicatorsPage.qml+35−7 Panel/Indicators/client/IndicatorsTree.qml+5−25
Panel/Indicators/client/IndicatorsPage.qml+35−7
@@ -22,7 +22,7 @@ import Ubuntu.Components 0.1
2222import Ubuntu.Components.ListItems 0.1 as ListItem
2323
2424Page {
25− id: _page
25+ id: page
2626
2727 title: indicatorProperties && indicatorProperties.title ? indicatorProperties.title : ""
2828 property variant indicatorProperties
@@ -31,11 +31,10 @@ Page {
3131 anchors.fill: parent
3232
3333 ListItem.Standard {
34− id: button
35−
34+ id: visualCheckItem
3635 text: "Enable Visual Representation"
3736 control: Switch {
38− id: checked
37+ id: visualCheck
3938 checked: true
4039 }
4140 }
@@ -45,13 +44,14 @@ Page {
4544 objectName: "page_loader"
4645
4746 anchors {
48− top: button.bottom
47+ top: visualCheckItem.bottom
4948 left: parent.left
5049 right: parent.right
51− bottom: parent.bottom
50+ bottom: buttons.top
5251 topMargin: units.gu(2)
52+ bottomMargin: units.gu(2)
5353 }
54− source : checked.checked ? _page.pageSource : "IndicatorsTree.qml"
54+ source : visualCheck.checked ? page.pageSource : "IndicatorsTree.qml"
5555
5656 onLoaded: {
5757 for(var pName in indicatorProperties) {
@@ -62,4 +62,32 @@ Page {
6262 item.start();
6363 }
6464 }
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+ }
6593}
Panel/Indicators/client/IndicatorsTree.qml+5−25
@@ -39,6 +39,10 @@ Page {
3939 menuModel.start();
4040 }
4141
42+ function refresh() {
43+ all_data.text = printer.getString();
44+ }
45+
4246 QDBusMenuModel {
4347 id: menuModel
4448 objectPath: page.deviceMenuObjectPath
@@ -51,17 +55,8 @@ Page {
5155 onSourceChanged: page.refresh()
5256 }
5357
54− function refresh() {
55− all_data.text = printer.getString();
56− }
57−
5858 Flickable {
59− anchors {
60− top: parent.top
61− left: parent.left
62− right: parent.right
63− bottom: button.top
64− }
59+ anchors.fill: parent
6560 contentHeight: all_data.height
6661 clip:true
6762 Text {
@@ -69,19 +64,4 @@ Page {
6964 color: "white"
7065 }
7166 }
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− }
8767}