kexi

KexiViewBase Class Reference

#include <kexiviewbase.h>

Inheritance diagram for KexiViewBase:

KexiActionProxy KexiDataAwareView KexiEditor KexiMacroView KexiQueryDesignerGuiEditor KexiQueryDesignerSQLView KexiRelationMainDlg KexiRelationWidget KexiReportView KexiScriptDesignView KexiSimplePrintingPageSetup List of all members.

Detailed Description

Base class for single view embeddable of in KexiDialogBase.

This class automatically works as a proxy for shared (application-wide) actions. KexiViewBase has 'dirty' flag to indicate that view's data has changed. This flag's state is reused by KexiDialogBase object that contain the view. KexiViewBase objects can be also nested, using addChildView(): any actions and 'dirty' flag are transmited to parent view in this case.

KexiViewBase objects are usually allocated within KexiDialogBase objects by implementing KexiPart::createView() method. See query or table part code for examples.

KexiViewBase object can be also allocated without attaching it KexiDialogBase, especially withinn dock window. see KexiMainWindowImpl::initNavigator() to see example how KexiBrowser does this.

Definition at line 52 of file kexiviewbase.h.


Public Slots

virtual void setFocus ()
virtual void propertySetSwitched ()
void setDirty (bool set)
void setDirty ()

Signals

void closing (bool &cancel)
void focus (bool in)

Public Member Functions

 KexiViewBase (KexiMainWindow *mainWin, QWidget *parent, const char *name=0)
virtual ~KexiViewBase ()
KexiMainWindowmainWin () const
KexiDialogBaseparentDialog () const
KexiPart::Partpart () const
virtual QSize preferredSizeHint (const QSize &otherSize)
virtual bool eventFilter (QObject *o, QEvent *e)
void addChildView (KexiViewBase *childView)
virtual bool dirty () const
int viewMode () const
virtual KAction * sharedAction (const char *action_name)
virtual void setAvailable (const char *action_name, bool set)

Protected Member Functions

virtual tristate beforeSwitchTo (int mode, bool &dontStore)
virtual tristate afterSwitchFrom (int mode)
virtual void closeEvent (QCloseEvent *e)
virtual KoProperty::Set * propertySet ()
void propertySetReloaded (bool preservePrevSelection=false, const QCString &propertyToSelect=QCString())
virtual KexiDB::SchemaDatastoreNewData (const KexiDB::SchemaData &sdata, bool &cancel)
bool loadDataBlock (QString &dataString, const QString &dataID=QString::null, bool canBeEmpty=false)
virtual tristate storeData (bool dontAsk=false)
bool storeDataBlock (const QString &dataString, const QString &dataID=QString::null)
bool removeDataBlock (const QString &dataID=QString::null)
void setViewWidget (QWidget *w, bool focusProxy=false)
virtual void updateActions (bool activated)
virtual void setFocusInternal ()
virtual void parentDialogDetached ()
virtual void parentDialogAttached ()

Protected Attributes

QString m_defaultIconName
KexiMainWindowm_mainWin
KexiDialogBasem_dialog
QWidget * m_viewWidget
KexiViewBasem_parentView
QGuardedPtr< QWidget > m_lastFocusedChildBeforeFocusOut

Friends

class KexiDialogBase

Member Function Documentation

KexiMainWindow* KexiViewBase::mainWin (  )  const [inline]

Returns:
kexi main window that contain this view

Definition at line 61 of file kexiviewbase.h.

KexiDialogBase* KexiViewBase::parentDialog (  )  const [inline]

Returns:
parent KexiDialogBase that contains this view, or 0 if no dialog contain this view

Definition at line 64 of file kexiviewbase.h.

KexiPart::Part * KexiViewBase::part (  )  const

Added for convenience.

Returns:
KexiPart object that was used to create this view (with a dialog) or 0 if this view is not created using KexiPart.
See also:
parentDialog()

Definition at line 60 of file kexiviewbase.cpp.

QSize KexiViewBase::preferredSizeHint ( const QSize &  otherSize  )  [virtual]

Returns:
preferred size hint, that can be used to resize the view. It is computed using maximum of (a) otherSize and (b) current KMDI dock area's size, so the view won't exceed this maximum size. The method is used e.g. in KexiDialogBase::sizeHint(). If you reimplement this method, do not forget to return value of yoursize.boundedTo( KexiViewBase::preferredSizeHint(otherSize) ).

Reimplemented in KexiFormView, and KexiReportView.

Definition at line 75 of file kexiviewbase.cpp.

virtual bool KexiViewBase::dirty (  )  const [inline, virtual]

