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("edit");
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["autoTabStops"] = i18n("Auto Tab Order");
00294 m_propDesc["shadowEnabled"] = i18n("Shadow Enabled");
00295
00296 m_propDesc["widgetType"] = i18n("Editor Type");
00297
00298 m_propValDesc["Auto"] = i18n("AutoField editor's type", "Auto");
00299 m_propValDesc["Text"] = KexiDB::Field::typeName(KexiDB::Field::Text);
00300 m_propValDesc["Integer"] = KexiDB::Field::typeName(KexiDB::Field::Integer);
00301 m_propValDesc["Double"] = KexiDB::Field::typeName(KexiDB::Field::Double);
00302 m_propValDesc["Boolean"] = KexiDB::Field::typeName(KexiDB::Field::Boolean);
00303 m_propValDesc["Date"] = KexiDB::Field::typeName(KexiDB::Field::Date);
00304 m_propValDesc["Time"] = KexiDB::Field::typeName(KexiDB::Field::Time);
00305 m_propValDesc["DateTime"] = KexiDB::Field::typeName(KexiDB::Field::DateTime);
00306 m_propValDesc["MultiLineText"] = i18n("AutoField editor's type", "Multiline Text");
00307 m_propValDesc["ComboBox"] = i18n("AutoField editor's type", "Drop-Down List");
00308 m_propValDesc["Image"] = i18n("AutoField editor's type", "Image");
00309
00310
00311 m_propDesc["autoCaption"] = i18n("Auto Label");
00312 m_propDesc["foregroundLabelColor"] = i18n("Label Text Color");
00313 m_propDesc["backgroundLabelColor"] = i18n("(a property name, keep the text narrow!)",
00314 "Label Background\nColor");
00315
00316 m_propDesc["labelPosition"] = i18n("Label Position");
00317 m_propValDesc["Left"] = i18n("Label Position", "Left");
00318 m_propValDesc["Top"] = i18n("Label Position", "Top");
00319 m_propValDesc["NoLabel"] = i18n("Label Position", "No Label");
00320
00321 m_propDesc["sizeInternal"] = i18n("Size");
00322
00323 m_propDesc["pixmapId"] = i18n("Image");
00324 m_propDesc["scaledContents"] = i18n("Scaled Contents");
00325 m_propDesc["keepAspectRatio"] = i18n("Keep Aspect Ratio (short)", "Keep Ratio");
00326
00327
00328 hideClass("KexiPictureLabel");
00329 hideClass("KComboBox");
00330
00331
00332 m_propDesc["frameColor"] = i18n("Frame Color");
00333 m_propDesc["dropDownButtonVisible"] =
00334 i18n("Drop-Down Button for Image Box Visible (a property name, keep the text narrow!)",
00335 "Drop-Down\nButton Visible");
00336
00337
00338 m_propValDesc["TristateDefault"] = i18n("Tristate checkbox, default", "Default");
00339 m_propValDesc["TristateOn"] = i18n("Tristate checkbox, yes", "Yes");
00340 m_propValDesc["TristateOff"] = i18n("Tristate checkbox, no", "No");
00341
00342
00343 m_propDesc["editable"] = futureI18n2("Editable combobox", "Editable");
00344 }
00345
00346 KexiDBFactory::~KexiDBFactory()
00347 {
00348 }
00349
00350 QWidget*
00351 KexiDBFactory::createWidget(const QCString &c, QWidget *p, const char *n,
00352 KFormDesigner::Container *container, int options)
00353 {
00354 kexipluginsdbg << "KexiDBFactory::createWidget() " << this << endl;
00355
00356 QWidget *w=0;
00357 QString text( container->form()->library()->textForWidgetName(n, c) );
00358 const bool designMode = options & KFormDesigner::WidgetFactory::DesignViewMode;
00359
00360 if(c == "KexiDBSubForm")
00361 w = new KexiDBSubForm(container->form(), p, n);
00362 else if(c == "KexiDBLineEdit")
00363 {
00364 w = new KexiDBLineEdit(p, n);
00365 if (designMode)
00366 w->setCursor(QCursor(Qt::ArrowCursor));
00367 }
00368 else if(c == "KexiDBTextEdit")
00369 {
00370 w = new KexiDBTextEdit(p, n);
00371 if (designMode)
00372 w->setCursor(QCursor(Qt::ArrowCursor));
00373 }
00374 else if(c == "QFrame" || c == "KexiFrame")
00375 {
00376 w = new KexiFrame(p, n);
00377 new KFormDesigner::Container(container, w, container);
00378 }
00379 else if(c == "KexiDBLabel")
00380 w = new KexiDBLabel(text, p, n);
00381 #ifndef KEXI_NO_IMAGEBOX_WIDGET
00382 else if(c == "KexiDBImageBox") {
00383 w = new KexiDBImageBox(designMode, p, n);
00384 connect(w, SIGNAL(idChanged(long)), this, SLOT(slotImageBoxIdChanged(long)));
00385 }
00386 #endif
00387 #ifndef KEXI_NO_AUTOFIELD_WIDGET
00388 else if(c == "KexiDBAutoField")
00389 w = new KexiDBAutoField(p, n, designMode);
00390 #endif
00391 else if(c == "KexiDBCheckBox")
00392 w = new KexiDBCheckBox(text, p, n);
00393 else if(c == "KexiDBComboBox")
00394 w = new KexiDBComboBox(p, n, designMode);
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405 else if(c == "KPushButton" || c == "KexiPushButton")
00406 w = new KexiPushButton(text, p, n);
00407
00408 return w;
00409 }
00410
00411 bool
00412 KexiDBFactory::createMenuActions(const QCString &classname, QWidget *w, QPopupMenu *menu,
00413 KFormDesigner::Container *)
00414 {
00415 if(classname == "QPushButton" || classname == "KPushButton" || classname == "KexiPushButton")
00416 {
00418 m_assignAction->plug( menu );
00419 return true;
00420 }
00421 else if(classname == "KexiDBImageBox")
00422 {
00423 KexiDBImageBox *imageBox = static_cast<KexiDBImageBox*>(w);
00424 imageBox->contextMenu()->updateActionsAvailability();
00425 KActionCollection *ac = imageBox->contextMenu()->actionCollection();
00426 KPopupMenu *subMenu = new KPopupMenu();
00428 menu->insertItem(i18n("&Image"), subMenu);
00429 ac->action("insert")->plug(subMenu);
00430 ac->action("file_save_as")->plug(subMenu);
00431 subMenu->insertSeparator();
00432 ac->action("edit_cut")->plug(subMenu);
00433 ac->action("edit_copy")->plug(subMenu);
00434 ac->action("edit_paste")->plug(subMenu);
00435 ac->action("delete")->plug(subMenu);
00436 if (ac->action("properties")) {
00437 subMenu->insertSeparator();
00438 ac->action("properties")->plug(subMenu);
00439 }
00440 }
00441 return false;
00442 }
00443
00444 void
00445 KexiDBFactory::createCustomActions(KActionCollection* col)
00446 {
00447
00448 m_assignAction = new KAction( i18n("Assign Action..."), SmallIconSet("form_action"),
00449 0, 0, 0, col, "widget_assign_action");
00450 }
00451
00452 bool
00453 KexiDBFactory::startEditing(const QCString &classname, QWidget *w, KFormDesigner::Container *container)
00454 {
00455 m_container = container;
00456 if(classname == "KexiDBLineEdit")
00457 {
00460 KLineEdit *lineedit = static_cast<KLineEdit*>(w);
00461 createEditor(classname, lineedit->text(), lineedit, container,
00462 lineedit->geometry(), lineedit->alignment(), true);
00463 return true;
00464 }
00465 if(classname == "KexiDBTextEdit")
00466 {
00469 KTextEdit *textedit = static_cast<KTextEdit*>(w);
00470 createEditor(classname, textedit->text(), textedit, container,
00471 textedit->geometry(), textedit->alignment(), true, true);
00472
00473 KTextEdit *ed = dynamic_cast<KTextEdit *>( editor(w) );
00474 ed->setWrapPolicy(textedit->wrapPolicy());
00475 ed->setWordWrap(textedit->wordWrap());
00476 ed->setTabStopWidth(textedit->tabStopWidth());
00477 ed->setWrapColumnOrWidth(textedit->wrapColumnOrWidth());
00478 ed->setLinkUnderline(textedit->linkUnderline());
00479 ed->setTextFormat(textedit->textFormat());
00480 ed->setHScrollBarMode(textedit->hScrollBarMode());
00481 ed->setVScrollBarMode(textedit->vScrollBarMode());
00482 return true;
00483 }
00484 else if ( classname == "KexiDBLabel" ) {
00485 KexiDBLabel *label = static_cast<KexiDBLabel*>(w);
00486 m_widget = w;
00487 if(label->textFormat() == RichText)
00488 {
00489 QString text = label->text();
00490 if ( editRichText( label, text ) )
00491 {
00492 changeProperty( "textFormat", "RichText", container->form() );
00493 changeProperty( "text", text, container->form() );
00494 }
00495
00496 if ( classname == "KexiDBLabel" )
00497 w->resize(w->sizeHint());
00498 }
00499 else
00500 {
00501 createEditor(classname, label->text(), label, container,
00502 label->geometry(), label->alignment(),
00503 false, label->alignment() & Qt::WordBreak );
00504 }
00505 return true;
00506 }
00507 else if (classname == "KexiDBSubForm") {
00508
00509 KexiMainWindow *mainWin = KexiUtils::findParent<KexiMainWindow>(w, "KexiMainWindow");
00510 KexiDBSubForm *subform = static_cast<KexiDBSubForm*>(w);
00511 if(mainWin) {
00512 bool openingCancelled;
00513 mainWin->openObject("kexi/form", subform->formName(), Kexi::DesignViewMode,
00514 openingCancelled);
00515 }
00516 return true;
00517 }
00518 #if 0
00519 else if( (classname == "KexiDBDateEdit") || (classname == "KexiDBDateTimeEdit") || (classname == "KexiDBTimeEdit")
00520 ) {
00521 disableFilter(w, container);
00522 return true;
00523 }
00524 #endif
00525 else if(classname == "KexiDBAutoField") {
00526 if(static_cast<KexiDBAutoField*>(w)->hasAutoCaption())
00527 return false;
00528 QLabel *label = static_cast<KexiDBAutoField*>(w)->label();
00529 createEditor(classname, label->text(), label, container, label->geometry(), label->alignment());
00530 return true;
00531 }
00532 else if (classname == "KexiDBCheckBox") {
00533 KexiDBCheckBox *cb = static_cast<KexiDBCheckBox*>(w);
00534 QRect r( cb->geometry() );
00535 r.setLeft( r.left() + 2 + cb->style().subRect( QStyle::SR_CheckBoxIndicator, cb ).width() );
00536 createEditor(classname, cb->text(), cb, container, r, Qt::AlignAuto);
00537 return true;
00538 }
00539 else if(classname == "KexiDBImageBox") {
00540 KexiDBImageBox *image = static_cast<KexiDBImageBox*>(w);
00541 image->insertFromFile();
00542 return true;
00543 }
00544 return false;
00545 }
00546
00547 bool
00548 KexiDBFactory::previewWidget(const QCString &, QWidget *, KFormDesigner::Container *)
00549 {
00550 return false;
00551 }
00552
00553 bool
00554 KexiDBFactory::clearWidgetContent(const QCString & , QWidget *w)
00555 {
00558 KexiFormDataItemInterface *iface = dynamic_cast<KexiFormDataItemInterface*>(w);
00559 if(iface)
00560 iface->clear();
00561 return true;
00562 }
00563
00564 QValueList<QCString>
00565 KexiDBFactory::autoSaveProperties(const QCString & )
00566 {
00567 QValueList<QCString> lst;
00568
00569
00570
00571
00572
00573
00574 return lst;
00575 }
00576
00577 bool
00578 KexiDBFactory::isPropertyVisibleInternal(const QCString& classname, QWidget *w,
00579 const QCString& property, bool isTopLevel)
00580 {
00581
00582 if (property=="dataSource" || property=="dataSourceMimeType") {
00583 return false;
00584 }
00585
00586 bool ok = true;
00587
00588 if(classname == "KexiPushButton") {
00589 ok = property!="isDragEnabled"
00590 #ifdef KEXI_NO_UNFINISHED
00591 && property!="onClickAction"
00592 && property!="iconSet"
00593 && property!="stdItem"
00594 #endif
00595 ;
00596 }
00597 else if(classname == "KexiDBLineEdit")
00598 ok = property!="urlDropsEnabled"
00599 && property!="vAlign"
00600 #ifdef KEXI_NO_UNFINISHED
00601 && property!="inputMask"
00602 && property!="maxLength"
00603 #endif
00604 ;
00605 else if(classname == "KexiDBComboBox")
00606 ok = property!="autoCaption"
00607 && property!="labelPosition"
00608 && property!="widgetType"
00609 && property!="fieldTypeInternal"
00610 && property!="fieldCaptionInternal";
00611 else if(classname == "KexiDBTextEdit")
00612 ok = property!="undoDepth"
00613 && property!="undoRedoEnabled"
00614 && property!="dragAutoScroll"
00615 && property!="overwriteMode"
00616 && property!="resizePolicy"
00617 && property!="autoFormatting"
00618 #ifdef KEXI_NO_UNFINISHED
00619 && property!="paper"
00620 #endif
00621 ;
00622 else if(classname == "KexiDBSubForm")
00623 ok = property!="dragAutoScroll"
00624 && property!="resizePolicy"
00625 && property!="focusPolicy";
00626 else if(classname == "KexiDBForm")
00627 ok = property!="iconText"
00628 && property!="geometry" ;
00629 else if(classname == "KexiDBLabel")
00630 ok = property!="focusPolicy";
00631 else if(classname == "KexiDBAutoField") {
00632 if (!isTopLevel && property=="caption")
00633 return true;
00634 if (property=="fieldTypeInternal" || property=="fieldCaptionInternal"
00636 || property=="widgetType")
00637 return false;
00638 ok = property!="text";
00639 }
00640 else if (classname == "KexiDBImageBox") {
00641 ok = property!="font" && property!="wordbreak";
00642 }
00643 else if(classname == "KexiDBCheckBox") {
00644
00645 if (property=="text" && w && dynamic_cast<KFormDesigner::WidgetWithSubpropertiesInterface*>(w->parentWidget()))
00646 return false;
00647 ok = property!="autoRepeat";
00648 }
00649
00650 return ok && WidgetFactory::isPropertyVisibleInternal(classname, w, property, isTopLevel);
00651 }
00652
00653 bool
00654 KexiDBFactory::propertySetShouldBeReloadedAfterPropertyChange(const QCString& classname,
00655 QWidget *w, const QCString& property)
00656 {
00657 Q_UNUSED(classname);
00658 Q_UNUSED(w);
00659 if (property=="fieldTypeInternal" || property=="widgetType")
00660 return true;
00661 return false;
00662 }
00663
00664 bool
00665 KexiDBFactory::changeText(const QString &text)
00666 {
00667 KFormDesigner::Form *form = m_container ? m_container->form() : 0;
00668 if (!form)
00669 return false;
00670 if (!form->selectedWidget())
00671 return false;
00672 QCString n( form->selectedWidget()->className() );
00673
00674 if(n == "KexiDBAutoField") {
00675 changeProperty("caption", text, form);
00676 return true;
00677 }
00679 return false;
00680 }
00681
00682 void
00683 KexiDBFactory::resizeEditor(QWidget *editor, QWidget *w, const QCString &classname)
00684 {
00685
00686
00687
00688 if(classname == "KexiDBAutoField")
00689 editor->setGeometry( static_cast<KexiDBAutoField*>(w)->label()->geometry() );
00690 }
00691
00692 void
00693 KexiDBFactory::slotImageBoxIdChanged(KexiBLOBBuffer::Id_t id)
00694 {
00695
00696
00697
00698 KFormDesigner::Form *form = KFormDesigner::FormManager::self()->activeForm();
00699 KexiFormView *formView = form ? KexiUtils::findParent<KexiFormView>((QWidget*)form->widget(), "KexiFormView") : 0;
00700 if (formView) {
00701 changeProperty("pixmapId", (uint)id, form);
00702
00703 formView->setUnsavedLocalBLOB(form->selectedWidget(), id);
00704 }
00705 }
00706
00707 KFORMDESIGNER_WIDGET_FACTORY(KexiDBFactory, kexidbwidgets)
00708
00709 #include "kexidbfactory.moc"