kexi

KexiPart::Part Class Reference

#include <kexipart.h>

Inheritance diagram for KexiPart::Part:

KexiFormPart KexiPart::StaticPart KexiQueryPart KexiReportPart KexiScriptPart KexiTablePart KexiSimplePrintingPart List of all members.

Detailed Description

The main class for kexi frontend parts like tables, queries, forms and reports.

Definition at line 64 of file kexipart.h.


Signals

void newObjectRequest (KexiPart::Info *info)

Public Member Functions

 Part (QObject *parent, const char *name, const QStringList &)
virtual ~Part ()
virtual KAction * action (const QString &actionuri, QObject *object=0)
int supportedViewModes () const
KexiDialogBaseopenInstance (KexiMainWindow *win, KexiPart::Item &item, int viewMode=Kexi::DataViewMode, QMap< QString, QString > *staticObjectArgs=0)
virtual bool remove (KexiMainWindow *win, KexiPart::Item &item)
virtual tristate rename (KexiMainWindow *win, KexiPart::Item &item, const QString &newName)
virtual KexiDialogTempDatacreateTempData (KexiDialogBase *dialog)
virtual KexiViewBasecreateView (QWidget *parent, KexiDialogBase *dialog, KexiPart::Item &item, int viewMode=Kexi::DataViewMode, QMap< QString, QString > *staticObjectArgs=0)=0
QCString instanceName () const
QString instanceCaption () const
Infoinfo () const
GUIClientguiClient () const
GUIClientinstanceGuiClient (int mode=0) const
KActionCollection * actionCollectionForMode (int viewMode) const
const Kexi::ObjectStatuslastOperationStatus () const
virtual QString i18nMessage (const QCString &englishMessage, KexiDialogBase *dlg) const

Protected Slots

void slotCreate ()

Protected Member Functions

 Part (QObject *parent, StaticInfo *info)
void createGUIClients (KexiMainWindow *win)
virtual void initPartActions ()
virtual void initInstanceActions ()
virtual KexiDB::SchemaDataloadSchemaData (KexiDialogBase *dlg, const KexiDB::SchemaData &sdata, int viewMode)
bool loadDataBlock (KexiDialogBase *dlg, QString &dataString, const QString &dataID=QString::null)
KAction * createSharedAction (int mode, const QString &text, const QString &pix_name, const KShortcut &cut, const char *name, const char *subclassName=0)
KAction * createSharedToggleAction (int mode, const QString &text, const QString &pix_name, const KShortcut &cut, const char *name)
KAction * createSharedPartAction (const QString &text, const QString &pix_name, const KShortcut &cut, const char *name, const char *subclassName=0)
KAction * createSharedPartToggleAction (const QString &text, const QString &pix_name, const KShortcut &cut, const char *name)
void setActionAvailable (const char *action_name, bool avail)
void setInfo (Info *info)
virtual void setupCustomPropertyPanelTabs (KTabWidget *tab, KexiMainWindow *mainWin)

Protected Attributes

QMap< QString, QString > m_names
int m_supportedViewModes
Infom_info
GUIClientm_guiClient
QIntDict< GUIClientm_instanceGuiClients
KexiMainWindowm_mainWin
Kexi::ObjectStatus m_status
int m_registeredPartID
bool m_newObjectsAreDirty: 1
PartPrivate * d

Friends

class Manager
class ::KexiMainWindow
class ::KexiMainWindowImpl
class GUIClient

Constructor & Destructor Documentation

Part::Part QObject *  parent,
const char *  name,
const QStringList & 
 

Constructor.

Definition at line 60 of file kexipart.cpp.

Part::~Part  )  [virtual]
 

Destructor.

Definition at line 84 of file kexipart.cpp.

Part::Part QObject *  parent,
StaticInfo info
[protected]
 

Used by StaticPart.

Definition at line 72 of file kexipart.cpp.


Member Function Documentation

virtual KAction* KexiPart::Part::action const QString &  actionuri,
QObject *  object = 0
[inline, virtual]
 

Query a KAction from the Part. This method is used to provide a common way for Parts to provide there own KActrion's on the fly. This method extends the normal KXMLGUIClient::action(const char*) functionality cause the Part is able to provide the KAction on the fly depending on the passed arguments.

