• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDEUI

  • sources
  • kde-4.14
  • kdelibs
  • kdeui
  • xmlgui
kxmlguiclient.h
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (C) 2000 Simon Hausmann <hausmann@kde.org>
3  Copyright (C) 2000 Kurt Granroth <granroth@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License version 2 as published by the Free Software Foundation.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 #ifndef KXMLGUICLIENT_H
20 #define KXMLGUICLIENT_H
21 
22 #include <kdeui_export.h>
23 
24 #include <QtCore/QMap>
25 #include <QtCore/QStringList>
26 
27 class QDomDocument;
28 class QDomElement;
29 class QWidget;
30 
31 class QAction;
32 class KActionCollection;
33 class KComponentData;
34 class KXMLGUIClientPrivate;
35 class KXMLGUIFactory;
36 class KXMLGUIBuilder;
37 
38 namespace KDEPrivate { class KEditToolBarWidget; }
39 
46 class KDEUI_EXPORT KXMLGUIClient
47 {
48  friend class KDEPrivate::KEditToolBarWidget; // for setXMLFile(3 args)
49 public:
55  KXMLGUIClient();
56 
68  explicit KXMLGUIClient( KXMLGUIClient *parent );
69 
79  virtual ~KXMLGUIClient();
80 
86  QAction* action( const char* name ) const;
87 
93  virtual QAction *action( const QDomElement &element ) const;
94 
98  virtual KActionCollection* actionCollection() const;
99 
103  virtual KComponentData componentData() const;
104 
110  virtual QDomDocument domDocument() const;
111 
125  virtual QString xmlFile() const;
126 
127  virtual QString localXMLFile() const;
128 
132  void setXMLGUIBuildDocument( const QDomDocument &doc );
136  QDomDocument xmlguiBuildDocument() const;
137 
142  void setFactory( KXMLGUIFactory *factory );
148  KXMLGUIFactory *factory() const;
149 
155  KXMLGUIClient *parentClient() const;
156 
163  void insertChildClient( KXMLGUIClient *child );
164 
168  void removeChildClient( KXMLGUIClient *child );
169 
173  QList<KXMLGUIClient*> childClients();
174 
183  void setClientBuilder( KXMLGUIBuilder *builder );
184 
189  KXMLGUIBuilder *clientBuilder() const;
190 
200  void reloadXML();
201 
245  void plugActionList( const QString &name, const QList<QAction*> &actionList );
246 
254  void unplugActionList( const QString &name );
255 
256  static QString findMostRecentXMLFile( const QStringList &files, QString &doc );
257 
258  void addStateActionEnabled(const QString& state, const QString& action);
259 
260  void addStateActionDisabled(const QString& state, const QString& action);
261 
262  enum ReverseStateChange { StateNoReverse, StateReverse };
263  struct StateChange
264  {
265  QStringList actionsToEnable;
266  QStringList actionsToDisable;
267  };
268 
269  StateChange getActionsToChangeForState(const QString& state);
270 
271  void beginXMLPlug( QWidget * );
272  void endXMLPlug();
273  void prepareXMLUnplug( QWidget * );
274 
298  void replaceXMLFile( const QString& xmlfile, const QString& localxmlfile, bool merge = false );
299 
300 protected:
305  //bool addSuperClient( KXMLGUIClient * );
306 
313  virtual void setComponentData(const KComponentData &componentData);
314 
331  virtual void setXMLFile( const QString& file, bool merge = false, bool setXMLDoc = true );
332 
337  void loadStandardsXmlFile();
338 
344  virtual void setLocalXMLFile( const QString &file );
345 
352  virtual void setXML( const QString &document, bool merge = false );
353 
369  virtual void setDOMDocument( const QDomDocument &document, bool merge = false );
370 
382  virtual void stateChanged(const QString &newstate, ReverseStateChange reverse = StateNoReverse);
383 
384  // KDE5 TODO: virtual void loadActionLists() {}, called when the guiclient is added to the xmlgui factory
385 
386 protected:
387  virtual void virtual_hook( int id, void* data );
388 
389 private:
390  KXMLGUIClientPrivate * const d;
391 };
392 
393 #endif
KActionCollection
A container for a set of QAction objects.
Definition: kactioncollection.h:56
QWidget
KXMLGUIClient
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document...
Definition: kxmlguiclient.h:46
KXMLGUIClient::StateChange::actionsToEnable
QStringList actionsToEnable
Definition: kxmlguiclient.h:265
KStandardAction::name
const char * name(StandardAction id)
This will return the internal name of a given standard action.
Definition: kstandardaction.cpp:223
KXMLGUIClient::StateChange::actionsToDisable
QStringList actionsToDisable
Definition: kxmlguiclient.h:266
KXMLGUIBuilder
Implements the creation of the GUI (menubar, menus and toolbars) as requested by the GUI factory...
Definition: kxmlguibuilder.h:41
QString
QList< KXMLGUIClient * >
QStringList
KXMLGUIClient::StateChange
Definition: kxmlguiclient.h:263
KXMLGUIFactory
KXMLGUIFactory, together with KXMLGUIClient objects, can be used to create a GUI of container widgets...
Definition: kxmlguifactory.h:65
QDomDocument
QAction
kdeui_export.h
QDomElement
KXMLGUIClient::ReverseStateChange
ReverseStateChange
Definition: kxmlguiclient.h:262
KComponentData
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:00 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal