18 import Ubuntu.Components 0.1
22 property var department: null
23 property var currentDepartment: null
24 signal enterDepartment(var newDepartmentId,
bool hasChildren)
25 signal goBackToParentClicked()
26 signal allDepartmentClicked()
28 readonly property
int itemHeight: units.gu(5)
29 implicitHeight: flickable.contentHeight
38 anchors.centerIn: parent
39 running: !(department && department.loaded)
44 UbuntuNumberAnimation {
46 duration: UbuntuAnimation.SnapDuration
55 contentHeight: column.height
67 objectName:
"backButton"
69 visible: department && !department.isRoot ||
false
72 onClicked: root.goBackToParentClicked();
77 verticalCenter: parent.verticalCenter
79 leftMargin: units.gu(2)
81 source:
"image://theme/back"
82 sourceSize.height: parent.height - units.gu(3)
83 sourceSize.width: units.gu(3)
84 fillMode: Image.PreserveAspectFit
89 verticalCenter: parent.verticalCenter
91 leftMargin: units.gu(0.5)
93 text: department ? department.parentLabel :
""
102 leftMargin: units.gu(2)
103 rightMargin: units.gu(2)
113 objectName:
"allButton"
115 visible: department && (!department.isRoot || (root.currentDepartment && !root.currentDepartment.isRoot && root.currentDepartment.parentDepartmentId == department.departmentId)) ||
false
120 verticalCenter: parent.verticalCenter
122 leftMargin: units.gu(2)
124 text: department ? (department.allLabel !=
"" ? department.allLabel : department.label) :
""
131 bottom: parent.bottom
134 leftMargin: units.gu(2)
135 rightMargin: units.gu(2)
142 onClicked: root.allDepartmentClicked();
146 model: department && department.loaded ? department : null
148 delegate: AbstractButton {
149 objectName: root.objectName +
"child" + index
150 height: root.itemHeight
153 onClicked: root.enterDepartment(departmentId, hasChildren)
157 verticalCenter: parent.verticalCenter
159 leftMargin: units.gu(2)
167 verticalCenter: parent.verticalCenter
169 rightMargin: units.gu(2)
171 source: hasChildren ?
"image://theme/chevron" :
"graphics/tick.png"
172 sourceSize.height: parent.height - units.gu(3)
173 sourceSize.width: units.gu(3)
174 fillMode: Image.PreserveAspectFit
175 visible: hasChildren || isActive
180 bottom: parent.bottom
183 leftMargin: units.gu(2)
184 rightMargin: units.gu(2)
189 visible: index != department.count - 1