diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-02-24 12:37:51 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-02-24 12:37:51 +0100 |
commit | 4b094beb151373abb4a24d473c6d69a11674c5ba (patch) | |
tree | 815b83ac455d5c62948f4ab02b33ea622567127f /framework/mail/actions/sinkactions.cpp | |
parent | 37d1ff146cda492b02c6b199e1b33f671c1fa9f9 (diff) | |
download | kube-4b094beb151373abb4a24d473c6d69a11674c5ba.tar.gz kube-4b094beb151373abb4a24d473c6d69a11674c5ba.zip |
Moved the ActionHandlerHelper
Diffstat (limited to 'framework/mail/actions/sinkactions.cpp')
-rw-r--r-- | framework/mail/actions/sinkactions.cpp | 21 |
1 files changed, 1 insertions, 20 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 | ||
25 | using namespace Kube; | 24 | using namespace Kube; |
26 | 25 | ||
27 | ActionHandlerHelper::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 | |||
35 | bool ActionHandlerHelper::isActionReady(Context *context) | ||
36 | { | ||
37 | return isReadyFunction(context); | ||
38 | } | ||
39 | |||
40 | void ActionHandlerHelper::execute(Context *context) | ||
41 | { | ||
42 | handlerFunction(context); | ||
43 | } | ||
44 | |||
45 | static ActionHandlerHelper markAsReadHandler("org.kde.kube.actions.mark-as-read", | 26 | static 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(); |