summaryrefslogtreecommitdiffstats
path: root/framework/domain/actions/sinkactions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'framework/domain/actions/sinkactions.cpp')
-rw-r--r--framework/domain/actions/sinkactions.cpp56
1 files changed, 0 insertions, 56 deletions
diff --git a/framework/domain/actions/sinkactions.cpp b/framework/domain/actions/sinkactions.cpp
deleted file mode 100644
index 460cb6a1..00000000
--- a/framework/domain/actions/sinkactions.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
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
20#include <actions/actionhandler.h>
21
22#include <KMime/Message>
23#include <QFile>
24
25#include <sink/store.h>
26#include <sink/log.h>
27
28SINK_DEBUG_AREA("sinkactions")
29
30using namespace Kube;
31using namespace Sink;
32using namespace Sink::ApplicationDomain;
33
34class FolderContext : public Kube::ContextWrapper {
35 using Kube::ContextWrapper::ContextWrapper;
36 KUBE_CONTEXTWRAPPER_PROPERTY(Sink::ApplicationDomain::Folder::Ptr, Folder, folder)
37};
38
39static ActionHandlerHelper synchronizeHandler("org.kde.kube.actions.synchronize",
40 [](Context *context) -> bool {
41 return true;
42 },
43 [](Context *context_) {
44 auto context = FolderContext{*context_};
45 if (auto folder = context.getFolder()) {
46 SinkLog() << "Synchronizing folder " << folder->resourceInstanceIdentifier() << folder->identifier();
47 auto scope = SyncScope().resourceFilter(folder->resourceInstanceIdentifier()).filter<Mail::Folder>(QVariant::fromValue(folder->identifier()));
48 scope.setType<ApplicationDomain::Mail>();
49 Store::synchronize(scope).exec();
50 } else {
51 SinkLog() << "Synchronizing all";
52 Store::synchronize(SyncScope()).exec();
53 }
54 }
55);
56