summaryrefslogtreecommitdiffstats
path: root/accounts/kolabnow
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-07-16 10:40:18 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-07-16 10:40:18 +0200
commit57429a6ec932978dbefd1c520ca98077c1c733a7 (patch)
tree825395d83394faaaaf4996c0e9de00a98298d533 /accounts/kolabnow
parent80859db2fb6746441668efc851c500695aaf4d58 (diff)
downloadkube-57429a6ec932978dbefd1c520ca98077c1c733a7.tar.gz
kube-57429a6ec932978dbefd1c520ca98077c1c733a7.zip
Kolabnow account configuration
Diffstat (limited to 'accounts/kolabnow')
-rw-r--r--accounts/kolabnow/CMakeLists.txt48
-rw-r--r--accounts/kolabnow/kolabnowaccountplugin.cpp29
-rw-r--r--accounts/kolabnow/kolabnowaccountplugin.h31
-rw-r--r--accounts/kolabnow/kolabnowsettings.cpp58
-rw-r--r--accounts/kolabnow/kolabnowsettings.h33
-rw-r--r--accounts/kolabnow/package/contents/ui/KolabnowAccountSettings.qml153
-rw-r--r--accounts/kolabnow/package/metadata.desktop8
-rw-r--r--accounts/kolabnow/qmldir3
8 files changed, 363 insertions, 0 deletions
diff --git a/accounts/kolabnow/CMakeLists.txt b/accounts/kolabnow/CMakeLists.txt
new file mode 100644
index 00000000..c8a2481f
--- /dev/null
+++ b/accounts/kolabnow/CMakeLists.txt
@@ -0,0 +1,48 @@
1project(kube-accounts-kolabnow)
2
3cmake_minimum_required(VERSION 2.8.12)
4
5include(CPack)
6include(FeatureSummary)
7find_package(PkgConfig)
8
9################# set KDE specific information #################
10
11find_package(ECM 0.0.8 REQUIRED NO_MODULE)
12
13# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked
14set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR})
15
16include(KDEInstallDirs)
17include(KDECMakeSettings)
18include(KDECompilerSettings)
19
20find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui)
21
22set (QT_MIN_VERSION "5.4.0")
23find_package(Sink CONFIG REQUIRED)
24find_package(KF5Async CONFIG REQUIRED)
25find_package(KF5 REQUIRED COMPONENTS Package Mime)
26
27include_directories(SYSTEM ${KDE_INSTALL_FULL_INCLUDEDIR}/KF5/)
28#FIXME
29include_directories(../../framework/)
30
31set(SRCS
32 kolabnowsettings.cpp
33 kolabnowaccountplugin.cpp
34)
35
36add_library(kolabnowaccountplugin SHARED ${SRCS})
37qt5_use_modules(kolabnowaccountplugin Core Quick Qml)
38target_link_libraries(kolabnowaccountplugin sink settingsplugin mailplugin)
39
40add_library(kolabnowaccount_static STATIC ${SRCS})
41qt5_use_modules(kolabnowaccount_static Core Quick Qml)
42target_link_libraries(kolabnowaccount_static sink settingsplugin mailplugin)
43# add_subdirectory(tests)
44
45kpackage_install_package(package org.kube.accounts.kolabnow "genericqml")
46
47install(TARGETS kolabnowaccountplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/kolabnow)
48install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/kolabnow)
diff --git a/accounts/kolabnow/kolabnowaccountplugin.cpp b/accounts/kolabnow/kolabnowaccountplugin.cpp
new file mode 100644
index 00000000..9c9aaff6
--- /dev/null
+++ b/accounts/kolabnow/kolabnowaccountplugin.cpp
@@ -0,0 +1,29 @@
1/*
2 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19#include "kolabnowaccountplugin.h"
20
21#include "kolabnowsettings.h"
22
23#include <QtQml>
24
25void KolabnowAccountPlugin::registerTypes (const char *uri)
26{
27 Q_ASSERT(uri == QLatin1String("org.kube.accounts.kolabnow"));
28 qmlRegisterType<KolabnowSettings>(uri, 1, 0, "KolabnowSettings");
29}
diff --git a/accounts/kolabnow/kolabnowaccountplugin.h b/accounts/kolabnow/kolabnowaccountplugin.h
new file mode 100644
index 00000000..3d5e2d88
--- /dev/null
+++ b/accounts/kolabnow/kolabnowaccountplugin.h
@@ -0,0 +1,31 @@
1/*
2 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19#pragma once
20
21#include <QQmlEngine>
22#include <QQmlExtensionPlugin>
23
24class KolabnowAccountPlugin : public QQmlExtensionPlugin
25{
26 Q_OBJECT
27 Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
28
29public:
30 virtual void registerTypes(const char *uri);
31};
diff --git a/accounts/kolabnow/kolabnowsettings.cpp b/accounts/kolabnow/kolabnowsettings.cpp
new file mode 100644
index 00000000..486a4c5f
--- /dev/null
+++ b/accounts/kolabnow/kolabnowsettings.cpp
@@ -0,0 +1,58 @@
1/*
2 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19#include "kolabnowsettings.h"
20
21KolabnowSettings::KolabnowSettings(QObject *parent)
22 : AccountSettings(parent)
23{
24}
25
26void KolabnowSettings::load()
27{
28 loadAccount();
29 loadImapResource();
30 loadMailtransportResource();
31 loadIdentity();
32}
33
34void KolabnowSettings::save()
35{
36 mUsername = mEmailAddress;
37 mImapServer = "imaps://imap.kolabnow.com:993";
38 mImapUsername = mEmailAddress;
39 // mImapPassword = mPassword;
40
41 mSmtpServer = "smtps://smtp.kolabnow.com:587";
42 mSmtpUsername = mEmailAddress;
43 mSmtpPassword = mImapPassword;
44
45 saveAccount();
46 saveImapResource();
47 saveMailtransportResource();
48 saveIdentity();
49}
50
51void KolabnowSettings::remove()
52{
53 removeResource(mMailtransportIdentifier);
54 removeResource(mImapIdentifier);
55 removeIdentity();
56 removeAccount();
57}
58
diff --git a/accounts/kolabnow/kolabnowsettings.h b/accounts/kolabnow/kolabnowsettings.h
new file mode 100644
index 00000000..43dc1133
--- /dev/null
+++ b/accounts/kolabnow/kolabnowsettings.h
@@ -0,0 +1,33 @@
1/*
2 Copyright (c) 2016 Christian Mollekopf <mollekopf@kolabsys.com>
3
4 This library is free software; you can redistribute it and/or modify it
5 under the terms of the GNU Library General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or (at your
7 option) any later version.
8
9 This library is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12 License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to the
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA.
18*/
19#pragma once
20
21#include <domain/settings/accountsettings.h>
22
23class KolabnowSettings : public AccountSettings
24{
25 Q_OBJECT
26
27public:
28 KolabnowSettings(QObject *parent = 0);
29
30 Q_INVOKABLE virtual void load() Q_DECL_OVERRIDE;
31 Q_INVOKABLE virtual void save() Q_DECL_OVERRIDE;
32 Q_INVOKABLE virtual void remove() Q_DECL_OVERRIDE;
33};
diff --git a/accounts/kolabnow/package/contents/ui/KolabnowAccountSettings.qml b/accounts/kolabnow/package/contents/ui/KolabnowAccountSettings.qml
new file mode 100644
index 00000000..274b9207
--- /dev/null
+++ b/accounts/kolabnow/package/contents/ui/KolabnowAccountSettings.qml
@@ -0,0 +1,153 @@
1/*
2 * Copyright (C) 2016 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 3 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
15 * along with this program; if not, see <http://www.gnu.org/licenses/>.
16 */
17
18import QtQuick 2.4
19import QtQuick.Controls 1.4
20import QtQuick.Layouts 1.1
21
22import org.kde.kirigami 1.0 as Kirigami
23
24import org.kube.framework.settings 1.0 as KubeSettings
25import org.kube.accounts.kolabnow 1.0 as KolabnowAccount
26
27
28Item {
29
30 property string accountId
31
32 KolabnowAccount.KolabnowSettings {
33 id: kolabnowSettings
34 accountIdentifier: accountId
35 }
36
37 anchors.fill: parent
38
39 Item {
40 anchors {
41 fill: parent
42 margins: Kirigami.Units.largeSpacing * 2
43 }
44
45 Kirigami.Heading {
46 id: heading
47 text: "Connect your KOLABNOW account"
48
49 color: Kirigami.Theme.highlightColor
50 }
51
52 Label {
53 id: subHeadline
54
55 anchors {
56 left: heading.left
57 top: heading.bottom
58 }
59
60 width: parent.width
61
62 text: "To let Kube access your KOLABNOW account, fill in email address and password and give the account a title that will be displayed inside Kube."
63 //TODO wait for kirgami theme disabled text color
64 opacity: 0.5
65 wrapMode: Text.Wrap
66 }
67
68
69 GridLayout {
70 anchors {
71 top:subHeadline.bottom
72 bottom: parent.bottom
73 left: parent.left
74 right: parent.right
75 topMargin: Kirigami.Units.largeSpacing
76 bottomMargin: Kirigami.Units.largeSpacing * 2
77 }
78
79 columns: 2
80 columnSpacing: Kirigami.Units.largeSpacing
81 rowSpacing: Kirigami.Units.largeSpacing
82
83 Kirigami.Label {
84 text: "Title of Account"
85 Layout.alignment: Qt.AlignRight
86 }
87 TextField {
88 Layout.fillWidth: true
89
90 text: kolabnowSettings.accountName
91 placeholderText: "KOLABNOW"
92 onTextChanged: {
93 kolabnowSettings.accountName = text
94 }
95 }
96
97 Kirigami.Label {
98 text: "Email address"
99 Layout.alignment: Qt.AlignRight
100 }
101 TextField {
102 Layout.fillWidth: true
103
104 text: kolabnowSettings.emailAddress
105 onTextChanged: {
106 kolabnowSettings.emailAddress = text
107 }
108 }
109
110 Kirigami.Label {
111 text: "Password"
112 Layout.alignment: Qt.AlignRight
113 }
114 TextField {
115 Layout.fillWidth: true
116
117 text: kolabnowSettings.imapPassword
118 onTextChanged: {
119 kolabnowSettings.imapPassword = text
120 kolabnowSettings.smtpPassword = text
121 }
122 }
123
124 Label {
125 text: ""
126 }
127 Item {
128 Layout.fillWidth: true
129
130 Button {
131 text: "Delete"
132
133 onClicked: {
134 kolabnowSettings.remove()
135 root.closeDialog()
136 }
137 }
138
139 Button {
140 anchors.right: parent.right
141
142 text: "Save"
143
144 onClicked: {
145 focus: true
146 kolabnowSettings.save()
147 root.closeDialog()
148 }
149 }
150 }
151 }
152 }
153}
diff --git a/accounts/kolabnow/package/metadata.desktop b/accounts/kolabnow/package/metadata.desktop
new file mode 100644
index 00000000..6777e2d1
--- /dev/null
+++ b/accounts/kolabnow/package/metadata.desktop
@@ -0,0 +1,8 @@
1[Desktop Entry]
2Name=Kube Kolabnow Accounts Plugin
3X-KDE-PluginInfo-Name=org.kube.accounts.kolabnow
4Exec=kpackagelauncherqml -a org.kube.accounts.kolabnow
5X-Plasma-MainScript=ui/KolabnowAccountSettings.qml
6X-KDE-ServiceTypes=KPackage/GenericQML
7Icon=folder
8Type=Service
diff --git a/accounts/kolabnow/qmldir b/accounts/kolabnow/qmldir
new file mode 100644
index 00000000..6eb25c24
--- /dev/null
+++ b/accounts/kolabnow/qmldir
@@ -0,0 +1,3 @@
1module org.kube.accounts.kolabnow
2
3plugin kolabnowaccountplugin