From b3223155b178427354b44f05167d0afba0926cbd Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Mon, 24 Apr 2017 21:51:24 +0200 Subject: Another bunch of controllers gone --- framework/src/domain/foldercontroller.cpp | 62 ------------------------------- 1 file changed, 62 deletions(-) delete mode 100644 framework/src/domain/foldercontroller.cpp (limited to 'framework/src/domain/foldercontroller.cpp') diff --git a/framework/src/domain/foldercontroller.cpp b/framework/src/domain/foldercontroller.cpp deleted file mode 100644 index 3c10f773..00000000 --- a/framework/src/domain/foldercontroller.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - 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 "foldercontroller.h" - -#include -#include - -SINK_DEBUG_AREA("foldercontroller"); - -using namespace Sink; -using namespace Sink::ApplicationDomain; - -FolderController::FolderController() - : Kube::Controller(), - action_synchronize{new Kube::ControllerAction{this, &FolderController::synchronize}}, - action_moveToFolder{new Kube::ControllerAction{this, &FolderController::moveToFolder}} -{ -} - -void FolderController::synchronize() -{ - auto job = [&] { - auto accountId = getAccountId(); - if (auto folder = getFolder()) { - SinkLog() << "Synchronizing folder " << folder->resourceInstanceIdentifier() << folder->identifier(); - auto scope = SyncScope().resourceFilter(folder->resourceInstanceIdentifier()).filter(QVariant::fromValue(folder->identifier())); - scope.setType(); - return Store::synchronize(scope); - } else if (!accountId.isEmpty()) { - return Store::synchronize(SyncScope{}.resourceFilter(accountId)); - } else { - SinkLog() << "Synchronizing all"; - return Store::synchronize(SyncScope()); - } - }(); - run(job); -} - -void FolderController::moveToFolder() -{ - auto mail = getMail(); - auto targetFolder = getFolder(); - mail->setFolder(*targetFolder); - SinkLog() << "Moving to folder " << mail->identifier() << targetFolder->identifier(); - run(Store::modify(*mail)); -} -- cgit v1.2.3