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-2005 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 
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 //      KexiFormView(KexiMainWindow *win, QWidget *parent, const char *name, KexiDB::Connection *conn);
00064         KexiFormView(KexiMainWindow *mainWin, QWidget *parent, const char *name = 0,
00065             bool dbAware = true);
00066         virtual ~KexiFormView();
00067 
00068 //      KexiDB::Connection* connection() { return m_conn; }
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             const QCString& propertyToSelect = QCString());
00114         void slotDirty(KFormDesigner::Form *f, bool isDirty);
00115         void slotFocus(bool in);
00116         void slotHandleDragMoveEvent(QDragMoveEvent* e);
00117 
00120         void slotHandleDropEvent(QDropEvent* e);
00121 
00122 //moved to formmanager      void slotWidgetSelected(KFormDesigner::Form *form, bool multiple);
00123 //moved to formmanager      void slotFormWidgetSelected(KFormDesigner::Form *form);
00124 //moved to formmanager      void slotNoFormSelected();
00125 
00126 //moved to formmanager      void setUndoEnabled(bool enabled);
00127 //moved to formmanager      void setRedoEnabled(bool enabled);
00128 
00129     protected:
00130         virtual tristate beforeSwitchTo(int mode, bool &dontStore);
00131         virtual tristate afterSwitchFrom(int mode);
00132         virtual KoProperty::Set* propertySet() { return m_propertySet; }
00133 
00134         virtual KexiDB::SchemaData* storeNewData(const KexiDB::SchemaData& sdata, bool &cancel);
00135         virtual tristate storeData(bool dontAsk = false);
00136 
00137         KexiFormPart::TempData* tempData() const {
00138             return dynamic_cast<KexiFormPart::TempData*>(parentDialog()->tempData()); }
00139         KexiFormPart* formPart() const { return dynamic_cast<KexiFormPart*>(part()); }
00140 
00141 //moved to formmanager      void disableWidgetActions();
00142 //moved to formmanager      void enableFormActions();
00143 
00144         void setForm(KFormDesigner::Form *f);
00145 
00146         void initForm();
00147 
00148         void loadForm();
00149 
00151         void updateAutoFieldsDataSource();
00152 
00154         void updateValuesForSubproperties();
00155 
00156         virtual void resizeEvent ( QResizeEvent * );
00157 
00158         void initDataSource();
00159 
00160         virtual void setFocusInternal();
00161 
00162 /*      // for navigator
00163         virtual void moveToRecordRequested(uint r);
00164         virtual void moveToLastRecordRequested();
00165         virtual void moveToPreviousRecordRequested();
00166         virtual void moveToNextRecordRequested();
00167         virtual void moveToFirstRecordRequested();
00168         virtual void addNewRecordRequested();*/
00169 
00173         void updateTabStopsOrder();
00174 
00176         void deleteQuery();
00177 
00179         void updateDataSourcePage();
00180 
00183 // todo     virtual void updateActions(bool activated);
00184 
00185         KexiDBForm *m_dbform;
00186         KexiFormScrollView *m_scrollView;
00187         KoProperty::Set *m_propertySet;
00188 
00193         QString m_previousDataSourceString;
00194 
00195         int m_resizeMode;
00196 
00197         KexiDB::QuerySchema* m_query;
00198 
00202         bool m_queryIsOwned;
00203 
00204         KexiDB::Cursor *m_cursor;
00205 
00209         int m_delayedFormContentsResizeOnShow;
00210 
00212         QGuardedPtr<QWidget> m_setFocusInternalOnce;
00213 
00214     
00220         QRect m_widgetGeometryForRecentInsertAutoFields;
00221 
00223         QMap<QWidget*, KexiBLOBBuffer::Id_t> m_unsavedLocalBLOBs;
00224 };
00225 
00226 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys