Kexi API Documentation (2.0 alpha)

KexiActionProxy Class Reference

#include <kexiactionproxy.h>

Inheritance diagram for KexiActionProxy:

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

Detailed Description

An interface that acts as proxy for shared actions within the application.

For example, edit->copy action can be reused to copy different types of items. Availability and meaning of given action depends on the context, while the context changes e.g. when another window is activated. This class is mostly used by subclassing in KexiDialogBase or KexiDockBase

Definition at line 83 of file kexiactionproxy.h.

Public Member Functions

 KexiActionProxy (QObject *receiver, KexiSharedActionHost *host=0)
virtual ~KexiActionProxy ()
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)
 For internal use by addActionProxyChild(). parent can be 0.

Public Attributes

KexiActionProxym_focusedChild

Protected Member Functions

void plugSharedAction (const char *action_name, QObject *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, QWidget *w)
void plugSharedActionToExternalGUI (const char *action_name, KXMLGUIClient *client)
void plugSharedActionsToExternalGUI (const QValueList< QCString > &action_names, KXMLGUIClient *client)
void unplugSharedAction (const char *action_name, QWidget *w)
KActionplugSharedAction (const char *action_name, const QString &alternativeText, QWidget *w)
virtual KActionsharedAction (const char *action_name)
QObject * receiver () const
virtual void setAvailable (const char *action_name, bool set)
void addActionProxyChild (KexiActionProxy *child)
void takeActionProxyChild (KexiActionProxy *child)

Protected Attributes

KexiSharedActionHostm_host
QGuardedPtr< QObject > m_receiver
QAsciiDict< QPair< QSignal *,
bool > > 
m_signals
QPtrList< KexiActionProxym_sharedActionChildren
QPtrList< KActionm_alternativeActions
KexiActionProxym_actionProxyParent
QObject m_signal_parent
 it's just to have common parent for owned signals
KAction_setEnabled_Helperm_KAction_setEnabled_helper
 For internal use by plugSharedActionToExternalGUI().

Friends

class KexiSharedActionHost
class KAction_setEnabled_Helper
class KexiSharedActionConnector


Constructor & Destructor Documentation

KexiActionProxy::KexiActionProxy QObject *  receiver,
KexiSharedActionHost host = 0
 

Constructs action proxy for object receiver, using host. If host is NULL, KexiSharedActionHost::defaultHost() is used. (you must be sure that it's true) -- it is casted to QObject and assigned as the receiver.

Definition at line 78 of file kexiactionproxy.cpp.

References m_alternativeActions, m_host, m_sharedActionChildren, m_signals, and KexiSharedActionHost::plugActionProxy().

KexiActionProxy::~KexiActionProxy  )  [virtual]
 

Definition at line 93 of file kexiactionproxy.cpp.

References m_actionProxyParent, m_host, m_KAction_setEnabled_helper, m_receiver, m_sharedActionChildren, takeActionProxyChild(), and KexiSharedActionHost::takeActionProxyFor().


Member Function Documentation

bool KexiActionProxy::activateSharedAction const char *  action_name,
bool  alsoCheckInChildren = true
 

Activates action named action_name for this proxy. If the action is executed (accepted), true is returned.

Definition at line 192 of file kexiactionproxy.cpp.

References activateSharedAction(), m_actionProxyParent, m_sharedActionChildren, and m_signals.

Referenced by activateSharedAction(), and KexiSharedActionHostPrivate::slotAction().

void KexiActionProxy::addActionProxyChild KexiActionProxy child  )  [protected]
 

Adds child of this proxy. Children will receive activateSharedAction() event, If activateSharedAction() "event" is not consumed by the main proxy, we start to iterate over proxy children (in unspecified order) to and call activateSharedAction() on every child until one of them accept the "event".

If proxy child is destroyed, it is automatically detached from its parent proxy. Parent proxy is 0 by default. This pointer is properly cleared when parent proxy is destroyed.

Definition at line 262 of file kexiactionproxy.cpp.

References m_sharedActionChildren.

Referenced by KexiViewBase::addChildView(), KexiRelationMainDlg::KexiRelationMainDlg(), and KexiDialogBase::switchToViewMode().

bool KexiActionProxy::isAvailable const char *  action_name,
bool  alsoCheckInChildren = true
const
 

Returns:
true, if action named action_name is enabled within the proxy. False is returned either if the action is not available or is not supported. \ sa isSupported()

