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. --- 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 ------------------ 6 files changed, 280 deletions(-) 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 (limited to 'framework') 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