From 277ea09b808dd76fcd9d432f7485bdd6d9f15d88 Mon Sep 17 00:00:00 2001 From: Michael Bohlender Date: Thu, 22 Mar 2018 10:06:48 +0100 Subject: cleanup contactcontroller --- framework/src/domain/contactcontroller.cpp | 22 +++------------------- framework/src/domain/contactcontroller.h | 4 ---- 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) const auto &vcard = c->getVcard(); KContacts::VCardConverter converter; const auto addressee = converter.parseVCard(vcard); - setEmails(addressee.emails()); + static_cast(mailsController())->set(addressee.emails()); + QStringList numbers; for (const auto &n : addressee.phoneNumbers()) { numbers << n.number(); } - setPhoneNumbers(numbers); + static_cast(phonesController())->set(numbers); for(const auto &a :addressee.addresses()) { setStreet(a.street()); @@ -96,9 +97,6 @@ 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); } } @@ -106,17 +104,3 @@ QVariant ContactController::contact() const { return QVariant{}; } - -void ContactController::removeEmail(const QString &email) -{ - auto emails = getEmails(); - emails.removeAll(email); - setEmails(emails); -} - -void ContactController::addEmail(const QString &email) -{ - auto emails = getEmails(); - emails.append(email); - setEmails(emails); -} 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 //Interface properties KUBE_CONTROLLER_PROPERTY(QString, Name, name) - KUBE_CONTROLLER_PROPERTY(QStringList, Emails, emails) - KUBE_CONTROLLER_PROPERTY(QStringList, PhoneNumbers, phoneNumbers) KUBE_CONTROLLER_PROPERTY(QString, Street, street) KUBE_CONTROLLER_PROPERTY(QString, City, city) KUBE_CONTROLLER_PROPERTY(QString, Country, country) @@ -53,8 +51,6 @@ public: explicit ContactController(); Q_INVOKABLE void loadContact(const QVariant &contact); - Q_INVOKABLE void removeEmail(const QString &email); - Q_INVOKABLE void addEmail(const QString &email); QVariant contact() const; -- cgit v1.2.3