kexi

kexiformview.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2004 Cedric Pasteur <cedric.pasteur@free.fr>
00003    Copyright (C) 2004-2007 Jaroslaw Staniek <js@iidea.pl>
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
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 namespace KFormDesigner
00040 {
00041     class Container;
00042 }
00043 
00045 
00055 class KEXIFORMUTILS_EXPORT KexiFormView : public KexiDataAwareView
00056 {
00057     Q_OBJECT
00058 
00059     public:
00060         enum ResizeMode {
00061             ResizeAuto = 0,
00062             ResizeDefault = ResizeAuto,
00063             ResizeFixed = 1,
00064             NoResize = 2 
00065         };
00066 
00067 //      KexiFormView(KexiMainWindow *win, QWidget *parent, const char *name, KexiDB::Connection *conn);
00068         KexiFormView(KexiMainWindow *mainWin, QWidget *parent, const char *name = 0,
00069             bool dbAware = true);
00070         virtual ~KexiFormView();
00071 
00072 //      KexiDB::Connection* connection() { return m_conn; }
00073 
00074         virtual QSize preferredSizeHint(const QSize& otherSize);
00075 
00076         int resizeMode() const { return m_resizeMode; }
00077 
00078         KFormDesigner::Form* form() const;
00079 
00092         void setUnsavedLocalBLOB(QWidget *widget, KexiBLOBBuffer::Id_t id);
00093 
00094     public slots:
00096         virtual void show();
00097 
00112         void insertAutoFields(const QString& sourceMimeType, const QString& sourceName,
00113             const QStringList& fields, KFormDesigner::Container* targetContainerWidget, 
00114             const QPoint& pos = QPoint(-1,-1));
00115 
00116     protected slots:
00117         void slotPropertySetSwitched(KoProperty::Set *b, bool forceReload = false, 
00118             const QCString& propertyToSelect = QCString());
00119         void slotDirty(KFormDesigner::Form *f, bool isDirty);
00120         void slotFocus(bool in);
00121         void slotHandleDragMoveEvent(QDragMoveEvent* e);
00122 
00125         void slotHandleDropEvent(QDropEvent* e);
00126 
00127 //moved to formmanager      void slotWidgetSelected(KFormDesigner::Form *form, bool multiple);
00128 //moved to formmanager      void slotFormWidgetSelected(KFormDesigner::Form *form);
00129 //moved to formmanager      void slotNoFormSelected();
00130 
00131 //moved to formmanager      void setUndoEnabled(bool enabled);
00132 //moved to formmanager      void setRedoEnabled(bool enabled);
00133 
00134     protected:
00135         virtual tristate beforeSwitchTo(int mode, bool &dontStore);
00136         virtual tristate afterSwitchFrom(int mode);
00137         virtual KoProperty::Set* propertySet() { return m_propertySet; }
00138 
00139         virtual KexiDB::SchemaData* storeNewData(const KexiDB::SchemaData& sdata, bool &cancel);
00140         virtual tristate storeData(bool dontAsk = false);
00141 
00142         KexiFormPart::TempData* tempData() const {
00143             return dynamic_cast<KexiFormPart::TempData*>(parentDialog()->tempData()); }
00144         KexiFormPart* formPart() const { return dynamic_cast<KexiFormPart*>(part()); }
00145 
00146 //moved to formmanager      void disableWidgetActions();
00147 //moved to formmanager      void enableFormActions();
00148 
00149         void setForm(KFormDesigner::Form *f);
00150 
00151         void initForm();
00152 
00153         void loadForm();
00154 
00156         void updateAutoFieldsDataSource();
00157 
00159         void updateValuesForSubproperties();
00160 
00161         virtual void resizeEvent ( QResizeEvent * );
00162 
00163         void initDataSource();
00164 
00165         virtual void setFocusInternal();
00166 
00167 /*      // for navigator
00168         virtual void moveToRecordRequested(uint r);
00169         virtual void moveToLastRecordRequested();
00170         virtual void moveToPreviousRecordRequested();
00171         virtual void moveToNextRecordRequested();
00172         virtual void moveToFirstRecordRequested();
00173         virtual void addNewRecordRequested();*/
00174 
00178         void updateTabStopsOrder();
00179 
00181         void deleteQuery();
00182 
00184         void updateDataSourcePage();
00185 
00188 // todo     virtual void updateActions(bool activated);
00189 
00190         KexiDBForm *m_dbform;
00191         KexiFormScrollView *m_scrollView;
00192         KoProperty::Set *m_propertySet;
00193 
00198         QString m_previousDataSourceString;
00199 
00200         int m_resizeMode;
00201 
00202         KexiDB::QuerySchema* m_query;
00203 
00207         bool m_queryIsOwned;
00208 
00209         KexiDB::Cursor *m_cursor;
00210 
00214         int m_delayedFormContentsResizeOnShow;
00215 
00217         QGuardedPtr<QWidget> m_setFocusInternalOnce;
00218 
00219     
00225         QRect m_widgetGeometryForRecentInsertAutoFields;
00226 
00228 //      QMap<QWidget*, KexiBLOBBuffer::Id_t> m_unsavedLocalBLOBs;
00229 };
00230 
00231 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys