diff options
author | Michael Bohlender <michael.bohlender@kdemail.net> | 2017-02-02 21:23:40 +0100 |
---|---|---|
committer | Michael Bohlender <michael.bohlender@kdemail.net> | 2017-02-02 21:32:50 +0100 |
commit | 84714d6f9435b59045c08c76eb556663d1ee36d4 (patch) | |
tree | 00fd009d64e2e562ad1d34b4993fac8e80c3320a /framework/domain/contactcontroller.cpp | |
parent | a319237e545213223e25ed9deb47e94c8529ae10 (diff) | |
download | kube-84714d6f9435b59045c08c76eb556663d1ee36d4.tar.gz kube-84714d6f9435b59045c08c76eb556663d1ee36d4.zip |
add initial contact controller and contact detail view
Diffstat (limited to 'framework/domain/contactcontroller.cpp')
-rw-r--r-- | framework/domain/contactcontroller.cpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/framework/domain/contactcontroller.cpp b/framework/domain/contactcontroller.cpp new file mode 100644 index 00000000..0be90e77 --- /dev/null +++ b/framework/domain/contactcontroller.cpp | |||
@@ -0,0 +1,59 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2017 Michael Bohlender, <michael.bohlender@kdemail.net> | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify | ||
5 | * it under the terms of the GNU General Public License as published by | ||
6 | * the Free Software Foundation; either version 2 of the License, or | ||
7 | * (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along | ||
15 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
17 | */ | ||
18 | |||
19 | #include "contactcontroller.h" | ||
20 | |||
21 | ContactController::ContactController() | ||
22 | : Kube::Controller(), | ||
23 | action_save{new Kube::ControllerAction{this, &ContactController::save}} | ||
24 | { | ||
25 | loadContact("test"); | ||
26 | updateSaveAction(); | ||
27 | } | ||
28 | |||
29 | void ContactController::save() { | ||
30 | //TODO | ||
31 | } | ||
32 | |||
33 | void ContactController::updateSaveAction() | ||
34 | { | ||
35 | saveAction()->setEnabled(!getName().isEmpty()); | ||
36 | } | ||
37 | |||
38 | void ContactController::loadContact(const QVariant &contact) | ||
39 | { | ||
40 | setName("Anita Rosenzweig"); | ||
41 | m_emails << "rosenzweig@kolabnow.com" << "wolfi@kolabnow.com"; | ||
42 | } | ||
43 | |||
44 | void ContactController::removeEmail(const QString &email) | ||
45 | { | ||
46 | m_emails.removeOne(email); | ||
47 | emit emailsChanged(); | ||
48 | } | ||
49 | |||
50 | void ContactController::addEmail(const QString &email) | ||
51 | { | ||
52 | m_emails << email; | ||
53 | emit emailsChanged(); | ||
54 | } | ||
55 | |||
56 | QStringList ContactController::emails() const | ||
57 | { | ||
58 | return m_emails; | ||
59 | } | ||