.TH "KXMLGUIClient" kde3 "11 Jun 2005" "Version Version 3.4.1" "kdeui Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KXMLGUIClient \- A KXMLGUIClient can be used with \fBKXMLGUIFactory\fP to create a GUI from actions and an XML document, and can be dynamically merged with other KXMLGUIClients.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <kxmlguiclient.h>\fP
.PP
Inherited by \fBKDEPrivate::ToolBarHandler\fP, \fBKEditToolbarWidget\fP\fC [virtual]\fP, and \fBKMainWindow\fP\fC [virtual]\fP.
.PP
.SS "Public Types"

.in +1c
.ti -1c
.RI "enum \fBReverseStateChange\fP { \fBStateNoReverse\fP, \fBStateReverse\fP }"
.br
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKXMLGUIClient\fP ()"
.br
.ti -1c
.RI "\fBKXMLGUIClient\fP (\fBKXMLGUIClient\fP *parent)"
.br
.ti -1c
.RI "virtual \fB~KXMLGUIClient\fP ()"
.br
.ti -1c
.RI "\fBKAction\fP * \fBaction\fP (const char *name) const "
.br
.ti -1c
.RI "virtual \fBKAction\fP * \fBaction\fP (const \fBQDomElement\fP &element) const "
.br
.ti -1c
.RI "virtual \fBKActionCollection\fP * \fBactionCollection\fP () const "
.br
.ti -1c
.RI "virtual \fBKInstance\fP * \fBinstance\fP () const "
.br
.ti -1c
.RI "virtual \fBQDomDocument\fP \fBdomDocument\fP () const "
.br
.ti -1c
.RI "virtual \fBQString\fP \fBxmlFile\fP () const "
.br
.ti -1c
.RI "virtual \fBQString\fP \fBlocalXMLFile\fP () const "
.br
.ti -1c
.RI "void \fBsetXMLGUIBuildDocument\fP (const \fBQDomDocument\fP &doc)"
.br
.ti -1c
.RI "\fBQDomDocument\fP \fBxmlguiBuildDocument\fP () const "
.br
.ti -1c
.RI "void \fBsetFactory\fP (\fBKXMLGUIFactory\fP *factory)"
.br
.ti -1c
.RI "\fBKXMLGUIFactory\fP * \fBfactory\fP () const "
.br
.ti -1c
.RI "\fBKXMLGUIClient\fP * \fBparentClient\fP () const "
.br
.ti -1c
.RI "void \fBinsertChildClient\fP (\fBKXMLGUIClient\fP *child)"
.br
.ti -1c
.RI "void \fBremoveChildClient\fP (\fBKXMLGUIClient\fP *child)"
.br
.ti -1c
.RI "const \fBQPtrList\fP< \fBKXMLGUIClient\fP > * \fBchildClients\fP ()"
.br
.ti -1c
.RI "void \fBsetClientBuilder\fP (\fBKXMLGUIBuilder\fP *builder)"
.br
.ti -1c
.RI "\fBKXMLGUIBuilder\fP * \fBclientBuilder\fP () const "
.br
.ti -1c
.RI "void \fBreloadXML\fP ()"
.br
.ti -1c
.RI "void \fBplugActionList\fP (const \fBQString\fP &name, const \fBQPtrList\fP< \fBKAction\fP > &actionList)"
.br
.ti -1c
.RI "void \fBunplugActionList\fP (const \fBQString\fP &name)"
.br
.ti -1c
.RI "void \fBaddStateActionEnabled\fP (const \fBQString\fP &state, const \fBQString\fP &action)"
.br
.ti -1c
.RI "void \fBaddStateActionDisabled\fP (const \fBQString\fP &state, const \fBQString\fP &action)"
.br
.ti -1c
.RI "StateChange \fBgetActionsToChangeForState\fP (const \fBQString\fP &state)"
.br
.ti -1c
.RI "void \fBbeginXMLPlug\fP (\fBQWidget\fP *)"
.br
.ti -1c
.RI "void \fBendXMLPlug\fP ()"
.br
.ti -1c
.RI "void \fBprepareXMLUnplug\fP (\fBQWidget\fP *)"
.br
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "static \fBQString\fP \fBfindMostRecentXMLFile\fP (const \fBQStringList\fP &files, \fBQString\fP &doc)"
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "virtual void \fBsetInstance\fP (\fBKInstance\fP *instance)"
.br
.ti -1c
.RI "virtual void \fBsetXMLFile\fP (const \fBQString\fP &file, bool merge=false, bool setXMLDoc=true)"
.br
.ti -1c
.RI "virtual void \fBsetLocalXMLFile\fP (const \fBQString\fP &file)"
.br
.ti -1c
.RI "virtual void \fBsetXML\fP (const \fBQString\fP &document, bool merge=false)"
.br
.ti -1c
.RI "virtual void \fBsetDOMDocument\fP (const \fBQDomDocument\fP &document, bool merge=false)"
.br
.ti -1c
.RI "virtual void \fBconserveMemory\fP ()"
.br
.ti -1c
.RI "virtual void \fBstateChanged\fP (const \fBQString\fP &newstate, ReverseStateChange reverse=StateNoReverse)"
.br
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int id, void *data)"
.br
.in -1c
.SS "Friends"

