20#include "kexiformeventhandler.h"
23#include <tqobjectlist.h>
28#include <tableview/kexitableitem.h>
29#include <tableview/kexitableviewdata.h>
30#include <kexidb/queryschema.h>
31#include <keximainwindow.h>
32#include <kexidialogbase.h>
34#include <kexipartinfo.h>
35#include <kexipartitem.h>
37KexiFormEventAction::ActionData::ActionData()
43 return string.isEmpty();
47 TQString& actionType, TQString& actionArg,
bool& ok)
const
49 const int idx =
string.find(
':');
53 const TQString _actionType =
string.left(idx);
54 const TQString _actionArg =
string.mid(idx+1);
55 if (_actionType.isEmpty() || _actionArg.isEmpty())
58 if (_actionType!=
"tdeaction" && _actionType!=
"currentForm") {
63 actionType = _actionType;
64 actionArg = _actionArg;
71KexiFormEventAction::KexiFormEventAction(
KexiMainWindow *mainWin, TQObject* parent,
72 const TQString& actionName,
const TQString& objectName,
const TQString& actionOption)
73 : TDEAction(parent), m_mainWin(mainWin), m_actionName(actionName), m_objectName(objectName)
74 , m_actionOption(actionOption)
78KexiFormEventAction::~KexiFormEventAction()
82void KexiFormEventAction::activate()
84 KexiProject* project = m_mainWin->project();
88 TQString(
"kexi/%1").arg(m_actionName) );
91 KexiPart::Item* item = project->
item( part->info(), m_objectName );
94 bool actionCancelled =
false;
95 if (m_actionOption.isEmpty()) {
99 m_mainWin->openObject(item, Kexi::DataViewMode, actionCancelled);
103 if (m_actionOption ==
"open")
104 m_mainWin->openObject(item, Kexi::DataViewMode, actionCancelled);
105 else if (m_actionOption ==
"execute")
107 else if (m_actionOption ==
"print") {
109 m_mainWin->printItem(item);
111 else if (m_actionOption ==
"printPreview") {
113 m_mainWin->printPreviewForItem(item);
115 else if (m_actionOption ==
"pageSetup") {
117 m_mainWin->showPageSetupForItem(item);
119 else if (m_actionOption ==
"exportToCSV"
120 || m_actionOption ==
"copyToClipboardAsCSV")
123 m_mainWin->executeCustomActionForObject(item, m_actionOption);
125 else if (m_actionOption ==
"new")
126 m_mainWin->newObject( part->info(), actionCancelled );
127 else if (m_actionOption ==
"design")
128 m_mainWin->openObject(item, Kexi::DesignViewMode, actionCancelled);
129 else if (m_actionOption ==
"editText")
131 else if (m_actionOption ==
"close") {
132 tristate res = m_mainWin->closeObject(item);
134 actionCancelled =
true;
141KexiFormEventHandler::KexiFormEventHandler()
146KexiFormEventHandler::~KexiFormEventHandler()
152 m_mainWidget = mainWidget;
158 TQObjectList *l = m_mainWidget->queryList(
"KexiPushButton" );
159 TQObjectListIt it( *l );
161 for ( ; (obj = it.current()) != 0; ++it ) {
164 data.
string = obj->property(
"onClickAction").toString();
165 data.
option = obj->property(
"onClickActionOption").toString();
169 TQString actionType, actionArg;
173 if (actionType==
"tdeaction" || actionType==
"currentForm") {
174 TDEAction *action = mainWin->actionCollection()->action( actionArg.latin1() );
177 TQObject::disconnect( obj, TQ_SIGNAL(clicked()), action, TQ_SLOT(activate()) );
178 TQObject::connect( obj, TQ_SIGNAL(clicked()), action, TQ_SLOT(activate()) );
181 KexiFormEventAction* action =
new KexiFormEventAction(mainWin, obj, actionType, actionArg,
183 TQObject::disconnect( obj, TQ_SIGNAL(clicked()), action, TQ_SLOT(activate()) );
184 TQObject::connect( obj, TQ_SIGNAL(clicked()), action, TQ_SLOT(activate()) );
Kexi's main window interface This interface is implemented by KexiMainWindowImpl class.
Information about a Kexi Part (plugin).
bool isDataExportSupported() const
bool isPrintingSupported() const
bool isExecuteSupported() const
Part * partForMimeType(const TQString &mimeTypt)
Info * infoForMimeType(const TQString &mimeType)
virtual bool execute(KexiPart::Item *item, TQObject *sender=0)
KexiPart::Item * item(KexiPart::Info *i, const TQString &name)
KEXICORE_EXPORT KexiPart::Manager & partManager()
shared part manager
@ TextViewMode
Also known as SQL View Mode.