kexi
kexiformview.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KEXIFORMVIEW_H
00022 #define KEXIFORMVIEW_H
00023
00024 #include <qtimer.h>
00025
00026 #include <kexiviewbase.h>
00027 #include <widget/kexidataawareview.h>
00028
00029 #include "kexiformpart.h"
00030 #include <core/kexiblobbuffer.h>
00031
00032 class KexiFormPart;
00033 class KexiMainWindow;
00034 class KexiDBForm;
00035 class KexiTableItem;
00036 class KexiTableViewData;
00037 class KexiFormScrollView;
00038 namespace KexiDB { class Cursor; }
00039
00041
00051 class KEXIFORMUTILS_EXPORT KexiFormView : public KexiDataAwareView
00052 {
00053 Q_OBJECT
00054
00055 public:
00056 enum ResizeMode {
00057 ResizeAuto = 0,
00058 ResizeDefault = ResizeAuto,
00059 ResizeFixed = 1,
00060 NoResize = 2
00061 };
00062
00063
00064 KexiFormView(KexiMainWindow *mainWin, QWidget *parent, const char *name = 0,
00065 bool dbAware = true);
00066 virtual ~KexiFormView();
00067
00068
00069
00070 virtual QSize preferredSizeHint(const QSize& otherSize);
00071
00072 int resizeMode() const { return m_resizeMode; }
00073
00074 KFormDesigner::Form* form() const;
00075
00088 void setUnsavedLocalBLOB(QWidget *widget, KexiBLOBBuffer::Id_t id);
00089
00090 public slots:
00092 virtual void show();
00093
00108 void insertAutoFields(const QString& sourceMimeType, const QString& sourceName,
00109 const QStringList& fields, const QPoint& pos = QPoint(-1,-1));
00110
00111 protected slots:
00112 void slotPropertySetSwitched(KoProperty::Set *b, bool forceReload = false);
00113 void slotDirty(KFormDesigner::Form *f, bool isDirty);
00114 void slotFocus(bool in);
00115 void slotHandleDragMoveEvent(QDragMoveEvent* e);
00116
00119 void slotHandleDropEvent(QDropEvent* e);
00120
00121
00122
00123
00124
00125
00126
00127
00128 protected:
00129 virtual tristate beforeSwitchTo(int mode, bool &dontStore);
00130 virtual tristate afterSwitchFrom(int mode);
00131 virtual KoProperty::Set* propertySet() { return m_propertySet; }
00132
00133 virtual KexiDB::SchemaData* storeNewData(const KexiDB::SchemaData& sdata, bool &cancel);
00134 virtual tristate storeData(bool dontAsk = false);
00135
00136 KexiFormPart::TempData* tempData() const {
00137 return dynamic_cast<KexiFormPart::TempData*>(parentDialog()->tempData()); }
00138 KexiFormPart* formPart() const { return dynamic_cast<KexiFormPart*>(part()); }
00139
00140
00141
00142
00143 void setForm(KFormDesigner::Form *f);
00144
00145 void initForm();
00146 void loadForm();
00147 void updateAutoFieldsDataSource();
00148
00149 virtual void resizeEvent ( QResizeEvent * );
00150
00151 void initDataSource();
00152
00153 virtual void setFocusInternal();
00154
00155
00156
00157
00158
00159
00160
00161
00162
00166 void updateTabStopsOrder();
00167
00169 void deleteQuery();
00170
00172 void updateDataSourcePage();
00173
00176
00177
00178 KexiDBForm *m_dbform;
00179 KexiFormScrollView *m_scrollView;
00180 KoProperty::Set *m_propertySet;
00181
00186 QString m_previousDataSourceString;
00187
00188 int m_resizeMode;
00189
00190 KexiDB::QuerySchema* m_query;
00191
00195 bool m_queryIsOwned;
00196
00197 KexiDB::Cursor *m_cursor;
00198
00202 int m_delayedFormContentsResizeOnShow;
00203
00205 QGuardedPtr<QWidget> m_setFocusInternalOnce;
00206
00207
00213 QRect m_widgetGeometryForRecentInsertAutoFields;
00214
00216 QMap<QWidget*, KexiBLOBBuffer::Id_t> m_unsavedLocalBLOBs;
00217 };
00218
00219 #endif
|