summaryrefslogtreecommitdiffstats
path: root/framework/actions/actionhandler.h
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-05-03 20:24:09 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-05-03 20:24:26 +0200
commite06e1dad4a4570e5c1181d05ab6ed7a5d74c6c91 (patch)
treeef606d36ee693eff087292a1950fe122a7376f19 /framework/actions/actionhandler.h
parent21f7851f044cd8b6e38c821ce12d7e1b291cae27 (diff)
downloadkube-e06e1dad4a4570e5c1181d05ab6ed7a5d74c6c91.tar.gz
kube-e06e1dad4a4570e5c1181d05ab6ed7a5d74c6c91.zip
A save-as-draft action & action results
This patch introduces tracking of actions, so they can be tested. It also provides a save-as-draft action, that looks for the draft folder, and stores the mail accordingly.
Diffstat (limited to 'framework/actions/actionhandler.h')
-rw-r--r--framework/actions/actionhandler.h14
1 files changed, 10 insertions, 4 deletions
diff --git a/framework/actions/actionhandler.h b/framework/actions/actionhandler.h
index 1820bfd4..c8c10dc7 100644
--- a/framework/actions/actionhandler.h
+++ b/framework/actions/actionhandler.h
@@ -21,6 +21,9 @@
21#include <QObject> 21#include <QObject>
22#include <QMultiMap> 22#include <QMultiMap>
23#include <functional> 23#include <functional>
24#include <Async/Async>
25
26#include "actionresult.h"
24 27
25namespace Kube { 28namespace Kube {
26class Context; 29class Context;
@@ -36,7 +39,7 @@ public:
36 virtual bool isActionReady(Context *context); 39 virtual bool isActionReady(Context *context);
37 40
38 // void pre(Context *context); 41 // void pre(Context *context);
39 virtual void execute(Context *context); 42 virtual ActionResult execute(Context *context);
40 // void post(Context *context); 43 // void post(Context *context);
41 44
42 void setActionId(const QByteArray &); 45 void setActionId(const QByteArray &);
@@ -52,14 +55,17 @@ class ActionHandlerHelper : public ActionHandler
52public: 55public:
53 typedef std::function<bool(Context*)> IsReadyFunction; 56 typedef std::function<bool(Context*)> IsReadyFunction;
54 typedef std::function<void(Context*)> Handler; 57 typedef std::function<void(Context*)> Handler;
58 typedef std::function<KAsync::Job<void>(Context*)> JobHandler;
55 59
56 ActionHandlerHelper(const QByteArray &actionId, const IsReadyFunction &, const Handler &); 60 ActionHandlerHelper(const QByteArray &actionId, const IsReadyFunction &, const Handler &);
61 ActionHandlerHelper(const QByteArray &actionId, const IsReadyFunction &, const JobHandler &);
57 62
58 bool isActionReady(Context *context) Q_DECL_OVERRIDE; 63 bool isActionReady(Context *context) Q_DECL_OVERRIDE;
59 void execute(Context *context) Q_DECL_OVERRIDE; 64 ActionResult execute(Context *context) Q_DECL_OVERRIDE;
60private: 65private:
61 const std::function<bool(Context*)> isReadyFunction; 66 const IsReadyFunction isReadyFunction;
62 const std::function<void(Context*)> handlerFunction; 67 const Handler handlerFunction;
68 const JobHandler jobHandlerFunction;
63}; 69};
64 70
65} 71}