summaryrefslogtreecommitdiffstats
path: root/framework/mail
diff options
context:
space:
mode:
Diffstat (limited to 'framework/mail')
-rw-r--r--framework/mail/actions/sinkactions.cpp21
-rw-r--r--framework/mail/actions/sinkactions.h40
2 files changed, 1 insertions, 60 deletions
diff --git a/framework/mail/actions/sinkactions.cpp b/framework/mail/actions/sinkactions.cpp
index 978a045b..e00d3947 100644
--- a/framework/mail/actions/sinkactions.cpp
+++ b/framework/mail/actions/sinkactions.cpp
@@ -16,32 +16,13 @@
16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 16 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 02110-1301, USA. 17 02110-1301, USA.
18*/ 18*/
19#include "sinkactions.h"
20
21#include <actions/context.h> 19#include <actions/context.h>
20#include <actions/actionhandler.h>
22 21
23#include <sink/store.h> 22#include <sink/store.h>
24 23
25using namespace Kube; 24using namespace Kube;
26 25
27ActionHandlerHelper::ActionHandlerHelper(const QByteArray &actionId, const std::function<bool(Context*)> &isReady, const std::function<void(Context*)> &handler)
28 : ActionHandler(nullptr),
29 isReadyFunction(isReady),
30 handlerFunction(handler)
31{
32 setActionId(actionId);
33}
34
35bool ActionHandlerHelper::isActionReady(Context *context)
36{
37 return isReadyFunction(context);
38}
39
40void ActionHandlerHelper::execute(Context *context)
41{
42 handlerFunction(context);
43}
44
45static ActionHandlerHelper markAsReadHandler("org.kde.kube.actions.mark-as-read", 26static ActionHandlerHelper markAsReadHandler("org.kde.kube.actions.mark-as-read",
46 [](Context *context) -> bool { 27 [](Context *context) -> bool {
47 return context->property("mail").isValid(); 28 return context->property("mail").isValid();
diff --git a/framework/mail/actions/sinkactions.h b/framework/mail/actions/sinkactions.h
deleted file mode 100644
index a583ebf8..00000000
--- a/framework/mail/actions/sinkactions.h
+++ /dev/null
@@ -1,40 +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#pragma once
20
21#include <actions/actionhandler.h>
22#include <functional>
23
24namespace Kube {
25class Context;
26
27class ActionHandlerHelper : public ActionHandler
28{
29 Q_OBJECT
30public:
31 ActionHandlerHelper(const QByteArray &actionId, const std::function<bool(Context*)> &, const std::function<void(Context*)> &);
32
33 bool isActionReady(Context *context) Q_DECL_OVERRIDE;
34 void execute(Context *context) Q_DECL_OVERRIDE;
35private:
36 const std::function<bool(Context*)> isReadyFunction;
37 const std::function<void(Context*)> handlerFunction;
38};
39
40}