kexi
kexidialogbase.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KEXIDIALOGBASE_H
00022 #define KEXIDIALOGBASE_H
00023
00024 #include "kexipartguiclient.h"
00025 #include "kexiactionproxy.h"
00026 #include "kexi.h"
00027 #include "kexipart.h"
00028
00029 #include <qguardedptr.h>
00030
00031 #include <kmdichildview.h>
00032 #include <kxmlguiclient.h>
00033
00034 class QWidgetStack;
00035 class KexiMainWindow;
00036 class KexiViewBase;
00037 class KActionCollection;
00038 class KexiContextHelpInfo;
00039 namespace KexiPart {
00040 class Part;
00041 }
00042
00043 namespace KoProperty {
00044 class Set;
00045 }
00046
00048
00049 class KEXICORE_EXPORT KexiDialogTempData : public QObject
00050 {
00051 public:
00052 KexiDialogTempData(QObject* parent)
00053 : QObject(parent, "KexiDialogTempData")
00054 , proposeOpeningInTextViewModeBecauseOfProblems(false)
00055 {}
00068 bool proposeOpeningInTextViewModeBecauseOfProblems : 1;
00069 };
00070
00072
00075 class KEXICORE_EXPORT KexiDialogBase :
00076 public KMdiChildView,
00077 public KexiActionProxy,
00078 public Kexi::ObjectStatus
00079 {
00080 Q_OBJECT
00081
00082 public:
00083 KexiDialogBase(KexiMainWindow *parent, const QString &caption = QString::null);
00084 virtual ~KexiDialogBase();
00085
00086 bool isRegistered();
00087
00089 KexiViewBase *selectedView() const;
00090
00093 KexiViewBase *viewForMode(int mode) const;
00094
00096 void addView(KexiViewBase *view);
00097
00100
00101
00103 virtual QSize minimumSizeHint() const;
00104
00106 virtual QSize sizeHint() const;
00107
00108 KexiMainWindow *mainWin() { return m_parentWindow; }
00109
00110
00111
00116 void setId(int id) { m_id = id; }
00117
00121 int id() const;
00122
00124 inline KexiPart::Part* part() const { return m_part; }
00125
00127 KexiPart::Item *partItem() const { return m_item; }
00128
00131 KexiPart::GUIClient* commonGUIClient() const;
00132
00135 KexiPart::GUIClient* guiClient() const;
00136
00140
00141
00144 virtual QString itemIcon();
00145
00151 bool supportsViewMode( int mode ) const { return m_supportedViewModes & mode; }
00152
00154 int currentViewMode() const { return m_currentViewMode; }
00155
00162 tristate switchToViewMode( int newViewMode );
00163
00164 void setContextHelp(const QString& caption, const QString& text, const QString& iconName);
00165
00167 virtual bool eventFilter(QObject *obj, QEvent *e);
00168
00172 virtual void attachToGUIClient();
00173 virtual void detachFromGUIClient();
00174
00180 bool dirty() const;
00181
00188 bool neverSaved() const;
00189
00192 KoProperty::Set *propertySet();
00193
00194 KexiDB::SchemaData* schemaData() const { return m_schemaData; }
00196
00197
00199 KexiDialogTempData *tempData() const { return m_tempData; }
00200
00201
00202
00203
00206 void activate();
00207
00210 void deactivate();
00211
00212 public slots:
00213 virtual void setFocus();
00214
00215 void updateCaption();
00216
00223 tristate storeData(bool dontAsk = false);
00224
00233 tristate storeNewData();
00234
00238 void sendDetachedStateToCurrentView();
00239
00243 void sendAttachedStateToCurrentView();
00244
00245 signals:
00246 void updateContextHelp();
00247
00249 void closing();
00250
00253 void dirtyChanged(KexiDialogBase*);
00254
00255 protected slots:
00257 void setDirty(bool dirty);
00258
00259 protected:
00263 tristate switchToViewMode( int newViewMode, QMap<QString,QString>* staticObjectArgs );
00264
00265 void registerDialog();
00266
00267 virtual void closeEvent( QCloseEvent * e );
00268
00270 void addView(KexiViewBase *view, int mode);
00271
00272 int m_supportedViewModes;
00273 int m_openedViewModes;
00274 int m_currentViewMode;
00275
00276 inline QWidgetStack * stack() const { return m_stack; }
00277
00278 void dirtyChanged();
00279 #if 0
00280
00284 bool loadDataBlock( QString &dataString, const QString& dataID = QString::null);
00285
00292 bool storeDataBlock( const QString &dataString, const QString& dataID = QString::null );
00293
00299 bool removeDataBlock( QString &dataString, const QString& dataID = QString::null);
00300
00304 bool storeDataBlock_internal( const QString &dataString, int o_id, const QString& dataID );
00305 #endif
00306
00307
00308 private:
00309 KexiMainWindow *m_parentWindow;
00310 bool m_isRegistered;
00311 #ifdef KEXI_NO_CTXT_HELP
00312 KexiContextHelpInfo *m_contextHelpInfo;
00313 #endif
00314 int m_id;
00315 QGuardedPtr<KexiPart::Part> m_part;
00316 KexiPart::Item *m_item;
00317 QWidgetStack *m_stack;
00318 QString m_origCaption;
00319 KexiDB::SchemaData* m_schemaData;
00320 KexiViewBase *m_newlySelectedView;
00321
00322 QGuardedPtr<KexiDialogTempData> m_tempData;
00323
00326 int m_creatingViewsMode;
00327
00328 bool m_destroying : 1;
00329 bool m_disableDirtyChanged;
00330
00331 friend class KexiMainWindow;
00332
00333 friend class KexiPart::Part;
00334 friend class KexiInternalPart;
00335 friend class KexiViewBase;
00336 };
00337
00338 #endif
00339
|