~aacid/unity8/dash_overview

« back to all changes in this revision

Viewing changes to qml/Dash/DashNavigationList.qml

  • Committer: Albert Astals
  • Date: 2014-08-07 15:27:32 UTC
  • mfrom: (1155.1.29 do_merged)
  • Revision ID: albert.astals@canonical.com-20140807152732-0zf22298f1lsxrz8
Merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 */
16
16
 
17
17
import QtQuick 2.2
18
 
import Ubuntu.Components 0.1
 
18
import Ubuntu.Components 1.1
19
19
 
20
20
Item {
21
21
    id: root
22
 
    property var department: null
23
 
    property var currentDepartment: null
 
22
    property var navigation: null
 
23
    property var currentNavigation: null
24
24
    property var scopeStyle: null
25
 
    signal enterDepartment(var newDepartmentId, bool hasChildren)
 
25
    signal enterNavigation(var newNavigationId, bool hasChildren)
26
26
    signal goBackToParentClicked()
27
 
    signal allDepartmentClicked()
 
27
    signal allNavigationClicked()
28
28
 
29
29
    readonly property int itemHeight: units.gu(5)
30
30
    readonly property color foregroundColor: root.scopeStyle ? root.scopeStyle.foreground : "grey"
35
35
        anchors.fill: parent
36
36
    }
37
37
 
38
 
    ActivityIndicator {
39
 
        id: loadingIndicator
40
 
        anchors.centerIn: parent
41
 
        running: !(department && department.loaded)
42
 
    }
43
38
    clip: true
44
39
 
45
40
    Behavior on height {
54
49
 
55
50
        anchors.fill: parent
56
51
 
 
52
        flickableDirection: Flickable.VerticalFlick
57
53
        contentHeight: column.height
58
54
        contentWidth: width
59
55
 
68
64
                id: backButton
69
65
                objectName: "backButton"
70
66
                width: parent.width
71
 
                visible: department && !department.isRoot || false
 
67
                visible: navigation && !navigation.isRoot || false
72
68
                height: itemHeight
73
69
 
74
70
                onClicked: root.goBackToParentClicked();
92
88
                        left: backImage.right
93
89
                        leftMargin: units.gu(0.5)
94
90
                    }
95
 
                    text: department ? department.parentLabel : ""
 
91
                    text: navigation ? navigation.parentLabel : ""
96
92
                    color: root.foregroundColor
97
93
                }
98
94
 
114
110
                id: allButton
115
111
                objectName: "allButton"
116
112
                width: parent.width
117
 
                visible: department && (!department.isRoot || (root.currentDepartment && !root.currentDepartment.isRoot && root.currentDepartment.parentDepartmentId == department.departmentId)) || false
 
113
                visible: navigation && (!navigation.isRoot || (root.currentNavigation && !root.currentNavigation.isRoot && root.currentNavigation.parentNavigationId == navigation.navigationId)) || false
118
114
                height: itemHeight
119
115
 
120
116
                Label {
123
119
                        left: parent.left
124
120
                        leftMargin: units.gu(2)
125
121
                    }
126
 
                    text: department ? (department.allLabel != "" ? department.allLabel : department.label) : ""
 
122
                    text: navigation ? (navigation.allLabel != "" ? navigation.allLabel : navigation.label) : ""
127
123
                    font.bold: true
128
124
                    color: root.foregroundColor
129
125
                }
141
137
                    height: units.dp(1)
142
138
                }
143
139
 
144
 
                onClicked: root.allDepartmentClicked();
 
140
                onClicked: root.allNavigationClicked();
145
141
            }
146
142
 
147
143
            Repeater {
148
 
                model: department && department.loaded ? department : null
 
144
                model: navigation && navigation.loaded ? navigation : null
149
145
                clip: true
150
146
                delegate: AbstractButton {
151
147
                    objectName: root.objectName + "child" + index
152
148
                    height: root.itemHeight
153
149
                    width: root.width
154
150
 
155
 
                    onClicked: root.enterDepartment(departmentId, hasChildren)
 
151
                    onClicked: root.enterNavigation(navigationId, hasChildren)
156
152
 
157
153
                    Label {
158
154
                        anchors {
188
184
                        color: root.foregroundColor
189
185
                        opacity: 0.1
190
186
                        height: units.dp(1)
191
 
                        visible: index != department.count - 1
 
187
                        visible: index != navigation.count - 1
192
188
                    }
193
189
                }
194
190
            }