kexi

kexidialogbase.h
1/* This file is part of the KDE project
2 Copyright (C) 2003 Lucijan Busch <lucijan@kde.org>
3 Copyright (C) 2003-2004 Jaroslaw Staniek <js@iidea.pl>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KEXIDIALOGBASE_H
22#define KEXIDIALOGBASE_H
23
24#include "kexipartguiclient.h"
25#include "kexiactionproxy.h"
26#include "kexi.h"
27#include "kexipart.h"
28
29#include <tqguardedptr.h>
30
31#include <tdemdichildview.h>
32#include <kxmlguiclient.h>
33
34class TQWidgetStack;
35class KexiMainWindow;
36class KexiViewBase;
37class TDEActionCollection;
38class KexiContextHelpInfo;
39namespace KexiPart {
40 class Part;
41}
42
43namespace KoProperty {
44 class Set;
45}
46
48
49class KEXICORE_EXPORT KexiDialogTempData : public TQObject
50{
51 public:
52 KexiDialogTempData(TQObject* parent)
53 : TQObject(parent, "KexiDialogTempData")
55 {}
69};
70
72
75class KEXICORE_EXPORT KexiDialogBase :
76 public KMdiChildView,
77 public KexiActionProxy,
79{
80 TQ_OBJECT
81
82
83 public:
84 KexiDialogBase(KexiMainWindow *parent, const TQString &caption = TQString());
85 virtual ~KexiDialogBase();
86
87 bool isRegistered();
88
90 KexiViewBase *selectedView() const;
91
94 KexiViewBase *viewForMode(int mode) const;
95
97 void addView(KexiViewBase *view);
98
101// virtual TQWidget* mainWidget() = 0;
102
104 virtual TQSize minimumSizeHint() const;
105
107 virtual TQSize sizeHint() const;
108
109 KexiMainWindow *mainWin() const { return m_parentWindow; }
110
111 //js todo: maybe remove this since it's often the same as partItem()->identifier()?:
112
117 void setId(int id) { m_id = id; }
118
122 int id() const;
123
125 inline KexiPart::Part* part() const { return m_part; }
126
128 KexiPart::Item *partItem() const { return m_item; }
129
132 KexiPart::GUIClient* commonGUIClient() const;
133
136 KexiPart::GUIClient* guiClient() const;
137
141//js removed bool tryClose(bool dontSaveChanges);
142
145 virtual TQString itemIcon();
146
152 bool supportsViewMode( int mode ) const { return m_supportedViewModes & mode; }
153
155 int currentViewMode() const { return m_currentViewMode; }
156
163 tristate switchToViewMode( int newViewMode );
164
165 void setContextHelp(const TQString& caption, const TQString& text, const TQString& iconName);
166
168 virtual bool eventFilter(TQObject *obj, TQEvent *e);
169
173 virtual void attachToGUIClient();
174 virtual void detachFromGUIClient();
175
181 bool dirty() const;
182
185 KexiViewBase* viewThatRecentlySetDirtyFlag() const { return m_viewThatRecentlySetDirtyFlag; }
186
193 bool neverSaved() const;
194
197 KoProperty::Set *propertySet();
198
199 KexiDB::SchemaData* schemaData() const { return m_schemaData; }
201// TQString caption() const;
202
204 KexiDialogTempData *tempData() const { return m_tempData; }
205
206// /*! Used by KexiViewBase subclasses. Sets temporary data shared between views. */
207// void setTempData( KexiDialogTempData* data ) { m_tempData = data; }
208
211 void activate();
212
215 void deactivate();
216
217 public slots:
218 virtual void setFocus();
219
220 void updateCaption();
221
228 tristate storeData(bool dontAsk = false);
229
238 tristate storeNewData();
239
243 void sendDetachedStateToCurrentView();
244
248 void sendAttachedStateToCurrentView();
249
250 signals:
251 void updateContextHelp();
252
254 void closing();
255
258 void dirtyChanged(KexiDialogBase*);
259
260 protected slots:
262 void setDirty(bool dirty);
263
264 protected:
268 tristate switchToViewMode( int newViewMode, TQMap<TQString,TQString>* staticObjectArgs,
269 bool& proposeOpeningInTextViewModeBecauseOfProblems);
270
271 void registerDialog();
272
273 virtual void closeEvent( TQCloseEvent * e );
274
276 void addView(KexiViewBase *view, int mode);
277
279 void removeView(int mode);
280
281 int m_supportedViewModes;
282 int m_openedViewModes;
283 int m_currentViewMode;
284
285 inline TQWidgetStack * stack() const { return m_stack; }
286
288 void dirtyChanged(KexiViewBase* view);
289#if 0
294 bool loadDataBlock( TQString &dataString, const TQString& dataID = TQString());
295
302 bool storeDataBlock( const TQString &dataString, const TQString& dataID = TQString() );
303
309 bool removeDataBlock( TQString &dataString, const TQString& dataID = TQString());
310
314 bool storeDataBlock_internal( const TQString &dataString, int o_id, const TQString& dataID );
315#endif
316// void setError(const TQString& message, const TQString& details);
317
318 bool isDesignModePreloadedForTextModeHackUsed(int newViewMode) const;
319
320 private:
321 KexiMainWindow *m_parentWindow;
322 bool m_isRegistered;
323#ifdef KEXI_NO_CTXT_HELP
324 KexiContextHelpInfo *m_contextHelpInfo;
325#endif
326 int m_id;
327 TQGuardedPtr<KexiPart::Part> m_part;
328 KexiPart::Item *m_item;
329 TQWidgetStack *m_stack;
330 TQString m_origCaption;
331 KexiDB::SchemaData* m_schemaData;
332 TQGuardedPtr<KexiViewBase> m_newlySelectedView;
335 TQGuardedPtr<KexiViewBase> m_viewThatRecentlySetDirtyFlag;
336 TQGuardedPtr<KexiDialogTempData> m_tempData;
337
340 int m_creatingViewsMode;
341
342 bool m_destroying : 1;
343 bool m_disableDirtyChanged;
344
345 friend class KexiMainWindow;
346// friend class KexiMainWindowImpl;
347 friend class KexiPart::Part;
348 friend class KexiInternalPart;
349 friend class KexiViewBase;
350};
351
352#endif
353
KexiActionProxy(TQObject *receiver, KexiSharedActionHost *host=0)
void setId(int id)
int currentViewMode() const
KexiDialogTempData * tempData() const
virtual TQSize sizeHint() const
void setDirty(bool dirty)
KexiViewBase * viewThatRecentlySetDirtyFlag() const
bool supportsViewMode(int mode) const
virtual TQSize minimumSizeHint() const
KexiViewBase * viewForMode(int mode) const
KexiPart::Part * part() const
KexiPart::Item * partItem() const
void closing()
emitted when the window is about to close
KexiViewBase * selectedView() const
void dirtyChanged(KexiDialogBase *)
tristate switchToViewMode(int newViewMode)
bool dirty() const
void addView(KexiViewBase *view)
Adds view for the dialog. It will be the only view (of unspecified mode) for the dialog.
Privides temporary data shared between KexiDialogBase's views (KexiView's).
bool proposeOpeningInTextViewModeBecauseOfProblems
A prototype for Kexi Internal Parts (plugins) implementation.
Kexi's main window interface This interface is implemented by KexiMainWindowImpl class.
Information about a single object that can be instantiated using Kexi Part.
The main class for kexi frontend parts like tables, queries, forms and reports.
Definition kexipart.h:66
Base class for single view embeddable of in KexiDialogBase.
3-state logical type with three values: true, false and cancelled and convenient operators.
Definition tristate.h:100