.in +1c
.ti -1c
.RI "class \fBKEditToolbarWidget\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
A KXMLGUIClient can be used with \fBKXMLGUIFactory\fP to create a GUI from actions and an XML document, and can be dynamically merged with other KXMLGUIClients. 
.PP
Definition at line 43 of file kxmlguiclient.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KXMLGUIClient::KXMLGUIClient ()"
.PP
Constructs a KXMLGUIClient which can be used with a \fBKXMLGUIFactory\fP to create a GUI from actions and an XML document, and which can be dynamically merged with other KXMLGUIClients. 
.PP
Definition at line 67 of file kxmlguiclient.cpp.
.SS "KXMLGUIClient::KXMLGUIClient (\fBKXMLGUIClient\fP * parent)"
.PP
Constructs a KXMLGUIClient which can be used with a \fBKXMLGUIFactory\fP to create a GUI from actions and an XML document, and which can be dynamically merged with other KXMLGUIClients. 
.PP
This constructor takes an additional \fCparent\fP argument, which makes the client a child client of the parent.
.PP
Child clients are automatically added to the GUI if the parent is added. 
.PP
Definition at line 72 of file kxmlguiclient.cpp.
.SS "KXMLGUIClient::~\fBKXMLGUIClient\fP ()\fC [virtual]\fP"
.PP
Destructs the KXMLGUIClient. 
.PP
Definition at line 78 of file kxmlguiclient.cpp.
.SH "Member Function Documentation"
.PP 
.SS "\fBKAction\fP * KXMLGUIClient::action (const char * name) const"
.PP
Retrieves an action of the client by name. 
.PP
If not found, it looks in its child clients. This method is provided for convenience, as it uses \fBactionCollection()\fP to get the action object. 
.PP
Definition at line 93 of file kxmlguiclient.cpp.
.PP
References KActionCollection::action(), and actionCollection().
.SS "\fBKAction\fP * KXMLGUIClient::action (const \fBQDomElement\fP & element) const\fC [virtual]\fP"
.PP
Retrieves an action for a given \fBQDomElement\fP. 
.PP
The default implementation uses the 'name' attribute to query the action object via the other \fBaction()\fP method. 
.PP
Definition at line 117 of file kxmlguiclient.cpp.
.PP
References KActionCollection::action(), actionCollection(), and KGlobal::staticQString().
.SS "\fBKActionCollection\fP * KXMLGUIClient::actionCollection () const\fC [virtual]\fP"
.PP
Retrieves the entire action collection for the GUI client. 
.PP
If you subclass KXMLGUIClient you should call \fBKActionCollection::setWidget( QWidget* )\fP with this object, or you will encounter subtle bugs with \fBKAction\fP keyboard shortcuts. This is not necessary if your KXMLGUIClient is a \fBKMainWindow\fP.
.PP
\fBSee also:\fP
.RS 4
\fBKActionCollection::setWidget( QWidget* )\fP 
.RE
.PP

