summaryrefslogtreecommitdiffstats
path: root/framework/src/domain/contactcontroller.cpp
diff options
context:
space:
mode:
authorMichael Bohlender <michael.bohlender@kdemail.net>2018-03-22 10:06:48 +0100
committerMichael Bohlender <michael.bohlender@kdemail.net>2018-03-22 10:07:56 +0100
commit277ea09b808dd76fcd9d432f7485bdd6d9f15d88 (patch)
tree10c5d610839701f559a93601453ae1c9d532311d /framework/src/domain/contactcontroller.cpp
parent514016a5508f778f40bda030ae16d4e43be2cd67 (diff)
downloadkube-277ea09b808dd76fcd9d432f7485bdd6d9f15d88.tar.gz
kube-277ea09b808dd76fcd9d432f7485bdd6d9f15d88.zip
cleanup contactcontroller
Diffstat (limited to 'framework/src/domain/contactcontroller.cpp')
-rw-r--r--framework/src/domain/contactcontroller.cpp22
1 files changed, 3 insertions, 19 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}