diff options
-rw-r--r-- | framework/qml/Icons.qml | 1 | ||||
-rw-r--r-- | views/people/qml/MailListEditor.qml | 62 | ||||
-rw-r--r-- | views/people/qml/PersonComposer.qml | 41 | ||||
-rw-r--r-- | views/people/qml/PhoneListEditor.qml | 61 |
4 files changed, 128 insertions, 37 deletions
diff --git a/framework/qml/Icons.qml b/framework/qml/Icons.qml index 4dfae3d7..79a52046 100644 --- a/framework/qml/Icons.qml +++ b/framework/qml/Icons.qml | |||
@@ -66,6 +66,7 @@ Item { | |||
66 | property string key_import_inverted: "view-certificate-import-inverted" | 66 | property string key_import_inverted: "view-certificate-import-inverted" |
67 | 67 | ||
68 | property string addNew: "list-add" | 68 | property string addNew: "list-add" |
69 | property string listRemove: "list-remove" | ||
69 | property string remove: "kube-list-remove-inverted" | 70 | property string remove: "kube-list-remove-inverted" |
70 | property string folder: "folder" | 71 | property string folder: "folder" |
71 | property string save_inverted: "document-save-inverted" | 72 | property string save_inverted: "document-save-inverted" |
diff --git a/views/people/qml/MailListEditor.qml b/views/people/qml/MailListEditor.qml new file mode 100644 index 00000000..e9dc76e7 --- /dev/null +++ b/views/people/qml/MailListEditor.qml | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2018 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 | |||
21 | import QtQuick 2.7 | ||
22 | import QtQuick.Layouts 1.1 | ||
23 | |||
24 | import org.kube.framework 1.0 as Kube | ||
25 | |||
26 | Column { | ||
27 | id: root | ||
28 | |||
29 | property variant controller | ||
30 | |||
31 | spacing: Kube.Units.smallSpacing | ||
32 | |||
33 | ListView { | ||
34 | id: emails | ||
35 | |||
36 | width: personComposerRoot.width - Kube.Units.largeSpacing | ||
37 | height: contentHeight | ||
38 | |||
39 | model: controller.model | ||
40 | |||
41 | delegate: Row { | ||
42 | height: textField.height + Kube.Units.smallSpacing | ||
43 | spacing: Kube.Units.smallSpacing | ||
44 | Kube.Label { text: qsTr("(main)") } | ||
45 | Kube.TextField {id: textField; width: Kube.Units.gridUnit * 15; text: model.email; backgroundColor: "white" } | ||
46 | Kube.IconButton { | ||
47 | id: removeButton | ||
48 | iconName: Kube.Icons.listRemove | ||
49 | onClicked: root.controller.remove(model.id) | ||
50 | } | ||
51 | } | ||
52 | } | ||
53 | |||
54 | Kube.Button { | ||
55 | id: button | ||
56 | text: qsTr("Add") | ||
57 | focus: true | ||
58 | onClicked: { | ||
59 | root.controller.add({email: ""}); | ||
60 | } | ||
61 | } | ||
62 | } | ||
diff --git a/views/people/qml/PersonComposer.qml b/views/people/qml/PersonComposer.qml index 1d4dfa87..2e0436ed 100644 --- a/views/people/qml/PersonComposer.qml +++ b/views/people/qml/PersonComposer.qml | |||
@@ -168,24 +168,8 @@ Flickable { | |||
168 | Kube.Label { | 168 | Kube.Label { |
169 | text: qsTr("Email") | 169 | text: qsTr("Email") |
170 | } | 170 | } |
171 | Flow { | 171 | MailListEditor { |
172 | id: emails | 172 | controller: contactController.mails |
173 | |||
174 | width: personComposerRoot.width - Kube.Units.largeSpacing | ||
175 | |||
176 | Repeater { | ||
177 | model: contactController.emails | ||
178 | |||
179 | delegate: Row { | ||
180 | spacing: Kube.Units.smallSpacing | ||
181 | Kube.Label { text: qsTr("(main)") } | ||
182 | Kube.TextField { width: Kube.Units.gridUnit * 15; text: modelDatas; color: Kube.Colors.highlightColor; backgroundColor: "white" } | ||
183 | Item { width: Kube.Units.smallSpacing; height: 1 } | ||
184 | } | ||
185 | } | ||
186 | } | ||
187 | Kube.Button { | ||
188 | text: qsTr("Add") | ||
189 | } | 173 | } |
190 | } | 174 | } |
191 | 175 | ||
@@ -197,25 +181,8 @@ Flickable { | |||
197 | text: qsTr("Phone") | 181 | text: qsTr("Phone") |
198 | } | 182 | } |
199 | 183 | ||
200 | Flow { | 184 | PhoneListEditor { |
201 | id: phone | 185 | controller: contactController.phones |
202 | |||
203 | width: personComposerRoot.width - Kube.Units.largeSpacing | ||
204 | spacing: Kube.Units.smallSpacing | ||
205 | |||
206 | Repeater { | ||
207 | model: contactController.phoneNumbers | ||
208 | |||
209 | Row { | ||
210 | spacing: Kube.Units.smallSpacing | ||
211 | Kube.Label { text: qsTr("(main)") } | ||
212 | Kube.TextField { width: Kube.Units.gridUnit * 15; text: modelData; backgroundColor: "white"} | ||
213 | Item { width: Kube.Units.smallSpacing; height: 1 } | ||
214 | } | ||
215 | } | ||
216 | } | ||
217 | Kube.Button { | ||
218 | text: qsTr("Add") | ||
219 | } | 186 | } |
220 | } | 187 | } |
221 | 188 | ||
diff --git a/views/people/qml/PhoneListEditor.qml b/views/people/qml/PhoneListEditor.qml new file mode 100644 index 00000000..6486e088 --- /dev/null +++ b/views/people/qml/PhoneListEditor.qml | |||
@@ -0,0 +1,61 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2018 Michael Bohlender, <michael.bohlender@kdemail.net> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along | ||
15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | |||
20 | import QtQuick 2.7 | ||
21 | import QtQuick.Layouts 1.1 | ||
22 | |||
23 | import org.kube.framework 1.0 as Kube | ||
24 | |||
25 | Column { | ||
26 | id: root | ||
27 | |||
28 | property variant controller | ||
29 | |||
30 | spacing: Kube.Units.smallSpacing | ||
31 | |||
32 | ListView { | ||
33 | id: emails | ||
34 | |||
35 | width: personComposerRoot.width - Kube.Units.largeSpacing | ||
36 | height: contentHeight | ||
37 | |||
38 | model: controller.model | ||
39 | |||
40 | delegate: Row { | ||
41 | height: textField.height + Kube.Units.smallSpacing | ||
42 | spacing: Kube.Units.smallSpacing | ||
43 | Kube.Label { text: qsTr("(main)") } | ||
44 | Kube.TextField {id: textField; width: Kube.Units.gridUnit * 15; text: model.number; backgroundColor: "white" } | ||
45 | Kube.IconButton { | ||
46 | id: removeButton | ||
47 | iconName: Kube.Icons.listRemove | ||
48 | onClicked: root.controller.remove(model.id) | ||
49 | } | ||
50 | } | ||
51 | } | ||
52 | |||
53 | Kube.Button { | ||
54 | id: button | ||
55 | text: qsTr("Add") | ||
56 | focus: true | ||
57 | onClicked: { | ||
58 | root.controller.add({number: ""}); | ||
59 | } | ||
60 | } | ||
61 | } | ||