summaryrefslogtreecommitdiffstats
path: root/views
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
parentebf7f47e62e50ed80deb15793fdce4b67bacb32d (diff)
downloadkube-6681381298bd9230ae4d8309ef5ff191a5e77ff5.tar.gz
kube-6681381298bd9230ae4d8309ef5ff191a5e77ff5.zip
move people & person page to view
Diffstat (limited to 'views')
-rw-r--r--views/people/qml/People.qml264
-rw-r--r--views/people/qml/PersonPage.qml238
2 files changed, 502 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
diff --git a/views/people/qml/PersonPage.qml b/views/people/qml/PersonPage.qml
new file mode 100644
index 00000000..cd2a5d65
--- /dev/null
+++ b/views/people/qml/PersonPage.qml
@@ -0,0 +1,238 @@
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
27Flickable {
28 id: personPageFlickable
29
30 anchors {
31 fill: parent
32 leftMargin: Kube.Units.largeSpacing
33 }
34
35 Controls2.ScrollBar.vertical: Kube.ScrollBar { }
36 contentHeight: contentColumn.height
37
38 clip: true
39
40 Kube.ScrollHelper {
41 flickable: personPageFlickable
42 anchors.fill: parent
43 }
44
45
46 ColumnLayout {
47 id: contentColumn
48
49 anchors {
50 left: parent.left
51 right: parent.right
52 }
53
54 spacing: Kube.Units.largeSpacing
55
56 Item {
57 width: parent.width
58 height: Kube.Units.smallSpacing
59 }
60
61
62 Item {
63
64 height: Kube.Units.gridUnit * 8
65 width: personPageRoot.width - Kube.Units.largeSpacing
66
67 Rectangle {
68 id: avatar
69
70 height: parent.height
71 width: height
72 Kube.KubeImage {
73 anchors.fill: parent
74 visible: contactController.imageData != ""
75 imageData: contactController.imageData
76 }
77 Kube.Icon {
78 anchors.fill: parent
79 visible: contactController.imageData == ""
80 iconName: Kube.Icons.user
81 }
82 color: Kube.Colors.buttonColor
83 }
84
85 Kube.Heading {
86 id: nameLabel
87
88 anchors {
89 top: avatar.top
90 left: avatar.right
91 leftMargin: Kube.Units.largeSpacing
92 }
93
94 text: contactController.name
95 }
96
97 Kube.Label {
98 id: jobTitle
99
100 anchors {
101 top: nameLabel.bottom
102 left: avatar.right
103 leftMargin: Kube.Units.largeSpacing
104 }
105
106 text: contactController.jobTitle
107 }
108
109 Rectangle {
110 id: company
111 visible: contactController.company != ""
112
113 anchors {
114 bottom: avatar.bottom
115 left: avatar.right
116 leftMargin: Kube.Units.largeSpacing
117 }
118
119 height: Kube.Units.gridUnit * 3
120 width: Kube.Units.gridUnit * 10
121
122 border.width: 1
123 border.color: Kube.Colors.buttonColor
124
125 Rectangle {
126 id: av
127
128 height: parent.height
129 width: height
130
131 color: Kube.Colors.buttonColor
132 }
133
134 Kube.Label {
135 anchors {
136 verticalCenter: av.verticalCenter
137 left: av.right
138 leftMargin: Kube.Units.smallSpacing
139 }
140
141 text: contactController.company
142 }
143 }
144 }
145
146 Flow {
147 id: emails
148
149 width: personPageRoot.width - Kube.Units.largeSpacing
150
151 Repeater {
152 model: contactController.emails
153
154 delegate: Row {
155 spacing: Kube.Units.smallSpacing
156 Kube.Label { text: qsTr("(main)") }
157 Kube.Label { text: modelData ; color: Kube.Colors.highlightColor }
158 Item { width: Kube.Units.smallSpacing; height: 1 }
159 }
160 }
161 }
162
163 Flow {
164 id: phone
165
166 width: personPageRoot.width - Kube.Units.largeSpacing
167 spacing: Kube.Units.smallSpacing
168
169 Repeater {
170 model: contactController.phoneNumbers
171
172 Row {
173 spacing: Kube.Units.smallSpacing
174 Kube.Label { text: qsTr("(main)") }
175 Kube.Label { text: modelData ; opacity: 0.6 }
176 Item { width: Kube.Units.smallSpacing; height: 1 }
177 }
178 }
179 }
180
181 Column {
182 id: address
183
184 width: personPageRoot.width - Kube.Units.largeSpacing
185
186 Kube.Label { text: contactController.street }
187 Kube.Label { text: contactController.city }
188 Kube.Label { text: contactController.country }
189 }
190 Item {
191 width: parent.width
192 height: Kube.Units.largeSpacing
193 }
194 }
195}
196
197// Column {
198//
199// width: parent.width
200//
201// spacing: Kube.Units.smallSpacing
202//
203// Text {
204//
205// text: root.firstname + " is part of these groups:"
206// }
207//
208// GroupGrid {
209// id: groups
210//
211// width: root.width - Kube.Units.largeSpacing
212//
213// model: GroupModel1 {}
214// }
215// }
216
217// Column {
218//
219// width: parent.width
220//
221// spacing: Kube.Units.smallSpacing
222//
223// Text {
224// id: commonPeopleLabel
225//
226// text: root.firstname + " is associated with:"
227// }
228//
229// PeopleGrid {
230// id: commonPeople
231//
232// width: root.width - Kube.Units.largeSpacing
233//
234// model: PeopleModel2 {}
235// }
236// }
237
238