~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to kexi/formeditor/kexiformeventhandler.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of the KDE project
 
2
   Copyright (C) 2005-2006 Jarosław Staniek <staniek@kde.org>
 
3
 
 
4
   This library is free software; you can redistribute it and/or
 
5
   modify it under the terms of the GNU Library General Public
 
6
   License as published by the Free Software Foundation; either
 
7
   version 2 of the License, or (at your option) any later version.
 
8
 
 
9
   This library is distributed in the hope that it will be useful,
 
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
   Library General Public 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
 
16
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 
17
 * Boston, MA 02110-1301, USA.
 
18
*/
 
19
 
 
20
#ifndef KEXIFORMEVENTHANDLER_H
 
21
#define KEXIFORMEVENTHANDLER_H
 
22
 
 
23
#include <qwidget.h>
 
24
#include <kaction.h>
 
25
#include <kexi_export.h>
 
26
 
 
27
namespace KexiPart
 
28
{
 
29
class Info;
 
30
}
 
31
 
 
32
//! The KexiFormEventHandler class handles events defined within Kexi Forms
 
33
/*! For now only "onClickAction" property of Push Button widget is handled:
 
34
 It's possible to connect this event to predefined global action.
 
35
 
 
36
 Note: This interface will be extended in the future!
 
37
 
 
38
 @see KexiFormPart::slotAssignAction()
 
39
 */
 
40
class KFORMEDITOR_EXPORT KexiFormEventHandler
 
41
{
 
42
public:
 
43
    KexiFormEventHandler();
 
44
    virtual ~KexiFormEventHandler();
 
45
 
 
46
    /*! Sets \a mainWidget to be a main widget for this handler.
 
47
     Also find widgets having action assigned and connects them
 
48
     to appropriate actions.
 
49
     For now, all of them must be KexiPushButton). */
 
50
    void setMainWidgetForEventHandling(QWidget* mainWidget);
 
51
 
 
52
protected:
 
53
    QWidget *m_mainWidget;
 
54
};
 
55
 
 
56
//! @internal form-level action for handling "on click" actions
 
57
class KFORMEDITOR_EXPORT KexiFormEventAction : public KAction
 
58
{
 
59
    Q_OBJECT
 
60
public:
 
61
    //! A structure used in currentActionName()
 
62
    class KFORMEDITOR_EXPORT ActionData
 
63
    {
 
64
    public:
 
65
        ActionData();
 
66
 
 
67
        /*! Decodes action string into action type/action argument parts.
 
68
         Action string has to be in a form of "actiontype:actionarg"
 
69
         - Action type is passed to \a actionType on success. Action type can be "kaction"
 
70
          or any of the part names (see KexiPart::Info::objectName()), e.g. "table", "query", etc.
 
71
         - Action argument can be an action name in case of "kaction" type or object name
 
72
          in case of action of type "table", "query", etc.
 
73
         \a ok is set to true on success and to false on failure. On failure no other
 
74
         values are passed.
 
75
         \return part info if action type is "table", "query", etc., or 0 for "kaction" type. */
 
76
        KexiPart::Info* decodeString(QString& actionType, QString& actionArg, bool& ok) const;
 
77
 
 
78
        //! \return true if the action is empty
 
79
        bool isEmpty() const;
 
80
 
 
81
        QString string; //!< action string with prefix, like "kaction:edit_copy" or "table:<tableName>"
 
82
 
 
83
        QString option; //!< option used when name is "table/query/etc.:\<objectName\>" is set;
 
84
        //!< can be set to "open", "design", "editText", etc.
 
85
        //!< @see ActionToExecuteListView::showActionsForPartClass()
 
86
    };
 
87
 
 
88
    KexiFormEventAction(QObject* parent, const QString& actionName,
 
89
                        const QString& objectName, const QString& actionOption);
 
90
    virtual ~KexiFormEventAction();
 
91
 
 
92
public slots:
 
93
    //! Activates the action. If the object supports executing (macro, script),
 
94
    //! it is executed; otherwise (table, query, form,...) it is opened in its data view.
 
95
    void slotTrigger();
 
96
 
 
97
private:
 
98
    QString m_actionName, m_objectName, m_actionOption;
 
99
};
 
100
 
 
101
#endif