summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-03-01 13:24:28 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-03-01 13:24:28 +0100
commit4d422c52e64e1f06f46174b8cfbb70d17543e418 (patch)
treef2da2dace42639c69bc28f7e27dddbf25a12d938
parent06a2d75d5e4c050fee5c52c7e220cf3e945fbdf6 (diff)
downloadkube-4d422c52e64e1f06f46174b8cfbb70d17543e418.tar.gz
kube-4d422c52e64e1f06f46174b8cfbb70d17543e418.zip
Removed the unused maildircontroller
-rw-r--r--accounts/maildir/CMakeLists.txt1
-rw-r--r--accounts/maildir/maildiraccountplugin.cpp2
-rw-r--r--accounts/maildir/maildircontroller.cpp107
-rw-r--r--accounts/maildir/maildircontroller.h64
4 files changed, 0 insertions, 174 deletions
diff --git a/accounts/maildir/CMakeLists.txt b/accounts/maildir/CMakeLists.txt
index c8bf37c9..e50d4179 100644
--- a/accounts/maildir/CMakeLists.txt
+++ b/accounts/maildir/CMakeLists.txt
@@ -31,7 +31,6 @@ include_directories(../../framework/)
31set(SRCS 31set(SRCS
32 maildirsettings.cpp 32 maildirsettings.cpp
33 maildiraccountplugin.cpp 33 maildiraccountplugin.cpp
34 maildircontroller.cpp
35) 34)
36 35
37add_library(maildiraccountplugin SHARED ${SRCS}) 36add_library(maildiraccountplugin SHARED ${SRCS})
diff --git a/accounts/maildir/maildiraccountplugin.cpp b/accounts/maildir/maildiraccountplugin.cpp
index 5ae49d8e..2c3c8c4d 100644
--- a/accounts/maildir/maildiraccountplugin.cpp
+++ b/accounts/maildir/maildiraccountplugin.cpp
@@ -1,7 +1,6 @@
1#include "maildiraccountplugin.h" 1#include "maildiraccountplugin.h"
2 2
3#include "maildirsettings.h" 3#include "maildirsettings.h"
4#include "maildircontroller.h"
5 4
6#include <QtQml> 5#include <QtQml>
7 6
@@ -9,5 +8,4 @@ void MaildirAccountPlugin::registerTypes (const char *uri)
9{ 8{
10 Q_ASSERT(uri == QLatin1String("org.kube.accounts.maildir")); 9 Q_ASSERT(uri == QLatin1String("org.kube.accounts.maildir"));
11 qmlRegisterType<MaildirSettings>(uri, 1, 0, "MaildirSettings"); 10 qmlRegisterType<MaildirSettings>(uri, 1, 0, "MaildirSettings");
12 qmlRegisterType<MaildirController>(uri, 1, 0, "MaildirController");
13} 11}
diff --git a/accounts/maildir/maildircontroller.cpp b/accounts/maildir/maildircontroller.cpp
deleted file mode 100644
index fa211284..00000000
--- a/accounts/maildir/maildircontroller.cpp
+++ /dev/null
@@ -1,107 +0,0 @@
1/*
2 * Copyright (c) 2016 Michael Bohlender <michael.bohlender@kdemail.net>
3 * Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
4 *
5 * This library is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU Library General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 * License for more details.
14 *
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to the
17 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 * 02110-1301, USA.
19 */
20
21#include "maildircontroller.h"
22
23#include <sink/store.h>
24
25using namespace Sink;
26using namespace Sink::ApplicationDomain;
27
28MaildirController::MaildirController(QObject *parent)
29: QObject(parent)
30{
31}
32
33QByteArray MaildirController::accountIdentifier() const
34{
35 return mAccountIdentifier;
36}
37
38void MaildirController::setAccountIdentifier(const QByteArray &id)
39{
40 if (id.isEmpty()) {
41 return;
42 }
43 mAccountIdentifier = id;
44
45 //clear
46 mIcon = QString();
47 mName = QString();
48 mPath = QUrl();
49
50 //load
51}
52
53QUrl MaildirController::path() const
54{
55 return QUrl(mPath);
56}
57
58void MaildirController::setPath(const QUrl &path)
59{
60 auto normalizedPath = path.path();
61 if (mPath != normalizedPath) {
62 mPath = normalizedPath;
63 emit pathChanged();
64 }
65}
66
67void MaildirController::createAccount()
68{
69 auto account = ApplicationDomainType::createEntity<SinkAccount>();
70 account.setProperty("type", "maildir");
71 account.setProperty("name", mName);
72 account.setProperty("icon", mIcon);
73 Store::create(account).exec().waitForFinished();
74
75 auto resource = ApplicationDomainType::createEntity<SinkResource>();
76 resource.setResourceType("sink.maildir");
77 resource.setAccount(account);
78 resource.setProperty("path", mPath);
79 //TODO not yet implemented in resource? // resource.setProperty("readonly", readonly);
80 Store::create(resource).exec().waitForFinished();
81}
82
83//TODO
84void MaildirController::loadAccount(const QByteArray &id)
85{
86 Q_ASSERT(!mAccountIdentifier.isEmpty());
87 Store::fetchOne<SinkAccount>(Query().filter(mAccountIdentifier))
88 .then([this](const SinkAccount &account) {
89 mIcon = account.getIcon();
90 mName = account.getName();
91 emit nameChanged();
92 emit iconChanged();
93 }).exec();
94}
95
96//TODO
97void MaildirController::modifyAccount()
98{
99}
100
101void MaildirController::deleteAccount()
102{
103 if (!mAccountIdentifier.isEmpty()) {
104 SinkAccount account(mAccountIdentifier);
105 Store::remove(account).exec();
106 }
107}
diff --git a/accounts/maildir/maildircontroller.h b/accounts/maildir/maildircontroller.h
deleted file mode 100644
index 80ffb8ca..00000000
--- a/accounts/maildir/maildircontroller.h
+++ /dev/null
@@ -1,64 +0,0 @@
1/*
2 * Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net>
3 * Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19
20#pragma once
21
22#include <QObject>
23#include <QString>
24#include <QByteArray>
25#include <QUrl>
26
27class MaildirController : public QObject
28{
29 Q_OBJECT
30
31 Q_PROPERTY(QByteArray accountIdentifier READ accountIdentifier WRITE setAccountIdentifier NOTIFY accountIdentifierChanged)
32
33 Q_PROPERTY(QString name MEMBER mName NOTIFY nameChanged)
34 Q_PROPERTY(QString icon MEMBER mIcon NOTIFY iconChanged)
35 Q_PROPERTY(QUrl path READ path WRITE setPath NOTIFY pathChanged)
36
37public:
38 explicit MaildirController(QObject *parent = Q_NULLPTR);
39
40 QByteArray accountIdentifier() const;
41 void setAccountIdentifier(const QByteArray &id);
42
43 QUrl path() const;
44 void setPath(const QUrl &path);
45
46signals:
47 void accountIdentifierChanged();
48 void nameChanged();
49 void iconChanged();
50 void pathChanged();
51
52public slots:
53 void createAccount();
54 void loadAccount(const QByteArray &id);
55 void modifyAccount();
56 void deleteAccount();
57
58private:
59 QByteArray mAccountIdentifier;
60 QString mIcon;
61 QString mName;
62 QUrl mPath;
63};
64