00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __PLUGIN_MANAGER_H__
00025 #define __PLUGIN_MANAGER_H__
00026
00027 #include <tqmap.h>
00028 #include <tqobject.h>
00029 #include <tqstringlist.h>
00030 #include <kdemacros.h>
00031 #include <kstaticdeleter.h>
00032
00033 #include "appletinfo.h"
00034
00035 class AppletContainer;
00036 class ExtensionContainer;
00037 class KPanelApplet;
00038 class KPanelExtension;
00039 class TQPopupMenu;
00040
00041 class KDE_EXPORT PluginManager : public QObject
00042 {
00043 Q_OBJECT
00044
00045 public:
00046 static PluginManager* the();
00047 static AppletInfo::List applets(bool sort = true, AppletInfo::List* list = 0);
00048 static AppletInfo::List extensions(bool sort = true, AppletInfo::List* list = 0);
00049 static AppletInfo::List builtinButtons(bool sort = true, AppletInfo::List* list = 0);
00050 static AppletInfo::List specialButtons(bool sort = true, AppletInfo::List* list = 0);
00051
00052 AppletContainer* createAppletContainer(const TQString& desktopFile,
00053 bool isStartup,
00054 const TQString& configFile,
00055 TQPopupMenu* opMenu,
00056 TQWidget* parent,
00057 bool isImmutable = false);
00058 ExtensionContainer* createExtensionContainer(const TQString& desktopFile,
00059 bool isStartup,
00060 const TQString& configFile,
00061 const TQString& extensionId);
00062
00063 KPanelApplet* loadApplet(const AppletInfo& info, TQWidget* parent);
00064 KPanelExtension* loadExtension(const AppletInfo& info, TQWidget* parent);
00065
00066 bool hasInstance(const AppletInfo&) const;
00067
00068 public slots:
00069 void clearUntrustedLists();
00070
00071 protected:
00072 static AppletInfo::List plugins(const TQStringList& desktopFiles,
00073 AppletInfo::AppletType,
00074 bool sort,
00075 AppletInfo::List* list);
00076
00077 private slots:
00078 void slotPluginDestroyed(TQObject* plugin);
00079
00080 private:
00081 friend class KStaticDeleter<PluginManager>;
00082 PluginManager();
00083 virtual ~PluginManager();
00084
00085 AppletInfo::Dict _dict;
00086 static PluginManager* m_self;
00087 TQStringList m_untrustedApplets;
00088 TQStringList m_untrustedExtensions;
00089 };
00090
00091 class LibUnloader : public QObject
00092 {
00093 Q_OBJECT
00094 public:
00095 static void unload( const TQString &libName );
00096
00097 private slots:
00098 void unload();
00099
00100 private:
00101 LibUnloader( const TQString &libName, TQObject *parent );
00102
00103 TQString _libName;
00104 };
00105
00106 #endif