kexi

#include <kexiformview.h>

Inheritance diagram for KexiFormView:
KexiDataAwareView KexiViewBase KexiSearchAndReplaceViewInterface KexiActionProxy

Public Types

enum  ResizeMode { ResizeAuto = 0 , ResizeDefault = ResizeAuto , ResizeFixed = 1 , NoResize = 2 }
 

Public Slots

virtual void show ()
 
void insertAutoFields (const TQString &sourceMimeType, const TQString &sourceName, const TQStringList &fields, KFormDesigner::Container *targetContainerWidget, const TQPoint &pos=TQPoint(-1,-1))
 
- Public Slots inherited from KexiDataAwareView
void deleteAllRows ()
 
void deleteCurrentRow ()
 
void deleteAndStartEditCurrentCell ()
 
void startEditOrToggleValue ()
 
bool acceptRowEdit ()
 
void cancelRowEdit ()
 
void sortAscending ()
 
void sortDescending ()
 
void copySelection ()
 
void cutSelection ()
 
void paste ()
 
void slotGoToFirstRow ()
 
void slotGoToPreviusRow ()
 
void slotGoToNextRow ()
 
void slotGoToLastRow ()
 
void slotGoToNewRow ()
 
- Public Slots inherited from KexiViewBase
virtual void setFocus ()
 
virtual void propertySetSwitched ()
 
void setDirty (bool set)
 
void setDirty ()
 

Public Member Functions

 KexiFormView (KexiMainWindow *mainWin, TQWidget *parent, const char *name=0, bool dbAware=true)
 
virtual TQSize preferredSizeHint (const TQSize &otherSize)
 
int resizeMode () const
 
KFormDesigner::Form * form () const
 
void setUnsavedLocalBLOB (TQWidget *widget, KexiBLOBBuffer::Id_t id)
 
- Public Member Functions inherited from KexiDataAwareView
 KexiDataAwareView (KexiMainWindow *mainWin, TQWidget *parent, const char *name=0)
 
TQWidget * mainWidget ()
 
virtual TQSize minimumSizeHint () const
 
virtual TQSize sizeHint () const
 
KexiDataAwareObjectInterface * dataAwareObject () const
 
virtual bool setupFindAndReplace (TQStringList &columnNames, TQStringList &columnCaptions, TQString &currentColumnName)
 
virtual tristate find (const TQVariant &valueToFind, const KexiSearchAndReplaceViewInterface::Options &options, bool next)
 
virtual tristate findNextAndReplace (const TQVariant &valueToFind, const TQVariant &replacement, const KexiSearchAndReplaceViewInterface::Options &options, bool replaceAll)
 
- Public Member Functions inherited from KexiViewBase
 KexiViewBase (KexiMainWindow *mainWin, TQWidget *parent, const char *name=0)
 
KexiMainWindow * mainWin () const
 
KexiDialogBase * parentDialog () const
 
KexiPart::Part * part () const
 
virtual bool eventFilter (TQObject *o, TQEvent *e)
 
void addChildView (KexiViewBase *childView)
 
virtual bool dirty () const
 
int viewMode () const
 
virtual TDEAction * sharedAction (const char *action_name)
 
virtual void setAvailable (const char *action_name, bool set)
 
- Public Member Functions inherited from KexiActionProxy
 KexiActionProxy (TQObject *receiver, KexiSharedActionHost *host=0)
 
bool activateSharedAction (const char *action_name, bool alsoCheckInChildren=true)
 
void setSharedActionHost (KexiSharedActionHost &host)
 
bool isAvailable (const char *action_name, bool alsoCheckInChildren=true) const
 
bool isSupported (const char *action_name) const
 
void setActionProxyParent_internal (KexiActionProxy *parent)
 

Protected Slots

void slotPropertySetSwitched (KoProperty::Set *b, bool forceReload=false, const TQCString &propertyToSelect=TQCString())
 
void slotDirty (KFormDesigner::Form *f, bool isDirty)
 
void slotFocus (bool in)
 
void slotHandleDragMoveEvent (TQDragMoveEvent *e)
 
void slotHandleDropEvent (TQDropEvent *e)
 
- Protected Slots inherited from KexiDataAwareView
void slotCellSelected (int col, int row)
 
void reloadActions ()
 