.PP
Reimplemented in \fBKEditToolbarWidget\fP.
.PP
Definition at line 107 of file kxmlguiclient.cpp.
.PP
Referenced by action(), beginXMLPlug(), KXMLGUIFactory::configureShortcuts(), KMainWindow::configureToolbars(), KMainWindow::createGUI(), KMainWindow::createStandardStatusBarAction(), endXMLPlug(), KMainWindowInterface::KMainWindowInterface(), prepareXMLUnplug(), setDOMDocument(), setInstance(), KMainWindow::setupGUI(), setXMLFile(), and stateChanged().
.SS "\fBKInstance\fP * KXMLGUIClient::instance () const\fC [virtual]\fP"
.PP
\fBReturns:\fP
.RS 4
The instance ( \fBKInstance\fP ) for this GUI client. 
.RE
.PP

.PP
Definition at line 123 of file kxmlguiclient.cpp.
.PP
Referenced by KMainWindow::createGUI(), KMainWindow::helpMenu(), setClientBuilder(), setInstance(), and setXMLFile().
.SS "\fBQDomDocument\fP KXMLGUIClient::domDocument () const\fC [virtual]\fP"
.PP
\fBReturns:\fP
.RS 4
The parsed XML in a \fBQDomDocument\fP, set by \fBsetXMLFile()\fP or \fBsetXML()\fP. This document describes the layout of the GUI. 
.RE
.PP

.PP
Definition at line 128 of file kxmlguiclient.cpp.
.PP
Referenced by KMainWindow::createGUI().
.SS "\fBQString\fP KXMLGUIClient::xmlFile () const\fC [virtual]\fP"
.PP
This will return the name of the XML file as set by \fBsetXMLFile()\fP. 
.PP
If \fBsetXML()\fP is used directly, then this will return NULL.
.PP
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.
.PP
\fBReturns:\fP
.RS 4
The name of the XML file or QString::null 
.RE
.PP

