KXMLGUIClient Class Reference
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document, and can be dynamically merged with other KXMLGUIClients. More...
#include <kxmlguiclient.h>
Inheritance diagram for KXMLGUIClient:

Public Types | |
enum | ReverseStateChange { StateNoReverse, StateReverse } |
Public Member Functions | |
KXMLGUIClient () | |
KXMLGUIClient (KXMLGUIClient *parent) | |
virtual | ~KXMLGUIClient () |
KAction * | action (const char *name) const |
virtual KAction * | action (const QDomElement &element) const |
virtual KActionCollection * | actionCollection () const |
virtual KInstance * | instance () const |
virtual QDomDocument | domDocument () const |
virtual QString | xmlFile () const |
virtual QString | localXMLFile () const |
void | setXMLGUIBuildDocument (const QDomDocument &doc) |
QDomDocument | xmlguiBuildDocument () const |
void | setFactory (KXMLGUIFactory *factory) |
KXMLGUIFactory * | factory () const |
KXMLGUIClient * | parentClient () const |
void | insertChildClient (KXMLGUIClient *child) |
void | removeChildClient (KXMLGUIClient *child) |
const QPtrList< KXMLGUIClient > * | childClients () |
void | setClientBuilder (KXMLGUIBuilder *builder) |
KXMLGUIBuilder * | clientBuilder () const |
void | reloadXML () |
void | plugActionList (const QString &name, const QPtrList< KAction > &actionList) |
void | unplugActionList (const QString &name) |
void | addStateActionEnabled (const QString &state, const QString &action) |
void | addStateActionDisabled (const QString &state, const QString &action) |
StateChange | getActionsToChangeForState (const QString &state) |
void | beginXMLPlug (QWidget *) |
void | endXMLPlug () |
void | prepareXMLUnplug (QWidget *) |
Static Public Member Functions | |
QString | findMostRecentXMLFile (const QStringList &files, QString &doc) |
Protected Member Functions | |
virtual void | setInstance (KInstance *instance) |
virtual void | setXMLFile (const QString &file, bool merge=false, bool setXMLDoc=true) |
virtual void | setLocalXMLFile (const QString &file) |
virtual void | setXML (const QString &document, bool merge=false) |
virtual void | setDOMDocument (const QDomDocument &document, bool merge=false) |
virtual void | conserveMemory () |
virtual void | stateChanged (const QString &newstate, ReverseStateChange reverse=StateNoReverse) |
virtual void | virtual_hook (int id, void *data) |
Friends | |
class | KEditToolbarWidget |
Detailed Description
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document, and can be dynamically merged with other KXMLGUIClients.
Definition at line 41 of file kxmlguiclient.h.
Constructor & Destructor Documentation
|
Constructs a KXMLGUIClient which can be used with a KXMLGUIFactory to create a GUI from actions and an XML document, and which can be dynamically merged with other KXMLGUIClients.
Definition at line 67 of file kxmlguiclient.cpp. |
|
Constructs a KXMLGUIClient which can be used with a KXMLGUIFactory to create a GUI from actions and an XML document, and which can be dynamically merged with other KXMLGUIClients.
This constructor takes an additional Child clients are automatically added to the GUI if the parent is added. Definition at line 72 of file kxmlguiclient.cpp. References insertChildClient(). |
|
Destructs the KXMLGUIClient.
Definition at line 78 of file kxmlguiclient.cpp. |
Member Function Documentation
|
Retrieves an action of the client by name. If not found, it looks in its child clients. This method is provided for convenience, as it uses actionCollection() to get the action object. Definition at line 93 of file kxmlguiclient.cpp. References KActionCollection::action(), and actionCollection(). |
|
Retrieves an action for a given QDomElement. The default implementation uses the "name" attribute to query the action object via the other action() method. Definition at line 115 of file kxmlguiclient.cpp. References KActionCollection::action(), actionCollection(), and KGlobal::staticQString(). |
|
Retrieves the entire action collection for the GUI client.
Reimplemented in KEditToolbarWidget. Definition at line 107 of file kxmlguiclient.cpp. Referenced by action(), beginXMLPlug(), KMainWindow::createGUI(), KMainWindow::createStandardStatusBarAction(), endXMLPlug(), KMainWindowInterface::KMainWindowInterface(), prepareXMLUnplug(), setDOMDocument(), setInstance(), setXMLFile(), and stateChanged(). |
|
Definition at line 121 of file kxmlguiclient.cpp. Referenced by KMainWindow::createGUI(), KMainWindow::helpMenu(), setClientBuilder(), and setXMLFile(). |
|
Definition at line 126 of file kxmlguiclient.cpp. Referenced by KXMLGUIFactory::addClient(), KMainWindow::createGUI(), and KXMLGUIFactory::removeClient(). |
|
This will return the name of the XML file as set by setXMLFile(). If setXML() is used directly, then this will return NULL. The filename that this returns is obvious for components as each component has exactly one XML file. In non-components, however, there are usually two: the global file and the local file. This function doesn't really care about that, though. It will always return the last XML file set. This, in almost all cases, will be the local XML file.
Definition at line 131 of file kxmlguiclient.cpp. Referenced by reloadXML(), and KEditToolbarWidget::save(). |
|
This method is called by the KXMLGUIFactory as soon as the client is added to the KXMLGUIFactory's GUI.
Definition at line 549 of file kxmlguiclient.cpp. Referenced by KXMLGUIFactory::addClient(), and KXMLGUIFactory::removeClient(). |
|
Retrieves a pointer to the KXMLGUIFactory this client is associated with (will return 0L if the client's GUI has not been built by a KXMLGUIFactory.
Definition at line 554 of file kxmlguiclient.cpp. Referenced by KXMLGUIFactory::addClient(), KXMLGUIFactory::removeClient(), KEditToolbarWidget::save(), and KMainWindow::setStandardToolBarMenuEnabled(). |
|
KXMLGUIClients can form a simple child/parent object tree. This method returns a pointer to the parent client or 0L if it has no parent client assigned. Definition at line 559 of file kxmlguiclient.cpp. |
|
Use this method to make a client a child client of another client. Usually you don't need to call this method, as it is called automatically when using the second constructor, which takes a arent argument. Definition at line 564 of file kxmlguiclient.cpp. References d. Referenced by KXMLGUIClient(). |
|
Removes the given
Definition at line 572 of file kxmlguiclient.cpp. References d. |
|
Retrieves a list of all child clients.
Definition at line 587 of file kxmlguiclient.cpp. Referenced by KXMLGUIFactory::addClient(), and KXMLGUIFactory::removeClient(). |
|
A client can have an own KXMLGUIBuilder. Use this method to assign your builder instance to the client (so that the KXMLGUIFactory can use it when building the client's GUI) Client specific guibuilders are useful if you want to create custom container widgets for your GUI. Definition at line 592 of file kxmlguiclient.cpp. References instance(), and KXMLGUIBuilder::setBuilderInstance(). |
|
Retrieves the client's GUI builder or 0L if no client specific builder has been assigned via setClientBuilder().
Definition at line 599 of file kxmlguiclient.cpp. Referenced by KXMLGUIFactory::addClient(), and KXMLGUIFactory::removeClient(). |
|
Forces this client to re-read its XML resource file. This is intended to be used when you know that the resource file has changed and you will soon be rebuilding the GUI. It has no useful effect with non-KParts GUIs, so don't bother using it unless your app is component based. Definition at line 148 of file kxmlguiclient.cpp. References setXMLFile(), and xmlFile(). |
|
ActionLists are a way for XMLGUI to support dynamic lists of actions. E.g. if you are writing a file manager, and there is a menu file whose contents depend on the mimetype of the file that is selected, then you can achieve this using ActionLists. It works as follows: In your xxxui.rc file ( the one that you set in setXMLFile() ), you put an <ActionList name="xxx"> tag. E.g.
This tag will get expanded to a list of actions. In the example above ( a file manager with a dynamic file menu ), you would call every time a file is selected, unselected or ...
Definition at line 604 of file kxmlguiclient.cpp. |
|
The complement of plugActionList() ...
Definition at line 612 of file kxmlguiclient.cpp. |
|
Definition at line 922 of file kxmlguiclient.cpp. References actionCollection(), and KActionCollection::beginXMLPlug(). Referenced by KXMLGUIFactory::addClient(). |
|
Definition at line 930 of file kxmlguiclient.cpp. References actionCollection(), and KActionCollection::endXMLPlug(). Referenced by KXMLGUIFactory::addClient(). |
|
Definition at line 938 of file kxmlguiclient.cpp. References actionCollection(), and KActionCollection::prepareXMLUnplug(). Referenced by KXMLGUIFactory::removeClient(). |
|
Sets the instance ( KInstance) for this part. Call this first in the inherited class constructor. (At least before setXMLFile().) Definition at line 155 of file kxmlguiclient.cpp. References actionCollection(), and KActionCollection::setInstance(). |
|
Sets the name of the rc file containing the XML for the part. Call this in the Part-inherited class constructor.
Definition at line 163 of file kxmlguiclient.cpp. References actionCollection(), KInstance::dirs(), KStandardDirs::findAllResources(), instance(), kdWarning(), setXML(), and KActionCollection::setXMLFile(). Referenced by KMainWindow::createGUI(), reloadXML(), and KEditToolbarWidget::save(). |
|
Sets the XML for the part. Call this in the Part-inherited class constructor if you don't call setXMLFile(). Definition at line 215 of file kxmlguiclient.cpp. References setDOMDocument(). Referenced by setXMLFile(). |
|
Sets the Document for the part, describing the layout of the GUI. Call this in the Part-inherited class constructor if you don't call setXMLFile or setXML . Definition at line 222 of file kxmlguiclient.cpp. References actionCollection(), and KXMLGUIFactory::removeDOMComments(). Referenced by setXML(). |
|
This function will attempt to give up some memory after the GUI is built. It should never be used in apps where the GUI may be rebuilt at some later time (components, for instance). Definition at line 533 of file kxmlguiclient.cpp. Referenced by KMainWindow::createGUI(). |
|
Actions can collectively be assigned a "State". To accomplish this the respective actions are tagged as <enable> or <disable> in a <State> </State> group of the XMLfile. During program execution the programmer can call stateChanged() to set actions to a defined state.
Definition at line 895 of file kxmlguiclient.cpp. References KActionCollection::action(), and actionCollection(). Referenced by KMainWindow::slotStateChanged(). |
The documentation for this class was generated from the following files: