diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-07-16 10:40:18 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-07-16 10:40:18 +0200 |
commit | 57429a6ec932978dbefd1c520ca98077c1c733a7 (patch) | |
tree | 825395d83394faaaaf4996c0e9de00a98298d533 /accounts/kolabnow | |
parent | 80859db2fb6746441668efc851c500695aaf4d58 (diff) | |
download | kube-57429a6ec932978dbefd1c520ca98077c1c733a7.tar.gz kube-57429a6ec932978dbefd1c520ca98077c1c733a7.zip |
Kolabnow account configuration
Diffstat (limited to 'accounts/kolabnow')
-rw-r--r-- | accounts/kolabnow/CMakeLists.txt | 48 | ||||
-rw-r--r-- | accounts/kolabnow/kolabnowaccountplugin.cpp | 29 | ||||
-rw-r--r-- | accounts/kolabnow/kolabnowaccountplugin.h | 31 | ||||
-rw-r--r-- | accounts/kolabnow/kolabnowsettings.cpp | 58 | ||||
-rw-r--r-- | accounts/kolabnow/kolabnowsettings.h | 33 | ||||
-rw-r--r-- | accounts/kolabnow/package/contents/ui/KolabnowAccountSettings.qml | 153 | ||||
-rw-r--r-- | accounts/kolabnow/package/metadata.desktop | 8 | ||||
-rw-r--r-- | accounts/kolabnow/qmldir | 3 |
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 @@ | |||
1 | project(kube-accounts-kolabnow) | ||
2 | |||
3 | cmake_minimum_required(VERSION 2.8.12) | ||
4 | |||
5 | include(CPack) | ||
6 | include(FeatureSummary) | ||
7 | find_package(PkgConfig) | ||
8 | |||
9 | ################# set KDE specific information ################# | ||
10 | |||
11 | find_package(ECM 0.0.8 REQUIRED NO_MODULE) | ||
12 | |||
13 | # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked | ||
14 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) | ||
15 | |||
16 | include(KDEInstallDirs) | ||
17 | include(KDECMakeSettings) | ||
18 | include(KDECompilerSettings) | ||
19 | |||
20 | find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui) | ||
21 | |||
22 | set (QT_MIN_VERSION "5.4.0") | ||
23 | find_package(Sink CONFIG REQUIRED) | ||
24 | find_package(KF5Async CONFIG REQUIRED) | ||
25 | find_package(KF5 REQUIRED COMPONENTS Package Mime) | ||
26 | |||
27 | include_directories(SYSTEM ${KDE_INSTALL_FULL_INCLUDEDIR}/KF5/) | ||
28 | #FIXME | ||
29 | include_directories(../../framework/) | ||
30 | |||
31 | set(SRCS | ||
32 | kolabnowsettings.cpp | ||
33 | kolabnowaccountplugin.cpp | ||
34 | ) | ||
35 | |||
36 | add_library(kolabnowaccountplugin SHARED ${SRCS}) | ||
37 | qt5_use_modules(kolabnowaccountplugin Core Quick Qml) | ||
38 | target_link_libraries(kolabnowaccountplugin sink settingsplugin mailplugin) | ||
39 | |||
40 | add_library(kolabnowaccount_static STATIC ${SRCS}) | ||
41 | qt5_use_modules(kolabnowaccount_static Core Quick Qml) | ||
42 | target_link_libraries(kolabnowaccount_static sink settingsplugin mailplugin) | ||
43 | # add_subdirectory(tests) | ||
44 | |||
45 | kpackage_install_package(package org.kube.accounts.kolabnow "genericqml") | ||
46 | |||
47 | install(TARGETS kolabnowaccountplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/kolabnow) | ||
48 | install(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 | |||
25 | void 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 | |||
24 | class KolabnowAccountPlugin : public QQmlExtensionPlugin | ||
25 | { | ||
26 | Q_OBJECT | ||
27 | Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") | ||
28 | |||
29 | public: | ||
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 | |||
21 | KolabnowSettings::KolabnowSettings(QObject *parent) | ||
22 | : AccountSettings(parent) | ||
23 | { | ||
24 | } | ||
25 | |||
26 | void KolabnowSettings::load() | ||
27 | { | ||
28 | loadAccount(); | ||
29 | loadImapResource(); | ||
30 | loadMailtransportResource(); | ||
31 | loadIdentity(); | ||
32 | } | ||
33 | |||
34 | void 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 | |||
51 | void 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 | |||
23 | class KolabnowSettings : public AccountSettings | ||
24 | { | ||
25 | Q_OBJECT | ||
26 | |||
27 | public: | ||
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 | |||
18 | import QtQuick 2.4 | ||
19 | import QtQuick.Controls 1.4 | ||
20 | import QtQuick.Layouts 1.1 | ||
21 | |||
22 | import org.kde.kirigami 1.0 as Kirigami | ||
23 | |||
24 | import org.kube.framework.settings 1.0 as KubeSettings | ||
25 | import org.kube.accounts.kolabnow 1.0 as KolabnowAccount | ||
26 | |||
27 | |||
28 | Item { | ||
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] | ||
2 | Name=Kube Kolabnow Accounts Plugin | ||
3 | X-KDE-PluginInfo-Name=org.kube.accounts.kolabnow | ||
4 | Exec=kpackagelauncherqml -a org.kube.accounts.kolabnow | ||
5 | X-Plasma-MainScript=ui/KolabnowAccountSettings.qml | ||
6 | X-KDE-ServiceTypes=KPackage/GenericQML | ||
7 | Icon=folder | ||
8 | Type=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 @@ | |||
1 | module org.kube.accounts.kolabnow | ||
2 | |||
3 | plugin kolabnowaccountplugin | ||