blob: 9424e0141e98ded7d3c60f21d7f9f7487781205c (
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
/*
**************************************************************************
description
--------------------
copyright : (C) 2003 by Andreas Zehender
email : zehender@kde.org
**************************************************************************
**************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
**************************************************************************/
#ifndef PMPLUGINMANAGER_H
#define PMPLUGINMANAGER_H
#include <kstaticdeleter.h>
#include <qstring.h>
#include <qptrlist.h>
class PMPart;
/**
* Plugin info for one plugin
*/
class PMPluginInfo
{
public:
/**
* Default constructor
*/
PMPluginInfo( const QString& name, const QString& description,
bool enabled )
{
m_name = name;
m_description = description;
m_enabled = enabled;
}
/**
* Returns the plugin name
*/
QString name( ) const { return m_name; }
/**
* Returns the plugin description (i18n'ed)
*/
QString description( ) const { return m_description; }
/**
* Returns true if the plugin is enabled
*/
bool enabled( ) const { return m_enabled; }
/**
* Enables/disables the plugin
*/
void enable( bool en ) { m_enabled = en; }
private:
QString m_name, m_description;
bool m_enabled;
};
/**
* Manager class for plugins.
*
* Stores a list of available plugins and loads and unloads plugins.
*/
class PMPluginManager
{
public:
/**
* Destructor
*/
~PMPluginManager( );
/**
* Returns the instance (singleton)
*/
static PMPluginManager* theManager( );
/**
* Registers a part instance and loads the plugins for that part
*/
void registerPart( PMPart* p );
/**
* Removes a part instance
*/
void removePart( PMPart* p );
/**
* Returns a list of available plugins
*/
QPtrList<PMPluginInfo> plugins( ) const { return m_plugins; }
/**
* Loads and unloads plugins for all parts when plugins were activated or
* deactivated
*/
void updatePlugins( );
private:
/**
* Constructor
*/
PMPluginManager( );
QPtrList<PMPluginInfo> m_plugins;
QPtrList<PMPart> m_parts;
static PMPluginManager* s_pInstance;
static KStaticDeleter<PMPluginManager> s_staticDeleter;
};
#endif
|