summaryrefslogtreecommitdiffstats
path: root/src/plugincontroller.h
blob: eb635bb65389b3bdfd48984559e93f56ff4dc258 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef __PLUGINCONTROLLER_H__
#define __PLUGINCONTROLLER_H__

#include <tqdict.h>
#include <tqvaluelist.h>

#include <kservice.h>

#include <tdevplugincontroller.h>

#include <profileengine.h>

class KXMLGUIClient;
class KService;
class TDevPlugin;
class KDialogBase;
class ProjectInfo;

/**
Plugin controller implementation.
Loads and unloads plugins.
*/
class PluginController : public TDevPluginController
{
  Q_OBJECT
  

public:

  ~PluginController();

  static PluginController *getInstance();
  static TQStringList argumentsFromService( const KService::Ptr &service );


  virtual TDevPlugin * loadPlugin( const TQString & serviceType, const TQString & constraint );
  virtual void unloadPlugin( const TQString & plugin );

  TQString currentProfile() const { return m_profile; }

  void loadInitialPlugins();

  void loadProjectPlugins( const TQStringList & ignorePlugins );
  void unloadProjectPlugins();

  void loadGlobalPlugins( const TQStringList & ignorePlugins = TQStringList() );

  //  TDevPlugin * getPlugin( const KService::Ptr &service );

  virtual TDevPlugin *extension(const TQString &serviceType, const TQString &constraint = "");

  void unloadPlugins( TQStringList const & );

  void integratePart(KXMLGUIClient *part);
  void integrateAndRememberPart(const TQString &name, TDevPlugin *part);
  void removePart(KXMLGUIClient* part);
  void removeAndForgetPart(const TQString &name, TDevPlugin* part);

  const TQValueList<TDevPlugin*> loadedPlugins();

  ProfileEngine &engine() { return m_engine; }

  virtual KURL::List profileResources(const TQString &nameFilter);
  virtual KURL::List profileResourcesRecursive(const TQString &nameFilter);

  //returns the name of an old profile that was unloaded
  TQString changeProfile(const TQString &newProfile);

public slots:
  void selectPlugins();

signals:
  void loadingPlugin(const TQString &plugin);

protected:
  PluginController();

private slots:
//  void slotConfigWidget( KDialogBase* );
  void loadCorePlugins();
  void loadPlugins( TDETrader::OfferList offers, const TQStringList & ignorePlugins = TQStringList() );
  void unloadPlugins();

private:
	static TDevPlugin *loadPlugin( const KService::Ptr &service );


  TQDict<TDevPlugin> m_parts;
  TQString m_profile;

  static PluginController *s_instance;

  ProfileEngine m_engine;

};

#endif