kdeui
kxmlguifactory.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __kxmlguifactory_h__
00022 #define __kxmlguifactory_h__
00023
00024 #include <qobject.h>
00025 #include <qptrlist.h>
00026 #include <qdom.h>
00027 #include <qvaluelist.h>
00028
00029 #include <kdelibs_export.h>
00030
00031 class KAction;
00032 class KXMLGUIFactoryPrivate;
00033 class KXMLGUIClient;
00034 class KXMLGUIBuilder;
00035 class KInstance;
00036
00037 namespace KXMLGUI
00038 {
00039 struct MergingIndex;
00040 struct ContainerNode;
00041 struct ContainerClient;
00042 class BuildHelper;
00043 }
00044
00062 class KDEUI_EXPORT KXMLGUIFactory : public QObject
00063 {
00064 friend class KXMLGUI::BuildHelper;
00065 Q_OBJECT
00066 public:
00074 KXMLGUIFactory( KXMLGUIBuilder *builder, QObject *parent = 0, const char *name = 0 );
00075
00079 ~KXMLGUIFactory();
00080
00081
00082 static QString readConfigFile( const QString &filename, bool never_null, const KInstance *instance = 0 );
00083 static QString readConfigFile( const QString &filename, const KInstance *instance = 0 );
00084 static bool saveConfigFile( const QDomDocument& doc, const QString& filename,
00085 const KInstance *instance = 0 );
00086
00087 static QString documentToXML( const QDomDocument& doc );
00088 static QString elementToXML( const QDomElement& elem );
00089
00093 static void removeDOMComments( QDomNode &node );
00094
00099 static QDomElement actionPropertiesElement( QDomDocument& doc );
00100
00106 static QDomElement findActionByName( QDomElement& elem, const QString& sName, bool create );
00107
00118 void addClient( KXMLGUIClient *client );
00119
00125 void removeClient( KXMLGUIClient *client );
00126
00127 void plugActionList( KXMLGUIClient *client, const QString &name, const QPtrList<KAction> &actionList );
00128 void unplugActionList( KXMLGUIClient *client, const QString &name );
00129
00133 QPtrList<KXMLGUIClient> clients() const;
00134
00155 QWidget *container( const QString &containerName, KXMLGUIClient *client, bool useTagName = false );
00156
00157 QPtrList<QWidget> containers( const QString &tagName );
00158
00167 void reset();
00168
00178 void resetContainer( const QString &containerName, bool useTagName = false );
00179
00180 public slots:
00196 int configureShortcuts(bool bAllowLetterShortcuts = true, bool bSaveSettings = true);
00197
00198 signals:
00199 void clientAdded( KXMLGUIClient *client );
00200 void clientRemoved( KXMLGUIClient *client );
00201
00202 private:
00203
00204 QWidget *findRecursive( KXMLGUI::ContainerNode *node, bool tag );
00205
00206 QPtrList<QWidget> findRecursive( KXMLGUI::ContainerNode *node, const QString &tagName );
00207
00208 void applyActionProperties( const QDomElement &element );
00209 void configureAction( KAction *action, const QDomNamedNodeMap &attributes );
00210 void configureAction( KAction *action, const QDomAttr &attribute );
00211
00212 protected:
00213 virtual void virtual_hook( int id, void* data );
00214 private:
00215 KXMLGUIFactoryPrivate *d;
00216 };
00217
00218 #endif
00219
00220