1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
#ifndef KEXIUSERACTION_H
#define KEXIUSERACTION_H
#include <kaction.h>
#include "kexiuseractionmethod.h"
namespace KexiDB
{
class Cursor;
}
class KexiMainWindow;
typedef TQValueVector<TQVariant> Arguments;
/*! action that can be defined by a user for a special scope e.g. main, form ...
the actions can have some predefined \ref Methods which are described in \ref KexiUserActionMethod
e.g. OpenObject, ExecuteScript ... those methods take different arguments also described in \ref KexiUserActionMethod
*/
class KEXICORE_EXPORT KexiUserAction : public KAction
{
Q_OBJECT
TQ_OBJECT
public:
/*! bytecode of available methods */
enum Methods
{
MethodNone = 0,
OpenObject = 1,
CloseObject = 2,
DeleteObject = 3,
ExecuteScript = 4,
ExitKexi = 5,
LastMethod = 6 //use the last integer here... so we can stop iteration
};
/*! argument types */
enum ArgTypes
{
String = 0,
Integer = 1,
Bool = 2,
KexiPart = 3,
KexiItem = 4
};
/*! constructs an action
\note methods are associated using setMethod()
*/
KexiUserAction(KexiMainWindow *context, KActionCollection *parent, const TQString &name, const TQString &text, const TQString &pixmap);
~KexiUserAction();
/*! sets execution information associated with this action this will mostly look like
\code
KexiUserAction *action = new KexiUserAction(...);
Arguments arg;
arg.append(TQVariant("kexi/form"));
arg.append(TQVariant("main"));
action->setMethod(KexiUserAction::OpenAction, arg);
\endcode
*/
void setMethod(int method, Arguments args);
/*! creates a KexiUserAction from current record in \a c
mostly needed for creation from kexi__useractions table */
static KexiUserAction *fromCurrentRecord(KexiMainWindow *context, KActionCollection *parent, KexiDB::Cursor *c);
protected slots:
/*! actually executes the associated method
\note KexiUserAction automatically connects KAction::activated() to KexiUserAction::execute()
*/
void execute();
private:
KexiMainWindow *m_win;
int m_method;
Arguments m_args;
};
#endif
|