summaryrefslogtreecommitdiffstats
path: root/views/people
diff options
context:
space:
mode:
Diffstat (limited to 'views/people')
-rw-r--r--views/people/qml/People.qml53
-rw-r--r--views/people/qml/PersonComposer.qml249
-rw-r--r--views/people/qml/PersonPage.qml2
-rw-r--r--views/people/qml/View.qml2
4 files changed, 304 insertions, 2 deletions
diff --git a/views/people/qml/People.qml b/views/people/qml/People.qml
index 1a08d900..41acfba0 100644
--- a/views/people/qml/People.qml
+++ b/views/people/qml/People.qml
@@ -52,6 +52,10 @@ FocusScope {
52 } 52 }
53 text: "New Contact" 53 text: "New Contact"
54 visible: stack.depth == 1 54 visible: stack.depth == 1
55
56 onClicked: {
57 stack.push(personComposer)
58 }
55 } 59 }
56 60
57 Kube.IconButton { 61 Kube.IconButton {
@@ -217,6 +221,55 @@ FocusScope {
217 221
218 PersonPage { 222 PersonPage {
219 } 223 }
224
225 Kube.Button {
226
227 anchors {
228 bottom: parent.bottom
229 right: parent.right
230 margins: Kube.Units.largeSpacing
231 }
232
233 text: "Edit"
234
235 onClicked: {
236 stack.push(personComposer)
237 }
238 }
239 }
240 }
241
242
243 Component {
244 id: personComposer
245
246 Rectangle {
247 id: personComposerRoot
248
249 Kube.ContactController {
250 id: contactController
251 contact: ""
252 }
253
254 color: Kube.Colors.viewBackgroundColor
255
256 PersonComposer {
257 }
258
259 Kube.PositiveButton {
260
261 anchors {
262 bottom: parent.bottom
263 right: parent.right
264 margins: Kube.Units.largeSpacing
265 }
266
267 text: "Save"
268
269 onClicked: {
270 stack.pop()
271 }
272 }
220 } 273 }
221 } 274 }
222} 275}
diff --git a/views/people/qml/PersonComposer.qml b/views/people/qml/PersonComposer.qml
new file mode 100644
index 00000000..e3140953
--- /dev/null
+++ b/views/people/qml/PersonComposer.qml
@@ -0,0 +1,249 @@
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
23import QtQuick.Dialogs 1.0 as Dialogs
24
25
26import org.kube.framework 1.0 as Kube
27
28
29Flickable {
30 id: personComposerFlickable
31
32 anchors {
33 fill: parent
34 leftMargin: Kube.Units.largeSpacing
35 }
36
37 Controls2.ScrollBar.vertical: Kube.ScrollBar { }
38 contentHeight: contentColumn.height
39
40 clip: true
41
42 Kube.ScrollHelper {
43 flickable: personComposerFlickable
44 anchors.fill: parent
45 }
46
47 ColumnLayout {
48 id: contentColumn
49
50 anchors {
51 left: parent.left
52 right: parent.right
53 }
54
55 spacing: Kube.Units.largeSpacing
56
57 Item {
58 width: parent.width
59 height: Kube.Units.smallSpacing
60 }
61
62
63 Item {
64
65 height: Kube.Units.gridUnit * 8
66 width: personComposerRoot.width - Kube.Units.largeSpacing
67
68 Rectangle {
69 id: avatar
70
71 height: parent.height
72 width: height
73 Kube.KubeImage {
74 anchors.fill: parent
75 visible: contactController.imageData != ""
76 imageData: contactController.imageData
77 }
78 Kube.Icon {
79 anchors.fill: parent
80 visible: contactController.imageData == ""
81 iconName: Kube.Icons.user
82 }
83 color: Kube.Colors.buttonColor
84
85 Kube.AbstractButton {
86 anchors.fill: parent
87
88 color: "#00000000"
89
90 onClicked: {
91 fileDialogComponent.createObject(parent)
92 }
93
94 Component {
95 id: fileDialogComponent
96 Dialogs.FileDialog {
97 id: fileDialog
98 visible: true
99 title: "Choose an Avatar"
100 selectFolder: false
101 onAccepted: {
102 //TODO
103 }
104 }
105 }
106 }
107 }
108
109 Row {
110 id: nameRow
111 anchors {
112 left: avatar.right
113 leftMargin: Kube.Units.largeSpacing
114 }
115
116 spacing: Kube.Units.smallSpacing
117
118 Kube.TextField {
119 width: Kube.Units.gridUnit * 15
120 placeholderText: qsTr("First Name")
121 }
122
123 Kube.TextField {
124 width: Kube.Units.gridUnit * 15
125 placeholderText: qsTr("Last Name")
126 }
127 }
128
129 Kube.TextField {
130 id: jobTitle
131
132 anchors {
133 top: nameRow.bottom
134 left: avatar.right
135 topMargin: Kube.Units.smallSpacing
136 leftMargin: Kube.Units.largeSpacing
137 }
138
139 width: Kube.Units.gridUnit * 20
140 text: contactController.jobTitle
141 placeholderText: qsTr("Job Title")
142 }
143
144 Kube.TextField {
145 id: company
146
147 anchors {
148 bottom: avatar.bottom
149 left: avatar.right
150 leftMargin: Kube.Units.largeSpacing
151 }
152 width: Kube.Units.gridUnit * 20
153
154 placeholderText: qsTr("Company")
155 text: contactController.company
156 }
157 }
158
159
160 Column {
161 width: personComposerRoot.width - Kube.Units.largeSpacing
162 spacing: Kube.Units.smallSpacing
163
164 Kube.Label {
165 text: qsTr("Email")
166 }
167 Flow {
168 id: emails
169
170 width: personComposerRoot.width - Kube.Units.largeSpacing
171
172 Repeater {
173 model: contactController.emails
174
175 delegate: Row {
176 spacing: Kube.Units.smallSpacing
177 Kube.Label { text: qsTr("(main)") }
178 Kube.TextField { text: modelData ; color: Kube.Colors.highlightColor }
179 Item { width: Kube.Units.smallSpacing; height: 1 }
180 }
181 }
182 }
183 Kube.Button {
184 text: qsTr("Add")
185 }
186 }
187
188 Column {
189 width: personComposerRoot.width - Kube.Units.largeSpacing
190 spacing: Kube.Units.smallSpacing
191
192 Kube.Label {
193 text: qsTr("Phone")
194 }
195
196 Flow {
197 id: phone
198
199 width: personComposerRoot.width - Kube.Units.largeSpacing
200 spacing: Kube.Units.smallSpacing
201
202 Repeater {
203 model: contactController.phoneNumbers
204
205 Row {
206 spacing: Kube.Units.smallSpacing
207 Kube.Label { text: qsTr("(main)") }
208 Kube.TextField { text: modelData ; opacity: 0.6 }
209 Item { width: Kube.Units.smallSpacing; height: 1 }
210 }
211 }
212 }
213 Kube.Button {
214 text: qsTr("Add")
215 }
216 }
217
218 Column{
219 id: address
220
221 width: personComposerRoot.width - Kube.Units.largeSpacing
222 spacing: Kube.Units.smallSpacing
223
224 Kube.Label {
225 text: "Address"
226 }
227
228 Kube.TextField {
229 width: Kube.Units.gridUnit * 20
230 text: contactController.street
231 placeholderText: qsTr("Street")
232 }
233 Kube.TextField {
234 width: Kube.Units.gridUnit * 20
235 text: contactController.city
236 placeholderText: qsTr("City")
237 }
238 Kube.TextField {
239 width: Kube.Units.gridUnit * 20
240 text: contactController.country
241 placeholderText: qsTr("Country")
242 }
243 }
244 Item {
245 width: parent.width
246 height: Kube.Units.largeSpacing
247 }
248 }
249}
diff --git a/views/people/qml/PersonPage.qml b/views/people/qml/PersonPage.qml
index cd2a5d65..0b04a3d7 100644
--- a/views/people/qml/PersonPage.qml
+++ b/views/people/qml/PersonPage.qml
@@ -82,7 +82,7 @@ Flickable {
82 color: Kube.Colors.buttonColor 82 color: Kube.Colors.buttonColor
83 } 83 }
84 84
85 Kube.Heading { 85 Kube.Heading {
86 id: nameLabel 86 id: nameLabel
87 87
88 anchors { 88 anchors {
diff --git a/views/people/qml/View.qml b/views/people/qml/View.qml
index 3f1b9261..800c4925 100644
--- a/views/people/qml/View.qml
+++ b/views/people/qml/View.qml
@@ -28,7 +28,7 @@ Item {
28 Kube.Fabric.postMessage(Kube.Messages.synchronize, {"type": "contacts"}) 28 Kube.Fabric.postMessage(Kube.Messages.synchronize, {"type": "contacts"})
29 } 29 }
30 30
31 Kube.People { 31 People {
32 id: people 32 id: people
33 anchors { 33 anchors {
34 fill: parent 34 fill: parent