diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-06-27 15:19:41 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-06-27 22:17:42 +0200 |
commit | 2b8918e1cf28890b47c0cd2399eccf2087cbfbb4 (patch) | |
tree | 6163bea0a84853bce158efd5adc6f514bc17d3e5 /framework/src | |
parent | 30bb56cddfce3ce7aefa9cf00a3d6a81fb7b5acc (diff) | |
download | kube-2b8918e1cf28890b47c0cd2399eccf2087cbfbb4.tar.gz kube-2b8918e1cf28890b47c0cd2399eccf2087cbfbb4.zip |
No more dummy values in the people view
Diffstat (limited to 'framework/src')
-rw-r--r-- | framework/src/CMakeLists.txt | 3 | ||||
-rw-r--r-- | framework/src/domain/contactcontroller.cpp | 22 | ||||
-rw-r--r-- | framework/src/domain/contactcontroller.h | 6 |
3 files changed, 26 insertions, 5 deletions
diff --git a/framework/src/CMakeLists.txt b/framework/src/CMakeLists.txt index 0e6af2ce..1b92e8c3 100644 --- a/framework/src/CMakeLists.txt +++ b/framework/src/CMakeLists.txt | |||
@@ -6,6 +6,7 @@ find_package(KAsync CONFIG REQUIRED) | |||
6 | find_package(QGpgme CONFIG REQUIRED) | 6 | find_package(QGpgme CONFIG REQUIRED) |
7 | find_package(KF5Codecs CONFIG REQUIRED) | 7 | find_package(KF5Codecs CONFIG REQUIRED) |
8 | find_package(KF5Package CONFIG REQUIRED) | 8 | find_package(KF5Package CONFIG REQUIRED) |
9 | find_package(KF5Contacts CONFIG REQUIRED) | ||
9 | 10 | ||
10 | add_definitions("-Wall -std=c++0x -g") | 11 | add_definitions("-Wall -std=c++0x -g") |
11 | 12 | ||
@@ -42,7 +43,7 @@ set(SRCS | |||
42 | 43 | ||
43 | add_library(frameworkplugin SHARED ${SRCS}) | 44 | add_library(frameworkplugin SHARED ${SRCS}) |
44 | qt5_use_modules(frameworkplugin Core Quick Qml WebEngineWidgets Test) | 45 | qt5_use_modules(frameworkplugin Core Quick Qml WebEngineWidgets Test) |
45 | target_link_libraries(frameworkplugin sink kube_otp KF5::Codecs KF5::Package KAsync) | 46 | target_link_libraries(frameworkplugin sink kube_otp KF5::Codecs KF5::Package KF5::Contacts KAsync) |
46 | install(TARGETS frameworkplugin DESTINATION ${FRAMEWORK_INSTALL_DIR}) | 47 | install(TARGETS frameworkplugin DESTINATION ${FRAMEWORK_INSTALL_DIR}) |
47 | 48 | ||
48 | add_subdirectory(domain/mime/mimetreeparser) | 49 | add_subdirectory(domain/mime/mimetreeparser) |
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 | ||