KXmlGui

kxmlguiclient.h
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 2000 Simon Hausmann <[email protected]>
4  SPDX-FileCopyrightText: 2000 Kurt Granroth <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-only
7 */
8 
9 #ifndef KXMLGUICLIENT_H
10 #define KXMLGUICLIENT_H
11 
12 #include <kxmlgui_export.h>
13 
14 #include <QStringList>
15 
16 class QDomDocument;
17 class QDomElement;
18 class QWidget;
19 
20 class QAction;
21 class KActionCollection;
22 class KXMLGUIClientPrivate;
23 class KXMLGUIFactory;
24 class KXMLGUIBuilder;
25 
26 namespace KDEPrivate
27 {
28 class KEditToolBarWidget;
29 }
30 
38 class KXMLGUI_EXPORT KXMLGUIClient
39 {
40  friend class KDEPrivate::KEditToolBarWidget; // for setXMLFile(3 args)
41 public:
47  KXMLGUIClient();
48 
60  explicit KXMLGUIClient(KXMLGUIClient *parent);
61 
71  virtual ~KXMLGUIClient();
72 
78  QAction *action(const char *name) const;
79 
85  virtual QAction *action(const QDomElement &element) const;
86 
90  virtual KActionCollection *actionCollection() const;
91 
95  virtual QString componentName() const;
96 
102  virtual QDomDocument domDocument() const;
103 
117  virtual QString xmlFile() const;
118 
119  virtual QString localXMLFile() const;
120 
124  void setXMLGUIBuildDocument(const QDomDocument &doc);
128  QDomDocument xmlguiBuildDocument() const;
129 
134  void setFactory(KXMLGUIFactory *factory);
140  KXMLGUIFactory *factory() const;
141 
147  KXMLGUIClient *parentClient() const;
148 
155  void insertChildClient(KXMLGUIClient *child);
156 
160  void removeChildClient(KXMLGUIClient *child);
161 
165  QList<KXMLGUIClient *> childClients();
166 
175  void setClientBuilder(KXMLGUIBuilder *builder);
176 
181  KXMLGUIBuilder *clientBuilder() const;
182 
192  void reloadXML();
193 
237  void plugActionList(const QString &name, const QList<QAction *> &actionList);
238 
246  void unplugActionList(const QString &name);
247 
248  static QString findMostRecentXMLFile(const QStringList &files, QString &doc);
249 
250  void addStateActionEnabled(const QString &state, const QString &action);
251 
252  void addStateActionDisabled(const QString &state, const QString &action);
253 
254  enum ReverseStateChange { StateNoReverse, StateReverse };
255  struct StateChange {
256  QStringList actionsToEnable;
257  QStringList actionsToDisable;
258  };
259 
260  StateChange getActionsToChangeForState(const QString &state);
261 
262  void beginXMLPlug(QWidget *);
263  void endXMLPlug();
264  void prepareXMLUnplug(QWidget *);
265 
289  void replaceXMLFile(const QString &xmlfile, const QString &localxmlfile, bool merge = false);
290 
296  static QString findVersionNumber(const QString &xml);
297 
298 protected:
307  virtual void setComponentName(const QString &componentName, const QString &componentDisplayName);
308 
339  virtual void setXMLFile(const QString &file, bool merge = false, bool setXMLDoc = true);
340 
346  static QString standardsXmlFileLocation();
347 
352  void loadStandardsXmlFile();
353 
359  virtual void setLocalXMLFile(const QString &file);
360 
367  virtual void setXML(const QString &document, bool merge = false);
368 
384  virtual void setDOMDocument(const QDomDocument &document, bool merge = false);
385 
397  virtual void stateChanged(const QString &newstate, ReverseStateChange reverse = StateNoReverse);
398 
399  // KDE5 TODO: virtual void loadActionLists() {}, called when the guiclient is added to the xmlgui factory
400 
401 protected:
402  virtual void virtual_hook(int id, void *data);
403 
404 private:
405  KXMLGUIClientPrivate *const d;
406 };
407 
408 #endif
A container for a set of QAction objects.
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document...
Definition: kxmlguiclient.h:38
Implements the creation of the GUI (menubar, menus and toolbars) as requested by the GUI factory...
KXMLGUIFactory, together with KXMLGUIClient objects, can be used to create a GUI of container widgets...
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Nov 26 2020 22:49:21 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.