18 import Ubuntu.Components 0.1
22 property var department: null
23 property var currentDepartment: null
24 property var scopeStyle: null
25 signal enterDepartment(var newDepartmentId,
bool hasChildren)
26 signal goBackToParentClicked()
27 signal allDepartmentClicked()
29 readonly property
int itemHeight: units.gu(5)
30 readonly property color foregroundColor: root.scopeStyle ? root.scopeStyle.foreground : "grey"
31 implicitHeight: flickable.contentHeight
34 color: !root.scopeStyle || Qt.colorEqual(root.scopeStyle.background,
"transparent") ?
"white" : root.scopeStyle.background
40 anchors.centerIn: parent
41 running: !(department && department.loaded)
46 UbuntuNumberAnimation {
48 duration: UbuntuAnimation.SnapDuration
57 contentHeight: column.height
69 objectName:
"backButton"
71 visible: department && !department.isRoot ||
false
74 onClicked: root.goBackToParentClicked();
79 verticalCenter: parent.verticalCenter
81 leftMargin: units.gu(2)
86 color: root.foregroundColor
91 verticalCenter: parent.verticalCenter
93 leftMargin: units.gu(0.5)
95 text: department ? department.parentLabel :
""
96 color: root.foregroundColor
101 bottom: parent.bottom
104 leftMargin: units.gu(2)
105 rightMargin: units.gu(2)
107 color: root.foregroundColor
115 objectName:
"allButton"
117 visible: department && (!department.isRoot || (root.currentDepartment && !root.currentDepartment.isRoot && root.currentDepartment.parentDepartmentId == department.departmentId)) ||
false
122 verticalCenter: parent.verticalCenter
124 leftMargin: units.gu(2)
126 text: department ? (department.allLabel !=
"" ? department.allLabel : department.label) :
""
128 color: root.foregroundColor
133 bottom: parent.bottom
136 leftMargin: units.gu(2)
137 rightMargin: units.gu(2)
139 color: root.foregroundColor
144 onClicked: root.allDepartmentClicked();
148 model: department && department.loaded ? department : null
150 delegate: AbstractButton {
151 objectName: root.objectName +
"child" + index
152 height: root.itemHeight
155 onClicked: root.enterDepartment(departmentId, hasChildren)
159 verticalCenter: parent.verticalCenter
161 leftMargin: units.gu(2)
164 color: root.foregroundColor
169 verticalCenter: parent.verticalCenter
171 rightMargin: units.gu(2)
175 name: hasChildren ?
"go-next" :
"tick"
176 color: root.foregroundColor
177 visible: hasChildren || isActive
182 bottom: parent.bottom
185 leftMargin: units.gu(2)
186 rightMargin: units.gu(2)
188 color: root.foregroundColor
191 visible: index != department.count - 1