True if contents (data) of the view is dirty and need to be saved This may or not be used, depending if changes in the dialog are saved immediately (e.g. like in datatableview) or saved by hand (by user) (e.g. like in alter-table dialog). "Dirty" flag is reused by KexiDialogBase::dirty(). Default implementation just uses internal m_dirty flag, that is false by default. Reimplement this if you e.g. want reuse other "dirty" flag from internal structures that may be changed.

Definition at line 90 of file kexiviewbase.h.

int KexiViewBase::viewMode (  )  const [inline]

Returns:
the view mode for this view.

Definition at line 93 of file kexiviewbase.h.

KAction * KexiViewBase::sharedAction ( const char *  action_name  )  [virtual]

Reimpelmented from KexiActionProxy.

Returns:
shared action with name action_name for this view. If there's no such action declared in Kexi Part (part()), global shared action is returned (if exists).

Reimplemented from KexiActionProxy.

Definition at line 292 of file kexiviewbase.cpp.

void KexiViewBase::setAvailable ( const char *  action_name,
bool  set 
) [virtual]

Enables or disables shared action declared in Kexi Part (part()). If there's no such action, global shared action is enabled or disabled (if exists).

Reimplemented from KexiActionProxy.

Definition at line 305 of file kexiviewbase.cpp.

void KexiViewBase::propertySetSwitched (  )  [virtual, slot]

Call this in your view's implementation whenever current property set (returned by propertySet()) is switched to other, so property editor contents need to be completely replaced.

Reimplemented in KexiTableDesignerView.

Definition at line 104 of file kexiviewbase.cpp.

void KexiViewBase::setDirty ( bool  set  )  [slot]

Sets dirty flag on or off. It the flag changes, dirty(bool) signal is emitted by parent dialog (KexiDialog), to inform the world about that. If this view has a parent view, setDirty() is called also on parent view. Always use this function to update 'dirty' flag information.

Reimplemented in KexiSimplePrintingPageSetup.

Definition at line 116 of file kexiviewbase.cpp.

void KexiViewBase::setDirty (  )  [inline, slot]

Equal to setDirty(true).

Definition at line 121 of file kexiviewbase.h.

void KexiViewBase::closing ( bool &  cancel  )  [signal]

emitted when the view is about to close

tristate KexiViewBase::beforeSwitchTo ( int  mode,
bool &  dontStore 
) [protected, virtual]

called by KexiDialogBase::switchToViewMode() right before dialog is switched to new mode By default does nothing. Reimplement this if you need to do something before switching to this view.

Returns:
true if you accept or false if a error occupied and view shouldn't change If there is no error but switching should be just cancelled (probably after showing some info messages), you need to return cancelled. Set dontStore to true (it's false by default) if you want to avoid data storing by storeData() or storeNewData().

Reimplemented in KexiFormView, KexiMacroView, KexiQueryDesignerGuiEditor, KexiQueryDesignerSQLView, KexiReportView, KexiTableDesigner_DataView, and KexiTableDesignerView.

Definition at line 65 of file kexiviewbase.cpp.

tristate KexiViewBase::afterSwitchFrom ( int  mode  )  [protected, virtual]

called by KexiDialogBase::switchToViewMode() right after dialog is switched to new mode By default does nothing. Reimplement this if you need to do something after switching to this view.

Returns:
true if you accept or false if a error occupied and view shouldn't change If there is no error but switching should be just cancelled (probably after showing some info messages), you need to return cancelled.

Reimplemented in KexiFormView, KexiMacroView, KexiQueryDesignerGuiEditor, KexiQueryDesignerSQLView, KexiQueryView, KexiReportView, KexiTableDesigner_DataView, and KexiTableDesignerView.

Definition at line 70 of file kexiviewbase.cpp.

KoProperty::Set * KexiViewBase::propertySet (  )  [protected, virtual]

Returns:
a property set for this view. For reimplementation. By default returns NULL.

Reimplemented in KexiFormView, KexiMacroDesignView, KexiQueryDesignerGuiEditor, KexiReportView, KexiScriptDesignView, and KexiTableDesignerView.

Definition at line 99 of file kexiviewbase.cpp.

void KexiViewBase::propertySetReloaded ( bool  preservePrevSelection = false,
const QCString &  propertyToSelect = QCString() 
) [protected]

Call this in your view's implementation whenever current property set is changed that few properties are now visible and/or few other are invisible, so property editor operating on this property set should be completely reloaded. If preservePrevSelection is true and there was a property set assigned before call, previously selected item will be preselected in the editor (if found).

Definition at line 110 of file kexiviewbase.cpp.

KexiDB::SchemaData * KexiViewBase::storeNewData ( const KexiDB::SchemaData sdata,
bool &  cancel 
) [protected, virtual]

