KParts
plugin.h
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 Copyright (C) 1999 Simon Hausmann <hausmann@kde.org> 00003 (C) 1999 David Faure <faure@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 as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00018 Boston, MA 02110-1301, USA. 00019 */ 00020 #ifndef PLUGIN_H 00021 #define PLUGIN_H 00022 00023 #include <QtXml/QDomElement> 00024 #include <QtCore/QObject> 00025 #include <kaction.h> 00026 #include <kxmlguiclient.h> 00027 00028 #include <kparts/kparts_export.h> 00029 00030 class KComponentData; 00031 00032 namespace KParts 00033 { 00034 00054 class KPARTS_EXPORT Plugin : public QObject, virtual public KXMLGUIClient 00055 { 00056 Q_OBJECT 00057 public: 00058 struct PluginInfo 00059 { 00060 QString m_relXMLFileName; // relative filename, i.e. kpartplugins/name 00061 QString m_absXMLFileName; // full path of most recent filename matching the relative 00062 // filename 00063 QDomDocument m_document; 00064 }; 00065 00069 Plugin( QObject* parent = 0 ); 00073 virtual ~Plugin(); 00074 00078 virtual QString xmlFile() const; 00079 00083 virtual QString localXMLFile() const; 00084 00092 static void loadPlugins( QObject *parent, const KComponentData &instance ); 00093 00101 static void loadPlugins( QObject *parent, const QList<PluginInfo> &pluginInfos ); 00102 00110 static void loadPlugins( QObject *parent, const QList<PluginInfo> &pluginInfos, const KComponentData &instance ); 00111 00149 static void loadPlugins(QObject *parent, KXMLGUIClient* parentGUIClient, 00150 const KComponentData &instance, bool enableNewPluginsByDefault = true, 00151 int interfaceVersionRequired = 0); 00152 00159 static QList<Plugin *> pluginObjects( QObject *parent ); 00160 00161 protected: 00167 static QList<Plugin::PluginInfo> pluginInfos(const KComponentData &instance); 00168 00173 #ifndef KDE_NO_DEPRECATED 00174 KDE_DEPRECATED static Plugin* loadPlugin( QObject * parent, const char* libname ); 00175 #endif 00176 00181 #ifndef KDE_NO_DEPRECATED 00182 KDE_DEPRECATED static Plugin* loadPlugin( QObject * parent, const QByteArray &libname ); 00183 #endif 00184 00189 static Plugin* loadPlugin( QObject * parent, const QString &libname ); 00190 00191 static Plugin* loadPlugin( QObject * parent, const QString &libname, const QString &keyword ); 00192 00193 virtual void setComponentData(const KComponentData &instance); 00194 00195 private: 00196 static bool hasPlugin( QObject* parent, const QString& library ); 00197 class PluginPrivate; 00198 PluginPrivate* const d; 00199 }; 00200 00201 } 00202 00203 #endif
KDE 4.6 API Reference