From 5ca3a769c0b0c93cfcbf6134937b32eed52e2fc2 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 22 Feb 2017 15:56:21 +0100 Subject: Removed Create/Edit*.qml and controllers, added gmail plugin The current settings plugin could potentially be replaced by a proper controller, but what we have works so that's low priority. --- accounts/CMakeLists.txt | 1 + accounts/gmail/CMakeLists.txt | 43 +++++ accounts/gmail/gmailaccountplugin.cpp | 29 +++ accounts/gmail/gmailaccountplugin.h | 31 +++ accounts/gmail/gmailsettings.cpp | 58 ++++++ accounts/gmail/gmailsettings.h | 33 ++++ .../gmail/package/contents/ui/GmailSettings.qml | 136 ++++++++++++++ accounts/gmail/package/metadata.desktop | 8 + accounts/gmail/qmldir | 3 + .../package/contents/ui/ImapAccountSettings.qml | 137 ++++---------- .../package/contents/ui/MaildirAccountSettings.qml | 124 +++--------- components/accounts/contents/ui/AccountWizard.qml | 2 +- components/accounts/contents/ui/CreateImap.qml | 165 ---------------- components/accounts/contents/ui/CreateKolabNow.qml | 208 --------------------- components/accounts/contents/ui/CreateMaildir.qml | 201 -------------------- components/accounts/contents/ui/EditImap.qml | 1 - components/accounts/contents/ui/EditKolabNow.qml | 1 - components/accounts/contents/ui/EditMaildir.qml | 1 - framework/accounts/CMakeLists.txt | 3 - framework/accounts/accountsplugin.cpp | 6 - framework/accounts/kolabnowcontroller.cpp | 88 --------- framework/accounts/kolabnowcontroller.h | 54 ------ framework/accounts/maildircontroller.cpp | 78 -------- framework/accounts/maildircontroller.h | 51 ----- 24 files changed, 406 insertions(+), 1056 deletions(-) create mode 100644 accounts/gmail/CMakeLists.txt create mode 100644 accounts/gmail/gmailaccountplugin.cpp create mode 100644 accounts/gmail/gmailaccountplugin.h create mode 100644 accounts/gmail/gmailsettings.cpp create mode 100644 accounts/gmail/gmailsettings.h create mode 100644 accounts/gmail/package/contents/ui/GmailSettings.qml create mode 100644 accounts/gmail/package/metadata.desktop create mode 100644 accounts/gmail/qmldir delete mode 100644 components/accounts/contents/ui/CreateImap.qml delete mode 100644 components/accounts/contents/ui/CreateKolabNow.qml delete mode 100644 components/accounts/contents/ui/CreateMaildir.qml delete mode 100644 components/accounts/contents/ui/EditImap.qml delete mode 100644 components/accounts/contents/ui/EditKolabNow.qml delete mode 100644 components/accounts/contents/ui/EditMaildir.qml delete mode 100644 framework/accounts/kolabnowcontroller.cpp delete mode 100644 framework/accounts/kolabnowcontroller.h delete mode 100644 framework/accounts/maildircontroller.cpp delete mode 100644 framework/accounts/maildircontroller.h diff --git a/accounts/CMakeLists.txt b/accounts/CMakeLists.txt index e941e07d..613f9792 100644 --- a/accounts/CMakeLists.txt +++ b/accounts/CMakeLists.txt @@ -1,3 +1,4 @@ add_subdirectory(maildir) add_subdirectory(imap) add_subdirectory(kolabnow) +add_subdirectory(gmail) diff --git a/accounts/gmail/CMakeLists.txt b/accounts/gmail/CMakeLists.txt new file mode 100644 index 00000000..f75cf388 --- /dev/null +++ b/accounts/gmail/CMakeLists.txt @@ -0,0 +1,43 @@ +project(kube-accounts-gmail) + +cmake_minimum_required(VERSION 2.8.12) + +include(CPack) +include(FeatureSummary) +find_package(PkgConfig) + +################# set KDE specific information ################# + +find_package(ECM 0.0.8 REQUIRED NO_MODULE) + +# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) + +include(KDEInstallDirs) +include(KDECMakeSettings) +include(KDECompilerSettings) + +find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui) + +set (QT_MIN_VERSION "5.4.0") +find_package(Sink CONFIG REQUIRED) +find_package(KF5Async CONFIG REQUIRED) +find_package(KF5 REQUIRED COMPONENTS Package Mime) + +include_directories(SYSTEM ${KDE_INSTALL_FULL_INCLUDEDIR}/KF5/) +#FIXME +include_directories(../../framework/) + +set(SRCS + gmailsettings.cpp + gmailaccountplugin.cpp +) + +add_library(gmailaccountplugin SHARED ${SRCS}) +qt5_use_modules(gmailaccountplugin Core Quick Qml) +target_link_libraries(gmailaccountplugin sink settingsplugin mailplugin) + +kpackage_install_package(package org.kube.accounts.gmail "genericqml") + +install(TARGETS gmailaccountplugin DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/gmail) +install(FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kube/accounts/gmail) diff --git a/accounts/gmail/gmailaccountplugin.cpp b/accounts/gmail/gmailaccountplugin.cpp new file mode 100644 index 00000000..53218939 --- /dev/null +++ b/accounts/gmail/gmailaccountplugin.cpp @@ -0,0 +1,29 @@ +/* + Copyright (c) 2016 Christian Mollekopf + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + This library is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ +#include "gmailaccountplugin.h" + +#include "gmailsettings.h" + +#include + +void GmailAccountPlugin::registerTypes (const char *uri) +{ + Q_ASSERT(uri == QLatin1String("org.kube.accounts.gmail")); + qmlRegisterType(uri, 1, 0, "GmailSettings"); +} diff --git a/accounts/gmail/gmailaccountplugin.h b/accounts/gmail/gmailaccountplugin.h new file mode 100644 index 00000000..5876e393 --- /dev/null +++ b/accounts/gmail/gmailaccountplugin.h @@ -0,0 +1,31 @@ +/* + Copyright (c) 2016 Christian Mollekopf + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + This library is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ +#pragma once + +#include +#include + +class GmailAccountPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + +public: + virtual void registerTypes(const char *uri); +}; diff --git a/accounts/gmail/gmailsettings.cpp b/accounts/gmail/gmailsettings.cpp new file mode 100644 index 00000000..428b164a --- /dev/null +++ b/accounts/gmail/gmailsettings.cpp @@ -0,0 +1,58 @@ +/* + Copyright (c) 2016 Christian Mollekopf + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + This library is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ +#include "gmailsettings.h" + +GmailSettings::GmailSettings(QObject *parent) + : AccountSettings(parent) +{ +} + +void GmailSettings::load() +{ + loadAccount(); + loadImapResource(); + loadMailtransportResource(); + loadIdentity(); +} + +void GmailSettings::save() +{ + mUsername = mEmailAddress; + mImapServer = "imaps://imap.gmail.com:993"; + mImapUsername = mEmailAddress; + // mImapPassword = mPassword; + + mSmtpServer = "smtps://smtp.gmail.com:465"; + mSmtpUsername = mEmailAddress; + mSmtpPassword = mImapPassword; + + saveAccount(); + saveImapResource(); + saveMailtransportResource(); + saveIdentity(); +} + +void GmailSettings::remove() +{ + removeResource(mMailtransportIdentifier); + removeResource(mImapIdentifier); + removeIdentity(); + removeAccount(); +} + diff --git a/accounts/gmail/gmailsettings.h b/accounts/gmail/gmailsettings.h new file mode 100644 index 00000000..708cb94b --- /dev/null +++ b/accounts/gmail/gmailsettings.h @@ -0,0 +1,33 @@ +/* + Copyright (c) 2016 Christian Mollekopf + + This library is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published by + the Free Software Foundation; either version 2 of the License, or (at your + option) any later version. + + This library is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public + License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ +#pragma once + +#include + +class GmailSettings : public AccountSettings +{ + Q_OBJECT + +public: + GmailSettings(QObject *parent = 0); + + Q_INVOKABLE virtual void load() Q_DECL_OVERRIDE; + Q_INVOKABLE virtual void save() Q_DECL_OVERRIDE; + Q_INVOKABLE virtual void remove() Q_DECL_OVERRIDE; +}; diff --git a/accounts/gmail/package/contents/ui/GmailSettings.qml b/accounts/gmail/package/contents/ui/GmailSettings.qml new file mode 100644 index 00000000..33dafe8d --- /dev/null +++ b/accounts/gmail/package/contents/ui/GmailSettings.qml @@ -0,0 +1,136 @@ +/* + Copyright (C) 2016 Michael Bohlender, + Copyright (C) 2017 Christian Mollekopf, + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +import QtQuick 2.4 +import QtQuick.Controls 1.4 as Controls +import QtQuick.Layouts 1.1 + +import org.kde.kirigami 1.0 as Kirigami + +import org.kube.framework.settings 1.0 as KubeSettings +import org.kube.accounts.gmail 1.0 as GmailAccount + +Item { + + property string accountId + property string heading: "Connect your GMail account" + property string subheadline: "To let Kube access your account, fill in email address, username, password and give the account a title that will be displayed inside Kube." + + GmailAccount.GmailSettings { + id: gmailSettings + accountIdentifier: accountId + accountType: "gmail" + } + + function save(){ + gmailSettings.save() + } + + function remove(){ + gmailSettings.remove() + } + + Item { + anchors { + fill: parent + } + + GridLayout { + anchors { + fill: parent + } + columns: 2 + columnSpacing: Kirigami.Units.largeSpacing + rowSpacing: Kirigami.Units.largeSpacing + + Controls.Label { + text: "Title of Account" + Layout.alignment: Qt.AlignRight + } + Controls.TextField { + Layout.fillWidth: true + placeholderText: "E.g. \"Work\", \"Home\" that will be displayed in Kube as name" + text: gmailSettings.accountName + onTextChanged: { + gmailSettings.accountName = text + } + } + + Controls.Label { + text: "Name" + Layout.alignment: Qt.AlignRight + } + Controls.TextField { + Layout.fillWidth: true + placeholderText: "Your name" + text: gmailSettings.userName + onTextChanged: { + gmailSettings.userName = text + } + } + + Controls.Label { + text: "Email address" + Layout.alignment: Qt.AlignRight + } + Controls.TextField { + Layout.fillWidth: true + + text: gmailSettings.emailAddress + onTextChanged: { + gmailSettings.emailAddress = text + } + placeholderText: "Your email address" + } + + Controls.Label { + text: "Password" + Layout.alignment: Qt.AlignRight + } + RowLayout { + Layout.fillWidth: true + + Controls.TextField { + id: pwField + Layout.fillWidth: true + + placeholderText: "Password of your email account" + text: gmailSettings.imapPassword + onTextChanged: { + gmailSettings.imapPassword = text + gmailSettings.smtpPassword = text + } + + echoMode: TextInput.Password + } + + Controls.CheckBox { + text: "Show Password" + onClicked: { + if(pwField.echoMode == TextInput.Password) { + pwField.echoMode = TextInput.Normal; + } else { + pwField.echoMode = TextInput.Password; + } + } + } + } + } + } +} diff --git a/accounts/gmail/package/metadata.desktop b/accounts/gmail/package/metadata.desktop new file mode 100644 index 00000000..e2b71ec9 --- /dev/null +++ b/accounts/gmail/package/metadata.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=Kube GMail Accounts Plugin +X-KDE-PluginInfo-Name=org.kube.accounts.gmail +Exec=kpackagelauncherqml -a org.kube.accounts.gmail +X-Plasma-MainScript=ui/GmailSettings.qml +X-KDE-ServiceTypes=KPackage/GenericQML +Icon=folder +Type=Service diff --git a/accounts/gmail/qmldir b/accounts/gmail/qmldir new file mode 100644 index 00000000..78a9e5b7 --- /dev/null +++ b/accounts/gmail/qmldir @@ -0,0 +1,3 @@ +module org.kube.accounts.gmail + +plugin gmailaccountplugin diff --git a/accounts/imap/package/contents/ui/ImapAccountSettings.qml b/accounts/imap/package/contents/ui/ImapAccountSettings.qml index a9ac9317..e7834368 100644 --- a/accounts/imap/package/contents/ui/ImapAccountSettings.qml +++ b/accounts/imap/package/contents/ui/ImapAccountSettings.qml @@ -1,5 +1,6 @@ /* Copyright (C) 2016 Michael Bohlender, + Copyright (C) 2017 Christian Mollekopf, This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,7 +18,7 @@ */ import QtQuick 2.4 -import QtQuick.Controls 1.4 +import QtQuick.Controls 1.4 as Controls import QtQuick.Layouts 1.1 import org.kde.kirigami 1.0 as Kirigami @@ -25,132 +26,101 @@ import org.kde.kirigami 1.0 as Kirigami import org.kube.framework.settings 1.0 as KubeSettings import org.kube.accounts.imap 1.0 as ImapAccount - Item { property string accountId + property string heading: "Connect your IMAP account" + property string subheadline: "To let Kube access your account, fill in email address, username, password and give the account a title that will be displayed inside Kube. For information about which SMTP, IMAP address, which authentification and port to be used, please contact your email provider." ImapAccount.ImapSettings { id: imapSettings accountIdentifier: accountId + accountType: "imap" + } + + function save(){ + imapSettings.save() } - anchors.fill: parent + function remove(){ + imapSettings.remove() + } Item { anchors { fill: parent - margins: Kirigami.Units.largeSpacing * 2 - } - - Kirigami.Heading { - id: heading - text: "Connect your IMAP account" - - color: Kirigami.Theme.highlightColor } - Label { - id: subHeadline - - anchors { - left: heading.left - top: heading.bottom - } - - width: parent.width - - text: "To let Kube access your account, fill in email address, username, password and give the account a title that will be displayed inside Kube. For information about which SMTP, IMAP address, which authentification and port to be used, please contact your email provider" - - color: Kirigami.Theme.disabledTextColor - - wrapMode: Text.Wrap - } - - GridLayout { anchors { - top:subHeadline.bottom - bottom: parent.bottom - left: parent.left - right: parent.right - topMargin: Kirigami.Units.largeSpacing - bottomMargin: Kirigami.Units.largeSpacing * 2 + fill: parent } - columns: 2 columnSpacing: Kirigami.Units.largeSpacing rowSpacing: Kirigami.Units.largeSpacing - Kirigami.Label { - text: "Title of Acocunt" + Controls.Label { + text: "Title of Account" Layout.alignment: Qt.AlignRight } - TextField { + Controls.TextField { Layout.fillWidth: true - placeholderText: "E.g. \"Work\", \"Home\" that will be displayed in Kube as name" - text: imapSettings.accountName onTextChanged: { imapSettings.accountName = text } } - Kirigami.Label { - text: "Email address" + Controls.Label { + text: "Name" Layout.alignment: Qt.AlignRight } - - TextField { + Controls.TextField { Layout.fillWidth: true - - placeholderText: "Your email address" - - text: imapSettings.emailAddress + placeholderText: "Your name" + text: imapSettings.userName onTextChanged: { - imapSettings.emailAddress = text + imapSettings.userName = text } } - Kirigami.Label { - text: "Username" + Controls.Label { + text: "Email address" Layout.alignment: Qt.AlignRight } - TextField { + Controls.TextField { Layout.fillWidth: true - placeholderText: "The name used to log into your email account" - - text: imapSettings.imapUsername + text: imapSettings.emailAddress onTextChanged: { - imapSettings.imapUsername = text - imapSettings.smtpUsername = text + imapSettings.emailAddress = text } + placeholderText: "Your email address" } - Kirigami.Label { + Controls.Label { text: "Password" Layout.alignment: Qt.AlignRight } - RowLayout { Layout.fillWidth: true - TextField { + Controls.TextField { id: pwField Layout.fillWidth: true - text: imapSettings.imapPassword placeholderText: "Password of your email account" - echoMode: TextInput.Password + text: imapSettings.imapPassword onTextChanged: { imapSettings.imapPassword = text imapSettings.smtpPassword = text } + + echoMode: TextInput.Password } - CheckBox { + Controls.CheckBox { text: "Show Password" onClicked: { if(pwField.echoMode == TextInput.Password) { @@ -160,14 +130,13 @@ Item { } } } - } - Kirigami.Label { - text: "IMAP address" + Controls.Label { + text: "IMAP server address" Layout.alignment: Qt.AlignRight } - TextField { + Controls.TextField { id: imapServer Layout.fillWidth: true @@ -187,11 +156,11 @@ Item { } } - Kirigami.Label { + Controls.Label { text: "Smtp address" Layout.alignment: Qt.AlignRight } - TextField { + Controls.TextField { id: smtpServer Layout.fillWidth: true @@ -209,34 +178,6 @@ Item { visible: smtpServer.acceptableInput } } - - Label { - text: "" - } - Item { - Layout.fillWidth: true - - Button { - text: "Delete" - - onClicked: { - imapSettings.remove() - root.closeDialog() - } - } - - Button { - anchors.right: parent.right - - text: "Save" - - onClicked: { - focus: true - imapSettings.save() - root.closeDialog() - } - } - } } } } diff --git a/accounts/maildir/package/contents/ui/MaildirAccountSettings.qml b/accounts/maildir/package/contents/ui/MaildirAccountSettings.qml index a5d35d5c..b768979a 100644 --- a/accounts/maildir/package/contents/ui/MaildirAccountSettings.qml +++ b/accounts/maildir/package/contents/ui/MaildirAccountSettings.qml @@ -1,5 +1,6 @@ /* Copyright (C) 2016 Michael Bohlender, + Copyright (C) 2017 Christian Mollekopf, This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,108 +18,76 @@ */ import QtQuick 2.4 -import QtQuick.Controls 1.4 +import QtQuick.Controls 1.4 as Controls +import QtQuick.Controls 2.0 as Controls2 import QtQuick.Layouts 1.1 -import QtQuick.Dialogs 1.0 +import QtQuick.Dialogs 1.0 as Dialogs import org.kde.kirigami 1.0 as Kirigami import org.kube.framework.settings 1.0 as KubeSettings import org.kube.accounts.maildir 1.0 as MaildirAccount - Item { property string accountId + property string heading: "Add your Maildir archive" + property string subheadline: "To let Kube access your maildir archive, add the path to your archive and give the account a title that will be displayed inside Kube." MaildirAccount.MaildirSettings { id: maildirSettings accountIdentifier: accountId + accountType: "maildir" + } + + function save(){ + maildirSettings.save() } - anchors.fill: parent + function remove(){ + maildirSettings.remove() + } Item { anchors { fill: parent - margins: Kirigami.Units.largeSpacing * 2 - } - - Kirigami.Heading { - id: heading - text: "Add your Maildir archive" - - color: Kirigami.Theme.highlightColor - } - - Label { - id: subHeadline - - anchors { - left: heading.left - top: heading.bottom - } - - width: parent.width - - text: "To let Kube access your maildir archive, add the path to your archive and give the account a title that will be displayed inside Kube" - //TODO wait for kirgami theme disabled text color - opacity: 0.5 - wrapMode: Text.Wrap } GridLayout { anchors { - top:subHeadline.bottom - bottom: parent.bottom - left: parent.left - right: parent.right - topMargin: Kirigami.Units.largeSpacing * 2 - bottomMargin: Kirigami.Units.largeSpacing * 2 + fill: parent } - columns: 2 columnSpacing: Kirigami.Units.largeSpacing rowSpacing: Kirigami.Units.largeSpacing - Kirigami.Label { - text: "Title of account" + Controls.Label { + text: "Title of Account" Layout.alignment: Qt.AlignRight } - TextField { + Controls.TextField { Layout.fillWidth: true - + placeholderText: "E.g. \"Work\", \"Home\" that will be displayed in Kube as name" text: maildirSettings.accountName onTextChanged: { maildirSettings.accountName = text } } - Kirigami.Label { + Controls2.Label { text: "Path" Layout.alignment: Qt.AlignRight } RowLayout { Layout.fillWidth: true - TextField { + Controls.TextField { id: path Layout.fillWidth: true - + enabled: false text: maildirSettings.path - onTextChanged: { - maildirSettings.path = text - } - validator: maildirSettings.pathValidator - - Rectangle { - anchors.fill: parent - opacity: 0.2 - color: "yellow" - visible: path.acceptableInput == false - } } - Button { + Controls.Button { iconName: "folder" onClicked: { @@ -127,7 +96,7 @@ Item { Component { id: fileDialogComponent - FileDialog { + Dialogs.FileDialog { id: fileDialog visible: true @@ -142,51 +111,6 @@ Item { } } } - - Label { - text: "" - } - CheckBox { - text: "Read only" - } - - Label { - text: "" - Layout.fillHeight: true - } - Label { - text: "" - } - - Label { - text: "" - } - Item { - Layout.fillWidth: true - - Button { - text: "Delete" - - onClicked: { - maildirSettings.remove() - root.closeDialog() - } - } - - Button { - id: saveButton - - anchors.right: parent.right - - text: "Save" - - onClicked: { - focus: true - maildirSettings.save() - root.closeDialog() - } - } - } } } } diff --git a/components/accounts/contents/ui/AccountWizard.qml b/components/accounts/contents/ui/AccountWizard.qml index ffc3f5da..ddf7a6ef 100644 --- a/components/accounts/contents/ui/AccountWizard.qml +++ b/components/accounts/contents/ui/AccountWizard.qml @@ -53,7 +53,7 @@ Controls2.Popup { Repeater { //TODO replace by model of available accounts - model: ["kolabnow", "imap", "maildir"] + model: ["kolabnow", "imap", "maildir", "gmail"] delegate: Controls2.Button { Layout.fillWidth: true text: modelData +" account" diff --git a/components/accounts/contents/ui/CreateImap.qml b/components/accounts/contents/ui/CreateImap.qml deleted file mode 100644 index 7f355409..00000000 --- a/components/accounts/contents/ui/CreateImap.qml +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (C) 2016 Michael Bohlender, - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 2.7 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 as Controls -import QtQuick.Controls 2.0 as Controls2 -import org.kde.kirigami 1.0 as Kirigami - -Item { - - Controls.ToolButton { - iconName: "go-previous" - - tooltip: "go back" - - onClicked: { - stack.pop() - } - } - - //Item to avoid anchors conflict with stack - Item { - - anchors { - fill: parent - margins: Kirigami.Units.largeSpacing * 2 - } - - Kirigami.Heading { - id: heading - text: "Connect your IMAP account" - - color: Kirigami.Theme.highlightColor - } - - Kirigami.Label { - id: subHeadline - - anchors { - left: heading.left - top: heading.bottom - } - - width: parent.width - - text: "To let Kube access your account, fill in email address, username, password and give the account a title that will be displayed inside Kube." - - color: Kirigami.Theme.disabledTextColor - - wrapMode: Text.Wrap - } - - GridLayout { - anchors { - top:subHeadline.bottom - bottom: parent.bottom - left: parent.left - right: parent.right - topMargin: Kirigami.Units.largeSpacing * 2 - } - - columns: 2 - columnSpacing: Kirigami.Units.largeSpacing - rowSpacing: Kirigami.Units.largeSpacing - - Controls.Label { - text: "Title of Account" - Layout.alignment: Qt.AlignRight - } - Controls.TextField { - Layout.fillWidth: true - - placeholderText: "E.g. \"Work\", \"Home\" that will be displayed in Kube as name" - } - - Controls.Label { - text: "Email address" - Layout.alignment: Qt.AlignRight - } - - Controls.TextField { - Layout.fillWidth: true - - placeholderText: "Your email address" - } - - Kirigami.Label { - text: "Password" - Layout.alignment: Qt.AlignRight - } - - RowLayout { - Layout.fillWidth: true - - Controls.TextField { - id: pwField - Layout.fillWidth: true - - placeholderText: "Password of your email account" - echoMode: TextInput.Password - } - - Controls.CheckBox { - text: "Show Password" - onClicked: { - if(pwField.echoMode == TextInput.Password) { - pwField.echoMode = TextInput.Normal; - } else { - pwField.echoMode = TextInput.Password; - } - } - } - } - - Item { - Layout.fillHeight: true - } - - Kirigami.Label { - text: "" - } - - Kirigami.Label { - text: "" - } - - Item { - Layout.fillWidth: true - - Controls.Button { - text: "Discard" - - onClicked: { - popup.close() - } - } - - Controls.Button { - anchors.right: parent.right - - text: "Next" - - onClicked: { - } - } - } - } - } -} diff --git a/components/accounts/contents/ui/CreateKolabNow.qml b/components/accounts/contents/ui/CreateKolabNow.qml deleted file mode 100644 index e6022cbb..00000000 --- a/components/accounts/contents/ui/CreateKolabNow.qml +++ /dev/null @@ -1,208 +0,0 @@ -/* - * Copyright (C) 2016 Michael Bohlender, - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 2.7 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 as Controls -import QtQuick.Controls 2.0 as Controls2 -import org.kde.kirigami 1.0 as Kirigami - -import org.kube.framework.accounts 1.0 as KubeAccounts - -Item { - - KubeAccounts.KolabNowController { - id: account - } - - Controls.ToolButton { - iconName: "go-previous" - - tooltip: "go back" - - onClicked: { - stack.pop() - } - } - - //Item to avoid anchors conflict with stack - Item { - - anchors { - fill: parent - margins: Kirigami.Units.largeSpacing * 2 - } - - Kirigami.Heading { - id: heading - text: "Connect your Kolab Now account" - - color: Kirigami.Theme.highlightColor - } - - Kirigami.Label { - id: subHeadline - - anchors { - left: heading.left - top: heading.bottom - } - - width: parent.width - - text: "To let Kube access your account, fill in email address, username, password and give the account a title that will be displayed inside Kube." - - color: Kirigami.Theme.disabledTextColor - - wrapMode: Text.Wrap - } - - GridLayout { - anchors { - top:subHeadline.bottom - bottom: parent.bottom - left: parent.left - right: parent.right - topMargin: Kirigami.Units.largeSpacing * 2 - } - - columns: 2 - columnSpacing: Kirigami.Units.largeSpacing - rowSpacing: Kirigami.Units.largeSpacing - - Controls.Label { - text: "Title of Account" - Layout.alignment: Qt.AlignRight - } - Controls.TextField { - Layout.fillWidth: true - - placeholderText: "E.g. \"Work\", \"Home\" that will be displayed in Kube as name" - - text: account.name - - onTextChanged: { - account.name = text - } - } - - Controls.Label { - text: "Name" - Layout.alignment: Qt.AlignRight - } - Controls.TextField { - Layout.fillWidth: true - - placeholderText: "Your name" - - text: account.identityName - - onTextChanged: { - account.identityName = text - } - } - - Controls.Label { - text: "Email address" - Layout.alignment: Qt.AlignRight - } - - Controls.TextField { - Layout.fillWidth: true - - text: account.emailAddress - - onTextChanged: { - account.emailAddress = text - } - - placeholderText: "Your email address" - } - - Kirigami.Label { - text: "Password" - Layout.alignment: Qt.AlignRight - } - - RowLayout { - Layout.fillWidth: true - - Controls.TextField { - id: pwField - Layout.fillWidth: true - - placeholderText: "Password of your email account" - - text: account.password - - onTextChanged: { - account.password = text - } - - echoMode: TextInput.Password - } - - Controls.CheckBox { - text: "Show Password" - onClicked: { - if(pwField.echoMode == TextInput.Password) { - pwField.echoMode = TextInput.Normal; - } else { - pwField.echoMode = TextInput.Password; - } - } - } - } - - Item { - Layout.fillHeight: true - } - - Kirigami.Label { - text: "" - } - - Kirigami.Label { - text: "" - } - - Item { - Layout.fillWidth: true - - Controls.Button { - text: "Discard" - - onClicked: { - popup.close() - } - } - - Controls.Button { - anchors.right: parent.right - - text: "Save" - - onClicked: { - account.createAction.execute() - popup.close() - } - } - } - } - } -} diff --git a/components/accounts/contents/ui/CreateMaildir.qml b/components/accounts/contents/ui/CreateMaildir.qml deleted file mode 100644 index 99bde452..00000000 --- a/components/accounts/contents/ui/CreateMaildir.qml +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright (C) 2016 Michael Bohlender, - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -import QtQuick 2.7 -import QtQuick.Layouts 1.1 -import QtQuick.Controls 1.4 as Controls -import QtQuick.Controls 2.0 as Controls2 -import org.kde.kirigami 1.0 as Kirigami -import QtQuick.Dialogs 1.0 as Dialogs - -import org.kube.framework.accounts 1.0 as KubeAccounts - -Item { - id: root - - //Controller - KubeAccounts.MaildirController { - id: account - } - - //Navigation - Controls.ToolButton { - iconName: "go-previous" - - tooltip: "go back" - - onClicked: { - stack.pop() - } - } - - //Item to avoid anchors conflict with stack - Item { - - anchors { - fill: parent - margins: Kirigami.Units.largeSpacing * 2 - } - - - //BEGIN heading - Kirigami.Heading { - id: heading - text: "Add your Maildir archive" - - color: Kirigami.Theme.highlightColor - } - - Controls2.Label { - id: subHeadline - - anchors { - left: heading.left - top: heading.bottom - } - - width: parent.width - - text: "To let Kube access your maildir archive, add the path to your archive and give the account a title that will be displayed inside Kube" - - color: Kirigami.Theme.disabledTextColor - wrapMode: Text.Wrap - } - //END heading - - GridLayout { - anchors { - top:subHeadline.bottom - bottom: parent.bottom - left: parent.left - right: parent.right - topMargin: Kirigami.Units.largeSpacing * 2 - } - - columns: 2 - columnSpacing: Kirigami.Units.largeSpacing - rowSpacing: Kirigami.Units.largeSpacing - - Controls2.Label { - text: "Title of account" - Layout.alignment: Qt.AlignRight - } - Controls.TextField { - id: title - Layout.fillWidth: true - - text: account.name - - onTextChanged: { - account.name = text - } - } - - Controls2.Label { - text: "Path" - Layout.alignment: Qt.AlignRight - } - RowLayout { - Layout.fillWidth: true - - Controls.TextField { - id: path - Layout.fillWidth: true - - enabled: false - - text: account.path - } - - Controls.Button { - iconName: "folder" - - onClicked: { - fileDialogComponent.createObject(parent) - } - - Component { - id: fileDialogComponent - Dialogs.FileDialog { - id: fileDialog - - visible: true - title: "Choose the maildir folder" - - selectFolder: true - - onAccepted: { - account.path = fileDialog.fileUrl - } - } - } - } - } - - /* - Controls2.Label { - text: "" - } - Controls.CheckBox { - id: readOnly - text: "Read only" - } - */ - - Controls2.Label { - text: "" - Layout.fillHeight: true - } - Controls2.Label { - text: "" - } - - Controls2.Label { - text: "" - } - Item { - Layout.fillWidth: true - - Controls2.Button { - text: "Discard" - - onClicked: { - //account.clear() - popup.close() - } - } - - Controls2.Button { - id: saveButton - - anchors.right: parent.right - - text: "Save" - - enabled: account.createAction.enabled - - onClicked: { - account.createAction.execute() - popup.close() - } - } - } - } - } -} - diff --git a/components/accounts/contents/ui/EditImap.qml b/components/accounts/contents/ui/EditImap.qml deleted file mode 100644 index 8b137891..00000000 --- a/components/accounts/contents/ui/EditImap.qml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/components/accounts/contents/ui/EditKolabNow.qml b/components/accounts/contents/ui/EditKolabNow.qml deleted file mode 100644 index 8b137891..00000000 --- a/components/accounts/contents/ui/EditKolabNow.qml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/components/accounts/contents/ui/EditMaildir.qml b/components/accounts/contents/ui/EditMaildir.qml deleted file mode 100644 index 8b137891..00000000 --- a/components/accounts/contents/ui/EditMaildir.qml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/framework/accounts/CMakeLists.txt b/framework/accounts/CMakeLists.txt index 06fcbf08..bccafd77 100644 --- a/framework/accounts/CMakeLists.txt +++ b/framework/accounts/CMakeLists.txt @@ -2,9 +2,6 @@ set(accountsplugin_SRCS accountsplugin.cpp accountfactory.cpp accountsmodel.cpp - maildircontroller.cpp - kolabnowcontroller.cpp - gmailcontroller.cpp ) add_library(accountsplugin SHARED ${accountsplugin_SRCS}) diff --git a/framework/accounts/accountsplugin.cpp b/framework/accounts/accountsplugin.cpp index 83ae6f0b..e980d5f3 100644 --- a/framework/accounts/accountsplugin.cpp +++ b/framework/accounts/accountsplugin.cpp @@ -20,9 +20,6 @@ #include "accountsmodel.h" #include "accountfactory.h" -#include "maildircontroller.h" -#include "kolabnowcontroller.h" -#include "gmailcontroller.h" #include @@ -31,7 +28,4 @@ void AccountsPlugin::registerTypes (const char *uri) Q_ASSERT(uri == QLatin1String("org.kube.framework.accounts")); qmlRegisterType(uri, 1, 0, "AccountFactory"); qmlRegisterType(uri, 1, 0, "AccountsModel"); - qmlRegisterType(uri, 1, 0, "MaildirController"); - qmlRegisterType(uri, 1, 0, "KolabNowController"); - qmlRegisterType(uri, 1, 0, "GmailController"); } diff --git a/framework/accounts/kolabnowcontroller.cpp b/framework/accounts/kolabnowcontroller.cpp deleted file mode 100644 index d584b598..00000000 --- a/framework/accounts/kolabnowcontroller.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (C) 2017 Michael Bohlender, - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "kolabnowcontroller.h" - -#include - -using namespace Sink; -using namespace Sink::ApplicationDomain; - -KolabNowController::KolabNowController() : Kube::Controller(), -action_create{new Kube::ControllerAction{this, &KolabNowController::create}}, -action_modify{new Kube::ControllerAction{this, &KolabNowController::modify}}, -action_remove{new Kube::ControllerAction{this, &KolabNowController::remove}} -{ - -} - -void KolabNowController::create() { - - //account - auto account = ApplicationDomainType::createEntity(); - account.setProperty("type", "kolabnow"); - account.setProperty("name", getName()); - Store::create(account).exec().waitForFinished(); - - //imap - auto resource = ApplicationDomainType::createEntity(); - resource.setResourceType("sink.imap"); - resource.setAccount(account); - resource.setProperty("server","imaps://beta.kolabnow.com:143"); - resource.setProperty("username", getEmailAddress()); - resource.setProperty("password", getPassword()); - Store::create(resource).exec().waitForFinished(); - - //smtp - resource = ApplicationDomainType::createEntity(); - resource.setResourceType("sink.mailtransport"); - resource.setAccount(account); - resource.setProperty("server", "smtps://smtp.kolabnow.com:465"); - resource.setProperty("username", getEmailAddress()); - resource.setProperty("password", getPassword()); - Store::create(resource).exec().waitForFinished(); - - //identity - auto identity = ApplicationDomainType::createEntity(); - m_identityId = identity.identifier(); - identity.setAccount(account); - identity.setName(getIdentityName()); - identity.setAddress(getEmailAddress()); - Store::create(identity).exec(); -} - -void KolabNowController::modify() { - //TODO -} - -void KolabNowController::remove() { - SinkAccount account(m_accountId); - Store::remove(account).exec(); -} - -void KolabNowController::load(const QByteArray &id) { - - m_accountId = id; - - Store::fetchOne(Query().filter(m_accountId)) - .then([this](const SinkAccount &account) { - setName(account.getName()); - }).exec(); - - //TODO -} diff --git a/framework/accounts/kolabnowcontroller.h b/framework/accounts/kolabnowcontroller.h deleted file mode 100644 index 85918800..00000000 --- a/framework/accounts/kolabnowcontroller.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (C) 2017 Michael Bohlender, - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#pragma once - -#include -#include -#include - -#include - -class KolabNowController : public Kube::Controller -{ - Q_OBJECT - - //Interface properties - KUBE_CONTROLLER_PROPERTY(QString, Name, name) - - KUBE_CONTROLLER_PROPERTY(QString, EmailAddress, emailAddress) - KUBE_CONTROLLER_PROPERTY(QString, Password, password) - KUBE_CONTROLLER_PROPERTY(QString, IdentityName, identityName) - - //Actions - KUBE_CONTROLLER_ACTION(create) - KUBE_CONTROLLER_ACTION(modify) - KUBE_CONTROLLER_ACTION(remove) - -public: - explicit KolabNowController(); - -public slots: - void load(const QByteArray &id); - -private: - QByteArray m_accountId; - QByteArray m_smtpId; - QByteArray m_imapId; - QByteArray m_identityId; -}; diff --git a/framework/accounts/maildircontroller.cpp b/framework/accounts/maildircontroller.cpp deleted file mode 100644 index c2e15eb8..00000000 --- a/framework/accounts/maildircontroller.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2017 Michael Bohlender, - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "maildircontroller.h" - -#include - -using namespace Sink; -using namespace Sink::ApplicationDomain; - -MaildirController::MaildirController() : Kube::Controller(), - action_create{new Kube::ControllerAction{this, &MaildirController::create}}, - action_modify{new Kube::ControllerAction{this, &MaildirController::modify}}, - action_remove{new Kube::ControllerAction{this, &MaildirController::remove}} -{ - -} - -void MaildirController::create() { - auto account = ApplicationDomainType::createEntity(); - account.setProperty("type", "maildir"); - account.setProperty("name", getName()); - //account.setProperty("icon", getIcon()); - Store::create(account).exec().waitForFinished(); - - auto resource = ApplicationDomainType::createEntity(); - resource.setResourceType("sink.maildir"); - resource.setAccount(account); - resource.setProperty("path", getPath().path()); - - Store::create(resource).exec().waitForFinished(); -} - -void MaildirController::modify() { - SinkResource resource(m_resourceId); - resource.setProperty("path", getPath().path()); - Store::modify(resource).exec(); -} - -void MaildirController::remove() { - SinkAccount account(m_accountId); - Store::remove(account).exec(); - - clear(); -} - -void MaildirController::load(const QByteArray &id) { - - m_accountId = id; - clear(); - - Store::fetchOne(Query().filter(m_accountId)) - .then([this](const SinkAccount &account) { - setIcon(account.getIcon()); - setName(account.getName()); - }).exec(); - - Store::fetchOne(Query().filter(m_accountId).containsFilter(ResourceCapabilities::Mail::storage)) - .then([this](const SinkResource &resource) { - m_resourceId = resource.identifier(); - setPath(resource.getProperty("path").toString()); - }).exec(); -} diff --git a/framework/accounts/maildircontroller.h b/framework/accounts/maildircontroller.h deleted file mode 100644 index 5965f118..00000000 --- a/framework/accounts/maildircontroller.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - Copyright (C) 2017 Michael Bohlender, - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - -#pragma once - -#include -#include -#include -#include - -#include - -class MaildirController : public Kube::Controller -{ - Q_OBJECT - - //Interface properties - KUBE_CONTROLLER_PROPERTY(QString, Name, name) - KUBE_CONTROLLER_PROPERTY(QString, Icon, icon) - KUBE_CONTROLLER_PROPERTY(QUrl, Path, path) - - //Actions - KUBE_CONTROLLER_ACTION(create) - KUBE_CONTROLLER_ACTION(modify) - KUBE_CONTROLLER_ACTION(remove) - -public: - explicit MaildirController(); - -public slots: - void load(const QByteArray &id); - -private: - QByteArray m_accountId; - QByteArray m_resourceId; -}; -- cgit v1.2.3