kexiformpart.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2004 Lucijan Busch <lucijan@kde.org>
3 Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
4 Copyright (C) 2005 Jaroslaw Staniek <js@iidea.pl>
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
15
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20*/
21
22#include <kdebug.h>
23#include <kgenericfactory.h>
24#include <kdialogbase.h>
25#include <tdelistview.h>
26#include <ktabwidget.h>
27#include <kiconloader.h>
28#include <kcombobox.h>
29#include <tdeapplication.h>
30#include <tdeconfig.h>
31
32#include <kexiviewbase.h>
33#include <keximainwindow.h>
34#include <kexiproject.h>
35#include <kexipartitem.h>
36#include <kexidialogbase.h>
37#include <kexidatasourcecombobox.h>
38#include <kexidb/connection.h>
39#include <kexidb/fieldlist.h>
40#include <kexidb/field.h>
41#include <kexiutils/utils.h>
42
43#include <form.h>
44#include <formIO.h>
45#include <widgetpropertyset.h>
46#include <widgetlibrary.h>
47#include <objecttreeview.h>
48#include <koproperty/property.h>
49
50#include "kexiformview.h"
51#include "widgets/kexidbform.h"
52#include "kexiformscrollview.h"
53#include "kexiactionselectiondialog.h"
54#include "kexiformmanager.h"
55#include "kexiformpart.h"
56#include "kexidatasourcepage.h"
57
59
61
63class KexiFormPart::Private
64{
65 public:
66 Private()
67 {
68 }
69 ~Private()
70 {
71 delete static_cast<KFormDesigner::ObjectTreeView*>(objectTreeView);
72 delete static_cast<KexiDataSourcePage*>(dataSourcePage);
73 }
74// TQGuardedPtr<KFormDesigner::FormManager> manager;
75 TQGuardedPtr<KFormDesigner::ObjectTreeView> objectTreeView;
76 TQGuardedPtr<KexiDataSourcePage> dataSourcePage;
77 KexiDataSourceComboBox *dataSourceCombo;
78};
79
80KexiFormPart::KexiFormPart(TQObject *parent, const char *name, const TQStringList &l)
81 : KexiPart::Part(parent, name, l)
82 , d(new Private())
83{
84 // REGISTERED ID:
85 m_registeredPartID = (int)KexiPart::FormObjectType;
86
87 kexipluginsdbg << "KexiFormPart::KexiFormPart()" << endl;
88 m_names["instanceName"]
89 = i18n("Translate this word using only lowercase alphanumeric characters (a..z, 0..9). "
90 "Use '_' character instead of spaces. First character should be a..z character. "
91 "If you cannot use latin characters in your language, use english word.",
92 "form");
93 m_names["instanceCaption"] = i18n("Form");
94 m_supportedViewModes = Kexi::DataViewMode | Kexi::DesignViewMode;
95 m_newObjectsAreDirty = true;
96
97 // Only create form manager if it's not yet created.
98 // KexiReportPart could have created it already.
100 if (!formManager)
101 formManager = new KexiFormManager(this, "kexi_form_and_report_manager");
102
103 // Create and store a handle to forms' library. Reports will have their own library too.
104/* @todo add configuration for supported factory groups */
105 TQStringList supportedFactoryGroups;
106 supportedFactoryGroups += "kexi";
108 formManager, supportedFactoryGroups);
109 static_formsLibrary->setAdvancedPropertiesVisible(false);
110 connect(static_formsLibrary, TQ_SIGNAL(widgetCreated(TQWidget*)),
111 this, TQ_SLOT(slotWidgetCreatedByFormsLibrary(TQWidget*)));
112
113 connect(KFormDesigner::FormManager::self()->propertySet(), TQ_SIGNAL(widgetPropertyChanged(TQWidget *, const TQCString &, const TQVariant&)),
114 this, TQ_SLOT(slotPropertyChanged(TQWidget *, const TQCString &, const TQVariant&)));
115 connect(KFormDesigner::FormManager::self(), TQ_SIGNAL(autoTabStopsSet(KFormDesigner::Form*,bool)),
116 this, TQ_SLOT(slotAutoTabStopsSet(KFormDesigner::Form*,bool)));
117}
118
119KexiFormPart::~KexiFormPart()
120{
121 delete d;
122}
123
128
129#if 0
130void KexiFormPart::initPartActions(TDEActionCollection *collection)
131{
132//this is automatic? -no
133//create child guicilent: guiClient()->setXMLFile("kexidatatableui.rc");
134
135 kexipluginsdbg<<"FormPart INIT ACTIONS***********************************************************************"<<endl;
136 //TODO
137
138 //guiClient()->setXMLFile("kexiformui.rc");
139//js m_manager->createActions(collection, 0);
140}
141
142void KexiFormPart::initInstanceActions( int mode, TDEActionCollection *col )
143{
144 if (mode==Kexi::DesignViewMode) {
146 new TDEAction(i18n("Edit Tab Order..."), "tab_order", TDEShortcut(0), KFormDesigner::FormManager::self(), TQ_SLOT(editTabOrder()), col, "taborder");
147 new TDEAction(i18n("Adjust Size"), "zoom-fit-best", TDEShortcut(0), KFormDesigner::FormManager::self(), TQ_SLOT(ajustWidgetSize()), col, "adjust");
148 }
149 //TODO
150}
151#endif
152
153void KexiFormPart::initPartActions()
154{
155// new TDEAction(i18n("Show Form UI Code"), "show_form_ui", CTRL+Key_U, m_manager, TQ_SLOT(showFormUICode()),
156// guiClient()->actionCollection(), "show_form_ui");
157}
158
159void KexiFormPart::initInstanceActions()
160{
161#ifdef KEXI_DEBUG_GUI
162 kapp->config()->setGroup("General");
163 if (kapp->config()->readBoolEntry("showInternalDebugger", false)) {
164 new TDEAction(i18n("Show Form UI Code"), "compfile",
165 CTRL+Key_U, KFormDesigner::FormManager::self(), TQ_SLOT(showFormUICode()),
166 actionCollectionForMode(Kexi::DesignViewMode), "show_form_ui");
167 }
168#endif
169
170 TDEActionCollection *col = actionCollectionForMode(Kexi::DesignViewMode);
171 KFormDesigner::FormManager::self()->createActions( library(), col, (KXMLGUIClient*)col->parentGUIClient() ); //guiClient() );
172
173 //connect actions provided by widget factories
174 connect( col->action("widget_assign_action"), TQ_SIGNAL(activated()), this, TQ_SLOT(slotAssignAction()));
175
176 createSharedAction(Kexi::DesignViewMode, i18n("Clear Widget Contents"), "edit-clear", 0, "formpart_clear_contents");
177 createSharedAction(Kexi::DesignViewMode, i18n("Edit Tab Order..."), "tab_order", 0, "formpart_taborder");
178//TODO createSharedAction(Kexi::DesignViewMode, i18n("Edit Pixmap Collection"), "icons", 0, "formpart_pixmap_collection");
179//TODO createSharedAction(Kexi::DesignViewMode, i18n("Edit Form Connections"), "connections", 0, "formpart_connections");
180
181// KFormDesigner::CreateLayoutCommand
182
183 TDEAction *action = createSharedAction(Kexi::DesignViewMode, i18n("Layout Widgets"), "", 0, "formpart_layout_menu", "TDEActionMenu");
184 TDEActionMenu *menu = static_cast<TDEActionMenu*>(action);
185
186 menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("&Horizontally"),
187 TQString(), 0, "formpart_layout_hbox"));
188 menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("&Vertically"),
189 TQString(), 0, "formpart_layout_vbox"));
190 menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("In &Grid"),
191 TQString(), 0, "formpart_layout_grid"));
192#ifdef KEXI_SHOW_SPLITTER_WIDGET
193 menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("Horizontally in &Splitter"),
194 TQString(), 0, "formpart_layout_hsplitter"));
195 menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("Verti&cally in Splitter"),
196 TQString(), 0, "formpart_layout_vsplitter"));
197#endif
198
199 createSharedAction(Kexi::DesignViewMode, i18n("&Break Layout"), TQString(), 0, "formpart_break_layout");
200/*
201 createSharedAction(Kexi::DesignViewMode, i18n("Lay Out Widgets &Horizontally"), TQString(), 0, "formpart_layout_hbox");
202 createSharedAction(Kexi::DesignViewMode, i18n("Lay Out Widgets &Vertically"), TQString(), 0, "formpart_layout_vbox");
203 createSharedAction(Kexi::DesignViewMode, i18n("Lay Out Widgets in &Grid"), TQString(), 0, "formpart_layout_grid");
204*/
205 createSharedAction(Kexi::DesignViewMode, i18n("Bring Widget to Front"), "raise", 0, "formpart_format_raise");
206 createSharedAction(Kexi::DesignViewMode, i18n("Send Widget to Back"), "lower", 0, "formpart_format_lower");
207
208#ifndef KEXI_NO_UNFINISHED
209 action = createSharedAction(Kexi::DesignViewMode, i18n("Other Widgets"), "", 0, "other_widgets_menu", "TDEActionMenu");
210#endif
211
212 action = createSharedAction(Kexi::DesignViewMode, i18n("Align Widgets Position"), "aoleft", 0, "formpart_align_menu", "TDEActionMenu");
213 menu = static_cast<TDEActionMenu*>(action);
214 menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Left"), "aoleft", 0, "formpart_align_to_left") );
215 menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Right"), "aoright", 0, "formpart_align_to_right") );
216 menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Top"), "aotop", 0, "formpart_align_to_top") );
217 menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Bottom"), "aobottom", 0, "formpart_align_to_bottom") );
218 menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Grid"), "aopos2grid", 0, "formpart_align_to_grid") );
219
220 action = createSharedAction(Kexi::DesignViewMode, i18n("Adjust Widgets Size"), "aogrid", 0, "formpart_adjust_size_menu", "TDEActionMenu");
221 menu = static_cast<TDEActionMenu*>(action);
222 menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Fit"), "aofit", 0, "formpart_adjust_to_fit") );
223 menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Grid"), "aogrid", 0, "formpart_adjust_size_grid") );
224 menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Shortest"), "aoshortest", 0, "formpart_adjust_height_small") );
225 menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Tallest"), "aotallest", 0, "formpart_adjust_height_big") );
226 menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Narrowest"), "aonarrowest", 0, "formpart_adjust_width_small") );
227 menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Widest"), "aowidest", 0, "formpart_adjust_width_big") );
228}
229
232{
233 return new KexiFormPart::TempData(dialog);
234}
235
237 KexiPart::Item &item, int viewMode, TQMap<TQString,TQString>*)
238{
239 Q_UNUSED( viewMode );
240
241 kexipluginsdbg << "KexiFormPart::createView()" << endl;
242 KexiMainWindow *win = dialog->mainWin();
243 if (!win || !win->project() || !win->project()->dbConnection())
244 return 0;
245
246 KexiFormView *view = new KexiFormView(win, parent, item.name().latin1(),
247 win->project()->dbConnection() );
248
249 return view;
250}
251
252void
254{
255 //this form generates a .ui from FieldList list
256 //basically that is a Label and a LineEdit for each field
257 domDoc = TQDomDocument("UI");
258 TQDomElement uiElement = domDoc.createElement("UI");
259 domDoc.appendChild(uiElement);
260 uiElement.setAttribute("version", "3.1");
261 uiElement.setAttribute("stdsetdef", 1);
262
263 TQDomElement baseClass = domDoc.createElement("class");
264 uiElement.appendChild(baseClass);
265 TQDomText baseClassV = domDoc.createTextNode("TQWidget");
266 baseClass.appendChild(baseClassV);
267 TQDomElement baseWidget = domDoc.createElement("widget");
268 baseWidget.setAttribute("class", "TQWidget");
269
270 int y=0;
271
272 for(unsigned int i=0; i < list->fieldCount(); i++)
273 {
274 TQDomElement lclass = domDoc.createElement("widget");
275 baseWidget.appendChild(lclass);
276 lclass.setAttribute("class", "TQLabel");
277 TQDomElement lNameProperty = domDoc.createElement("property");
278 lNameProperty.setAttribute("name", "name");
279 TQDomElement lType = domDoc.createElement("cstring");
280 TQDomText lClassN = domDoc.createTextNode(TQString("l%1").arg(list->field(i)->name()));
281 lType.appendChild(lClassN);
282 lNameProperty.appendChild(lType);
283 lclass.appendChild(lNameProperty);
284
285 TQDomElement gNameProperty = domDoc.createElement("property");
286 gNameProperty.setAttribute("name", "geometry");
287 TQDomElement lGType = domDoc.createElement("rect");
288
289 TQDomElement lx = domDoc.createElement("x");
290 TQDomText lxV = domDoc.createTextNode("10");
291 lx.appendChild(lxV);
292 TQDomElement ly = domDoc.createElement("y");
293 TQDomText lyV = domDoc.createTextNode(TQString::number(y + 10));
294 ly.appendChild(lyV);
295 TQDomElement lWidth = domDoc.createElement("width");
296 TQDomText lWidthV = domDoc.createTextNode("100");
297 lWidth.appendChild(lWidthV);
298 TQDomElement lHeight = domDoc.createElement("height");
299 TQDomText lHeightV = domDoc.createTextNode("20");
300 lHeight.appendChild(lHeightV);
301
302 lGType.appendChild(lx);
303 lGType.appendChild(ly);
304 lGType.appendChild(lWidth);
305 lGType.appendChild(lHeight);
306
307 gNameProperty.appendChild(lGType);
308 lclass.appendChild(gNameProperty);
309
310 TQDomElement tNameProperty = domDoc.createElement("property");
311 tNameProperty.setAttribute("name", "text");
312 TQDomElement lTType = domDoc.createElement("string");
313 TQDomText lTextV = domDoc.createTextNode(list->field(i)->name());
314 lTType.appendChild(lTextV);
315 tNameProperty.appendChild(lTType);
316 lclass.appendChild(tNameProperty);
317
318
320
321
322 TQDomElement vclass = domDoc.createElement("widget");
323 baseWidget.appendChild(vclass);
324 vclass.setAttribute("class", "KLineEdit");
325 TQDomElement vNameProperty = domDoc.createElement("property");
326 vNameProperty.setAttribute("name", "name");
327 TQDomElement vType = domDoc.createElement("cstring");
328 TQDomText vClassN = domDoc.createTextNode(list->field(i)->name());
329 vType.appendChild(vClassN);
330 vNameProperty.appendChild(vType);
331 vclass.appendChild(vNameProperty);
332
333 TQDomElement vgNameProperty = domDoc.createElement("property");
334 vgNameProperty.setAttribute("name", "geometry");
335 TQDomElement vGType = domDoc.createElement("rect");
336
337 TQDomElement vx = domDoc.createElement("x");
338 TQDomText vxV = domDoc.createTextNode("110");
339 vx.appendChild(vxV);
340 TQDomElement vy = domDoc.createElement("y");
341 TQDomText vyV = domDoc.createTextNode(TQString::number(y + 10));
342 vy.appendChild(vyV);
343 TQDomElement vWidth = domDoc.createElement("width");
344 TQDomText vWidthV = domDoc.createTextNode("200");
345 vWidth.appendChild(vWidthV);
346 TQDomElement vHeight = domDoc.createElement("height");
347 TQDomText vHeightV = domDoc.createTextNode("20");
348 vHeight.appendChild(vHeightV);
349
350 vGType.appendChild(vx);
351 vGType.appendChild(vy);
352 vGType.appendChild(vWidth);
353 vGType.appendChild(vHeight);
354
355 vgNameProperty.appendChild(vGType);
356 vclass.appendChild(vgNameProperty);
357
358 y += 20;
359 }
360
361 TQDomElement lNameProperty = domDoc.createElement("property");
362 lNameProperty.setAttribute("name", "name");
363 TQDomElement lType = domDoc.createElement("cstring");
364 TQDomText lClassN = domDoc.createTextNode("DBForm");
365 lType.appendChild(lClassN);
366 lNameProperty.appendChild(lType);
367 baseWidget.appendChild(lNameProperty);
368
369 TQDomElement wNameProperty = domDoc.createElement("property");
370 wNameProperty.setAttribute("name", "geometry");
371 TQDomElement wGType = domDoc.createElement("rect");
372
373 TQDomElement wx = domDoc.createElement("x");
374 TQDomText wxV = domDoc.createTextNode("0");
375 wx.appendChild(wxV);
376 TQDomElement wy = domDoc.createElement("y");
377 TQDomText wyV = domDoc.createTextNode("0");
378 wy.appendChild(wyV);
379 TQDomElement wWidth = domDoc.createElement("width");
380 TQDomText wWidthV = domDoc.createTextNode("340");
381 wWidth.appendChild(wWidthV);
382 TQDomElement wHeight = domDoc.createElement("height");
383 TQDomText wHeightV = domDoc.createTextNode(TQString::number(y + 30));
384 wHeight.appendChild(wHeightV);
385
386 wGType.appendChild(wx);
387 wGType.appendChild(wy);
388 wGType.appendChild(wWidth);
389 wGType.appendChild(wHeight);
390
391 wNameProperty.appendChild(wGType);
392 baseWidget.appendChild(wNameProperty);
393
394 uiElement.appendChild(baseWidget);
395}
396
397void KexiFormPart::slotAutoTabStopsSet(KFormDesigner::Form *form, bool set)
398{
399 Q_UNUSED( form );
400
401 KoProperty::Property &p = (*KFormDesigner::FormManager::self()->propertySet())["autoTabStops"];
402 if (!p.isNull())
403 p.setValue(TQVariant(set));
404}
405
406void KexiFormPart::slotAssignAction()
407{
408 KexiDBForm *dbform;
409 if (!KFormDesigner::FormManager::self()->activeForm() || !KFormDesigner::FormManager::self()->activeForm()->designMode()
410 || !(dbform = dynamic_cast<KexiDBForm*>(KFormDesigner::FormManager::self()->activeForm()->formWidget())))
411 return;
412
413 KFormDesigner::WidgetPropertySet * propSet = KFormDesigner::FormManager::self()->propertySet();
414
415 KoProperty::Property &onClickActionProp = propSet->property("onClickAction");
416 if (onClickActionProp.isNull())
417 return;
418 KoProperty::Property &onClickActionOptionProp = propSet->property("onClickActionOption");
420 data.string = onClickActionProp.value().toString();
421 if (!onClickActionOptionProp.isNull())
422 data.option = onClickActionOptionProp.value().toString();
423
424 KexiFormScrollView *scrollViewWidget = dynamic_cast<KexiFormScrollView*>(dbform->dataAwareObject());
425 if (!scrollViewWidget)
426 return;
427 KexiFormView* formViewWidget = dynamic_cast<KexiFormView*>(scrollViewWidget->parent());
428 if (!formViewWidget)
429 return;
430
431 KexiMainWindow * mainWin = formViewWidget->parentDialog()->mainWin();
432 KexiActionSelectionDialog dlg(mainWin, dbform, data,
433 propSet->property("name").value().toCString());
434
435 if(dlg.exec() == TQDialog::Accepted) {
436 data = dlg.currentAction();
437 //update property value
438 propSet->property("onClickAction").setValue(data.string);
439 propSet->property("onClickActionOption").setValue(data.option);
440 }
441}
442
443TQString
444KexiFormPart::i18nMessage(const TQCString& englishMessage, KexiDialogBase* dlg) const
445{
446 Q_UNUSED(dlg);
447 if (englishMessage=="Design of object \"%1\" has been modified.")
448 return i18n("Design of form \"%1\" has been modified.");
449 if (englishMessage=="Object \"%1\" already exists.")
450 return i18n("Form \"%1\" already exists.");
451
452 return englishMessage;
453}
454
455void
456KexiFormPart::slotPropertyChanged(TQWidget *w, const TQCString &name, const TQVariant &value)
457{
458 Q_UNUSED( w );
459
460 if (!KFormDesigner::FormManager::self()->activeForm())
461 return;
462 if (name == "autoTabStops") {
463 //TQWidget *w = KFormDesigner::FormManager::self()->activeForm()->selectedWidget();
464 //update autoTabStops setting at KFD::Form level
466 }
467 if (KFormDesigner::FormManager::self()->activeForm()->widget() && name == "geometry") {
468 //fall back to sizeInternal property....
469 if (KFormDesigner::FormManager::self()->propertySet()->contains("sizeInternal"))
470 KFormDesigner::FormManager::self()->propertySet()->property("sizeInternal").setValue(TQSize(value.toRect().size()));
471 }
472}
473
474/*KFormDesigner::FormManager*
475KexiFormPart::manager() const
476{
477 return d->manager;
478}*/
479
480KexiDataSourcePage* KexiFormPart::dataSourcePage() const
481{
482 return d->dataSourcePage;
483}
484
486{
487 if (!d->objectTreeView) {
488 d->objectTreeView = new KFormDesigner::ObjectTreeView(0, "KexiFormPart:ObjectTreeView");
489 KFormDesigner::FormManager::self()->setObjectTreeView(d->objectTreeView); //important: assign to manager
490 d->dataSourcePage = new KexiDataSourcePage(0, "dataSourcePage");
491 connect(d->dataSourcePage, TQ_SIGNAL(jumpToObjectRequested(const TQCString&, const TQCString&)),
492 mainWin, TQ_SLOT(highlightObject(const TQCString&, const TQCString&)));
493 connect(d->dataSourcePage, TQ_SIGNAL(formDataSourceChanged(const TQCString&, const TQCString&)),
494 KFormDesigner::FormManager::self(), TQ_SLOT(setFormDataSource(const TQCString&, const TQCString&)));
495 connect(d->dataSourcePage, TQ_SIGNAL(dataSourceFieldOrExpressionChanged(const TQString&, const TQString&, KexiDB::Field::Type)),
496 KFormDesigner::FormManager::self(), TQ_SLOT(setDataSourceFieldOrExpression(const TQString&, const TQString&, KexiDB::Field::Type)));
497 connect(d->dataSourcePage, TQ_SIGNAL(insertAutoFields(const TQString&, const TQString&, const TQStringList&)),
498 KFormDesigner::FormManager::self(), TQ_SLOT(insertAutoFields(const TQString&, const TQString&, const TQStringList&)));
499 }
500
501 KexiProject *prj = mainWin->project();
502 d->dataSourcePage->setProject(prj);
503
504 tab->addTab( d->dataSourcePage, SmallIconSet("application-vnd.oasis.opendocument.database"), "");
505 tab->setTabToolTip( d->dataSourcePage, i18n("Data Source"));
506
507 tab->addTab( d->objectTreeView, SmallIconSet("widgets"), "");
508 tab->setTabToolTip( d->objectTreeView, i18n("Widgets"));
509}
510
511void KexiFormPart::slotWidgetCreatedByFormsLibrary(TQWidget* widget)
512{
513 TQStrList signalNames(widget->metaObject()->signalNames());
514 if (!signalNames.isEmpty()) {
515 const char *handleDragMoveEventSignal = "handleDragMoveEvent(TQDragMoveEvent*)";
516 const char *handleDropEventSignal = "handleDropEvent(TQDropEvent*)";
517
518 for (TQStrListIterator it(signalNames); it.current(); ++it) {
519 if (0==qstrcmp(it.current(), handleDragMoveEventSignal)) {
520 kdDebug() << it.current() << endl;
521 KexiFormView *formView = KexiUtils::findParent<KexiFormView>(widget, "KexiFormView");
522 if (formView) {
523 connect(widget, TQ_SIGNAL(handleDragMoveEvent(TQDragMoveEvent*)),
524 formView, TQ_SLOT(slotHandleDragMoveEvent(TQDragMoveEvent*)));
525 }
526 }
527 else if (0==qstrcmp(it.current(), handleDropEventSignal)) {
528 kdDebug() << it.current() << endl;
529 KexiFormView *formView = KexiUtils::findParent<KexiFormView>(widget, "KexiFormView");
530 if (formView) {
531 connect(widget, TQ_SIGNAL(handleDropEvent(TQDropEvent*)),
532 formView, TQ_SLOT(slotHandleDropEvent(TQDropEvent*)));
533 }
534 }
535 }
536 }
537}
538
539//----------------
540
541KexiFormPart::TempData::TempData(TQObject* parent)
542 : KexiDialogTempData(parent)
543{
544}
545
546KexiFormPart::TempData::~TempData()
547{
548}
549
550#include "kexiformpart.moc"
A class to manage (create/load/save) Forms.
Definition formmanager.h:73
static FormManager * self()
Access to FormManager singleton.
WidgetPropertySet * propertySet() const
void setObjectTreeView(ObjectTreeView *treeview)
static WidgetLibrary * createWidgetLibrary(FormManager *m, const TQStringList &supportedFactoryGroups)
Creates widget library for supportedFactoryGroups and initializes FormManager singleton.
ActionList createActions(WidgetLibrary *lib, TDEActionCollection *collection, KXMLGUIClient *client)
A simple class representing a form.
Definition form.h:136
void setAutoTabStops(bool autoTab)
Definition form.h:286
A graphical view of Form's ObjectTree. This is a TDEListView which represents an item for each widget...
This class searches for factories and provides TDEActions for widget creation.
A dialog for selecting an action to be executed for a form's command button.
A DB-aware form widget, acting as form's toplevel widget.
Definition kexidbform.h:44
uint fieldCount() const
Definition fieldlist.h:58
Field * field(uint id)
Definition fieldlist.h:76
A combo box listing availabe data sources (tables and queries) with icons.
A page within form designer's property tabbed pane, providing data source editor.
Base class for child window of Kexi's main application window.
Privides temporary data shared between KexiDialogBase's views (KexiView's)
A structure used in currentActionName()
TQString option
option used when name is "table/query/etc.:<objectName>" is set;
TQString string
action string with prefix, like "tdeaction:edit_copy" or "table:<tableName>"
static KFormDesigner::WidgetLibrary * static_formsLibrary
virtual KexiViewBase * createView(TQWidget *parent, KexiDialogBase *dialog, KexiPart::Item &item, int viewMode=Kexi::DataViewMode, TQMap< TQString, TQString > *staticObjectArgs=0)
virtual TQString i18nMessage(const TQCString &englishMessage, KexiDialogBase *dlg) const
virtual KexiDialogTempData * createTempData(KexiDialogBase *dialog)
virtual void setupCustomPropertyPanelTabs(KTabWidget *tab, KexiMainWindow *mainWin)
static KFormDesigner::WidgetLibrary * library()
void generateForm(KexiDB::FieldList *list, TQDomDocument &domDoc)
KexiFormScrollView class provides a widget for displaying data in a form view.
The KexiFormView lass provides a data-driven (record-based) form view .
Kexi's main window interface This interface is implemented by KexiMainWindowImpl class.
virtual KexiProject * project()=0
Project data of currently opened project or NULL if no project here yet.
Information about a single object that can be instantiated using Kexi Part.
TDEAction * createSharedAction(int mode, const TQString &text, const TQString &pix_name, const TDEShortcut &cut, const char *name, const char *subclassName=0)
Definition kexipart.cpp:170
TDEActionCollection * actionCollectionForMode(int viewMode) const
Definition kexipart.cpp:164
A project's main controller.
Definition kexiproject.h:68
KexiDB::Connection * dbConnection() const
Base class for single view embeddable of in KexiDialogBase.
KexiDialogBase * parentDialog() const
type * findParent(TQObject *o, const char *className)