diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-07-13 14:56:07 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2018-07-13 14:56:07 +0200 |
commit | ba774b1654efcd7b27f84c3e0f6fd9d98bc0f0d0 (patch) | |
tree | 1c5ade9b52b25b415efe6fd6f2289467b8eccc12 | |
parent | 1cdd003f623dec1fc2aff80c073c94e82b263a85 (diff) | |
download | kube-ba774b1654efcd7b27f84c3e0f6fd9d98bc0f0d0.tar.gz kube-ba774b1654efcd7b27f84c3e0f6fd9d98bc0f0d0.zip |
Contact removal
-rw-r--r-- | framework/src/domain/contactcontroller.cpp | 14 | ||||
-rw-r--r-- | framework/src/domain/contactcontroller.h | 4 | ||||
-rw-r--r-- | views/people/qml/People.qml | 13 |
3 files changed, 28 insertions, 3 deletions
diff --git a/framework/src/domain/contactcontroller.cpp b/framework/src/domain/contactcontroller.cpp index e27c4a3b..6bcaac62 100644 --- a/framework/src/domain/contactcontroller.cpp +++ b/framework/src/domain/contactcontroller.cpp | |||
@@ -103,9 +103,10 @@ void ContactController::updateSaveAction() | |||
103 | saveAction()->setEnabled(!getFirstName().isEmpty()); | 103 | saveAction()->setEnabled(!getFirstName().isEmpty()); |
104 | } | 104 | } |
105 | 105 | ||
106 | void ContactController::loadContact(const QVariant &contact) | 106 | void ContactController::loadContact(const QVariant &variant) |
107 | { | 107 | { |
108 | if (auto c = contact.value<Sink::ApplicationDomain::Contact::Ptr>()) { | 108 | mContact = variant; |
109 | if (auto c = variant.value<Sink::ApplicationDomain::Contact::Ptr>()) { | ||
109 | const auto &vcard = c->getVcard(); | 110 | const auto &vcard = c->getVcard(); |
110 | KContacts::VCardConverter converter; | 111 | KContacts::VCardConverter converter; |
111 | const auto addressee = converter.parseVCard(vcard); | 112 | const auto addressee = converter.parseVCard(vcard); |
@@ -134,7 +135,14 @@ void ContactController::loadContact(const QVariant &contact) | |||
134 | } | 135 | } |
135 | } | 136 | } |
136 | 137 | ||
138 | void ContactController::remove() | ||
139 | { | ||
140 | if (auto c = mContact.value<Sink::ApplicationDomain::Contact::Ptr>()) { | ||
141 | run(Sink::Store::remove(*c)); | ||
142 | } | ||
143 | } | ||
144 | |||
137 | QVariant ContactController::contact() const | 145 | QVariant ContactController::contact() const |
138 | { | 146 | { |
139 | return QVariant{}; | 147 | return mContact; |
140 | } | 148 | } |
diff --git a/framework/src/domain/contactcontroller.h b/framework/src/domain/contactcontroller.h index 852a003f..61e37de8 100644 --- a/framework/src/domain/contactcontroller.h +++ b/framework/src/domain/contactcontroller.h | |||
@@ -54,9 +54,13 @@ public: | |||
54 | explicit ContactController(); | 54 | explicit ContactController(); |
55 | 55 | ||
56 | Q_INVOKABLE void loadContact(const QVariant &contact); | 56 | Q_INVOKABLE void loadContact(const QVariant &contact); |
57 | Q_INVOKABLE void remove(); | ||
57 | 58 | ||
58 | QVariant contact() const; | 59 | QVariant contact() const; |
59 | 60 | ||
60 | private slots: | 61 | private slots: |
61 | void updateSaveAction(); | 62 | void updateSaveAction(); |
63 | |||
64 | private: | ||
65 | QVariant mContact; | ||
62 | }; | 66 | }; |
diff --git a/views/people/qml/People.qml b/views/people/qml/People.qml index 8b35f5e7..718d3c08 100644 --- a/views/people/qml/People.qml +++ b/views/people/qml/People.qml | |||
@@ -228,7 +228,20 @@ FocusScope { | |||
228 | } | 228 | } |
229 | 229 | ||
230 | Kube.Button { | 230 | Kube.Button { |
231 | anchors { | ||
232 | bottom: parent.bottom | ||
233 | left: parent.left | ||
234 | margins: Kube.Units.largeSpacing | ||
235 | } | ||
236 | text: qsTr("Remove") | ||
231 | 237 | ||
238 | onClicked: { | ||
239 | contactController.remove() | ||
240 | stack.pop() | ||
241 | } | ||
242 | } | ||
243 | |||
244 | Kube.Button { | ||
232 | anchors { | 245 | anchors { |
233 | bottom: parent.bottom | 246 | bottom: parent.bottom |
234 | right: parent.right | 247 | right: parent.right |