.PP
Definition at line 133 of file kxmlguiclient.cpp.
.PP
Referenced by KXMLGUIFactory::configureShortcuts(), KMainWindow::configureToolbars(), reloadXML(), KEditToolbarWidget::save(), and KMainWindow::saveNewToolbarConfig().
.SS "void KXMLGUIClient::setFactory (\fBKXMLGUIFactory\fP * factory)"
.PP
This method is called by the \fBKXMLGUIFactory\fP as soon as the client is added to the KXMLGUIFactory's GUI. 
.PP
Definition at line 550 of file kxmlguiclient.cpp.
.PP
References factory().
.SS "\fBKXMLGUIFactory\fP * KXMLGUIClient::factory () const"
.PP
Retrieves a pointer to the \fBKXMLGUIFactory\fP this client is associated with (will return 0L if the client's GUI has not been built by a \fBKXMLGUIFactory\fP. 
.PP
Definition at line 555 of file kxmlguiclient.cpp.
.PP
Referenced by KEditToolbarWidget::save(), setFactory(), and KMainWindow::setStandardToolBarMenuEnabled().
.SS "\fBKXMLGUIClient\fP * KXMLGUIClient::parentClient () const"
.PP
KXMLGUIClients can form a simple child/parent object tree. 
.PP
This method returns a pointer to the parent client or 0L if it has no parent client assigned. 
.PP
Definition at line 560 of file kxmlguiclient.cpp.
.SS "void KXMLGUIClient::insertChildClient (\fBKXMLGUIClient\fP * child)"
.PP
Use this method to make a client a child client of another client. 
.PP
Usually you don't need to call this method, as it is called automatically when using the second constructor, which takes a parent argument. 
.PP
Definition at line 565 of file kxmlguiclient.cpp.
.PP
References d, and removeChildClient().
.SS "void KXMLGUIClient::removeChildClient (\fBKXMLGUIClient\fP * child)"
.PP
Removes the given \fCchild\fP from the client's children list. 
.PP
Definition at line 573 of file kxmlguiclient.cpp.
.PP
References d.
.PP
Referenced by insertChildClient().
.SS "const \fBQPtrList\fP< \fBKXMLGUIClient\fP > * KXMLGUIClient::childClients ()"
.PP
Retrieves a list of all child clients. 
.PP
Definition at line 588 of file kxmlguiclient.cpp.
.SS "void KXMLGUIClient::setClientBuilder (\fBKXMLGUIBuilder\fP * builder)"
.PP
A client can have an own \fBKXMLGUIBuilder\fP. 
.PP
Use this method to assign your builder instance to the client (so that the \fBKXMLGUIFactory\fP can use it when building the client's GUI)
.PP
Client specific guibuilders are useful if you want to create custom container widgets for your GUI. 
.PP
Definition at line 593 of file kxmlguiclient.cpp.
.PP
References instance().
.SS "\fBKXMLGUIBuilder\fP * KXMLGUIClient::clientBuilder () const"
.PP
Retrieves the client's GUI builder or 0L if no client specific builder has been assigned via \fBsetClientBuilder()\fP. 
.PP
Definition at line 600 of file kxmlguiclient.cpp.
.SS "void KXMLGUIClient::reloadXML ()"
.PP
Forces this client to re-read its XML resource file. 
.PP
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. 
.PP
Definition at line 150 of file kxmlguiclient.cpp.
.PP
References QString::isEmpty(), setXMLFile(), and xmlFile().
.SS "void KXMLGUIClient::plugActionList (const \fBQString\fP & name, const \fBQPtrList\fP< \fBKAction\fP > & actionList)"
.PP
ActionLists are a way for XMLGUI to support dynamic lists of actions. 
.PP
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 \fBsetXMLFile()\fP ), you put an 
.PP
<ActionList name='xxx'> tag. E.g. 
.PP
.nf

   * <kpartgui name="xxx_part" version="1">
   * <MenuBar>
   *   <Menu name="file">
   *     ...  <!-- some useful actions-->
   *     <ActionList name="xxx_file_actionlist" />
   *     ...  <!-- even more useful actions-->
   *   </Menu>
   *   ...
   * </MenuBar>
   * </kpartgui>
   * 
.fi
.PP
.PP
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 
.PP
.nf
 QPtrList<KAction> file_actions;
 for( ... )
   if( ... )
     file_actions.append( cool_action );
 unplugActionList( 'xxx_file_actionlist' );
 plugActionList( 'xxx_file_actionlist', file_actions );

.fi
.PP
 every time a file is selected, unselected or ...
.PP
\fBNote:\fP
.RS 4
You should not call createGUI() after calling this function. In fact, that would remove the newly added actionlists again... 
.PP
Forgetting to call \fBunplugActionList()\fP before \fBplugActionList()\fP would leave the previous actions in the menu too.. 
.RE
.PP

.PP
Definition at line 605 of file kxmlguiclient.cpp.
.SS "void KXMLGUIClient::unplugActionList (const \fBQString\fP & name)"
.PP
The complement of \fBplugActionList()\fP ... 
.PP
Definition at line 613 of file kxmlguiclient.cpp.
.SS "void KXMLGUIClient::beginXMLPlug (\fBQWidget\fP *)"
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP

.PP
Definition at line 926 of file kxmlguiclient.cpp.
.PP
References actionCollection(), and KActionCollection::beginXMLPlug().
.SS "void KXMLGUIClient::endXMLPlug ()"
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP

.PP
Definition at line 934 of file kxmlguiclient.cpp.
.PP
References actionCollection(), and KActionCollection::endXMLPlug().
.SS "void KXMLGUIClient::prepareXMLUnplug (\fBQWidget\fP *)"
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP

.PP
Definition at line 942 of file kxmlguiclient.cpp.
.PP
References actionCollection(), and KActionCollection::prepareXMLUnplug().
.SS "void KXMLGUIClient::setInstance (\fBKInstance\fP * instance)\fC [protected, virtual]\fP"
.PP
Sets the instance ( \fBKInstance\fP) for this part. 
.PP
Call this first in the inherited class constructor. (At least before \fBsetXMLFile()\fP.) 
.PP
Definition at line 157 of file kxmlguiclient.cpp.
.PP
References actionCollection(), instance(), and KActionCollection::setInstance().
.SS "void KXMLGUIClient::setXMLFile (const \fBQString\fP & file, bool merge = \fCfalse\fP, bool setXMLDoc = \fCtrue\fP)\fC [protected, virtual]\fP"
.PP
Sets the name of the rc file containing the XML for the part. 
.PP
Call this in the Part-inherited class constructor.
.PP
\fBParameters:\fP
.RS 4
\fIfile\fP Either an absolute path for the file, or simply the filename, which will then be assumed to be installed in the 'data' resource, under a directory named like the instance. 
.br
\fImerge\fP Whether to merge with the global document. 
.br
\fIsetXMLDoc\fP Specify whether to call setXML. Default is true. and the DOM document at once. 
.RE
.PP

.PP
Definition at line 165 of file kxmlguiclient.cpp.
.PP
References actionCollection(), KInstance::dirs(), endl(), KStandardDirs::findAllResources(), QString::fromLatin1(), instance(), QString::isEmpty(), kdWarning(), setXML(), and KActionCollection::setXMLFile().
.PP
Referenced by KMainWindow::createGUI(), reloadXML(), and KEditToolbarWidget::save().
.SS "void KXMLGUIClient::setXML (const \fBQString\fP & document, bool merge = \fCfalse\fP)\fC [protected, virtual]\fP"
.PP
Sets the XML for the part. 
.PP
Call this in the Part-inherited class constructor if you don't call \fBsetXMLFile()\fP. 
.PP
Definition at line 217 of file kxmlguiclient.cpp.
.PP
References QDomDocument::setContent(), and setDOMDocument().
.PP
Referenced by setXMLFile().
.SS "void KXMLGUIClient::setDOMDocument (const \fBQDomDocument\fP & document, bool merge = \fCfalse\fP)\fC [protected, virtual]\fP"
.PP
Sets the Document for the part, describing the layout of the GUI. 
.PP
Call this in the Part-inherited class constructor if you don't call setXMLFile or setXML . 
.PP
Definition at line 224 of file kxmlguiclient.cpp.
.PP
References actionCollection(), and QDomDocument::documentElement().
.PP
Referenced by setXML().
.SS "void KXMLGUIClient::conserveMemory ()\fC [protected, virtual]\fP"
.PP
This function will attempt to give up some memory after the GUI is built. 
.PP
It should never be used in apps where the GUI may be rebuilt at some later time (components, for instance). 
.PP
Definition at line 534 of file kxmlguiclient.cpp.
.PP
Referenced by KMainWindow::createGUI().
.SS "void KXMLGUIClient::stateChanged (const \fBQString\fP & newstate, ReverseStateChange reverse = \fCStateNoReverse\fP)\fC [protected, virtual]\fP"
.PP
Actions can collectively be assigned a 'State'. 
.PP
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 \fBstateChanged()\fP to set actions to a defined state.
.PP
\fBParameters:\fP
.RS 4
\fInewstate\fP Name of a State in the XMLfile. 
.br
\fIreverse\fP If the flag reverse is set to StateReverse, the State is reversed. (actions to be enabled will be disabled and action to be disabled will be enabled) Default is reverse=false. 
.RE
.PP

.PP
Definition at line 899 of file kxmlguiclient.cpp.
.PP
References KActionCollection::action(), and actionCollection().
.PP
Referenced by KMainWindow::slotStateChanged().

.SH "Author"
.PP 
Generated automatically by Doxygen for kdeui Library from the source code.
