summaryrefslogtreecommitdiffstats
path: root/views/people/qml/People.qml
diff options
context:
space:
mode:
authorMichael Bohlender <michael.bohlender@kdemail.net>2018-02-28 09:21:53 +0100
committerMichael Bohlender <michael.bohlender@kdemail.net>2018-02-28 13:41:42 +0100
commit6681381298bd9230ae4d8309ef5ff191a5e77ff5 (patch)
treecc510d5db12708df4c7ec74b0a8ff6c8ba933fb0 /views/people/qml/People.qml
parentebf7f47e62e50ed80deb15793fdce4b67bacb32d (diff)
downloadkube-6681381298bd9230ae4d8309ef5ff191a5e77ff5.tar.gz
kube-6681381298bd9230ae4d8309ef5ff191a5e77ff5.zip
move people & person page to view
Diffstat (limited to 'views/people/qml/People.qml')
-rw-r--r--views/people/qml/People.qml264
1 files changed, 264 insertions, 0 deletions
diff --git a/views/people/qml/People.qml b/views/people/qml/People.qml
new file mode 100644
index 00000000..1a08d900
--- /dev/null
+++ b/views/people/qml/People.qml
@@ -0,0 +1,264 @@
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
20import QtQuick 2.7
21import QtQuick.Controls 2.0 as Controls2
22import QtQuick.Layouts 1.1
23
24import org.kube.framework 1.0 as Kube
25
26
27FocusScope {
28 id: root
29
30 property var currentContact
31
32 Item {
33 id: peopleRoot
34
35 anchors.fill: parent
36
37 Item {
38 id: toolbar
39 anchors {
40 top: parent.top
41 horizontalCenter: parent.horizontalCenter
42 }
43
44 height: searchBar.height + Kube.Units.smallSpacing
45 width: parent.width
46
47 Kube.PositiveButton {
48 anchors {
49 verticalCenter: parent.verticalCenter
50 left: parent.left
51 leftMargin: Kube.Units.smallSpacing
52 }
53 text: "New Contact"
54 visible: stack.depth == 1
55 }
56
57 Kube.IconButton {
58 anchors {
59 top: parent.top
60 left: parent.left
61 leftMargin: Kube.Units.smallSpacing
62 }
63 visible: stack.depth > 1
64 iconName: Kube.Icons.goBack
65 onClicked: stack.pop()
66 }
67 Kube.TextField {
68 id: searchBar
69 focus: true
70 anchors.horizontalCenter: parent.horizontalCenter
71 width: parent.width * 0.5
72 placeholderText: "Search..."
73 }
74 }
75
76 Controls2.StackView {
77 id: stack
78
79 anchors {
80 top: toolbar.bottom
81 left: parent.left
82 right: parent.right
83 bottom: parent.bottom
84 }
85
86 initialItem: peoplePage
87
88 clip: true
89 }
90 }
91
92 Component {
93 id: peoplePage
94
95 Rectangle {
96 id: peoplePageRoot
97 color: Kube.Colors.viewBackgroundColor
98
99 Kube.GridView {
100 id: gridView
101 anchors {
102 fill: parent
103 margins: Kube.Units.largeSpacing
104 }
105
106 activeFocusOnTab: true
107
108 model: Kube.PeopleModel {
109 filter: searchBar.text
110 }
111
112 cellWidth: Kube.Units.gridUnit * 10
113 cellHeight: Kube.Units.gridUnit * 3
114
115 onActiveFocusChanged: {
116 if (currentIndex < 0) {
117 currentIndex = 0
118 }
119 }
120
121 function selectObject(domainObject) {
122 root.currentContact = domainObject
123 stack.push(personPage)
124 }
125
126 delegate: Item {
127 id: delegateRoot
128
129 height: gridView.cellHeight - Kube.Units.smallSpacing * 2
130 width: gridView.cellWidth - Kube.Units.smallSpacing * 2
131
132 Keys.onReturnPressed: {
133 GridView.view.currentIndex = index
134 GridView.view.selectObject(model.domainObject)
135 }
136
137 Rectangle {
138 anchors.fill: parent
139
140 border.width: 1
141 border.color: Kube.Colors.buttonColor
142
143 Rectangle {
144 id: avatarPlaceholder
145 color: Kube.Colors.buttonColor
146 anchors {
147 top: parent.top
148 left: parent.left
149 bottom: parent.bottom
150 }
151 clip: true
152
153 width: height
154 Kube.KubeImage {
155 anchors.fill: parent
156 visible: model.imageData != ""
157 imageData: model.imageData
158 }
159 Kube.Icon {
160 anchors.fill: parent
161 visible: model.imageData == ""
162 iconName: Kube.Icons.user
163 }
164 }
165
166 Column {
167 width: parent.width
168 anchors {
169 left: avatarPlaceholder.right
170 margins: Kube.Units.smallSpacing
171 verticalCenter: parent.verticalCenter
172 }
173
174 Kube.Label {
175 width: delegateRoot.width - avatarPlaceholder.width - Kube.Units.smallSpacing * 2
176
177 text: model.firstName
178 elide: Text.ElideRight
179 }
180
181 Kube.Label {
182 width: delegateRoot.width - avatarPlaceholder.width - Kube.Units.smallSpacing * 2
183
184 text: model.lastName
185 elide: Text.ElideRight
186 }
187 }
188 }
189 Kube.AbstractButton {
190
191 anchors.fill: parent
192
193 color: "#00000000"
194
195 onClicked: {
196 parent.GridView.view.currentIndex = index
197 parent.GridView.view.selectObject(model.domainObject)
198 }
199 }
200 }
201 }
202 }
203 }
204
205 Component {
206 id: personPage
207
208 Rectangle {
209 id: personPageRoot
210
211 Kube.ContactController {
212 id: contactController
213 contact: root.currentContact
214 }
215
216 color: Kube.Colors.viewBackgroundColor
217
218 PersonPage {
219 }
220 }
221 }
222}
223
224// Column {
225//
226// width: parent.width
227//
228// spacing: Kube.Units.smallSpacing
229//
230// Text {
231//
232// text: root.firstname + " is part of these groups:"
233// }
234//
235// GroupGrid {
236// id: groups
237//
238// width: root.width - Kube.Units.largeSpacing
239//
240// model: GroupModel1 {}
241// }
242// }
243
244// Column {
245//
246// width: parent.width
247//
248// spacing: Kube.Units.smallSpacing
249//
250// Text {
251// id: commonPeopleLabel
252//
253// text: root.firstname + " is associated with:"
254// }
255//
256// PeopleGrid {
257// id: commonPeople
258//
259// width: root.width - Kube.Units.largeSpacing
260//
261// model: PeopleModel2 {}
262// }
263// }
264