# class KXMLGUIClient

###

Module | kdeui
Namespace |
Class | KXMLGUIClient
Inherits |

### enums

- ReverseStateChange { StateNoReverse, StateReverse }

enum details

### methods

- KXMLGUIClient ( )

  returns ctor

  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.

- KXMLGUIClient (parent)

  returns ctor
  KDE 4.1.0 and later only

  Argument | Type | Default
  --- | --- | ---
  parent | KXMLGUIClient |

  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 parent argument, which makes the client a child client of the parent.

  Child clients are automatically added to the GUI if the parent is added.

- KXMLGUIClient (a0)

  returns ctor
  before KDE 4.1.0 only

  Argument | Type | Default
  --- | --- | ---
  a0 | KXMLGUIClient |

- action (name)

  returns QAction

  Argument | Type | Default
  --- | --- | ---
  name | char |

  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.

- action (element)

  returns QAction

  Argument | Type | Default
  --- | --- | ---
  element | QDomElement |

  Retrieves an action for a given QDomElement. The default implementation uses the "name" attribute to query the action object via the other action() method.

- actionCollection ( )

  returns KActionCollection

  Retrieves the entire action collection for the GUI client.

- addStateActionDisabled (state, action)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  state | QString |
  action | QString |

- addStateActionEnabled (state, action)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  state | QString |
  action | QString |

- beginXMLPlug (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QWidget |

- childClients ( )

  returns QList<KXMLGUIClient

  Retrieves a list of all child clients.

- clientBuilder ( )

  returns KXMLGUIBuilder

  Retrieves the client's GUI builder or 0 if no client specific builder has been assigned via setClientBuilder()

- componentData ( )

  returns KComponentData

  Returns The componentData ( KComponentData ) for this GUI client.

- domDocument ( )

  returns QDomDocument

  Returns The parsed XML in a QDomDocument, set by setXMLFile() or setXML(). This document describes the layout of the GUI.

- endXMLPlug ( )

  returns Nothing

- factory ( )

  returns KXMLGUIFactory

  Retrieves a pointer to the KXMLGUIFactory this client is associated with (will return 0 if the client's GUI has not been built by a KXMLGUIFactory.

- findMostRecentXMLFile (files, doc)

  returns QString
  static

  Argument | Type | Default
  --- | --- | ---
  files | QStringList |
  doc | QString |

- getActionsToChangeForState (state)

  returns KXMLGUIClient.StateChange

  Argument | Type | Default
  --- | --- | ---
  state | QString |

- insertChildClient (child)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  child | KXMLGUIClient |

  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 parent argument.

- localXMLFile ( )

  returns QString

- parentClient ( )

  returns KXMLGUIClient

  KXMLGUIClients can form a simple child/parent object tree. This method returns a pointer to the parent client or 0 if it has no parent client assigned.

- plugActionList (name, actionList)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  name | QString |
  actionList | QList<QAction |

  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() / pass to setupGUI() ), you put a tag `\`.

  Example:

      <MenuBar>

      ...

      ...

      ...
      </MenuBar>

  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

      QList<QAction*> file_actions;
      for( ... )
      if( ... )
      file_actions.append( cool_action );
      unplugActionList( "xxx_file_actionlist" );
      plugActionList( "xxx_file_actionlist", file_actions );

  every time a file is selected, unselected or ...

  You should not call createGUI() after calling this function. In fact, that would remove the newly added actionlists again... Forgetting to call unplugActionList() before plugActionList() would leave the previous actions in the menu too..

  See also unplugActionList()

- prepareXMLUnplug (a0)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  a0 | QWidget |

- reloadXML ( )

  returns Nothing

  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.

- removeChildClient (child)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  child | KXMLGUIClient |

  Removes the given child from the client's children list.

- setClientBuilder (builder)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  builder | KXMLGUIBuilder |

  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.

- setComponentData (componentData)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  componentData | KComponentData |

  Sets the componentData ( KComponentData) for this part.

  Call this first in the inherited class constructor. (At least before setXMLFile().)

- setDOMDocument (document, merge)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  document | QDomDocument |
  merge | bool | 0

  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 .

- setFactory (factory)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  factory | KXMLGUIFactory |

  This method is called by the KXMLGUIFactory as soon as the client is added to the KXMLGUIFactory's GUI.

- setLocalXMLFile (file)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  file | QString |

- setXML (document, merge)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  document | QString |
  merge | bool | 0

  Sets the XML for the part.

  Call this in the Part-inherited class constructor if you don't call setXMLFile().

- setXMLFile (file, merge, setXMLDoc)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  file | QString |
  merge | bool | 0
  setXMLDoc | bool | 1

  Sets the name of the rc file containing the XML for the part.

  Call this in the Part-inherited class constructor. If you're writing usual application, use KXmlGuiWindow.setupGUI() with non-default arguments

  file - 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 componentData.

  merge - Whether to merge with the global document.

  setXMLDoc - Specify whether to call setXML. Default is true. and the DOM document at once.

- setXMLGUIBuildDocument (doc)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  doc | QDomDocument |

  Internal

- stateChanged (newstate, reverse)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  newstate | QString |
  reverse | KXMLGUIClient.ReverseStateChange | KXMLGUIClient.StateNoReverse

  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.

  newstate - Name of a State in the XMLfile.

  reverse - 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.

- unplugActionList (name)

  returns Nothing

  Argument | Type | Default
  --- | --- | ---
  name | QString |

  Unplugs the action list name from the XMLGUI. Calling this removes the specified action list, i.e. this is the complement to plugActionList(). See plugActionList() for a more detailed example.

  See also plugActionList()

- virtual_hook (id, data)

  returns Nothing
  Not implemented

  Argument | Type | Default
  --- | --- | ---
  id | int |
  data | void |

- xmlFile ( )

  returns QString

  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.

  Returns The name of the XML file or QString()

- xmlguiBuildDocument ( )

  returns QDomDocument

  Internal

### enums - detail

- ReverseStateChange { StateNoReverse, StateReverse }

  | StateNoReverse | - | - |
  | StateReverse | - | - |