diff options
Diffstat (limited to 'framework/actions/action.h')
-rw-r--r-- | framework/actions/action.h | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/framework/actions/action.h b/framework/actions/action.h deleted file mode 100644 index dda8c987..00000000 --- a/framework/actions/action.h +++ /dev/null | |||
@@ -1,71 +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 <QObject> | ||
22 | #include "context.h" | ||
23 | #include "actionresult.h" | ||
24 | |||
25 | namespace Kube { | ||
26 | |||
27 | class ActionHandler; | ||
28 | |||
29 | class Action : public QObject | ||
30 | { | ||
31 | Q_OBJECT | ||
32 | Q_PROPERTY(QByteArray actionId READ actionId WRITE setActionId) | ||
33 | //FIXME if I set the property to Context* qml fails to assign the registered type which is calle Kube::Context_QML_90 in QML... | ||
34 | Q_PROPERTY(Context* context READ context WRITE setContext) | ||
35 | Q_PROPERTY(bool ready READ ready NOTIFY readyChanged) | ||
36 | |||
37 | public: | ||
38 | Action(QObject *parent = 0); | ||
39 | Action(const QByteArray &actionId, Context &context, QObject *parent = 0); | ||
40 | ~Action(); | ||
41 | |||
42 | void setContext(Context *); | ||
43 | Context *context() const; | ||
44 | |||
45 | void setActionId(const QByteArray &); | ||
46 | QByteArray actionId() const; | ||
47 | |||
48 | bool ready() const; | ||
49 | |||
50 | Q_INVOKABLE void execute(); | ||
51 | ActionResult executeWithResult(); | ||
52 | |||
53 | void addPreHandler(ActionHandler *handler); | ||
54 | void addPostHandler(ActionHandler *handler); | ||
55 | |||
56 | bool eventFilter(QObject *obj, QEvent *e) Q_DECL_OVERRIDE; | ||
57 | |||
58 | Q_SIGNALS: | ||
59 | void readyChanged(); | ||
60 | |||
61 | private Q_SLOTS: | ||
62 | void contextChanged(); | ||
63 | |||
64 | private: | ||
65 | Context *mContext; | ||
66 | QByteArray mActionId; | ||
67 | QList<QPointer<ActionHandler>> mPreHandler; | ||
68 | QList<QPointer<ActionHandler>> mPostHandler; | ||
69 | }; | ||
70 | |||
71 | } | ||