diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-01-01 13:37:19 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2017-01-02 00:31:41 +0100 |
commit | ba7128b30850594c7efb258d1794e377eede364a (patch) | |
tree | f805d511f6d12b0799c05b414054db8b8635bfc9 /framework/actions/actionhandler.cpp | |
parent | 431c257dd29e2e3d8878db200f0de4d452bffe92 (diff) | |
download | kube-ba7128b30850594c7efb258d1794e377eede364a.tar.gz kube-ba7128b30850594c7efb258d1794e377eede364a.zip |
Instead of using the action system we use controllers only.
It's simpler, and the action system was just too complex to use in a
typesafe way.
Diffstat (limited to 'framework/actions/actionhandler.cpp')
-rw-r--r-- | framework/actions/actionhandler.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/framework/actions/actionhandler.cpp b/framework/actions/actionhandler.cpp index dc9edeca..eb7b3224 100644 --- a/framework/actions/actionhandler.cpp +++ b/framework/actions/actionhandler.cpp | |||
@@ -31,6 +31,11 @@ ActionHandler::ActionHandler(QObject *parent) | |||
31 | 31 | ||
32 | } | 32 | } |
33 | 33 | ||
34 | ActionHandler::~ActionHandler() | ||
35 | { | ||
36 | ActionBroker::instance().unregisterHandler(mActionId, this); | ||
37 | } | ||
38 | |||
34 | bool ActionHandler::isActionReady(Context *context) | 39 | bool ActionHandler::isActionReady(Context *context) |
35 | { | 40 | { |
36 | if (context) { | 41 | if (context) { |
@@ -67,6 +72,8 @@ ActionResult ActionHandler::execute(Context *context) | |||
67 | 72 | ||
68 | void ActionHandler::setActionId(const QByteArray &actionId) | 73 | void ActionHandler::setActionId(const QByteArray &actionId) |
69 | { | 74 | { |
75 | //Reassigning the id is not supported | ||
76 | Q_ASSERT(mActionId.isEmpty()); | ||
70 | mActionId = actionId; | 77 | mActionId = actionId; |
71 | ActionBroker::instance().registerHandler(actionId, this); | 78 | ActionBroker::instance().registerHandler(actionId, this); |
72 | } | 79 | } |
@@ -76,6 +83,16 @@ QByteArray ActionHandler::actionId() const | |||
76 | return mActionId; | 83 | return mActionId; |
77 | } | 84 | } |
78 | 85 | ||
86 | void ActionHandler::setRequiredProperties(const QSet<QByteArray> &requiredProperties) | ||
87 | { | ||
88 | mRequiredProperties = requiredProperties; | ||
89 | } | ||
90 | |||
91 | QSet<QByteArray> ActionHandler::requiredProperties() const | ||
92 | { | ||
93 | return mRequiredProperties; | ||
94 | } | ||
95 | |||
79 | 96 | ||
80 | ActionHandlerHelper::ActionHandlerHelper(const Handler &handler) | 97 | ActionHandlerHelper::ActionHandlerHelper(const Handler &handler) |
81 | : ActionHandler(nullptr), | 98 | : ActionHandler(nullptr), |