summaryrefslogtreecommitdiffstats
path: root/framework/actions
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-05-04 16:49:31 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-05-04 16:49:31 +0200
commite4fba677a9755a5aee1a0ea1513b6f737429d832 (patch)
tree956856d3635249a6d7af98934f7f14885f264818 /framework/actions
parent8cfe1ed71dd342bfb625a94319f7b3d42709c8b0 (diff)
downloadkube-e4fba677a9755a5aee1a0ea1513b6f737429d832.tar.gz
kube-e4fba677a9755a5aee1a0ea1513b6f737429d832.zip
Unbreak action execution from qml
QML can't do with custom return types. (we'd have to wrap it in a QVariant or use a property).
Diffstat (limited to 'framework/actions')
-rw-r--r--framework/actions/action.cpp7
-rw-r--r--framework/actions/action.h3
-rw-r--r--framework/actions/actionplugin.cpp2
-rw-r--r--framework/actions/actionresult.h2
4 files changed, 12 insertions, 2 deletions
diff --git a/framework/actions/action.cpp b/framework/actions/action.cpp
index 28dd5e2a..4bda033e 100644
--- a/framework/actions/action.cpp
+++ b/framework/actions/action.cpp
@@ -85,7 +85,12 @@ bool Action::ready() const
85 return ActionBroker::instance().isActionReady(mActionId, mContext); 85 return ActionBroker::instance().isActionReady(mActionId, mContext);
86} 86}
87 87
88ActionResult Action::execute() 88void Action::execute()
89{
90 ActionBroker::instance().executeAction(mActionId, mContext);
91}
92
93ActionResult Action::executeWithResult()
89{ 94{
90 return ActionBroker::instance().executeAction(mActionId, mContext); 95 return ActionBroker::instance().executeAction(mActionId, mContext);
91} 96}
diff --git a/framework/actions/action.h b/framework/actions/action.h
index 1ad4a47e..1abf4a5c 100644
--- a/framework/actions/action.h
+++ b/framework/actions/action.h
@@ -44,7 +44,8 @@ public:
44 44
45 bool ready() const; 45 bool ready() const;
46 46
47 Q_INVOKABLE ActionResult execute(); 47 Q_INVOKABLE void execute();
48 ActionResult executeWithResult();
48 49
49Q_SIGNALS: 50Q_SIGNALS:
50 void readyChanged(); 51 void readyChanged();
diff --git a/framework/actions/actionplugin.cpp b/framework/actions/actionplugin.cpp
index 87bc4d7b..05852d2e 100644
--- a/framework/actions/actionplugin.cpp
+++ b/framework/actions/actionplugin.cpp
@@ -3,6 +3,7 @@
3#include "action.h" 3#include "action.h"
4#include "context.h" 4#include "context.h"
5#include "actionhandler.h" 5#include "actionhandler.h"
6#include "actionresult.h"
6 7
7#include <QtQml> 8#include <QtQml>
8 9
@@ -12,4 +13,5 @@ void KubePlugin::registerTypes (const char *uri)
12 qmlRegisterType<Kube::Context>(uri, 1, 0, "Context"); 13 qmlRegisterType<Kube::Context>(uri, 1, 0, "Context");
13 qmlRegisterType<Kube::Action>(uri, 1, 0, "Action"); 14 qmlRegisterType<Kube::Action>(uri, 1, 0, "Action");
14 qmlRegisterType<Kube::ActionHandler>(uri, 1, 0, "ActionHandler"); 15 qmlRegisterType<Kube::ActionHandler>(uri, 1, 0, "ActionHandler");
16 qmlRegisterType<Kube::ActionResult>(uri, 1, 0, "ActionResult");
15} 17}
diff --git a/framework/actions/actionresult.h b/framework/actions/actionresult.h
index cdc6a160..e4d3efeb 100644
--- a/framework/actions/actionresult.h
+++ b/framework/actions/actionresult.h
@@ -64,3 +64,5 @@ private:
64}; 64};
65 65
66} 66}
67
68Q_DECLARE_METATYPE(Kube::ActionResult);