diff options
Diffstat (limited to 'framework/qml/People.qml')
-rw-r--r-- | framework/qml/People.qml | 435 |
1 files changed, 435 insertions, 0 deletions
diff --git a/framework/qml/People.qml b/framework/qml/People.qml new file mode 100644 index 00000000..182cce94 --- /dev/null +++ b/framework/qml/People.qml | |||
@@ -0,0 +1,435 @@ | |||
1 | /* | ||
2 | Copyright (C) 2017 Michael Bohlender, <bohlender@kolabsys.com> | ||
3 | Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com> | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License along | ||
16 | with this program; if not, write to the Free Software Foundation, Inc., | ||
17 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | ||
19 | |||
20 | import QtQuick 2.7 | ||
21 | import QtQuick.Controls 2.0 | ||
22 | import QtQuick.Controls 1.4 as Controls | ||
23 | import QtQuick.Layouts 1.1 | ||
24 | |||
25 | import org.kde.kirigami 1.0 as Kirigami | ||
26 | import org.kube.components.theme 1.0 as KubeTheme | ||
27 | import org.kube.framework.domain 1.0 as KubeFramework | ||
28 | |||
29 | |||
30 | |||
31 | Popup { | ||
32 | id: popup | ||
33 | |||
34 | property var currentContact | ||
35 | |||
36 | modal: true | ||
37 | |||
38 | Item { | ||
39 | id: peopleRoot | ||
40 | |||
41 | anchors.fill: parent | ||
42 | |||
43 | ToolBar { | ||
44 | id: toolbar | ||
45 | |||
46 | width: parent.width | ||
47 | |||
48 | Controls.ToolButton { | ||
49 | |||
50 | anchors.verticalCenter: parent.verticalCenter | ||
51 | |||
52 | iconName: KubeTheme.Icons.goBack | ||
53 | |||
54 | onClicked: stack.pop() | ||
55 | |||
56 | visible: stack. depth > 1 | ||
57 | } | ||
58 | |||
59 | TextField { | ||
60 | id: searchBar | ||
61 | anchors.centerIn: parent | ||
62 | |||
63 | placeholderText: "Search..." | ||
64 | |||
65 | width: parent.width * 0.5 | ||
66 | } | ||
67 | |||
68 | Controls.ToolButton { | ||
69 | |||
70 | anchors { | ||
71 | right: parent.right | ||
72 | rightMargin: KubeTheme.Units.smallSpacing | ||
73 | verticalCenter: parent.verticalCenter | ||
74 | } | ||
75 | |||
76 | iconName: KubeTheme.Icons.addNew | ||
77 | } | ||
78 | } | ||
79 | |||
80 | StackView { | ||
81 | id: stack | ||
82 | |||
83 | anchors { | ||
84 | top: toolbar.bottom | ||
85 | left: parent.left | ||
86 | right: parent.right | ||
87 | bottom: parent.bottom | ||
88 | } | ||
89 | |||
90 | initialItem: peoplePage | ||
91 | |||
92 | clip: true | ||
93 | } | ||
94 | } | ||
95 | |||
96 | Component { | ||
97 | id: peoplePage | ||
98 | |||
99 | Rectangle { | ||
100 | id: peoplePageRoot | ||
101 | color: KubeTheme.Colors.viewBackgroundColor | ||
102 | |||
103 | Flickable { | ||
104 | |||
105 | anchors.fill: parent | ||
106 | |||
107 | ScrollBar.vertical: ScrollBar { } | ||
108 | contentHeight: content.height | ||
109 | clip: true | ||
110 | |||
111 | Item { | ||
112 | id: content | ||
113 | |||
114 | height: childrenRect.height | ||
115 | |||
116 | Flow { | ||
117 | |||
118 | anchors { | ||
119 | top: parent.top | ||
120 | topMargin: KubeTheme.Units.largeSpacing | ||
121 | left: parent.left | ||
122 | leftMargin: KubeTheme.Units.largeSpacing | ||
123 | } | ||
124 | |||
125 | spacing: KubeTheme.Units.largeSpacing | ||
126 | width: peoplePageRoot.width - KubeTheme.Units.largeSpacing * 2 | ||
127 | |||
128 | Repeater { | ||
129 | |||
130 | model: KubeFramework.PeopleModel { | ||
131 | filter: searchBar.text | ||
132 | } | ||
133 | |||
134 | delegate: Rectangle { | ||
135 | id: delegateRoot | ||
136 | |||
137 | height: KubeTheme.Units.gridUnit * 3 | ||
138 | width: KubeTheme.Units.gridUnit * 10 | ||
139 | |||
140 | border.width: 1 | ||
141 | border.color: "lightgrey" | ||
142 | |||
143 | MouseArea { | ||
144 | anchors.fill: parent | ||
145 | |||
146 | onClicked: { | ||
147 | popup.currentContact = model.domainObject | ||
148 | stack.push(personPage) | ||
149 | } | ||
150 | } | ||
151 | |||
152 | Rectangle { | ||
153 | id: avatarPlaceholder | ||
154 | |||
155 | height: parent.height | ||
156 | width: height | ||
157 | |||
158 | color: "lightgrey" | ||
159 | } | ||
160 | |||
161 | Column { | ||
162 | |||
163 | width: parent.width | ||
164 | |||
165 | anchors { | ||
166 | left: avatarPlaceholder.right | ||
167 | margins: KubeTheme.Units.smallSpacing | ||
168 | verticalCenter: parent.verticalCenter | ||
169 | } | ||
170 | |||
171 | Text { | ||
172 | width: delegateRoot.width - avatarPlaceholder.width - KubeTheme.Units.smallSpacing * 2 | ||
173 | |||
174 | text: model.firstName | ||
175 | elide: Text.ElideRight | ||
176 | color: KubeTheme.Colors.textColor | ||
177 | } | ||
178 | |||
179 | Text { | ||
180 | width: delegateRoot.width - avatarPlaceholder.width - KubeTheme.Units.smallSpacing * 2 | ||
181 | |||
182 | text: model.lastName | ||
183 | elide: Text.ElideRight | ||
184 | color: KubeTheme.Colors.textColor | ||
185 | } | ||
186 | } | ||
187 | } | ||
188 | } | ||
189 | } | ||
190 | } | ||
191 | } | ||
192 | } | ||
193 | } | ||
194 | |||
195 | Component { | ||
196 | id: personPage | ||
197 | |||
198 | Rectangle { | ||
199 | id: personPageRoot | ||
200 | |||
201 | KubeFramework.ContactController { | ||
202 | id: contactController | ||
203 | contact: popup.currentContact | ||
204 | } | ||
205 | |||
206 | color: KubeTheme.Colors.viewBackgroundColor | ||
207 | |||
208 | Item { | ||
209 | |||
210 | anchors { | ||
211 | top: parent.top | ||
212 | left: parent.left | ||
213 | leftMargin: KubeTheme.Units.largeSpacing | ||
214 | } | ||
215 | |||
216 | width: parent.width | ||
217 | height: parent.height | ||
218 | |||
219 | |||
220 | Flickable { | ||
221 | |||
222 | anchors.fill: parent | ||
223 | |||
224 | ScrollBar.vertical: ScrollBar { } | ||
225 | contentHeight: contentColumn.height | ||
226 | |||
227 | clip: true | ||
228 | |||
229 | ColumnLayout { | ||
230 | id: contentColumn | ||
231 | |||
232 | width: personPageRoot.width | ||
233 | |||
234 | spacing: KubeTheme.Units.largeSpacing | ||
235 | |||
236 | Item { | ||
237 | width: parent.width | ||
238 | height: KubeTheme.Units.smallSpacing | ||
239 | } | ||
240 | |||
241 | Item { | ||
242 | |||
243 | height: KubeTheme.Units.gridUnit * 8 | ||
244 | width: personPageRoot.width - KubeTheme.Units.largeSpacing | ||
245 | |||
246 | Rectangle { | ||
247 | id: avatar | ||
248 | |||
249 | height: parent.height | ||
250 | width: height | ||
251 | |||
252 | color: "lightgrey" | ||
253 | } | ||
254 | |||
255 | Kirigami.Heading { | ||
256 | id: nameLabel | ||
257 | |||
258 | anchors { | ||
259 | top: avatar.top | ||
260 | left: avatar.right | ||
261 | leftMargin: KubeTheme.Units.largeSpacing | ||
262 | } | ||
263 | |||
264 | text: contactController.name //"Michael Tester" | ||
265 | } | ||
266 | |||
267 | Text { | ||
268 | id: jobTitle | ||
269 | |||
270 | anchors { | ||
271 | top: nameLabel.bottom | ||
272 | left: avatar.right | ||
273 | leftMargin: KubeTheme.Units.largeSpacing | ||
274 | } | ||
275 | |||
276 | text: "CIO" | ||
277 | } | ||
278 | |||
279 | Rectangle { | ||
280 | id: company | ||
281 | |||
282 | anchors { | ||
283 | bottom: avatar.bottom | ||
284 | left: avatar.right | ||
285 | leftMargin: KubeTheme.Units.largeSpacing | ||
286 | } | ||
287 | |||
288 | height: KubeTheme.Units.gridUnit * 3 | ||
289 | width: KubeTheme.Units.gridUnit * 10 | ||
290 | |||
291 | border.width: 1 | ||
292 | border.color: "lightgrey" | ||
293 | |||
294 | Rectangle { | ||
295 | id: av | ||
296 | |||
297 | height: parent.height | ||
298 | width: height | ||
299 | |||
300 | color: "lightgrey" | ||
301 | } | ||
302 | |||
303 | Text { | ||
304 | anchors { | ||
305 | verticalCenter: av.verticalCenter | ||
306 | left: av.right | ||
307 | leftMargin: KubeTheme.Units.smallSpacing | ||
308 | } | ||
309 | |||
310 | text: "Sauerkraut AG" | ||
311 | |||
312 | color: KubeTheme.Colors.textColor | ||
313 | } | ||
314 | } | ||
315 | } | ||
316 | |||
317 | Flow { | ||
318 | id: emails | ||
319 | |||
320 | width: personPageRoot.width - KubeTheme.Units.largeSpacing | ||
321 | |||
322 | Repeater { | ||
323 | |||
324 | model: contactController.emails | ||
325 | |||
326 | Row { | ||
327 | spacing: KubeTheme.Units.smallSpacing | ||
328 | Text { text: "(main)" } | ||
329 | Text { text: modelData ; color: KubeTheme.Colors.highlightColor } | ||
330 | Item { width: KubeTheme.Units.smallSpacing; height: 1 } | ||
331 | } | ||
332 | } | ||
333 | |||
334 | Row { | ||
335 | spacing: KubeTheme.Units.smallSpacing | ||
336 | Text { text: "(alias)"} | ||
337 | Text { text: "test.testerson@gmail.com"; color: KubeTheme.Colors.highlightColor } | ||
338 | Item { width: KubeTheme.Units.smallSpacing; height: 1 } | ||
339 | } | ||
340 | |||
341 | Row { | ||
342 | spacing: KubeTheme.Units.smallSpacing | ||
343 | Text { text: "(private)"} | ||
344 | Text { text: "test@gmail.com"; color: KubeTheme.Colors.highlightColor } | ||
345 | Item { width: KubeTheme.Units.smallSpacing; height: 1 } | ||
346 | } | ||
347 | } | ||
348 | |||
349 | Flow { | ||
350 | id: phone | ||
351 | |||
352 | width: personPageRoot.width - KubeTheme.Units.largeSpacing | ||
353 | spacing: KubeTheme.Units.smallSpacing | ||
354 | |||
355 | Row { | ||
356 | spacing: KubeTheme.Units.smallSpacing | ||
357 | Text { text: "(inhouse)"} | ||
358 | Text { text: "+49812324932"; opacity: 0.6 } | ||
359 | Item { width: KubeTheme.Units.smallSpacing; height: 1 } | ||
360 | } | ||
361 | Row { | ||
362 | spacing: KubeTheme.Units.smallSpacing | ||
363 | Text { text: "(mobile)"} | ||
364 | Text { text: "+49812324932"; opacity: 0.6 } | ||
365 | Item { width: KubeTheme.Units.smallSpacing; height: 1 } | ||
366 | } | ||
367 | Row { | ||
368 | spacing: KubeTheme.Units.smallSpacing | ||
369 | Text { text: "(private)"} | ||
370 | Text { text: "+49812324932"; opacity: 0.6 } | ||
371 | Item { width: KubeTheme.Units.smallSpacing; height: 1 } | ||
372 | } | ||
373 | } | ||
374 | |||
375 | Column { | ||
376 | id: address | ||
377 | |||
378 | width: personPageRoot.width - KubeTheme.Units.largeSpacing | ||
379 | |||
380 | Text { text: "Albertstrasse 35a"} | ||
381 | Text { text: "81767 Teststadt"} | ||
382 | Text { text: "GERMANY" } | ||
383 | } | ||
384 | |||
385 | // Column { | ||
386 | // | ||
387 | // width: parent.width | ||
388 | // | ||
389 | // spacing: KubeTheme.Units.smallSpacing | ||
390 | // | ||
391 | // Text { | ||
392 | // | ||
393 | // text: root.firstname + " is part of these groups:" | ||
394 | // } | ||
395 | // | ||
396 | // GroupGrid { | ||
397 | // id: groups | ||
398 | // | ||
399 | // width: root.width - KubeTheme.Units.largeSpacing | ||
400 | // | ||
401 | // model: GroupModel1 {} | ||
402 | // } | ||
403 | // } | ||
404 | |||
405 | // Column { | ||
406 | // | ||
407 | // width: parent.width | ||
408 | // | ||
409 | // spacing: KubeTheme.Units.smallSpacing | ||
410 | // | ||
411 | // Text { | ||
412 | // id: commonPeopleLabel | ||
413 | // | ||
414 | // text: root.firstname + " is associated with:" | ||
415 | // } | ||
416 | // | ||
417 | // PeopleGrid { | ||
418 | // id: commonPeople | ||
419 | // | ||
420 | // width: root.width - KubeTheme.Units.largeSpacing | ||
421 | // | ||
422 | // model: PeopleModel2 {} | ||
423 | // } | ||
424 | // } | ||
425 | |||
426 | Item { | ||
427 | width: parent.width | ||
428 | height: KubeTheme.Units.largeSpacing | ||
429 | } | ||
430 | } | ||
431 | } | ||
432 | } | ||
433 | } | ||
434 | } | ||
435 | } | ||