kexi

kexiformpart.cpp

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Lucijan Busch <lucijan@kde.org>
00003    Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
00004    Copyright (C) 2005 Jaroslaw Staniek <js@iidea.pl>
00005 
00006    This library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Library General Public
00008    License as published by the Free Software Foundation; either
00009    version 2 of the License, or (at your option) any later version.
00010 
00011    This library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Library General Public License for more details.
00015 
00016    You should have received a copy of the GNU Library General Public License
00017    along with this library; see the file COPYING.LIB.  If not, write to
00018    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020 */
00021 
00022 #include <kdebug.h>
00023 #include <kgenericfactory.h>
00024 #include <kdialogbase.h>
00025 #include <klistview.h>
00026 #include <ktabwidget.h>
00027 #include <kiconloader.h>
00028 #include <kcombobox.h>
00029 
00030 #include <kexiviewbase.h>
00031 #include <keximainwindow.h>
00032 #include <kexiproject.h>
00033 #include <kexipartitem.h>
00034 #include <kexidialogbase.h>
00035 #include <kexidatasourcecombobox.h>
00036 #include <kexidb/connection.h>
00037 #include <kexidb/fieldlist.h>
00038 #include <kexidb/field.h>
00039 
00040 #include <form.h>
00041 #include <formIO.h>
00042 #include <widgetpropertyset.h>
00043 #include <widgetlibrary.h>
00044 #include <objecttreeview.h>
00045 #include <koproperty/property.h>
00046 
00047 #include "kexiformview.h"
00048 #include "widgets/kexidbform.h"
00049 #include "kexiformscrollview.h"
00050 #include "kexiactionselectiondialog.h"
00051 #include "kexiformmanager.h"
00052 #include "kexiformpart.h"
00053 #include "kexidatasourcepage.h"
00054 
00056 
00057 KFormDesigner::WidgetLibrary* KexiFormPart::static_formsLibrary = 0L;
00058 
00060 class KexiFormPart::Private
00061 {
00062     public:
00063         Private()
00064         {
00065         }
00066         ~Private()
00067         {
00068             delete static_cast<KFormDesigner::ObjectTreeView*>(objectTreeView);
00069             delete static_cast<KexiDataSourcePage*>(dataSourcePage);
00070         }
00071 //      QGuardedPtr<KFormDesigner::FormManager> manager;
00072         QGuardedPtr<KFormDesigner::ObjectTreeView> objectTreeView;
00073         QGuardedPtr<KexiDataSourcePage> dataSourcePage;
00074         KexiDataSourceComboBox *dataSourceCombo;
00075 };
00076 
00077 KexiFormPart::KexiFormPart(QObject *parent, const char *name, const QStringList &l)
00078  : KexiPart::Part(parent, name, l)
00079  , d(new Private())
00080 {
00081     // REGISTERED ID:
00082     m_registeredPartID = (int)KexiPart::FormObjectType;
00083 
00084     kexipluginsdbg << "KexiFormPart::KexiFormPart()" << endl;
00085     m_names["instanceName"]
00086         = i18n("Translate this word using only lowercase alphanumeric characters (a..z, 0..9). "
00087         "Use '_' character instead of spaces. First character should be a..z character. "
00088         "If you cannot use latin characters in your language, use english word.",
00089         "form");
00090     m_names["instanceCaption"] = i18n("Form");
00091     m_supportedViewModes = Kexi::DataViewMode | Kexi::DesignViewMode;
00092     m_newObjectsAreDirty = true;
00093 
00094     // Only create form manager if it's not yet created.
00095     // KexiReportPart could have created is already.
00096     KFormDesigner::FormManager *formManager = KFormDesigner::FormManager::self();
00097     if (!formManager)
00098         formManager = new KexiFormManager(this, "kexi_form_and_report_manager");
00099 
00100     // Create and store a handle to forms' library. Reports will have their own library too.
00101 /* @todo add configuration for supported factory groups */
00102     QStringList supportedFactoryGroups;
00103     supportedFactoryGroups += "kexi";
00104     static_formsLibrary = KFormDesigner::FormManager::createWidgetLibrary(
00105         formManager, supportedFactoryGroups);
00106     static_formsLibrary->setAdvancedPropertiesVisible(false);
00107 
00108     connect(KFormDesigner::FormManager::self()->propertySet(), SIGNAL(widgetPropertyChanged(QWidget *, const QCString &, const QVariant&)),
00109         this, SLOT(slotPropertyChanged(QWidget *, const QCString &, const QVariant&)));
00110     connect(KFormDesigner::FormManager::self(), SIGNAL(autoTabStopsSet(KFormDesigner::Form*,bool)),
00111         this, SLOT(slotAutoTabStopsSet(KFormDesigner::Form*,bool)));
00112 }
00113 
00114 KexiFormPart::~KexiFormPart()
00115 {
00116     delete d;
00117 }
00118 
00119 KFormDesigner::WidgetLibrary* KexiFormPart::library()
00120 {
00121     return static_formsLibrary;
00122 }
00123 
00124 #if 0
00125 void KexiFormPart::initPartActions(KActionCollection *collection)
00126 {
00127 //this is automatic? -no
00128 //create child guicilent: guiClient()->setXMLFile("kexidatatableui.rc");
00129 
00130     kexipluginsdbg<<"FormPart INIT ACTIONS***********************************************************************"<<endl;
00131     //TODO
00132 
00133     //guiClient()->setXMLFile("kexiformui.rc");
00134 //js    m_manager->createActions(collection, 0);
00135 }
00136 
00137 void KexiFormPart::initInstanceActions( int mode, KActionCollection *col )
00138 {
00139     if (mode==Kexi::DesignViewMode) {
00140         KFormDesigner::FormManager::self()->createActions(col, 0);
00141         new KAction(i18n("Edit Tab Order..."), "tab_order", KShortcut(0), KFormDesigner::FormManager::self(), SLOT(editTabOrder()), col, "taborder");
00142         new KAction(i18n("Adjust Size"), "viewmagfit", KShortcut(0), KFormDesigner::FormManager::self(), SLOT(ajustWidgetSize()), col, "adjust");
00143     }
00144     //TODO
00145 }
00146 #endif
00147 
00148 void KexiFormPart::initPartActions()
00149 {
00150 //  new KAction(i18n("Show Form UI Code"), "show_form_ui", CTRL+Key_U, m_manager, SLOT(showFormUICode()),
00151 //      guiClient()->actionCollection(), "show_form_ui");
00152 }
00153 
00154 void KexiFormPart::initInstanceActions()
00155 {
00156 #ifdef KEXI_SHOW_DEBUG_ACTIONS
00157     new KAction(i18n("Show Form UI Code"), "compfile", CTRL+Key_U, KFormDesigner::FormManager::self(), SLOT(showFormUICode()),
00158         actionCollectionForMode(Kexi::DesignViewMode), "show_form_ui");
00159 #endif
00160 
00161     KActionCollection *col = actionCollectionForMode(Kexi::DesignViewMode);
00162     KFormDesigner::FormManager::self()->createActions( library(), col, (KXMLGUIClient*)col->parentGUIClient() ); //guiClient() );
00163 
00164     //connect actions provided by widget factories
00165     connect( col->action("widget_assign_action"), SIGNAL(activated()), this, SLOT(slotAssignAction()));
00166 
00167     createSharedAction(Kexi::DesignViewMode, i18n("Clear Widget Contents"), "editclear", 0, "formpart_clear_contents");
00168     createSharedAction(Kexi::DesignViewMode, i18n("Edit Tab Order..."), "tab_order", 0, "formpart_taborder");
00169 //TODO  createSharedAction(Kexi::DesignViewMode, i18n("Edit Pixmap Collection"), "icons", 0, "formpart_pixmap_collection");
00170 //TODO  createSharedAction(Kexi::DesignViewMode, i18n("Edit Form Connections"), "connections", 0, "formpart_connections");
00171 
00172 //  KFormDesigner::CreateLayoutCommand
00173 
00174     KAction *action = createSharedAction(Kexi::DesignViewMode, i18n("Layout Widgets"), "", 0, "formpart_layout_menu", "KActionMenu");
00175     KActionMenu *menu = static_cast<KActionMenu*>(action);
00176 
00177     menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("&Horizontally"),
00178         QString::null, 0, "formpart_layout_hbox"));
00179     menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("&Vertically"),
00180         QString::null, 0, "formpart_layout_vbox"));
00181     menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("In &Grid"),
00182         QString::null, 0, "formpart_layout_grid"));
00183 #ifdef KEXI_SHOW_SPLITTER_WIDGET
00184     menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("Horizontally in &Splitter"),
00185         QString::null, 0, "formpart_layout_hsplitter"));
00186     menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("Verti&cally in Splitter"),
00187         QString::null, 0, "formpart_layout_vsplitter"));
00188 #endif
00189 
00190     createSharedAction(Kexi::DesignViewMode, i18n("&Break Layout"), QString::null, 0, "formpart_break_layout");
00191 /*
00192     createSharedAction(Kexi::DesignViewMode, i18n("Lay Out Widgets &Horizontally"), QString::null, 0, "formpart_layout_hbox");
00193     createSharedAction(Kexi::DesignViewMode, i18n("Lay Out Widgets &Vertically"), QString::null, 0, "formpart_layout_vbox");
00194     createSharedAction(Kexi::DesignViewMode, i18n("Lay Out Widgets in &Grid"), QString::null, 0, "formpart_layout_grid");
00195 */
00196     createSharedAction(Kexi::DesignViewMode, i18n("Bring Widget to Front"), "raise", 0, "formpart_format_raise");
00197     createSharedAction(Kexi::DesignViewMode, i18n("Send Widget to Back"), "lower", 0, "formpart_format_lower");
00198 
00199 #ifndef KEXI_NO_UNFINISHED
00200     action = createSharedAction(Kexi::DesignViewMode, i18n("Other Widgets"), "", 0, "other_widgets_menu", "KActionMenu");
00201 #endif
00202 
00203     action = createSharedAction(Kexi::DesignViewMode, i18n("Align Widgets Position"), "aoleft", 0, "formpart_align_menu", "KActionMenu");
00204     menu = static_cast<KActionMenu*>(action);
00205     menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Left"), "aoleft", 0, "formpart_align_to_left") );
00206     menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Right"), "aoright", 0, "formpart_align_to_right") );
00207     menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Top"), "aotop", 0, "formpart_align_to_top") );
00208     menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Bottom"), "aobottom", 0, "formpart_align_to_bottom") );
00209     menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Grid"), "aopos2grid", 0, "formpart_align_to_grid") );
00210 
00211     action = createSharedAction(Kexi::DesignViewMode, i18n("Adjust Widgets Size"), "aogrid", 0, "formpart_adjust_size_menu", "KActionMenu");
00212     menu = static_cast<KActionMenu*>(action);
00213     menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Fit"), "aofit", 0, "formpart_adjust_to_fit") );
00214     menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Grid"), "aogrid", 0, "formpart_adjust_size_grid") );
00215     menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Shortest"), "aoshortest", 0, "formpart_adjust_height_small") );
00216     menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Tallest"), "aotallest", 0, "formpart_adjust_height_big") );
00217     menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Narrowest"), "aonarrowest", 0, "formpart_adjust_width_small") );
00218     menu->insert( createSharedAction(Kexi::DesignViewMode, i18n("To Widest"), "aowidest", 0, "formpart_adjust_width_big") );
00219 }
00220 
00221 KexiDialogTempData*
00222 KexiFormPart::createTempData(KexiDialogBase* dialog)
00223 {
00224     return new KexiFormPart::TempData(dialog);
00225 }
00226 
00227 KexiViewBase* KexiFormPart::createView(QWidget *parent, KexiDialogBase* dialog,
00228     KexiPart::Item &item, int viewMode, QMap<QString,QString>*)
00229 {
00230     Q_UNUSED( viewMode );
00231 
00232     kexipluginsdbg << "KexiFormPart::createView()" << endl;
00233     KexiMainWindow *win = dialog->mainWin();
00234     if (!win || !win->project() || !win->project()->dbConnection())
00235         return 0;
00236 
00237     KexiFormView *view = new KexiFormView(win, parent, item.name().latin1(),
00238         win->project()->dbConnection() );
00239 
00240     return view;
00241 }
00242 
00243 void
00244 KexiFormPart::generateForm(KexiDB::FieldList *list, QDomDocument &domDoc)
00245 {
00246     //this form generates a .ui from FieldList list
00247     //basically that is a Label and a LineEdit for each field
00248     domDoc = QDomDocument("UI");
00249         QDomElement uiElement = domDoc.createElement("UI");
00250     domDoc.appendChild(uiElement);
00251     uiElement.setAttribute("version", "3.1");
00252     uiElement.setAttribute("stdsetdef", 1);
00253 
00254     QDomElement baseClass = domDoc.createElement("class");
00255     uiElement.appendChild(baseClass);
00256     QDomText baseClassV = domDoc.createTextNode("QWidget");
00257     baseClass.appendChild(baseClassV);
00258     QDomElement baseWidget = domDoc.createElement("widget");
00259     baseWidget.setAttribute("class", "QWidget");
00260 
00261     int y=0;
00262 
00263     for(unsigned int i=0; i < list->fieldCount(); i++)
00264     {
00265         QDomElement lclass = domDoc.createElement("widget");
00266         baseWidget.appendChild(lclass);
00267         lclass.setAttribute("class", "QLabel");
00268         QDomElement lNameProperty = domDoc.createElement("property");
00269         lNameProperty.setAttribute("name", "name");
00270         QDomElement lType = domDoc.createElement("cstring");
00271         QDomText lClassN = domDoc.createTextNode(QString("l%1").arg(list->field(i)->name()));
00272         lType.appendChild(lClassN);
00273         lNameProperty.appendChild(lType);
00274         lclass.appendChild(lNameProperty);
00275 
00276         QDomElement gNameProperty = domDoc.createElement("property");
00277         gNameProperty.setAttribute("name", "geometry");
00278         QDomElement lGType = domDoc.createElement("rect");
00279 
00280         QDomElement lx = domDoc.createElement("x");
00281         QDomText lxV = domDoc.createTextNode("10");
00282         lx.appendChild(lxV);
00283         QDomElement ly = domDoc.createElement("y");
00284         QDomText lyV = domDoc.createTextNode(QString::number(y + 10));
00285         ly.appendChild(lyV);
00286         QDomElement lWidth = domDoc.createElement("width");
00287         QDomText lWidthV = domDoc.createTextNode("100");
00288         lWidth.appendChild(lWidthV);
00289         QDomElement lHeight = domDoc.createElement("height");
00290         QDomText lHeightV = domDoc.createTextNode("20");
00291         lHeight.appendChild(lHeightV);
00292 
00293         lGType.appendChild(lx);
00294         lGType.appendChild(ly);
00295         lGType.appendChild(lWidth);
00296         lGType.appendChild(lHeight);
00297 
00298         gNameProperty.appendChild(lGType);
00299         lclass.appendChild(gNameProperty);
00300 
00301         QDomElement tNameProperty = domDoc.createElement("property");
00302         tNameProperty.setAttribute("name", "text");
00303         QDomElement lTType = domDoc.createElement("string");
00304         QDomText lTextV = domDoc.createTextNode(list->field(i)->name());
00305         lTType.appendChild(lTextV);
00306         tNameProperty.appendChild(lTType);
00307         lclass.appendChild(tNameProperty);
00308 
00309 
00311 
00312 
00313         QDomElement vclass = domDoc.createElement("widget");
00314         baseWidget.appendChild(vclass);
00315         vclass.setAttribute("class", "KLineEdit");
00316         QDomElement vNameProperty = domDoc.createElement("property");
00317         vNameProperty.setAttribute("name", "name");
00318         QDomElement vType = domDoc.createElement("cstring");
00319         QDomText vClassN = domDoc.createTextNode(list->field(i)->name());
00320         vType.appendChild(vClassN);
00321         vNameProperty.appendChild(vType);
00322         vclass.appendChild(vNameProperty);
00323 
00324         QDomElement vgNameProperty = domDoc.createElement("property");
00325         vgNameProperty.setAttribute("name", "geometry");
00326         QDomElement vGType = domDoc.createElement("rect");
00327 
00328         QDomElement vx = domDoc.createElement("x");
00329         QDomText vxV = domDoc.createTextNode("110");
00330         vx.appendChild(vxV);
00331         QDomElement vy = domDoc.createElement("y");
00332         QDomText vyV = domDoc.createTextNode(QString::number(y + 10));
00333         vy.appendChild(vyV);
00334         QDomElement vWidth = domDoc.createElement("width");
00335         QDomText vWidthV = domDoc.createTextNode("200");
00336         vWidth.appendChild(vWidthV);
00337         QDomElement vHeight = domDoc.createElement("height");
00338         QDomText vHeightV = domDoc.createTextNode("20");
00339         vHeight.appendChild(vHeightV);
00340 
00341         vGType.appendChild(vx);
00342         vGType.appendChild(vy);
00343         vGType.appendChild(vWidth);
00344         vGType.appendChild(vHeight);
00345 
00346         vgNameProperty.appendChild(vGType);
00347         vclass.appendChild(vgNameProperty);
00348 
00349         y += 20;
00350     }
00351 
00352     QDomElement lNameProperty = domDoc.createElement("property");
00353     lNameProperty.setAttribute("name", "name");
00354     QDomElement lType = domDoc.createElement("cstring");
00355     QDomText lClassN = domDoc.createTextNode("DBForm");
00356     lType.appendChild(lClassN);
00357     lNameProperty.appendChild(lType);
00358     baseWidget.appendChild(lNameProperty);
00359 
00360     QDomElement wNameProperty = domDoc.createElement("property");
00361     wNameProperty.setAttribute("name", "geometry");
00362     QDomElement wGType = domDoc.createElement("rect");
00363 
00364     QDomElement wx = domDoc.createElement("x");
00365     QDomText wxV = domDoc.createTextNode("0");
00366     wx.appendChild(wxV);
00367     QDomElement wy = domDoc.createElement("y");
00368     QDomText wyV = domDoc.createTextNode("0");
00369     wy.appendChild(wyV);
00370     QDomElement wWidth = domDoc.createElement("width");
00371     QDomText wWidthV = domDoc.createTextNode("340");
00372     wWidth.appendChild(wWidthV);
00373     QDomElement wHeight = domDoc.createElement("height");
00374     QDomText wHeightV = domDoc.createTextNode(QString::number(y + 30));
00375     wHeight.appendChild(wHeightV);
00376 
00377     wGType.appendChild(wx);
00378     wGType.appendChild(wy);
00379     wGType.appendChild(wWidth);
00380     wGType.appendChild(wHeight);
00381 
00382     wNameProperty.appendChild(wGType);
00383     baseWidget.appendChild(wNameProperty);
00384 
00385     uiElement.appendChild(baseWidget);
00386 }
00387 
00388 void KexiFormPart::slotAutoTabStopsSet(KFormDesigner::Form *form, bool set)
00389 {
00390     Q_UNUSED( form );
00391 
00392     KoProperty::Property &p = (*KFormDesigner::FormManager::self()->propertySet())["autoTabStops"];
00393     if (!p.isNull())
00394         p.setValue(QVariant(set, 4));
00395 }
00396 
00397 void KexiFormPart::slotAssignAction()
00398 {
00399     KexiDBForm *dbform;
00400     if (!KFormDesigner::FormManager::self()->activeForm() || !KFormDesigner::FormManager::self()->activeForm()->designMode()
00401         || !(dbform = dynamic_cast<KexiDBForm*>(KFormDesigner::FormManager::self()->activeForm()->formWidget())))
00402         return;
00403 
00404     KoProperty::Property &onClickActionProp = KFormDesigner::FormManager::self()->propertySet()->property("onClickAction");
00405     if (onClickActionProp.isNull())
00406         return;
00407     QString onClickActionValue( onClickActionProp.value().toString() );
00408 
00409     KexiFormScrollView *scrollViewWidget = dynamic_cast<KexiFormScrollView*>(dbform->dataAwareObject());
00410     if (!scrollViewWidget)
00411         return;
00412     KexiFormView* formViewWidget = dynamic_cast<KexiFormView*>(scrollViewWidget->parent());
00413     if (!formViewWidget)
00414         return;
00415 
00416     KexiMainWindow * mainWin = formViewWidget->parentDialog()->mainWin();
00417     KexiActionSelectionDialog dlg(mainWin, dbform, onClickActionValue,
00418         KFormDesigner::FormManager::self()->propertySet()->property("name").value().toCString());
00419 
00420     if(dlg.exec() == QDialog::Accepted) {
00421         onClickActionValue = dlg.currentActionName();
00422         //update property value
00423         (*KFormDesigner::FormManager::self()->propertySet())["onClickAction"].setValue(onClickActionValue);
00424     }
00425 }
00426 
00427 QString
00428 KexiFormPart::i18nMessage(const QCString& englishMessage, KexiDialogBase* dlg) const
00429 {
00430     Q_UNUSED(dlg);
00431     if (englishMessage=="Design of object \"%1\" has been modified.")
00432         return i18n("Design of form \"%1\" has been modified.");
00433     if (englishMessage=="Object \"%1\" already exists.")
00434         return i18n("Form \"%1\" already exists.");
00435 
00436     return englishMessage;
00437 }
00438 
00439 void
00440 KexiFormPart::slotPropertyChanged(QWidget *w, const QCString &name, const QVariant &value)
00441 {
00442     Q_UNUSED( w );
00443 
00444     if (!KFormDesigner::FormManager::self()->activeForm())
00445         return;
00446     if (name == "autoTabStops") {
00447         //QWidget *w = KFormDesigner::FormManager::self()->activeForm()->selectedWidget();
00448         //update autoTabStops setting at KFD::Form level
00449         KFormDesigner::FormManager::self()->activeForm()->setAutoTabStops( value.toBool() );
00450     }
00451     if (KFormDesigner::FormManager::self()->activeForm()->widget() && name == "geometry") {
00452         //fall back to sizeInternal property....
00453         if (KFormDesigner::FormManager::self()->propertySet()->contains("sizeInternal"))
00454             KFormDesigner::FormManager::self()->propertySet()->property("sizeInternal").setValue(value.toRect().size());
00455     }
00456 }
00457 
00458 /*KFormDesigner::FormManager*
00459 KexiFormPart::manager() const
00460 {
00461     return d->manager;
00462 }*/
00463 
00464 KexiDataSourcePage* KexiFormPart::dataSourcePage() const
00465 {
00466     return d->dataSourcePage;
00467 }
00468 
00469 void KexiFormPart::setupCustomPropertyPanelTabs(KTabWidget *tab, KexiMainWindow* mainWin)
00470 {
00471     if (!d->objectTreeView) {
00472         d->objectTreeView = new KFormDesigner::ObjectTreeView(0, "KexiFormPart:ObjectTreeView");
00473         KFormDesigner::FormManager::self()->setObjectTreeView(d->objectTreeView); //important: assign to manager
00474         d->dataSourcePage = new KexiDataSourcePage(0, "dataSourcePage");
00475         connect(d->dataSourcePage, SIGNAL(jumpToObjectRequested(const QCString&, const QCString&)),
00476             mainWin, SLOT(highlightObject(const QCString&, const QCString&)));
00477         connect(d->dataSourcePage, SIGNAL(formDataSourceChanged(const QCString&, const QCString&)),
00478             KFormDesigner::FormManager::self(), SLOT(setFormDataSource(const QCString&, const QCString&)));
00479         connect(d->dataSourcePage, SIGNAL(dataSourceFieldOrExpressionChanged(const QString&, const QString&, KexiDB::Field::Type)),
00480             KFormDesigner::FormManager::self(), SLOT(setDataSourceFieldOrExpression(const QString&, const QString&, KexiDB::Field::Type)));
00481         connect(d->dataSourcePage, SIGNAL(insertAutoFields(const QString&, const QString&, const QStringList&)),
00482             KFormDesigner::FormManager::self(), SLOT(insertAutoFields(const QString&, const QString&, const QStringList&)));
00483     }
00484 
00485     KexiProject *prj = mainWin->project();
00486     d->dataSourcePage->setProject(prj);
00487 
00488     tab->addTab( d->dataSourcePage, SmallIconSet("database"), "");
00489     tab->setTabToolTip( d->dataSourcePage, i18n("Data Source"));
00490 
00491     tab->addTab( d->objectTreeView, SmallIconSet("widgets"), "");
00492     tab->setTabToolTip( d->objectTreeView, i18n("Widgets"));
00493 }
00494 
00495 //----------------
00496 
00497 KexiFormPart::TempData::TempData(QObject* parent)
00498  : KexiDialogTempData(parent)
00499 {
00500 }
00501 
00502 KexiFormPart::TempData::~TempData()
00503 {
00504 }
00505 
00506 #include "kexiformpart.moc"
KDE Home | KDE Accessibility Home | Description of Access Keys