From 28903e867df6e3f3849f44911db21392c9b7cac6 Mon Sep 17 00:00:00 2001 From: Michael Bohlender Date: Thu, 22 Mar 2018 08:42:38 +0100 Subject: use KubeListController in person page --- framework/src/domain/contactcontroller.cpp | 15 +++++++++++++++ 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: { } + void set(const QStringList &list) + { + for (const auto &email: list) { + add({{"email", email}}); + } + } }; class PhonesController : public Kube::ListPropertyController @@ -41,6 +47,12 @@ public: { } + void set(const QStringList &list) + { + for (const auto &number: list) { + add({{"number", number}}); + } + } }; ContactController::ContactController() @@ -84,6 +96,9 @@ void ContactController::loadContact(const QVariant &contact) setCompany(addressee.organization()); setJobTitle(addressee.role()); setImageData(addressee.photo().rawData()); + + static_cast(mailsController())->set(addressee.emails()); + static_cast(phonesController())->set(numbers); } } 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 { width: personPageRoot.width - Kube.Units.largeSpacing Repeater { - model: contactController.emails + model: contactController.mails.model delegate: Row { spacing: Kube.Units.smallSpacing Kube.Label { text: qsTr("(main)") } - Kube.Label { text: modelData ; color: Kube.Colors.highlightColor } + Kube.Label { text: model.email ; color: Kube.Colors.highlightColor } Item { width: Kube.Units.smallSpacing; height: 1 } } } @@ -167,12 +167,11 @@ Flickable { spacing: Kube.Units.smallSpacing Repeater { - model: contactController.phoneNumbers - + model: contactController.phones.model Row { spacing: Kube.Units.smallSpacing Kube.Label { text: qsTr("(main)") } - Kube.Label { text: modelData ; opacity: 0.6 } + Kube.Label { text: model.number ; opacity: 0.6 } Item { width: Kube.Units.smallSpacing; height: 1 } } } -- cgit v1.2.3