~ubuntu-branches/ubuntu/oneiric/koffice/oneiric-updates

« back to all changes in this revision

Viewing changes to kexi/core/kexiuseraction.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

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