Todo:
THIS IS EXPERIMENTAL STUFF and used only on the ScriptPart-plugin.

Reimplemented in KexiScriptPart.

Definition at line 81 of file kexipart.h.

void Part::createGUIClients KexiMainWindow win  )  [protected]
 

Creates GUICLients for this part, attached to win This method is called from KexiMainWindow.

Definition at line 89 of file kexipart.cpp.

KAction * Part::createSharedAction int  mode,
const QString &  text,
const QString &  pix_name,
const KShortcut &  cut,
const char *  name,
const char *  subclassName = 0
[protected]
 

Creates shared action for action collection declared for 'instance actions' of this part. See KexiSharedActionHost::createSharedAction() for details. Pass desired KAction subclass with subclassName (e.g. "KToggleAction") to have that subclass allocated instead just KAction (what is the default).

Definition at line 137 of file kexipart.cpp.

KAction * Part::createSharedPartAction const QString &  text,
const QString &  pix_name,
const KShortcut &  cut,
const char *  name,
const char *  subclassName = 0
[protected]
 

Creates shared action for action collection declared for 'part actions' of this part. See KexiSharedActionHost::createSharedAction() for details. Pass desired KAction subclass with subclassName (e.g. "KToggleAction") to have that subclass allocated instead just KAction (what is the default).

Definition at line 150 of file kexipart.cpp.

KAction * Part::createSharedPartToggleAction const QString &  text,
const QString &  pix_name,
const KShortcut &  cut,
const char *  name
[protected]
 

Convenience version of above method - creates shared toggle action for 'part actions' of this part.

Definition at line 166 of file kexipart.cpp.

KAction * Part::createSharedToggleAction int  mode,
const QString &  text,
const QString &  pix_name,
const KShortcut &  cut,
const char *  name
[protected]
 

Convenience version of above method - creates shared toggle action.

Definition at line 160 of file kexipart.cpp.

KexiDialogTempData * Part::createTempData KexiDialogBase dialog  )  [virtual]
 

Creates and returns a new temporary data for a dialog dialog. This method is called on openInstance() once per dialog. Reimplement this to return KexiDialogTempData subclass instance. Default implemention just returns empty KexiDialogTempData object.

Reimplemented in KexiFormPart, KexiQueryPart, KexiReportPart, and KexiTablePart.

Definition at line 356 of file kexipart.cpp.

virtual KexiViewBase* KexiPart::Part::createView QWidget *  parent,
KexiDialogBase dialog,
KexiPart::Item item,
int  viewMode = Kexi::DataViewMode,
QMap< QString, QString > *  staticObjectArgs = 0
[pure virtual]
 

Creates a new view for mode viewMode, item and parent. The view will be used inside dialog.

Implemented in KexiPart::StaticPart, KexiSimplePrintingPart, KexiFormPart, KexiQueryPart, KexiReportPart, KexiScriptPart, and KexiTablePart.

GUIClient* KexiPart::Part::guiClient  )  const [inline]
 

Returns:
part's GUI Client, so you can create part-wide actions using this client.

Definition at line 157 of file kexipart.h.

QString Part::i18nMessage const QCString &  englishMessage,
KexiDialogBase dlg
const [virtual]
 

Returns:
i18n'd message translated from englishMessage. This method is useful for messages like: "<p>Table \"1\" has been modified.</p>", -- such messages can be accurately translated, while this could not: "<p>%1 \"2\" has been modified.</p>". See implementation of this method in KexiTablePart to see what strings are needed for translation.
Default implementation returns generic englishMessage. In special cases, englishMessage can start with ":", to indicate that empty string will be generated if a part does not offer a message for such englishMessage. This is used e.g. in KexiMainWindowImpl::closeDialog().

Reimplemented in KexiFormPart, KexiQueryPart, KexiReportPart, and KexiTablePart.

Definition at line 361 of file kexipart.cpp.

QString Part::instanceCaption  )  const
 

i18n'd instance name usable for displaying in gui as object's caption.

Todo:
move this to Info class when the name could be moved as localized property to service's .desktop file.

Definition at line 378 of file kexipart.cpp.

GUIClient* KexiPart::Part::instanceGuiClient int  mode = 0  )  const [inline]
 

Returns:
part's GUI Client, so you can create instance-wide actions using this client.

Definition at line 161 of file kexipart.h.

QCString Part::instanceName  )  const
 

i18n'd instance name usable for displaying in gui as object's name. The name is valid identifier - contains latin1 lowercase characters only.

Todo:
move this to Info class when the name could be moved as localized property to service's .desktop file.

Definition at line 371 of file kexipart.cpp.

KexiDialogBase * Part::openInstance KexiMainWindow win,
KexiPart::Item item,
int  viewMode = Kexi::DataViewMode,
QMap< QString, QString > *  staticObjectArgs = 0
 

"Opens" an instance that the part provides, pointed by item in a mode viewMode. viewMode is one of Kexi::ViewMode enum. staticObjectArgs can be passed for static Kexi Parts.

Definition at line 203 of file kexipart.cpp.

bool Part::remove KexiMainWindow win,
KexiPart::Item item
[virtual]
 

Removes any stored data pointed by item (example: table is dropped for table part). From now this data is inaccesible, and item disappear. You do not need to remove item, or remove object's schema stored in the database, beacuse this will be done automatically by KexiProject after successful call of this method. All object's data blocks are also automatically removed from database (from "kexi__objectdata" table). For this, a database connection associated with kexi project owned by win can be used.

Database transaction is started by KexiProject before calling this method, and it will be rolled back if you return false here. You shouldn't use by hand transactions here.

Default implementation just removes object from kexi__* system structures at the database backend using KexiDB::Connection::removeObject().

Reimplemented in KexiQueryPart, and KexiTablePart.

Definition at line 348 of file kexipart.cpp.

tristate Part::rename KexiMainWindow win,
KexiPart::Item item,
const QString &  newName
[virtual]
 

Renames stored data pointed by item to newName (example: table name is altered in the database). For this, a database connection associated with kexi project owned by win can be used. You do not need to change item, and change object's schema stored in the database, beacuse this is automatically handled by KexiProject.

Database transaction is started by KexiProject before calling this method, and it will be rolled back if you return false here. You shouldn't use by hand transactions here.

Default implementation does nothing and returns true.

Reimplemented in KexiQueryPart, and KexiTablePart.

Definition at line 383 of file kexipart.cpp.

void Part::setupCustomPropertyPanelTabs KTabWidget *  tab,
KexiMainWindow mainWin
[protected, virtual]
 

This method can be reimplemented to setup additional tabs in the property editor panel. Default implementation does nothing. This method is called whenever current dialog (KexiDialogBase) is switched and type (mime type) of its contents differs from previous one. For example, if a user switched from Table Designer to Form Designer, additional tab containing Form Designer's object tree should be shown.

Reimplemented in KexiFormPart.

Definition at line 367 of file kexipart.cpp.

int KexiPart::Part::supportedViewModes  )  const [inline]
 

Returns:
supported modes for dialogs created by this part, ie. a combination of Kexi::ViewMode enum elements. Set this member in your KexiPart subclass' ctor, if you need to override the default value that equals Kexi::DataViewMode | Kexi::DesignViewMode. This information is used to set supported view modes for every KexiDialogBase derived object created by this KexiPart. Default flag combination is Kexi::DataViewMode | Kexi::DesignViewMode.

Definition at line 94 of file kexipart.h.


Member Data Documentation

QMap<QString,QString> KexiPart::Part::m_names [protected]
 

Set of i18n'd action names for, initialised on KexiPart::Part subclass ctor The names are useful because the same action can have other name for each part E.g.

"New table" vs "New query" can have different forms for some languages...

Definition at line 282 of file kexipart.h.

bool KexiPart::Part::m_newObjectsAreDirty [protected]
 

True if newwly created, unsaved objects are dirty. False by default. You can change it in your subclass' constructor.

Definition at line 302 of file kexipart.h.

int KexiPart::Part::m_registeredPartID [protected]
 

If you're implementing a new part, set this to value >0 in your ctor if you have well known (ie registered ID) for your part. So far, table, query, form, report and script part have defined their IDs (see KexiPart::ObjectTypes).

Definition at line 298 of file kexipart.h.

int KexiPart::Part::m_supportedViewModes [protected]
 

Supported modes for dialogs created by this part.

See also:
supportedViewModes()

Definition at line 286 of file kexipart.h.


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