00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #include <qpopupmenu.h>
00022 #include <qscrollview.h>
00023 #include <qcursor.h>
00024 #include <qpainter.h>
00025 #include <qstyle.h>
00026
00027 #include <kgenericfactory.h>
00028 #include <klocale.h>
00029 #include <kdebug.h>
00030 #include <kiconloader.h>
00031 #include <kactioncollection.h>
00032 #include <kstdaction.h>
00033
00034 #include <formeditor/container.h>
00035 #include <formeditor/form.h>
00036 #include <formeditor/formIO.h>
00037 #include <formeditor/formmanager.h>
00038 #include <formeditor/objecttree.h>
00039 #include <formeditor/utils.h>
00040 #include <kexidb/utils.h>
00041 #include <kexidb/connection.h>
00042 #include <kexipart.h>
00043 #include <formeditor/widgetlibrary.h>
00044 #include <kexigradientwidget.h>
00045 #include <keximainwindow.h>
00046 #include <kexiutils/utils.h>
00047 #include <widget/kexicustompropertyfactory.h>
00048
00049 #include "kexiformview.h"
00050 #include "widgets/kexidbautofield.h"
00051 #include "widgets/kexidbcheckbox.h"
00052 #include "widgets/kexidbimagebox.h"
00053
00054
00055 #include "widgets/kexiframe.h"
00056 #include "widgets/kexidblabel.h"
00057 #include "widgets/kexidblineedit.h"
00058 #include "widgets/kexidbtextedit.h"
00059 #include "widgets/kexidbcombobox.h"
00060 #include "widgets/kexipushbutton.h"
00061 #include "widgets/kexidbform.h"
00062 #include "widgets/kexidbsubform.h"
00063 #include "kexidataawarewidgetinfo.h"
00064
00065 #include "kexidbfactory.h"
00066 #include <core/kexi.h>
00067
00068
00070
00071 KexiDBFactory::KexiDBFactory(QObject *parent, const char *name, const QStringList &)
00072 : KFormDesigner::WidgetFactory(parent, name)
00073 {
00074 KFormDesigner::WidgetInfo *wi;
00075 wi = new KexiDataAwareWidgetInfo(this);
00076 wi->setPixmap("form");
00077 wi->setClassName("KexiDBForm");
00078 wi->setName(i18n("Form"));
00079 wi->setNamePrefix(
00080 i18n("Widget name. This string will be used to name widgets of this class. "
00081 "It must _not_ contain white spaces and non latin1 characters.", "form"));
00082 wi->setDescription(i18n("A data-aware form widget"));
00083 addClass(wi);
00084
00085 #ifndef KEXI_NO_SUBFORM
00086 wi = new KexiDataAwareWidgetInfo(this);
00087 wi->setPixmap("subform");
00088 wi->setClassName("KexiDBSubForm");
00089 wi->addAlternateClassName("KexiSubForm", true);
00090 wi->setName(i18n("Sub Form"));
00091 wi->setNamePrefix(
00092 i18n("Widget name. This string will be used to name widgets of this class. "
00093 "It must _not_ contain white spaces and non latin1 characters.", "subForm"));
00094 wi->setDescription(i18n("A form widget included in another Form"));
00095 wi->setAutoSyncForProperty( "formName", false );
00096 addClass(wi);
00097 #endif
00098
00099
00100 wi = new KexiDataAwareWidgetInfo(this, "stdwidgets", "KLineEdit");
00101 wi->setPixmap("lineedit");
00102 wi->setClassName("KexiDBLineEdit");
00103 wi->addAlternateClassName("QLineEdit", true);
00104 wi->addAlternateClassName("KLineEdit", true);
00105 wi->setIncludeFileName("klineedit.h");
00106 wi->setName(i18n("Text Box"));
00107 wi->setNamePrefix(
00108 i18n("Widget name. This string will be used to name widgets of this class. "
00109 "It must _not_ contain white spaces and non latin1 characters.", "textBox"));
00110 wi->setDescription(i18n("A widget for entering and displaying text"));
00111 addClass(wi);
00112
00113
00114 wi = new KexiDataAwareWidgetInfo(this, "stdwidgets", "KTextEdit");
00115 wi->setPixmap("textedit");
00116 wi->setClassName("KexiDBTextEdit");
00117 wi->addAlternateClassName("QTextEdit", true);
00118 wi->addAlternateClassName("KTextEdit", true);
00119 wi->setIncludeFileName("ktextedit.h");
00120 wi->setName(i18n("Text Editor"));
00121 wi->setNamePrefix(
00122 i18n("Widget name. This string will be used to name widgets of this class. "
00123 "It must _not_ contain white spaces and non latin1 characters.", "textEditor"));
00124 wi->setDescription(i18n("A multiline text editor"));
00125 addClass(wi);
00126
00127 wi = new KFormDesigner::WidgetInfo(
00128 this, "containers", "QFrame" );
00129 wi->setPixmap("frame");
00130 wi->setClassName("KexiFrame");
00131 wi->addAlternateClassName("QFrame", true);
00132 wi->setName(i18n("Frame"));
00133 wi->setNamePrefix(
00134 i18n("Widget name. This string will be used to name widgets of this class. "
00135 "It must _not_ contain white spaces and non latin1 characters.", "frame"));
00136 wi->setDescription(i18n("A simple frame widget"));
00137 addClass(wi);
00138
00139 wi = new KexiDataAwareWidgetInfo(
00140 this, "stdwidgets", "QLabel" );
00141 wi->setPixmap("label");
00142 wi->setClassName("KexiDBLabel");
00143 wi->addAlternateClassName("QLabel", true);
00144 wi->addAlternateClassName("KexiLabel", true);
00145 wi->setName(i18n("Text Label", "Label"));
00146 wi->setNamePrefix(
00147 i18n("Widget name. This string will be used to name widgets of this class. "
00148 "It must _not_ contain white spaces and non latin1 characters.", "label"));
00149 wi->setDescription(i18n("A widget for displaying text"));
00150 addClass(wi);
00151
00152 #ifndef KEXI_NO_IMAGEBOX_WIDGET
00153 wi = new KexiDataAwareWidgetInfo(
00154 this, "stdwidgets", "KexiPictureLabel" );
00155 wi->setPixmap("pixmaplabel");
00156 wi->setClassName("KexiDBImageBox");
00157 wi->addAlternateClassName("KexiPictureLabel", true);
00158 wi->addAlternateClassName("KexiImageBox", true);
00159 wi->setName(i18n("Image Box"));
00160 wi->setNamePrefix(
00161 i18n("Widget name. This string will be used to name widgets of this class. "
00162 "It must _not_ contain white spaces and non latin1 characters.", "image"));
00163 wi->setDescription(i18n("A widget for displaying images"));
00164
00165 wi->setCustomTypeForProperty("pixmapId", KexiCustomPropertyFactory::PixmapId);
00166 addClass(wi);
00167
00168 setInternalProperty("KexiDBImageBox", "dontStartEditingOnInserting", "1");
00169
00170 #endif
00171
00172 #ifdef KEXI_DB_COMBOBOX_WIDGET
00173 wi = new KexiDataAwareWidgetInfo(
00174 this, "stdwidgets", "KComboBox" );
00175 wi->setPixmap("combo");
00176 wi->setClassName("KexiDBComboBox");
00177 wi->addAlternateClassName("KComboBox", true);
00178 wi->setName(i18n("Combo Box"));
00179 wi->setNamePrefix(
00180 i18n("Widget name. This string will be used to name widgets of this class. "
00181 "It must _not_ contain white spaces and non latin1 characters.", "comboBox"));
00182 wi->setDescription(i18n("A combo box widget"));
00183 addClass(wi);
00184 #endif
00185
00186 wi = new KexiDataAwareWidgetInfo(this, "stdwidgets", "QCheckBox");
00187 wi->setPixmap("check");
00188 wi->setClassName("KexiDBCheckBox");
00189 wi->addAlternateClassName("QCheckBox", true);
00190 wi->setName(i18n("Check Box"));
00191 wi->setNamePrefix(
00192 i18n("Widget name. This string will be used to name widgets of this class. "
00193 "It must _not_ contain white spaces and non latin1 characters.", "checkBox"));
00194 wi->setDescription(i18n("A check box with text label"));
00195 addClass(wi);
00196
00197 #ifndef KEXI_NO_AUTOFIELD_WIDGET
00198 wi = new KexiDataAwareWidgetInfo(this);
00199 wi->setPixmap("autofield");
00200 wi->setClassName("KexiDBAutoField");
00201 wi->addAlternateClassName("KexiDBFieldEdit", true);
00202 wi->setName(i18n("Auto Field"));
00203 wi->setNamePrefix(
00204 i18n("Widget name. This string will be used to name widgets of this class. "
00205 "It must _not_ contain white spaces and non latin1 characters", "autoField"));
00206 wi->setDescription(i18n("A widget containing an automatically selected editor "
00207 "and a label to edit the value of a database field of any type."));
00208 addClass(wi);
00209 #endif
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243
00244
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280 wi = new KFormDesigner::WidgetInfo(
00281 this, "stdwidgets", "KPushButton");
00282 wi->addAlternateClassName("KexiPushButton");
00283 wi->setName(i18n("Command Button"));
00284 wi->setNamePrefix(
00285 i18n("Widget name. This string will be used to name widgets of this class. "
00286 "It must _not_ contain white spaces and non latin1 characters.", "button"));
00287 wi->setDescription(i18n("A command button to execute actions"));
00288 addClass(wi);
00289
00290 m_propDesc["dataSource"] = i18n("Data Source");
00291 m_propDesc["formName"] = i18n("Form Name");
00292 m_propDesc["onClickAction"] = i18n("On Click");
00293 m_propDesc["onClickActionOption"] = i18n("On Click Option");
00294 m_propDesc["autoTabStops"] = i18n("Auto Tab Order");
00295 m_propDesc["shadowEnabled"] = i18n("Shadow Enabled");
00296 m_propDesc["on"] = i18n("On: button", "On");
00297
00298 m_propDesc["widgetType"] = i18n("Editor Type");
00299
00300 m_propValDesc["Auto"] = i18n("AutoField editor's type", "Auto");
00301 m_propValDesc["Text"] = KexiDB::Field::typeName(KexiDB::Field::Text);
00302 m_propValDesc["Integer"] = KexiDB::Field::typeName(KexiDB::Field::Integer);
00303 m_propValDesc["Double"] = KexiDB::Field::typeName(KexiDB::Field::Double);
00304 m_propValDesc["Boolean"] = KexiDB::Field::typeName(KexiDB::Field::Boolean);
00305 m_propValDesc["Date"] = KexiDB::Field::typeName(KexiDB::Field::Date);
00306 m_propValDesc["Time"] = KexiDB::Field::typeName(KexiDB::Field::Time);
00307 m_propValDesc["DateTime"] = KexiDB::Field::typeName(KexiDB::Field::DateTime);
00308 m_propValDesc["MultiLineText"] = i18n("AutoField editor's type", "Multiline Text");
00309 m_propValDesc["ComboBox"] = i18n("AutoField editor's type", "Drop-Down List");
00310 m_propValDesc["Image"] = i18n("AutoField editor's type", "Image");
00311
00312
00313 m_propDesc["autoCaption"] = i18n("Auto Label");
00314 m_propDesc["foregroundLabelColor"] = i18n("Label Text Color");
00315 m_propDesc["backgroundLabelColor"] = i18n("(a property name, keep the text narrow!)",
00316 "Label Background\nColor");
00317
00318 m_propDesc["labelPosition"] = i18n("Label Position");
00319 m_propValDesc["Left"] = i18n("Label Position", "Left");
00320 m_propValDesc["Top"] = i18n("Label Position", "Top");
00321 m_propValDesc["NoLabel"] = i18n("Label Position", "No Label");
00322
00323 m_propDesc["sizeInternal"] = i18n("Size");
00324
00325 m_propDesc["pixmapId"] = i18n("Image");
00326 m_propDesc["scaledContents"] = i18n("Scaled Contents");
00327 m_propDesc["keepAspectRatio"] = i18n("Keep Aspect Ratio (short)", "Keep Ratio");
00328
00329
00330 hideClass("KexiPictureLabel");
00331 hideClass("KComboBox");
00332
00333
00334 m_propDesc["frameColor"] = i18n("Frame Color");
00335 m_propDesc["dropDownButtonVisible"] =
00336 i18n("Drop-Down Button for Image Box Visible (a property name, keep the text narrow!)",
00337 "Drop-Down\nButton Visible");
00338
00339
00340 m_propValDesc["TristateDefault"] = i18n("Tristate checkbox, default", "Default");
00341 m_propValDesc["TristateOn"] = i18n("Tristate checkbox, yes", "Yes");
00342 m_propValDesc["TristateOff"] = i18n("Tristate checkbox, no", "No");
00343
00344
00345 m_propDesc["editable"] = i18n("Editable combobox", "Editable");
00346 }
00347
00348 KexiDBFactory::~KexiDBFactory()
00349 {
00350 }
00351
00352 QWidget*
00353 KexiDBFactory::createWidget(const QCString &c, QWidget *p, const char *n,
00354 KFormDesigner::Container *container, int options)
00355 {
00356 kexipluginsdbg << "KexiDBFactory::createWidget() " << this << endl;
00357
00358 QWidget *w=0;
00359 QString text( container->form()->library()->textForWidgetName(n, c) );
00360 const bool designMode = options & KFormDesigner::WidgetFactory::DesignViewMode;
00361
00362 if(c == "KexiDBSubForm")
00363 w = new KexiDBSubForm(container->form(), p, n);
00364 else if(c == "KexiDBLineEdit")
00365 {
00366 w = new KexiDBLineEdit(p, n);
00367 if (designMode)
00368 w->setCursor(QCursor(Qt::ArrowCursor));
00369 }
00370 else if(c == "KexiDBTextEdit")
00371 {
00372 w = new KexiDBTextEdit(p, n);
00373 if (designMode)
00374 w->setCursor(QCursor(Qt::ArrowCursor));
00375 }
00376 else if(c == "QFrame" || c == "KexiFrame")
00377 {
00378 w = new KexiFrame(p, n);
00379 new KFormDesigner::Container(container, w, container);
00380 }
00381 else if(c == "KexiDBLabel")
00382 w = new KexiDBLabel(text, p, n);
00383 #ifndef KEXI_NO_IMAGEBOX_WIDGET
00384 else if(c == "KexiDBImageBox") {
00385 w = new KexiDBImageBox(designMode, p, n);
00386 connect(w, SIGNAL(idChanged(long)), this, SLOT(slotImageBoxIdChanged(long)));
00387 }
00388 #endif
00389 #ifndef KEXI_NO_AUTOFIELD_WIDGET
00390 else if(c == "KexiDBAutoField")
00391 w = new KexiDBAutoField(p, n, designMode);
00392 #endif
00393 else if(c == "KexiDBCheckBox")
00394 w = new KexiDBCheckBox(text, p, n);
00395 else if(c == "KexiDBComboBox")
00396 w = new KexiDBComboBox(p, n, designMode);
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407 else if(c == "KPushButton" || c == "KexiPushButton")
00408 w = new KexiPushButton(text, p, n);
00409
00410 return w;
00411 }
00412
00413 bool
00414 KexiDBFactory::createMenuActions(const QCString &classname, QWidget *w, QPopupMenu *menu,
00415 KFormDesigner::Container *)
00416 {
00417 if(classname == "QPushButton" || classname == "KPushButton" || classname == "KexiPushButton")
00418 {
00420 m_assignAction->plug( menu );
00421 return true;
00422 }
00423 else if(classname == "KexiDBImageBox")
00424 {
00425 KexiDBImageBox *imageBox = static_cast<KexiDBImageBox*>(w);
00426 imageBox->contextMenu()->updateActionsAvailability();
00427 KActionCollection *ac = imageBox->contextMenu()->actionCollection();
00428 KPopupMenu *subMenu = new KPopupMenu();
00430 menu->insertItem(i18n("&Image"), subMenu);
00431 ac->action("insert")->plug(subMenu);
00432 ac->action("file_save_as")->plug(subMenu);
00433 subMenu->insertSeparator();
00434 ac->action("edit_cut")->plug(subMenu);
00435 ac->action("edit_copy")->plug(subMenu);
00436 ac->action("edit_paste")->plug(subMenu);
00437 ac->action("delete")->plug(subMenu);
00438 if (ac->action("properties")) {
00439 subMenu->insertSeparator();
00440 ac->action("properties")->plug(subMenu);
00441 }
00442 }
00443 return false;
00444 }
00445
00446 void
00447 KexiDBFactory::createCustomActions(KActionCollection* col)
00448 {
00449
00450 m_assignAction = new KAction( i18n("&Assign Action..."), SmallIconSet("form_action"),
00451 0, 0, 0, col, "widget_assign_action");
00452 }
00453
00454 bool
00455 KexiDBFactory::startEditing(const QCString &classname, QWidget *w, KFormDesigner::Container *container)
00456 {
00457 m_container = container;
00458 if(classname == "KexiDBLineEdit")
00459 {
00462 KLineEdit *lineedit = static_cast<KLineEdit*>(w);
00463 createEditor(classname, lineedit->text(), lineedit, container,
00464 lineedit->geometry(), lineedit->alignment(), true);
00465 return true;
00466 }
00467 if(classname == "KexiDBTextEdit")
00468 {
00471 KTextEdit *textedit = static_cast<KTextEdit*>(w);
00472 createEditor(classname, textedit->text(), textedit, container,
00473 textedit->geometry(), textedit->alignment(), true, true);
00474
00475 KTextEdit *ed = dynamic_cast<KTextEdit *>( editor(w) );
00476 ed->setWrapPolicy(textedit->wrapPolicy());
00477 ed->setWordWrap(textedit->wordWrap());
00478 ed->setTabStopWidth(textedit->tabStopWidth());
00479 ed->setWrapColumnOrWidth(textedit->wrapColumnOrWidth());
00480 ed->setLinkUnderline(textedit->linkUnderline());
00481 ed->setTextFormat(textedit->textFormat());
00482 ed->setHScrollBarMode(textedit->hScrollBarMode());
00483 ed->setVScrollBarMode(textedit->vScrollBarMode());
00484 return true;
00485 }
00486 else if ( classname == "KexiDBLabel" ) {
00487 KexiDBLabel *label = static_cast<KexiDBLabel*>(w);
00488 m_widget = w;
00489 if(label->textFormat() == RichText)
00490 {
00491 QString text = label->text();
00492 if ( editRichText( label, text ) )
00493 {
00494 changeProperty( "textFormat", "RichText", container->form() );
00495 changeProperty( "text", text, container->form() );
00496 }
00497
00498 if ( classname == "KexiDBLabel" )
00499 w->resize(w->sizeHint());
00500 }
00501 else
00502 {
00503 createEditor(classname, label->text(), label, container,
00504 label->geometry(), label->alignment(),
00505 false, label->alignment() & Qt::WordBreak );
00506 }
00507 return true;
00508 }
00509 else if (classname == "KexiDBSubForm") {
00510
00511 KexiMainWindow *mainWin = KexiUtils::findParent<KexiMainWindow>(w, "KexiMainWindow");
00512 KexiDBSubForm *subform = static_cast<KexiDBSubForm*>(w);
00513 if(mainWin) {
00514 bool openingCancelled;
00515 mainWin->openObject("kexi/form", subform->formName(), Kexi::DesignViewMode,
00516 openingCancelled);
00517 }
00518 return true;
00519 }
00520 #if 0
00521 else if( (classname == "KexiDBDateEdit") || (classname == "KexiDBDateTimeEdit") || (classname == "KexiDBTimeEdit")
00522 ) {
00523 disableFilter(w, container);
00524 return true;
00525 }
00526 #endif
00527 else if(classname == "KexiDBAutoField") {
00528 if(static_cast<KexiDBAutoField*>(w)->hasAutoCaption())
00529 return false;
00530 QLabel *label = static_cast<KexiDBAutoField*>(w)->label();
00531 createEditor(classname, label->text(), label, container, label->geometry(), label->alignment());
00532 return true;
00533 }
00534 else if (classname == "KexiDBCheckBox") {
00535 KexiDBCheckBox *cb = static_cast<KexiDBCheckBox*>(w);
00536 QRect r( cb->geometry() );
00537 r.setLeft( r.left() + 2 + cb->style().subRect( QStyle::SR_CheckBoxIndicator, cb ).width() );
00538 createEditor(classname, cb->text(), cb, container, r, Qt::AlignAuto);
00539 return true;
00540 }
00541 else if(classname == "KexiDBImageBox") {
00542 KexiDBImageBox *image = static_cast<KexiDBImageBox*>(w);
00543 image->insertFromFile();
00544 return true;
00545 }
00546 return false;
00547 }
00548
00549 bool
00550 KexiDBFactory::previewWidget(const QCString &, QWidget *, KFormDesigner::Container *)
00551 {
00552 return false;
00553 }
00554
00555 bool
00556 KexiDBFactory::clearWidgetContent(const QCString & , QWidget *w)
00557 {
00560 KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>(w);
00561 if(iface)
00562 iface->clear();
00563 return true;
00564 }
00565
00566 QValueList<QCString>
00567 KexiDBFactory::autoSaveProperties(const QCString & )
00568 {
00569 QValueList<QCString> lst;
00570
00571
00572
00573
00574
00575
00576 return lst;
00577 }
00578
00579 bool
00580 KexiDBFactory::isPropertyVisibleInternal(const QCString& classname, QWidget *w,
00581 const QCString& property, bool isTopLevel)
00582 {
00583
00584 if (property=="dataSource" || property=="dataSourceMimeType") {
00585 return false;
00586 }
00587
00588 bool ok = true;
00589
00590 if(classname == "KexiPushButton") {
00591 ok = property!="isDragEnabled"
00592 #ifdef KEXI_NO_UNFINISHED
00593 && property!="onClickAction"
00594 && property!="onClickActionOption"
00595 && property!="iconSet"
00596 && property!="stdItem"
00597 #endif
00598 ;
00599 }
00600 else if(classname == "KexiDBLineEdit")
00601 ok = property!="urlDropsEnabled"
00602 && property!="vAlign"
00603 #ifdef KEXI_NO_UNFINISHED
00604 && property!="inputMask"
00605 && property!="maxLength"
00606 #endif
00607 ;
00608 else if(classname == "KexiDBComboBox")
00609 ok = property!="autoCaption"
00610 && property!="labelPosition"
00611 && property!="widgetType"
00612 && property!="fieldTypeInternal"
00613 && property!="fieldCaptionInternal";
00614 else if(classname == "KexiDBTextEdit")
00615 ok = property!="undoDepth"
00616 && property!="undoRedoEnabled"
00617 && property!="dragAutoScroll"
00618 && property!="overwriteMode"
00619 && property!="resizePolicy"
00620 && property!="autoFormatting"
00621 #ifdef KEXI_NO_UNFINISHED
00622 && property!="paper"
00623 #endif
00624 ;
00625 else if(classname == "KexiDBSubForm")
00626 ok = property!="dragAutoScroll"
00627 && property!="resizePolicy"
00628 && property!="focusPolicy";
00629 else if(classname == "KexiDBForm")
00630 ok = property!="iconText"
00631 && property!="geometry" ;
00632 else if(classname == "KexiDBLabel")
00633 ok = property!="focusPolicy";
00634 else if(classname == "KexiDBAutoField") {
00635 if (!isTopLevel && property=="caption")
00636 return true;
00637 if (property=="fieldTypeInternal" || property=="fieldCaptionInternal"
00639 || property=="widgetType")
00640 return false;
00641 ok = property!="text";
00642 }
00643 else if (classname == "KexiDBImageBox") {
00644 ok = property!="font" && property!="wordbreak";
00645 }
00646 else if(classname == "KexiDBCheckBox") {
00647
00648 if (property=="text" && w && dynamic_cast<KFormDesigner::WidgetWithSubpropertiesInterface*>(w->parentWidget()))
00649 return false;
00650 ok = property!="autoRepeat";
00651 }
00652
00653 return ok && WidgetFactory::isPropertyVisibleInternal(classname, w, property, isTopLevel);
00654 }
00655
00656 bool
00657 KexiDBFactory::propertySetShouldBeReloadedAfterPropertyChange(const QCString& classname,
00658 QWidget *w, const QCString& property)
00659 {
00660 Q_UNUSED(classname);
00661 Q_UNUSED(w);
00662 if (property=="fieldTypeInternal" || property=="widgetType")
00663 return true;
00664 return false;
00665 }
00666
00667 bool
00668 KexiDBFactory::changeText(const QString &text)
00669 {
00670 KFormDesigner::Form *form = m_container ? m_container->form() : 0;
00671 if (!form)
00672 return false;
00673 if (!form->selectedWidget())
00674 return false;
00675 QCString n( form->selectedWidget()->className() );
00676
00677 if(n == "KexiDBAutoField") {
00678 changeProperty("caption", text, form);
00679 return true;
00680 }
00682 return false;
00683 }
00684
00685 void
00686 KexiDBFactory::resizeEditor(QWidget *editor, QWidget *w, const QCString &classname)
00687 {
00688
00689
00690
00691 if(classname == "KexiDBAutoField")
00692 editor->setGeometry( static_cast<KexiDBAutoField*>(w)->label()->geometry() );
00693 }
00694
00695 void
00696 KexiDBFactory::slotImageBoxIdChanged(KexiBLOBBuffer::Id_t id)
00697 {
00698
00699
00700
00701 KFormDesigner::Form *form = KFormDesigner::FormManager::self()->activeForm();
00702 KexiFormView *formView = form ? KexiUtils::findParent<KexiFormView>((QWidget*)form->widget(), "KexiFormView") : 0;
00703 if (formView) {
00704 changeProperty("pixmapId", (uint)id, form);
00705
00706 formView->setUnsavedLocalBLOB(form->selectedWidget(), id);
00707 }
00708 }
00709
00710 KFORMDESIGNER_WIDGET_FACTORY(KexiDBFactory, kexidbwidgets)
00711
00712 #include "kexidbfactory.moc"