KDEUI
kxmlguiclient.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2000 Simon Hausmann <hausmann@kde.org> 00003 Copyright (C) 2000 Kurt Granroth <granroth@kde.org> 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License version 2 as published by the Free Software Foundation. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 #ifndef KXMLGUICLIENT_H 00020 #define KXMLGUICLIENT_H 00021 00022 #include <kdeui_export.h> 00023 00024 #include <QtCore/QMap> 00025 #include <QtCore/QStringList> 00026 00027 class QDomDocument; 00028 class QDomElement; 00029 class QWidget; 00030 00031 class QAction; 00032 class KActionCollection; 00033 class KComponentData; 00034 class KXMLGUIClientPrivate; 00035 class KXMLGUIFactory; 00036 class KXMLGUIBuilder; 00037 00038 namespace KDEPrivate { class KEditToolBarWidget; } 00039 00046 class KDEUI_EXPORT KXMLGUIClient 00047 { 00048 friend class KDEPrivate::KEditToolBarWidget; // for setXMLFile(3 args) 00049 public: 00055 KXMLGUIClient(); 00056 00068 explicit KXMLGUIClient( KXMLGUIClient *parent ); 00069 00079 virtual ~KXMLGUIClient(); 00080 00086 QAction* action( const char* name ) const; 00087 00093 virtual QAction *action( const QDomElement &element ) const; 00094 00098 virtual KActionCollection* actionCollection() const; 00099 00103 virtual KComponentData componentData() const; 00104 00110 virtual QDomDocument domDocument() const; 00111 00125 virtual QString xmlFile() const; 00126 00127 virtual QString localXMLFile() const; 00128 00132 void setXMLGUIBuildDocument( const QDomDocument &doc ); 00136 QDomDocument xmlguiBuildDocument() const; 00137 00142 void setFactory( KXMLGUIFactory *factory ); 00148 KXMLGUIFactory *factory() const; 00149 00155 KXMLGUIClient *parentClient() const; 00156 00163 void insertChildClient( KXMLGUIClient *child ); 00164 00168 void removeChildClient( KXMLGUIClient *child ); 00169 00173 QList<KXMLGUIClient*> childClients(); 00174 00183 void setClientBuilder( KXMLGUIBuilder *builder ); 00184 00189 KXMLGUIBuilder *clientBuilder() const; 00190 00200 void reloadXML(); 00201 00245 void plugActionList( const QString &name, const QList<QAction*> &actionList ); 00246 00254 void unplugActionList( const QString &name ); 00255 00256 static QString findMostRecentXMLFile( const QStringList &files, QString &doc ); 00257 00258 void addStateActionEnabled(const QString& state, const QString& action); 00259 00260 void addStateActionDisabled(const QString& state, const QString& action); 00261 00262 enum ReverseStateChange { StateNoReverse, StateReverse }; 00263 struct StateChange 00264 { 00265 QStringList actionsToEnable; 00266 QStringList actionsToDisable; 00267 }; 00268 00269 StateChange getActionsToChangeForState(const QString& state); 00270 00271 void beginXMLPlug( QWidget * ); 00272 void endXMLPlug(); 00273 void prepareXMLUnplug( QWidget * ); 00274 00298 void replaceXMLFile( const QString& xmlfile, const QString& localxmlfile, bool merge = false ); 00299 00300 protected: 00305 //bool addSuperClient( KXMLGUIClient * ); 00306 00313 virtual void setComponentData(const KComponentData &componentData); 00314 00331 virtual void setXMLFile( const QString& file, bool merge = false, bool setXMLDoc = true ); 00332 00337 void loadStandardsXmlFile(); 00338 00344 virtual void setLocalXMLFile( const QString &file ); 00345 00352 virtual void setXML( const QString &document, bool merge = false ); 00353 00369 virtual void setDOMDocument( const QDomDocument &document, bool merge = false ); 00370 00382 virtual void stateChanged(const QString &newstate, ReverseStateChange reverse = StateNoReverse); 00383 00384 // KDE5 TODO: virtual void loadActionLists() {}, called when the guiclient is added to the xmlgui factory 00385 00386 protected: 00387 virtual void virtual_hook( int id, void* data ); 00388 00389 private: 00390 KXMLGUIClientPrivate * const d; 00391 }; 00392 00393 #endif
KDE 4.6 API Reference