Definition at line 233 of file kexiactionproxy.cpp.

References isAvailable(), m_actionProxyParent, m_focusedChild, m_sharedActionChildren, and m_signals.

Referenced by KexiSharedActionHost::invalidateSharedActions(), and isAvailable().

bool KexiActionProxy::isSupported const char *  action_name  )  const
 

Returns:
true, if action named action_name is supported by the proxy.

Definition at line 216 of file kexiactionproxy.cpp.

References m_focusedChild, m_sharedActionChildren, and m_signals.

Referenced by KexiSharedActionHost::invalidateSharedActions().

KAction * KexiActionProxy::plugSharedAction const char *  action_name,
const QString alternativeText,
QWidget w
[protected]
 

Like above, but creates alternative action as a copy of action_name, with alternativeText set. When this action is activated, just original action specified by action_name is activated. The aternative action has autmatically set name as: action_name + "_alt".

Returns:
newly created action or 0 if action_name not found.

Definition at line 151 of file kexiactionproxy.cpp.

References m_host, m_receiver, sharedAction(), and KexiSharedActionHost::updateActionAvailable().

int KexiActionProxy::plugSharedAction const char *  action_name,
QWidget w
[protected]
 

Plugs action named action_name to a widget w, so the action is visible on this widget as an item. w will typically be a menu, popup menu or a toolbar. Does nothing if no action found, so generally this is safer than just caling e.g. action("myaction")->plug(myPopup);

Returns:
index of inserted item, or -1 if there is not action with name action_name.
See also:
action(), KAction::plug(QWidget*, int)

Definition at line 131 of file kexiactionproxy.cpp.

References sharedAction().

void KexiActionProxy::plugSharedAction const char *  action_name,
const char *  slot
[inline, protected]
 

Typical version of plugAction() method -- plugs action named action_name to slot slot in _this_ widget.

Definition at line 116 of file kexiactionproxy.h.

void KexiActionProxy::plugSharedAction const char *  action_name,
QObject *  receiver,
const char *  slot
[protected]
 

Plugs shared action named action_name to slot slot in receiver. Receiver is usually a child of _this_ widget.

Definition at line 109 of file kexiactionproxy.cpp.

References m_signal_parent, and m_signals.

Referenced by KexiDataAwareView::initActions(), KexiFormView::KexiFormView(), KexiQueryDesignerSQLView::KexiQueryDesignerSQLView(), KexiRelationWidget::KexiRelationWidget(), KexiReportView::KexiReportView(), KexiScriptDesignView::KexiScriptDesignView(), KexiTableDesignerView::KexiTableDesignerView(), KexiSharedActionConnector::plugSharedAction(), plugSharedActionToExternalGUI(), and KexiDataAwareView::reloadActions().

void KexiActionProxy::plugSharedActionsToExternalGUI const QValueList< QCString > &  action_names,
KXMLGUIClient *  client
[protected]
 

Definition at line 184 of file kexiactionproxy.cpp.

References plugSharedActionToExternalGUI().

Referenced by KexiSharedActionConnector::plugSharedActionsToExternalGUI().

void KexiActionProxy::plugSharedActionToExternalGUI const char *  action_name,
KXMLGUIClient *  client
[protected]
 

Definition at line 171 of file kexiactionproxy.cpp.

References m_KAction_setEnabled_helper, plugSharedAction(), and setAvailable().

Referenced by plugSharedActionsToExternalGUI(), and KexiSharedActionConnector::plugSharedActionToExternalGUI().

QObject* KexiActionProxy::receiver  )  const [inline, protected]
 

Definition at line 147 of file kexiactionproxy.h.

void KexiActionProxy::setActionProxyParent_internal KexiActionProxy parent  ) 
 

For internal use by addActionProxyChild(). parent can be 0.

Definition at line 276 of file kexiactionproxy.cpp.

References m_actionProxyParent.

void KexiActionProxy::setAvailable const char *  action_name,
bool  set
[protected, virtual]
 

Reimplemented in KexiViewBase.

Definition at line 253 of file kexiactionproxy.cpp.

References m_host, m_receiver, m_signals, and KexiSharedActionHost::updateActionAvailable().

Referenced by plugSharedActionToExternalGUI(), KexiViewBase::setAvailable(), and KAction_setEnabled_Helper::slotSetEnabled().