void slotUpdateRowActions (int row)
 
void slotClosing (bool &cancel)
 

Protected Member Functions

virtual tristate beforeSwitchTo (int mode, bool &dontStore)
 
virtual tristate afterSwitchFrom (int mode)
 
virtual KoProperty::Set * propertySet ()
 
virtual KexiDB::SchemaData * storeNewData (const KexiDB::SchemaData &sdata, bool &cancel)
 
virtual tristate storeData (bool dontAsk=false)
 
KexiFormPart::TempData * tempData () const
 
KexiFormPart * formPart () const
 
void setForm (KFormDesigner::Form *f)
 
void initForm ()
 
void loadForm ()
 
void updateAutoFieldsDataSource ()
 
void updateValuesForSubproperties ()
 
virtual void resizeEvent (TQResizeEvent *)
 
void initDataSource ()
 
virtual void setFocusInternal ()
 
void updateTabStopsOrder ()
 
void deleteQuery ()
 
void updateDataSourcePage ()
 
- Protected Member Functions inherited from KexiDataAwareView
void init (TQWidget *viewWidget, KexiSharedActionClient *actionClient, KexiDataAwareObjectInterface *dataAwareObject, bool noDataAware=false)
 
void initActions ()
 
virtual void updateActions (bool activated)
 
- Protected Member Functions inherited from KexiViewBase
virtual void closeEvent (TQCloseEvent *e)
 
void propertySetReloaded (bool preservePrevSelection=false, const TQCString &propertyToSelect=TQCString())
 
bool loadDataBlock (TQString &dataString, const TQString &dataID=TQString(), bool canBeEmpty=false)
 
bool storeDataBlock (const TQString &dataString, const TQString &dataID=TQString())
 
bool removeDataBlock (const TQString &dataID=TQString())
 
void setViewWidget (TQWidget *w, bool focusProxy=false)
 
virtual void parentDialogDetached ()
 
virtual void parentDialogAttached ()
 
- Protected Member Functions inherited from KexiActionProxy
void plugSharedAction (const char *action_name, TQObject *receiver, const char *slot)
 
void unplugSharedAction (const char *action_name)
 
void plugSharedAction (const char *action_name, const char *slot)
 
int plugSharedAction (const char *action_name, TQWidget *w)
 
void plugSharedActionToExternalGUI (const char *action_name, KXMLGUIClient *client)
 
void plugSharedActionsToExternalGUI (const TQValueList< TQCString > &action_names, KXMLGUIClient *client)
 
void unplugSharedAction (const char *action_name, TQWidget *w)
 
TDEAction * plugSharedAction (const char *action_name, const TQString &alternativeText, TQWidget *w)
 
TQObject * receiver () const
 
void addActionProxyChild (KexiActionProxy *child)
 
void takeActionProxyChild (KexiActionProxy *child)
 

Protected Attributes

KexiDBForm * m_dbform
 
KexiFormScrollView * m_scrollView
 
KoProperty::Set * m_propertySet
 
TQString m_previousDataSourceString
 
int m_resizeMode
 
KexiDB::QuerySchema * m_query
 
bool m_queryIsOwned
 
KexiDB::Cursor * m_cursor
 
int m_delayedFormContentsResizeOnShow
 
TQGuardedPtr< TQWidget > m_setFocusInternalOnce
 
TQRect m_widgetGeometryForRecentInsertAutoFields
 
- Protected Attributes inherited from KexiDataAwareView
TQWidget * m_internalView
 
KexiSharedActionClient * m_actionClient
 
KexiDataAwareObjectInterface * m_dataAwareObject
 
- Protected Attributes inherited from KexiViewBase
TQString m_defaultIconName
 
KexiMainWindow * m_mainWin
 
KexiDialogBase * m_dialog
 
TQWidget * m_viewWidget
 
KexiViewBase * m_parentView
 
TQGuardedPtr< TQWidget > m_lastFocusedChildBeforeFocusOut
 
- Protected Attributes inherited from KexiActionProxy
KexiSharedActionHost * m_host
 
TQGuardedPtr< TQObject > m_receiver
 
TQAsciiDict< TQPair< TQSignal *, bool > > m_signals
 
TQPtrList< KexiActionProxy > m_sharedActionChildren
 
