summaryrefslogtreecommitdiffstats
path: root/framework/src/domain
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/domain')
-rw-r--r--framework/src/domain/contactcontroller.cpp22
-rw-r--r--framework/src/domain/contactcontroller.h4
2 files changed, 3 insertions, 23 deletions
diff --git a/framework/src/domain/contactcontroller.cpp b/framework/src/domain/contactcontroller.cpp
index 5211e5a5..effe96e8 100644
--- a/framework/src/domain/contactcontroller.cpp
+++ b/framework/src/domain/contactcontroller.cpp
@@ -80,12 +80,13 @@ void ContactController::loadContact(const QVariant &contact)
80 const auto &vcard = c->getVcard(); 80 const auto &vcard = c->getVcard();
81 KContacts::VCardConverter converter; 81 KContacts::VCardConverter converter;
82 const auto addressee = converter.parseVCard(vcard); 82 const auto addressee = converter.parseVCard(vcard);
83 setEmails(addressee.emails()); 83 static_cast<MailsController*>(mailsController())->set(addressee.emails());
84
84 QStringList numbers; 85 QStringList numbers;
85 for (const auto &n : addressee.phoneNumbers()) { 86 for (const auto &n : addressee.phoneNumbers()) {
86 numbers << n.number(); 87 numbers << n.number();
87 } 88 }
88 setPhoneNumbers(numbers); 89 static_cast<PhonesController*>(phonesController())->set(numbers);
89 90
90 for(const auto &a :addressee.addresses()) { 91 for(const auto &a :addressee.addresses()) {
91 setStreet(a.street()); 92 setStreet(a.street());
@@ -96,9 +97,6 @@ void ContactController::loadContact(const QVariant &contact)
96 setCompany(addressee.organization()); 97 setCompany(addressee.organization());
97 setJobTitle(addressee.role()); 98 setJobTitle(addressee.role());
98 setImageData(addressee.photo().rawData()); 99 setImageData(addressee.photo().rawData());
99
100 static_cast<MailsController*>(mailsController())->set(addressee.emails());
101 static_cast<PhonesController*>(phonesController())->set(numbers);
102 } 100 }
103} 101}
104 102
@@ -106,17 +104,3 @@ QVariant ContactController::contact() const
106{ 104{
107 return QVariant{}; 105 return QVariant{};
108} 106}
109
110void ContactController::removeEmail(const QString &email)
111{
112 auto emails = getEmails();
113 emails.removeAll(email);
114 setEmails(emails);
115}
116
117void ContactController::addEmail(const QString &email)
118{
119 auto emails = getEmails();
120 emails.append(email);
121 setEmails(emails);
122}
diff --git a/framework/src/domain/contactcontroller.h b/framework/src/domain/contactcontroller.h
index 102f6bef..e8d06229 100644
--- a/framework/src/domain/contactcontroller.h
+++ b/framework/src/domain/contactcontroller.h
@@ -35,8 +35,6 @@ class ContactController : public Kube::Controller
35 35
36 //Interface properties 36 //Interface properties
37 KUBE_CONTROLLER_PROPERTY(QString, Name, name) 37 KUBE_CONTROLLER_PROPERTY(QString, Name, name)
38 KUBE_CONTROLLER_PROPERTY(QStringList, Emails, emails)
39 KUBE_CONTROLLER_PROPERTY(QStringList, PhoneNumbers, phoneNumbers)
40 KUBE_CONTROLLER_PROPERTY(QString, Street, street) 38 KUBE_CONTROLLER_PROPERTY(QString, Street, street)
41 KUBE_CONTROLLER_PROPERTY(QString, City, city) 39 KUBE_CONTROLLER_PROPERTY(QString, City, city)
42 KUBE_CONTROLLER_PROPERTY(QString, Country, country) 40 KUBE_CONTROLLER_PROPERTY(QString, Country, country)
@@ -53,8 +51,6 @@ public:
53 explicit ContactController(); 51 explicit ContactController();
54 52
55 Q_INVOKABLE void loadContact(const QVariant &contact); 53 Q_INVOKABLE void loadContact(const QVariant &contact);
56 Q_INVOKABLE void removeEmail(const QString &email);
57 Q_INVOKABLE void addEmail(const QString &email);
58 54
59 QVariant contact() const; 55 QVariant contact() const;
60 56