void KexiActionProxy::setSharedActionHost KexiSharedActionHost host  )  [inline]
 

Sets host to host; rerely used.

Definition at line 97 of file kexiactionproxy.h.

KAction * KexiActionProxy::sharedAction const char *  action_name  )  [protected, virtual]
 

Returns:
action named with name or NULL if there is no such action.

Reimplemented in KexiViewBase.

Definition at line 211 of file kexiactionproxy.cpp.

References m_host, and KexiSharedActionHost::mainWindow().

Referenced by plugSharedAction(), KexiViewBase::sharedAction(), and unplugSharedAction().

void KexiActionProxy::takeActionProxyChild KexiActionProxy child  )  [protected]
 

Definition at line 270 of file kexiactionproxy.cpp.

References m_sharedActionChildren.

Referenced by KexiDialogBase::switchToViewMode(), and ~KexiActionProxy().

void KexiActionProxy::unplugSharedAction const char *  action_name,
QWidget w
[protected]
 

Unplugs action named action_name from a widget w.

See also:
plugSharedAction(const char *action_name, QWidget* w)

Definition at line 141 of file kexiactionproxy.cpp.

References sharedAction().

void KexiActionProxy::unplugSharedAction const char *  action_name  )  [protected]
 

Definition at line 122 of file kexiactionproxy.cpp.

References m_signals.

Referenced by KexiDataAwareView::reloadActions().


Friends And Related Function Documentation

friend class KAction_setEnabled_Helper [friend]
 

Definition at line 185 of file kexiactionproxy.h.

friend class KexiSharedActionConnector [friend]
 

Definition at line 186 of file kexiactionproxy.h.

friend class KexiSharedActionHost [friend]
 

Definition at line 184 of file kexiactionproxy.h.


Member Data Documentation

KexiActionProxy* KexiActionProxy::m_actionProxyParent [protected]
 

Definition at line 170 of file kexiactionproxy.h.

Referenced by activateSharedAction(), KexiViewBase::eventFilter(), isAvailable(), setActionProxyParent_internal(), and ~KexiActionProxy().

QPtrList<KAction> KexiActionProxy::m_alternativeActions [protected]
 

Definition at line 168 of file kexiactionproxy.h.

Referenced by KexiActionProxy().

KexiActionProxy* KexiActionProxy::m_focusedChild
 

Definition at line 182 of file kexiactionproxy.h.

Referenced by KexiViewBase::eventFilter(), isAvailable(), and isSupported().

KexiSharedActionHost* KexiActionProxy::m_host [protected]
 

Definition at line 162 of file kexiactionproxy.h.

Referenced by KexiActionProxy(), plugSharedAction(), setAvailable(), sharedAction(), and ~KexiActionProxy().

KAction_setEnabled_Helper* KexiActionProxy::m_KAction_setEnabled_helper [protected]
 

For internal use by plugSharedActionToExternalGUI().

Definition at line 175 of file kexiactionproxy.h.

Referenced by plugSharedActionToExternalGUI(), and ~KexiActionProxy().

QGuardedPtr<QObject> KexiActionProxy::m_receiver [protected]
 

Definition at line 163 of file kexiactionproxy.h.

Referenced by plugSharedAction(), setAvailable(), and ~KexiActionProxy().

QPtrList<KexiActionProxy> KexiActionProxy::m_sharedActionChildren [protected]
 

Definition at line 166 of file kexiactionproxy.h.

Referenced by activateSharedAction(), addActionProxyChild(), isAvailable(), isSupported(), KexiActionProxy(), takeActionProxyChild(), and ~KexiActionProxy().

QObject KexiActionProxy::m_signal_parent [protected]
 

it's just to have common parent for owned signals

Definition at line 172 of file kexiactionproxy.h.

Referenced by plugSharedAction().

QAsciiDict< QPair<QSignal*,bool> > KexiActionProxy::m_signals [protected]
 

Definition at line 164 of file kexiactionproxy.h.

Referenced by activateSharedAction(), isAvailable(), isSupported(), KexiActionProxy(), plugSharedAction(), setAvailable(), and unplugSharedAction().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for Kexi 2.0 alpha.
Documentation copyright © 2002-2007 the Kexi Team.
Generated on Tue Apr 1 20:49:43 2008 by doxygen 1.4.2 written by Dimitri van Heesch, © 1997-2003