Tells this dialog to create and store data of the new object pointed by sdata on the backend. Called by KexiDialogBase::storeNewData(). Default implementation:

  • makes a deep copy of sdata
  • stores object schema data sdata in 'kexi__objects' internal table using Connection::storeObjectSchemaData(). Reimpelment this for your needs. Requirements:
  • deep copy of sdata should be made
  • schema data should be created at the backend (by calling KexiViewBase::storeNewData(const KexiDB::SchemaData& sdata)), or using Connection::storeObjectSchemaData() or more specialized method. For example, KexiAlterTableDialog uses Connection::createTable(TableSchema) for this (tableschema is SchemaData subclass) to store more information than just a schem adata. You should use such subclasses if needed. Should return newly created schema data object on success. In this case, do not store schema object yourself (make deep copy if needed).

Reimplemented in KexiFormView, KexiMacroView, KexiQueryDesignerGuiEditor, KexiQueryDesignerSQLView, KexiQueryView, KexiReportView, KexiScriptDesignView, and KexiTableDesignerView.

Definition at line 149 of file kexiviewbase.cpp.

bool KexiViewBase::loadDataBlock ( QString &  dataString,
const QString &  dataID = QString::null,
bool  canBeEmpty = false 
) [protected]

Loads large string data dataString block (e.g. xml form's representation), indexed with optional dataID, from the database backend. If canBeEmpty is true and there is no data block for dataID, true is returned and dataString is set to null string. The default is false.

Returns:
true on success
See also:
storeDataBlock().

Definition at line 178 of file kexiviewbase.cpp.

tristate KexiViewBase::storeData ( bool  dontAsk = false  )  [protected, virtual]

Tells this view to store data changes on the backend. Called by KexiDialogBase::storeData(). Default implementation:

  • makes a deep copy of sdata
  • stores object schema data sdata in 'kexi__objects' internal table using Connection::storeObjectSchemaData(). If dontAsk is true, no question dialog will be shown to the user. The default is false.

Reimpelment this for your needs. Should return true on success or cancelled when the task should be cancelled.

See also:
storeNewData()

Reimplemented in KexiFormView, KexiMacroTextView, KexiMacroView, KexiQueryDesignerGuiEditor, KexiQueryDesignerSQLView, KexiQueryView, KexiReportView, KexiScriptDesignView, and KexiTableDesignerView.

Definition at line 164 of file kexiviewbase.cpp.

bool KexiViewBase::storeDataBlock ( const QString &  dataString,
const QString &  dataID = QString::null 
) [protected]

Stores (potentially large) string data dataString, block (e.g. xml form's representation), at the database backend. Block will be stored in "kexi__objectdata" table pointed by this object's id and an optional dataID identifier.

If dialog's id is not available (KexiDialogBase::id()), then ID that was just created in storeNewData() is used (see description of m_newlyAssignedID member). If there is already such record in the table, it's simply overwritten.

Returns:
true on success

Definition at line 190 of file kexiviewbase.cpp.

bool KexiViewBase::removeDataBlock ( const QString &  dataID = QString::null  )  [protected]

Removes (potentially large) string data (e.g. xml form's representation), pointed by optional dataID, from the database backend.

Returns:
true on success. Does not fail if the block doe not exists. Note that if dataID is not specified, all data blocks for this view will be removed.
See also:
storeDataBlock().

Definition at line 206 of file kexiviewbase.cpp.

void KexiViewBase::updateActions ( bool  activated  )  [protected, virtual]

Updates actions (e.g. availability). Reimplement it, if needed (you must call superclass impelmentation at the end!). This implementation does nothing for this view but calls updateActions() for every child-view of this view. called by KexiDialogBase on dialog's activation (activated is true) or deactivation.

Reimplemented in KexiQueryDesignerSQLView, KexiTableDesignerView, KexiDataAwareView, and KexiEditor.

Definition at line 318 of file kexiviewbase.cpp.

virtual void KexiViewBase::parentDialogDetached (  )  [inline, protected, virtual]

Allows to react on parent dialog's detaching (only for KMDI's ChildFrame mode)

  • it is called by KexiDialogBase::youAreDetached(). Default implementation does nothing. Implement it if you want to perform some appropriate actions.

Definition at line 239 of file kexiviewbase.h.

virtual void KexiViewBase::parentDialogAttached (  )  [inline, protected, virtual]

Allows to react on parent dialog's attaching (only for KMDI's ChildFrame mode)

  • it is called by KexiDialogBase::youAreAttached(). Default implementation does nothing. Implement it if you want to perform some appropriate actions.

Definition at line 245 of file kexiviewbase.h.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys