diff options
Diffstat (limited to 'views/people/qml/PersonComposer.qml')
-rw-r--r-- | views/people/qml/PersonComposer.qml | 249 |
1 files changed, 249 insertions, 0 deletions
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 | |||
20 | import QtQuick 2.7 | ||
21 | import QtQuick.Controls 2.0 as Controls2 | ||
22 | import QtQuick.Layouts 1.1 | ||
23 | import QtQuick.Dialogs 1.0 as Dialogs | ||
24 | |||
25 | |||
26 | import org.kube.framework 1.0 as Kube | ||
27 | |||
28 | |||
29 | Flickable { | ||
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 | } | ||