diff options
author | Michael Bohlender <michael.bohlender@kdemail.net> | 2018-03-22 08:42:38 +0100 |
---|---|---|
committer | Michael Bohlender <michael.bohlender@kdemail.net> | 2018-03-22 08:43:48 +0100 |
commit | 28903e867df6e3f3849f44911db21392c9b7cac6 (patch) | |
tree | cdbfd58ed17dcc0c43d8b287755b927ddec0df16 | |
parent | 587ede0351394299008d3f8cab4aaa519a91d186 (diff) | |
download | kube-28903e867df6e3f3849f44911db21392c9b7cac6.tar.gz kube-28903e867df6e3f3849f44911db21392c9b7cac6.zip |
use KubeListController in person page
-rw-r--r-- | framework/src/domain/contactcontroller.cpp | 15 | ||||
-rw-r--r-- | views/people/qml/PersonPage.qml | 9 |
2 files changed, 19 insertions, 5 deletions
diff --git a/framework/src/domain/contactcontroller.cpp b/framework/src/domain/contactcontroller.cpp index b9bb90c2..5211e5a5 100644 --- a/framework/src/domain/contactcontroller.cpp +++ b/framework/src/domain/contactcontroller.cpp | |||
@@ -30,6 +30,12 @@ public: | |||
30 | { | 30 | { |
31 | } | 31 | } |
32 | 32 | ||
33 | void set(const QStringList &list) | ||
34 | { | ||
35 | for (const auto &email: list) { | ||
36 | add({{"email", email}}); | ||
37 | } | ||
38 | } | ||
33 | }; | 39 | }; |
34 | 40 | ||
35 | class PhonesController : public Kube::ListPropertyController | 41 | class PhonesController : public Kube::ListPropertyController |
@@ -41,6 +47,12 @@ public: | |||
41 | { | 47 | { |
42 | } | 48 | } |
43 | 49 | ||
50 | void set(const QStringList &list) | ||
51 | { | ||
52 | for (const auto &number: list) { | ||
53 | add({{"number", number}}); | ||
54 | } | ||
55 | } | ||
44 | }; | 56 | }; |
45 | 57 | ||
46 | ContactController::ContactController() | 58 | ContactController::ContactController() |
@@ -84,6 +96,9 @@ void ContactController::loadContact(const QVariant &contact) | |||
84 | setCompany(addressee.organization()); | 96 | setCompany(addressee.organization()); |
85 | setJobTitle(addressee.role()); | 97 | setJobTitle(addressee.role()); |
86 | setImageData(addressee.photo().rawData()); | 98 | setImageData(addressee.photo().rawData()); |
99 | |||
100 | static_cast<MailsController*>(mailsController())->set(addressee.emails()); | ||
101 | static_cast<PhonesController*>(phonesController())->set(numbers); | ||
87 | } | 102 | } |
88 | } | 103 | } |
89 | 104 | ||
diff --git a/views/people/qml/PersonPage.qml b/views/people/qml/PersonPage.qml index 0b04a3d7..3f4c35a6 100644 --- a/views/people/qml/PersonPage.qml +++ b/views/people/qml/PersonPage.qml | |||
@@ -149,12 +149,12 @@ Flickable { | |||
149 | width: personPageRoot.width - Kube.Units.largeSpacing | 149 | width: personPageRoot.width - Kube.Units.largeSpacing |
150 | 150 | ||
151 | Repeater { | 151 | Repeater { |
152 | model: contactController.emails | 152 | model: contactController.mails.model |
153 | 153 | ||
154 | delegate: Row { | 154 | delegate: Row { |
155 | spacing: Kube.Units.smallSpacing | 155 | spacing: Kube.Units.smallSpacing |
156 | Kube.Label { text: qsTr("(main)") } | 156 | Kube.Label { text: qsTr("(main)") } |
157 | Kube.Label { text: modelData ; color: Kube.Colors.highlightColor } | 157 | Kube.Label { text: model.email ; color: Kube.Colors.highlightColor } |
158 | Item { width: Kube.Units.smallSpacing; height: 1 } | 158 | Item { width: Kube.Units.smallSpacing; height: 1 } |
159 | } | 159 | } |
160 | } | 160 | } |
@@ -167,12 +167,11 @@ Flickable { | |||
167 | spacing: Kube.Units.smallSpacing | 167 | spacing: Kube.Units.smallSpacing |
168 | 168 | ||
169 | Repeater { | 169 | Repeater { |
170 | model: contactController.phoneNumbers | 170 | model: contactController.phones.model |
171 | |||
172 | Row { | 171 | Row { |
173 | spacing: Kube.Units.smallSpacing | 172 | spacing: Kube.Units.smallSpacing |
174 | Kube.Label { text: qsTr("(main)") } | 173 | Kube.Label { text: qsTr("(main)") } |
175 | Kube.Label { text: modelData ; opacity: 0.6 } | 174 | Kube.Label { text: model.number ; opacity: 0.6 } |
176 | Item { width: Kube.Units.smallSpacing; height: 1 } | 175 | Item { width: Kube.Units.smallSpacing; height: 1 } |
177 | } | 176 | } |
178 | } | 177 | } |