summaryrefslogtreecommitdiffstats
path: root/framework/domain/contactcontroller.cpp
diff options
context:
space:
mode:
authorMichael Bohlender <michael.bohlender@kdemail.net>2017-02-02 21:23:40 +0100
committerMichael Bohlender <michael.bohlender@kdemail.net>2017-02-02 21:32:50 +0100
commit84714d6f9435b59045c08c76eb556663d1ee36d4 (patch)
tree00fd009d64e2e562ad1d34b4993fac8e80c3320a /framework/domain/contactcontroller.cpp
parenta319237e545213223e25ed9deb47e94c8529ae10 (diff)
downloadkube-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.cpp59
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
21ContactController::ContactController()
22 : Kube::Controller(),
23 action_save{new Kube::ControllerAction{this, &ContactController::save}}
24{
25 loadContact("test");
26 updateSaveAction();
27}
28
29void ContactController::save() {
30 //TODO
31}
32
33void ContactController::updateSaveAction()
34{
35 saveAction()->setEnabled(!getName().isEmpty());
36}
37
38void ContactController::loadContact(const QVariant &contact)
39{
40 setName("Anita Rosenzweig");
41 m_emails << "rosenzweig@kolabnow.com" << "wolfi@kolabnow.com";
42}
43
44void ContactController::removeEmail(const QString &email)
45{
46 m_emails.removeOne(email);
47 emit emailsChanged();
48}
49
50void ContactController::addEmail(const QString &email)
51{
52 m_emails << email;
53 emit emailsChanged();
54}
55
56QStringList ContactController::emails() const
57{
58 return m_emails;
59}