From 4d422c52e64e1f06f46174b8cfbb70d17543e418 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 1 Mar 2017 13:24:28 +0100 Subject: Removed the unused maildircontroller --- accounts/maildir/CMakeLists.txt | 1 - accounts/maildir/maildiraccountplugin.cpp | 2 - accounts/maildir/maildircontroller.cpp | 107 ------------------------------ accounts/maildir/maildircontroller.h | 64 ------------------ 4 files changed, 174 deletions(-) delete mode 100644 accounts/maildir/maildircontroller.cpp delete mode 100644 accounts/maildir/maildircontroller.h (limited to 'accounts/maildir') 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/) set(SRCS maildirsettings.cpp maildiraccountplugin.cpp - maildircontroller.cpp ) add_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 @@ #include "maildiraccountplugin.h" #include "maildirsettings.h" -#include "maildircontroller.h" #include @@ -9,5 +8,4 @@ void MaildirAccountPlugin::registerTypes (const char *uri) { Q_ASSERT(uri == QLatin1String("org.kube.accounts.maildir")); qmlRegisterType(uri, 1, 0, "MaildirSettings"); - qmlRegisterType(uri, 1, 0, "MaildirController"); } 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 @@ -/* - * Copyright (c) 2016 Michael Bohlender - * 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 "maildircontroller.h" - -#include - -using namespace Sink; -using namespace Sink::ApplicationDomain; - -MaildirController::MaildirController(QObject *parent) -: QObject(parent) -{ -} - -QByteArray MaildirController::accountIdentifier() const -{ - return mAccountIdentifier; -} - -void MaildirController::setAccountIdentifier(const QByteArray &id) -{ - if (id.isEmpty()) { - return; - } - mAccountIdentifier = id; - - //clear - mIcon = QString(); - mName = QString(); - mPath = QUrl(); - - //load -} - -QUrl MaildirController::path() const -{ - return QUrl(mPath); -} - -void MaildirController::setPath(const QUrl &path) -{ - auto normalizedPath = path.path(); - if (mPath != normalizedPath) { - mPath = normalizedPath; - emit pathChanged(); - } -} - -void MaildirController::createAccount() -{ - auto account = ApplicationDomainType::createEntity(); - account.setProperty("type", "maildir"); - account.setProperty("name", mName); - account.setProperty("icon", mIcon); - Store::create(account).exec().waitForFinished(); - - auto resource = ApplicationDomainType::createEntity(); - resource.setResourceType("sink.maildir"); - resource.setAccount(account); - resource.setProperty("path", mPath); - //TODO not yet implemented in resource? // resource.setProperty("readonly", readonly); - Store::create(resource).exec().waitForFinished(); -} - -//TODO -void MaildirController::loadAccount(const QByteArray &id) -{ - Q_ASSERT(!mAccountIdentifier.isEmpty()); - Store::fetchOne(Query().filter(mAccountIdentifier)) - .then([this](const SinkAccount &account) { - mIcon = account.getIcon(); - mName = account.getName(); - emit nameChanged(); - emit iconChanged(); - }).exec(); -} - -//TODO -void MaildirController::modifyAccount() -{ -} - -void MaildirController::deleteAccount() -{ - if (!mAccountIdentifier.isEmpty()) { - SinkAccount account(mAccountIdentifier); - Store::remove(account).exec(); - } -} 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 @@ -/* - * Copyright (C) 2016 Michael Bohlender, - * Copyright (c) 2016 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. - */ - -#pragma once - -#include -#include -#include -#include - -class MaildirController : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QByteArray accountIdentifier READ accountIdentifier WRITE setAccountIdentifier NOTIFY accountIdentifierChanged) - - Q_PROPERTY(QString name MEMBER mName NOTIFY nameChanged) - Q_PROPERTY(QString icon MEMBER mIcon NOTIFY iconChanged) - Q_PROPERTY(QUrl path READ path WRITE setPath NOTIFY pathChanged) - -public: - explicit MaildirController(QObject *parent = Q_NULLPTR); - - QByteArray accountIdentifier() const; - void setAccountIdentifier(const QByteArray &id); - - QUrl path() const; - void setPath(const QUrl &path); - -signals: - void accountIdentifierChanged(); - void nameChanged(); - void iconChanged(); - void pathChanged(); - -public slots: - void createAccount(); - void loadAccount(const QByteArray &id); - void modifyAccount(); - void deleteAccount(); - -private: - QByteArray mAccountIdentifier; - QString mIcon; - QString mName; - QUrl mPath; -}; - -- cgit v1.2.3