summaryrefslogtreecommitdiffstats
path: root/src/plugincontroller.h
blob: dc72169811d2923808fa3a2a7f552df91ab92594 (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 <kdevplugincontroller.h>

#include <profileengine.h>

class KXMLGUIClient;
class KService;
class KDevPlugin;
class KDialogBase;
class ProjectInfo;

/**
Plugin controller implementation.
Loads and unloads plugins.
*/
class PluginController : public KDevPluginController
{
  TQ_OBJECT
  

public:

  ~PluginController();

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


  virtual KDevPlugin * 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() );

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

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

  void unloadPlugins( TQStringList const & );

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

  const TQValueList<KDevPlugin*> 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 KDevPlugin *loadPlugin( const KService::Ptr &service );


  TQDict<KDevPlugin> m_parts;
  TQString m_profile;

  static PluginController *s_instance;

  ProfileEngine m_engine;

};

#endif