summaryrefslogtreecommitdiffstats
path: root/framework/qml/People.qml
diff options
context:
space:
mode:
Diffstat (limited to 'framework/qml/People.qml')
-rw-r--r--framework/qml/People.qml155
1 files changed, 76 insertions, 79 deletions
diff --git a/framework/qml/People.qml b/framework/qml/People.qml
index c2c6c9ef..472ba968 100644
--- a/framework/qml/People.qml
+++ b/framework/qml/People.qml
@@ -94,103 +94,100 @@ FocusScope {
94 id: peoplePageRoot 94 id: peoplePageRoot
95 color: Kube.Colors.viewBackgroundColor 95 color: Kube.Colors.viewBackgroundColor
96 96
97 Flickable { 97 Kube.GridView {
98 id: peopleFlickable 98 id: gridView
99 anchors {
100 fill: parent
101 margins: Kube.Units.largeSpacing
102 }
99 103
100 anchors.fill: parent 104 activeFocusOnTab: true
101 105
102 ScrollBar.vertical: ScrollBar { } 106 model: Kube.PeopleModel {
103 contentHeight: content.height 107 filter: searchBar.text
104 clip: true
105 Kube.ScrollHelper {
106 flickable: peopleFlickable
107 anchors.fill: parent
108 } 108 }
109 109
110 Item { 110 cellWidth: Kube.Units.gridUnit * 10
111 id: content 111 cellHeight: Kube.Units.gridUnit * 3
112 112
113 anchors { 113 onActiveFocusChanged: {
114 left: parent.left 114 if (currentIndex < 0) {
115 right: parent.right 115 currentIndex = 0
116 } 116 }
117 height: childrenRect.height 117 }
118 118
119 Flow { 119 function selectObject(domainObject) {
120 root.currentContact = domainObject
121 stack.push(personPage)
122 }
123
124 delegate: Item {
125 id: delegateRoot
120 126
121 anchors { 127 height: gridView.cellHeight - Kube.Units.smallSpacing * 2
122 top: parent.top 128 width: gridView.cellWidth - Kube.Units.smallSpacing * 2
123 topMargin: Kube.Units.largeSpacing 129
124 left: parent.left 130 MouseArea {
125 leftMargin: Kube.Units.largeSpacing 131 anchors.fill: parent
132 onClicked: {
133 parent.GridView.view.currentIndex = index
134 parent.GridView.view.selectObject(model.domainObject)
126 } 135 }
136 }
137 Keys.onReturnPressed: {
138 GridView.view.currentIndex = index
139 GridView.view.selectObject(model.domainObject)
140 }
127 141
128 spacing: Kube.Units.largeSpacing 142 Rectangle {
129 width: peoplePageRoot.width - Kube.Units.largeSpacing * 2 143 anchors.fill: parent
130 144
131 Repeater { 145 border.width: parent.GridView.view.currentIndex == index ? 2 : 1
146 border.color: parent.GridView.view.currentIndex == index ? Kube.Colors.highlightColor : Kube.Colors.buttonColor
132 147
133 model: Kube.PeopleModel { 148 Rectangle {
134 filter: searchBar.text 149 id: avatarPlaceholder
150 color: Kube.Colors.buttonColor
151 anchors {
152 top: parent.top
153 left: parent.left
154 bottom: parent.bottom
135 } 155 }
156 clip: true
136 157
137 delegate: Kube.AbstractButton { 158 width: height
138 id: delegateRoot 159 Kube.KubeImage {
160 anchors.fill: parent
161 visible: model.imageData != ""
162 imageData: model.imageData
163 }
164 Kube.Icon {
165 anchors.fill: parent
166 visible: model.imageData == ""
167 iconName: Kube.Icons.user
168 }
169 }
139 170
140 height: Kube.Units.gridUnit * 3 171 Column {
141 width: Kube.Units.gridUnit * 10 172 width: parent.width
173 anchors {
174 left: avatarPlaceholder.right
175 margins: Kube.Units.smallSpacing
176 verticalCenter: parent.verticalCenter
177 }
142 178
143 activeFocusOnTab: true 179 Kube.Label {
180 width: delegateRoot.width - avatarPlaceholder.width - Kube.Units.smallSpacing * 2
144 181
145 onClicked: { 182 text: model.firstName
146 root.currentContact = model.domainObject 183 elide: Text.ElideRight
147 stack.push(personPage) 184 }
148 }
149 185
150 contentItem: Item { 186 Kube.Label {
151 anchors.fill: parent 187 width: delegateRoot.width - avatarPlaceholder.width - Kube.Units.smallSpacing * 2
152 Item { 188
153 id: avatarPlaceholder 189 text: model.lastName
154 190 elide: Text.ElideRight
155 height: parent.height
156 width: height
157 Kube.KubeImage {
158 anchors.fill: parent
159 visible: model.imageData != ""
160 imageData: model.imageData
161 }
162 Kube.Icon {
163 anchors.fill: parent
164 visible: model.imageData == ""
165 iconName: Kube.Icons.user
166 }
167 }
168
169 Column {
170
171 width: parent.width
172
173 anchors {
174 left: avatarPlaceholder.right
175 margins: Kube.Units.smallSpacing
176 verticalCenter: parent.verticalCenter
177 }
178
179 Kube.Label {
180 width: delegateRoot.width - avatarPlaceholder.width - Kube.Units.smallSpacing * 2
181
182 text: model.firstName
183 elide: Text.ElideRight
184 }
185
186 Kube.Label {
187 width: delegateRoot.width - avatarPlaceholder.width - Kube.Units.smallSpacing * 2
188
189 text: model.lastName
190 elide: Text.ElideRight
191 }
192 }
193 }
194 } 191 }
195 } 192 }
196 } 193 }