TQPtrList< TDEAction > m_alternativeActions
 
KexiActionProxy * m_actionProxyParent
 
TQObject m_signal_parent
 
TDEAction_setEnabled_Helper * m_TDEAction_setEnabled_helper
 

Additional Inherited Members

- Signals inherited from KexiViewBase
void closing (bool &cancel)
 
void focus (bool in)
 
- Public Attributes inherited from KexiActionProxy
KexiActionProxy * m_focusedChild
 

Detailed Description

The KexiFormView lass provides a data-driven (record-based) form view .

The KexiFormView can display data provided "by hand" or from KexiDB-compatible database source.

This class provides a single view used inside KexiDialogBase. It takes care of saving/loading form, of enabling actions when needed. One KexiFormView object is instantiated for data view mode and a second KexiFormView object is instantiated for design view mode.

See also
KexiDataTable

Definition at line 55 of file kexiformview.h.

Member Enumeration Documentation

◆ ResizeMode

enum KexiFormView::ResizeMode

Definition at line 61 of file kexiformview.h.

Constructor & Destructor Documentation

◆ KexiFormView()

KexiFormView::KexiFormView ( KexiMainWindow *  mainWin,
TQWidget *  parent,
const char *  name = 0,
bool  dbAware = true 
)
Todo:
#define KEXI_SHOW_SPLITTER_WIDGET
Todo:
skip this if ther're no borders

Definition at line 63 of file kexiformview.cpp.

◆ ~KexiFormView()

KexiFormView::~KexiFormView ( )
virtual

Definition at line 167 of file kexiformview.cpp.

Member Function Documentation

◆ afterSwitchFrom()

tristate KexiFormView::afterSwitchFrom ( int  mode)
protectedvirtual

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.
Todo:
add option for skipping autoincremented fields

iface->dataSource().isEmpty()

Reimplemented from KexiViewBase.

Definition at line 470 of file kexiformview.cpp.

◆ beforeSwitchTo()

tristate KexiFormView::beforeSwitchTo ( int  mode,
bool &  dontStore 
)
protectedvirtual

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 from KexiViewBase.

Definition at line 432 of file kexiformview.cpp.

◆ deleteQuery()

void KexiFormView::deleteQuery ( )
protected
Todo:
remove this shared query from listened queries list

Definition at line 184 of file kexiformview.cpp.

◆ form()

KFormDesigner::Form * KexiFormView::form ( ) const

Definition at line 201 of file kexiformview.cpp.

◆ formPart()

KexiFormPart * KexiFormView::formPart ( ) const
inlineprotected

Definition at line 145 of file kexiformview.h.

◆ initDataSource()

