1
/* This file is part of the KDE project
2
Copyright (C) 2005-2006 Jarosław Staniek <staniek@kde.org>
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.
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.
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.
20
#ifndef KEXIFORMEVENTHANDLER_H
21
#define KEXIFORMEVENTHANDLER_H
25
#include <kexi_export.h>
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.
36
Note: This interface will be extended in the future!
38
@see KexiFormPart::slotAssignAction()
40
class KFORMEDITOR_EXPORT KexiFormEventHandler
43
KexiFormEventHandler();
44
virtual ~KexiFormEventHandler();
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);
53
QWidget *m_mainWidget;
56
//! @internal form-level action for handling "on click" actions
57
class KFORMEDITOR_EXPORT KexiFormEventAction : public KAction
61
//! A structure used in currentActionName()
62
class KFORMEDITOR_EXPORT ActionData
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
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;
78
//! \return true if the action is empty
81
QString string; //!< action string with prefix, like "kaction:edit_copy" or "table:<tableName>"
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()
88
KexiFormEventAction(QObject* parent, const QString& actionName,
89
const QString& objectName, const QString& actionOption);
90
virtual ~KexiFormEventAction();
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.
98
QString m_actionName, m_objectName, m_actionOption;