diff options
Diffstat (limited to 'framework/src/domain')
-rw-r--r-- | framework/src/domain/contactcontroller.cpp | 22 | ||||
-rw-r--r-- | framework/src/domain/contactcontroller.h | 6 |
2 files changed, 24 insertions, 4 deletions
diff --git a/framework/src/domain/contactcontroller.cpp b/framework/src/domain/contactcontroller.cpp index 49f78b40..90ef6323 100644 --- a/framework/src/domain/contactcontroller.cpp +++ b/framework/src/domain/contactcontroller.cpp | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "contactcontroller.h" | 19 | #include "contactcontroller.h" |
20 | 20 | ||
21 | #include <sink/applicationdomaintype.h> | 21 | #include <sink/applicationdomaintype.h> |
22 | #include <KContacts/VCardConverter> | ||
22 | 23 | ||
23 | ContactController::ContactController() | 24 | ContactController::ContactController() |
24 | : Kube::Controller(), | 25 | : Kube::Controller(), |
@@ -40,11 +41,24 @@ void ContactController::loadContact(const QVariant &contact) | |||
40 | { | 41 | { |
41 | if (auto c = contact.value<Sink::ApplicationDomain::Contact::Ptr>()) { | 42 | if (auto c = contact.value<Sink::ApplicationDomain::Contact::Ptr>()) { |
42 | setName(c->getFn()); | 43 | setName(c->getFn()); |
43 | QStringList emails; | 44 | const auto &vcard = c->getVcard(); |
44 | for (const auto &e : c->getEmails()) { | 45 | KContacts::VCardConverter converter; |
45 | emails << e.email; | 46 | const auto addressee = converter.parseVCard(vcard); |
47 | setEmails(addressee.emails()); | ||
48 | QStringList numbers; | ||
49 | for (const auto &n : addressee.phoneNumbers()) { | ||
50 | numbers << n.number(); | ||
46 | } | 51 | } |
47 | setEmails(emails); | 52 | setPhoneNumbers(numbers); |
53 | |||
54 | for(const auto &a :addressee.addresses()) { | ||
55 | setStreet(a.street()); | ||
56 | setCity(a.locality()); | ||
57 | setCountry(a.country()); | ||
58 | break; | ||
59 | } | ||
60 | setCompany(addressee.organization()); | ||
61 | setJobTitle(addressee.role()); | ||
48 | } | 62 | } |
49 | } | 63 | } |
50 | 64 | ||
diff --git a/framework/src/domain/contactcontroller.h b/framework/src/domain/contactcontroller.h index d1973d9c..fea42430 100644 --- a/framework/src/domain/contactcontroller.h +++ b/framework/src/domain/contactcontroller.h | |||
@@ -35,6 +35,12 @@ class ContactController : public Kube::Controller | |||
35 | //Interface properties | 35 | //Interface properties |
36 | KUBE_CONTROLLER_PROPERTY(QString, Name, name) | 36 | KUBE_CONTROLLER_PROPERTY(QString, Name, name) |
37 | KUBE_CONTROLLER_PROPERTY(QStringList, Emails, emails) | 37 | KUBE_CONTROLLER_PROPERTY(QStringList, Emails, emails) |
38 | KUBE_CONTROLLER_PROPERTY(QStringList, PhoneNumbers, phoneNumbers) | ||
39 | KUBE_CONTROLLER_PROPERTY(QString, Street, street) | ||
40 | KUBE_CONTROLLER_PROPERTY(QString, City, city) | ||
41 | KUBE_CONTROLLER_PROPERTY(QString, Country, country) | ||
42 | KUBE_CONTROLLER_PROPERTY(QString, Company, company) | ||
43 | KUBE_CONTROLLER_PROPERTY(QString, JobTitle, jobTitle) | ||
38 | 44 | ||
39 | KUBE_CONTROLLER_ACTION(save) | 45 | KUBE_CONTROLLER_ACTION(save) |
40 | 46 | ||