void KexiFormView::initDataSource ( )
protected
Todo:
also handle anonymous (not stored) queries provided as statements here
Todo:
check if the query could have skipped unused fields (no GROUP BY, no joins, etc.)
Todo:
There can be read-write queries, e.g. simple "SELECT * FROM...". Add a checking function to KexiDB.
Todo:
add expression support
Todo:
show error
Todo:
fieldName is ok, but what about expressions?
Todo:
PRIMITIVE!! data setting:
Todo:
Todo:
KexiTableViewData is not great name for data class here... rename/move?
Todo:
few backends return result count for free! - no need to reopen() *‍/ int resultCount = -1; if (ok) { resultCount = m_conn->resultCount(m_conn->selectStatement(*m_query)); ok = m_cursor->reopen(); } if (ok) ok = ! (!m_cursor->moveFirst() && m_cursor->error());
    m_scrollView->setData( data, true /*owner

Definition at line 568 of file kexiformview.cpp.

◆ initForm()

void KexiFormView::initForm ( )
protected
Todo:
handle errors

Definition at line 219 of file kexiformview.cpp.

◆ insertAutoFields

void KexiFormView::insertAutoFields ( const TQString &  sourceMimeType,
const TQString &  sourceName,
const TQStringList &  fields,
KFormDesigner::Container *  targetContainerWidget,
const TQPoint &  pos = TQPoint(-1,-1) 
)
slot

Inserts autofields onto the form at pos position. sourceMimeType can be "kexi/table" or "kexi/query", sourceName is a name of a table or query, fields is a list of fields to insert (one or more) Fields are inserted using standard KFormDesigner::InsertWidgetCommand framework, so undo/redo is available for this operation.

If multiple fields are provided, they will be aligned vertically. If pos is TQPoint(-1,-1) (the default), position is computed automatically based on a position last inserted field using this method. If this method has not been called yet, position of TQPoint(40, 40) will be set.

Called by:

  • slotHandleDropEvent() when field(s) are dropped from the data source pane onto the form
  • KexiFormManager is a used clicked "Insert fields" button on the data source pane.

todo unnamed query colums are not supported

todo add autolabel using field's caption or name

todo this is hardcoded!

todo this name can be invalid for expressions: if so, fall back to a default class' prefix!

addToActiveForm

execFlagForSubCommands

Definition at line 1084 of file kexiformview.cpp.

◆ loadForm()

void KexiFormView::loadForm ( )
protected

Definition at line 389 of file kexiformview.cpp.

◆ preferredSizeHint()

TQSize KexiFormView::preferredSizeHint ( const TQSize &  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 from KexiViewBase.

Definition at line 968 of file kexiformview.cpp.

◆ propertySet()

virtual KoProperty::Set * KexiFormView::propertySet ( )
inlineprotectedvirtual
Returns
a property set for this view. For reimplementation. By default returns NULL.

Reimplemented from KexiViewBase.

Definition at line 138 of file kexiformview.h.

◆ resizeEvent()

void KexiFormView::resizeEvent ( TQResizeEvent *  e)
protectedvirtual

Definition at line 982 of file kexiformview.cpp.

◆ resizeMode()

int KexiFormView::resizeMode ( ) const
inline

Definition at line 77 of file kexiformview.h.

◆ setFocusInternal()

void KexiFormView::setFocusInternal ( )
protectedvirtual

Reimplemented from KexiViewBase.

Definition at line 999 of file kexiformview.cpp.

◆ setForm()

void KexiFormView::setForm ( KFormDesigner::Form *  f)
protected

Definition at line 210 of file kexiformview.cpp.

◆ setUnsavedLocalBLOB()

void KexiFormView::setUnsavedLocalBLOB ( TQWidget *  widget,
KexiBLOBBuffer::Id_t  id 
)

Assigns id local (static) BLOB's identifier for widget widget. Previously assigned BLOB will be usassigned. If id is 0, BLOB is unassigned and no new is assigned.

This method is called when a widget supporting BLOB data (currently, images from KexiDBImageBox, within KexiDBFactory) has BLOB assigned by identifier id. BLOB identifiers are defined by KexiBLOBBuffer (KexiBLOBBuffer::self() instance).

The data collected by this method is used on form's design saving (in design mode). Local BLOBs are retrieved KexiBLOBBuffer::self() and stored in "kexi__blobs" 'system' table. Note that db-aware BLOBs (non local) are not handled this way.

Todo:
if there already was data assigned, remember it should be dereferenced

Definition at line 1239 of file kexiformview.cpp.

◆ show

void KexiFormView::show ( )
virtualslot

Reimplemented to update resize policy.

Definition at line 1018 of file kexiformview.cpp.

◆ slotDirty

void KexiFormView::slotDirty ( KFormDesigner::Form *  f,
bool  isDirty 
)
protectedslot

Definition at line 715 of file kexiformview.cpp.

◆ slotFocus

void KexiFormView::slotFocus ( bool  in)
protectedslot

Definition at line 1033 of file kexiformview.cpp.

◆ slotHandleDragMoveEvent

void KexiFormView::slotHandleDragMoveEvent ( TQDragMoveEvent *  e)
protectedslot

Definition at line 1057 of file kexiformview.cpp.

◆ slotHandleDropEvent

void KexiFormView::slotHandleDropEvent ( TQDropEvent *  e)
protectedslot

Handles field(s) dropping from the data source pane onto the form.

See also
insertAutoFields()

Definition at line 1066 of file kexiformview.cpp.

◆ slotPropertySetSwitched

void KexiFormView::slotPropertySetSwitched ( KoProperty::Set *  b,
bool  forceReload = false,
const TQCString &  propertyToSelect = TQCString() 
)
protectedslot

Definition at line 417 of file kexiformview.cpp.

◆ storeData()

tristate KexiFormView::storeData ( bool  dontAsk = false)
protectedvirtual

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()
Todo:
remove unused data stored previously
Todo:
show message about missing kexi__blobs?
Todo:
show message

stored

Todo:
unsafe
Todo:
show message?

Reimplemented from KexiViewBase.

Definition at line 742 of file kexiformview.cpp.

◆ storeNewData()

KexiDB::SchemaData * KexiFormView::storeNewData ( const KexiDB::SchemaData &  sdata,
bool &  cancel 
)
protectedvirtual

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 from KexiViewBase.

Definition at line 722 of file kexiformview.cpp.

◆ tempData()

KexiFormPart::TempData * KexiFormView::tempData ( ) const
inlineprotected

Definition at line 143 of file kexiformview.h.

◆ updateAutoFieldsDataSource()

void KexiFormView::updateAutoFieldsDataSource ( )
protected

Used in loadForm()

Todo:
call this when form's data source is changed

Definition at line 290 of file kexiformview.cpp.

◆ updateDataSourcePage()

void KexiFormView::updateDataSourcePage ( )
protected

Definition at line 1042 of file kexiformview.cpp.

◆ updateTabStopsOrder()

void KexiFormView::updateTabStopsOrder ( )
protected

Called after loading the form contents (before showing it). Also called when the form window (KexiDialogBase) is detached (in KMDI's Child Frame mode), because otherwise tabstop ordering can get broken.

◆ updateValuesForSubproperties()

void KexiFormView::updateValuesForSubproperties ( )
protected

Used in loadForm()

Todo:
call this when form's data source is changed
Todo:
this could be at the KFD level, but KFD is going to be merged anyway with kexiforms, right?

Definition at line 319 of file kexiformview.cpp.

Member Data Documentation

◆ m_cursor

KexiDB::Cursor* KexiFormView::m_cursor
protected

Definition at line 210 of file kexiformview.h.

◆ m_dbform

KexiDBForm* KexiFormView::m_dbform
protected

Reimplemented after KexiViewBase. Updates actions (e.g. availability).

Definition at line 191 of file kexiformview.h.

◆ m_delayedFormContentsResizeOnShow

int KexiFormView::m_delayedFormContentsResizeOnShow
protected

For new (empty) forms only: Our form's area will be resized more than once. We will resize form widget itself later (in resizeEvent()).

Definition at line 215 of file kexiformview.h.

◆ m_previousDataSourceString

TQString KexiFormView::m_previousDataSourceString
protected

Database cursor used for data retrieving. It is shared between subsequent Data view sessions (just reopened on switch), but deleted and recreated from scratch when form's "dataSource" property changed since last form viewing (m_previousDataSourceString is used for that).

Definition at line 199 of file kexiformview.h.

◆ m_propertySet

KoProperty::Set* KexiFormView::m_propertySet
protected

Definition at line 193 of file kexiformview.h.

◆ m_query

KexiDB::QuerySchema* KexiFormView::m_query
protected

Definition at line 203 of file kexiformview.h.

◆ m_queryIsOwned

bool KexiFormView::m_queryIsOwned
protected

True, if m_query is created as temporary object within this form. If user selected an existing, predefined (stored) query, m_queryIsOwned will be false, so the query object will not be destroyed.

Definition at line 208 of file kexiformview.h.

◆ m_resizeMode

int KexiFormView::m_resizeMode
protected

Definition at line 201 of file kexiformview.h.

◆ m_scrollView

KexiFormScrollView* KexiFormView::m_scrollView
protected

Definition at line 192 of file kexiformview.h.

◆ m_setFocusInternalOnce

TQGuardedPtr<TQWidget> KexiFormView::m_setFocusInternalOnce
protected

Used in setFocusInternal()

Definition at line 218 of file kexiformview.h.

◆ m_widgetGeometryForRecentInsertAutoFields

TQRect KexiFormView::m_widgetGeometryForRecentInsertAutoFields
protected

Stores geometry of widget recently inserted using insertAutoFields() method. having this information, we'r eable to compute position for a newly inserted widget in insertAutoFields() is such position has not been specified. (the position is specified when a widget is inserted with mouse drag & dropping but not with clicking of 'Insert fields' button from Data Source pane)

Definition at line 226 of file kexiformview.h.


The documentation for this class was generated from the following files: