@@ -52,122 +52,68 @@ Item {
53 anchors.fill: parent
53 anchors.fill: parent
55− readonly property int nTopButtonsVisible: 0 + (backButton.visible ? 1 : 0) + (allButton.visible ? 1 : 0)
56− readonly property int nItems: department && department.loaded ? (department.count + nTopButtonsVisible) : 0
57− contentHeight: nItems * root.itemHeight
55+ contentHeight: column.height
58 contentWidth: width
56 contentWidth: width
60− AbstractButton {
58+ Column {
61− id: backButton
59+ id: column
62− objectName: "backButton"
63 width: parent.width
60 width: parent.width
64− visible: department && !department.isRoot || false
65− height: visible ? itemHeight : 0
67− onClicked: root.goBackToParentClicked();
71− anchors.verticalCenter: parent.verticalCenter
72− anchors.left: parent.left
73− anchors.leftMargin: units.gu(2)
74− source: "image://theme/back"
75− sourceSize.height: parent.height - units.gu(3)
76− sourceSize.width: units.gu(3)
77− fillMode: Image.PreserveAspectFit
81− anchors.verticalCenter: parent.verticalCenter
82− anchors.left: backImage.right
83− anchors.leftMargin: units.gu(0.5)
84− text: department ? department.parentLabel : ""
85− color: "gray" // TODO remove once we're a separate app
88− Rectangle {
62+ AbstractButton {
89− anchors.bottom: parent.bottom
63+ id: backButton
90− anchors.left: parent.left
64+ objectName: "backButton"
91− anchors.right: parent.right
92− anchors.leftMargin: units.gu(2)
93− anchors.rightMargin: units.gu(2)
94 width: parent.width
65 width: parent.width
103− objectName: "allButton"
104− anchors.top: backButton.bottom
106− visible: department && (!department.isRoot || (root.currentDepartment && !root.currentDepartment.isRoot && root.currentDepartment.parentDepartmentId == department.departmentId)) || false
66+ visible: department && !department.isRoot || false
107− height: itemHeight
67+ height: itemHeight
110− anchors.verticalCenter: parent.verticalCenter
111− anchors.left: parent.left
112− anchors.leftMargin: units.gu(2)
113− text: department ? (department.allLabel != "" ? department.allLabel : department.label) : ""
115− color: "gray" // TODO remove once we're a separate app
119− anchors.bottom: parent.bottom
120− anchors.left: parent.left
121− anchors.right: parent.right
122− anchors.leftMargin: units.gu(2)
123− anchors.rightMargin: units.gu(2)
130− onClicked: root.allDepartmentClicked();
133− Repeater {
69+ onClicked: root.goBackToParentClicked();
134− model: department && department.loaded ? department : null
136− delegate: AbstractButton {
137− objectName: root.objectName + "child" + index
138− height: root.itemHeight
140− y: (flickable.nTopButtonsVisible + index) * root.itemHeight
142− onClicked: root.enterDepartment(departmentId, hasChildren)
71+ Image {
145 anchors.verticalCenter: parent.verticalCenter
73 anchors.verticalCenter: parent.verticalCenter
146 anchors.left: parent.left
74 anchors.left: parent.left
147 anchors.leftMargin: units.gu(2)
75 anchors.leftMargin: units.gu(2)
149− color: "gray" // TODO remove once we're a separate app
153− anchors.verticalCenter: parent.verticalCenter
154− anchors.right: parent.right
155− anchors.rightMargin: units.gu(2)
156− source: "image://theme/chevron"
76+ source: "image://theme/back"
157 sourceSize.height: parent.height - units.gu(3)
77 sourceSize.height: parent.height - units.gu(3)
158 sourceSize.width: units.gu(3)
78 sourceSize.width: units.gu(3)
159 fillMode: Image.PreserveAspectFit
79 fillMode: Image.PreserveAspectFit
160− visible: hasChildren
163 anchors.verticalCenter: parent.verticalCenter
83 anchors.verticalCenter: parent.verticalCenter
84+ anchors.left: backImage.right
85+ anchors.leftMargin: units.gu(0.5)
86+ text: department ? department.parentLabel : ""
87+ color: "gray" // TODO remove once we're a separate app
91+ anchors.bottom: parent.bottom
92+ anchors.left: parent.left
164 anchors.right: parent.right
93 anchors.right: parent.right
94+ anchors.leftMargin: units.gu(2)
165 anchors.rightMargin: units.gu(2)
95 anchors.rightMargin: units.gu(2)
166− source: "graphics/tick.png"
96+ width: parent.width
167− sourceSize.height: parent.height - units.gu(2)
97+ color: "gray"
168− sourceSize.width: units.gu(3)
98+ opacity: 0.2
169− fillMode: Image.PreserveAspectFit
99+ height: units.dp(1)
170− visible: !hasChildren && isActive
100+ }
105+ objectName: "allButton"
107+ visible: department && (!department.isRoot || (root.currentDepartment && !root.currentDepartment.isRoot && root.currentDepartment.parentDepartmentId == department.departmentId)) || false
111+ anchors.verticalCenter: parent.verticalCenter
112+ anchors.left: parent.left
113+ anchors.leftMargin: units.gu(2)
114+ text: department ? (department.allLabel != "" ? department.allLabel : department.label) : ""
116+ color: "gray" // TODO remove once we're a separate app
173 Rectangle {
119 Rectangle {
@@ -178,9 +124,64 @@ Item {
178 anchors.rightMargin: units.gu(2)
124 anchors.rightMargin: units.gu(2)
179 width: parent.width
125 width: parent.width
180 color: "gray"
126 color: "gray"
181− opacity: 0.1
127+ opacity: 0.2
182 height: units.dp(1)
128 height: units.dp(1)
131+ onClicked: root.allDepartmentClicked();
135+ model: department && department.loaded ? department : null
137+ delegate: AbstractButton {
138+ objectName: root.objectName + "child" + index
139+ height: root.itemHeight
142+ onClicked: root.enterDepartment(departmentId, hasChildren)
145+ anchors.verticalCenter: parent.verticalCenter
146+ anchors.left: parent.left
147+ anchors.leftMargin: units.gu(2)
149+ color: "gray" // TODO remove once we're a separate app
153+ anchors.verticalCenter: parent.verticalCenter
154+ anchors.right: parent.right
155+ anchors.rightMargin: units.gu(2)
156+ source: "image://theme/chevron"
157+ sourceSize.height: parent.height - units.gu(3)
158+ sourceSize.width: units.gu(3)
159+ fillMode: Image.PreserveAspectFit
160+ visible: hasChildren
163+ anchors.verticalCenter: parent.verticalCenter
164+ anchors.right: parent.right
165+ anchors.rightMargin: units.gu(2)
166+ source: "graphics/tick.png"
167+ sourceSize.height: parent.height - units.gu(2)
168+ sourceSize.width: units.gu(3)
169+ fillMode: Image.PreserveAspectFit
170+ visible: !hasChildren && isActive
174+ anchors.bottom: parent.bottom
175+ anchors.left: parent.left
176+ anchors.right: parent.right
177+ anchors.leftMargin: units.gu(2)
178+ anchors.rightMargin: units.gu(2)
183− visible: index != department.count - 1
183+ visible: index != department.count - 1