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