summaryrefslogtreecommitdiffabout
path: root/microkde/kresources/factory.h
Unidiff
Diffstat (limited to 'microkde/kresources/factory.h') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kresources/factory.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/microkde/kresources/factory.h b/microkde/kresources/factory.h
index f391bb3..ad67ab3 100644
--- a/microkde/kresources/factory.h
+++ b/microkde/kresources/factory.h
@@ -13,70 +13,80 @@
13 This library is distributed in the hope that it will be useful, 13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details. 16 Library General Public License for more details.
17 17
18 You should have received a copy of the GNU Library General Public License 18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to 19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA. 21 Boston, MA 02111-1307, USA.
22*/ 22*/
23 23
24#ifndef KRESOURCES_FACTORY_H 24#ifndef KRESOURCES_FACTORY_H
25#define KRESOURCES_FACTORY_H 25#define KRESOURCES_FACTORY_H
26 26
27#include <qdict.h> 27#include <qdict.h>
28#include <qstring.h> 28#include <qstring.h>
29 29
30#include <kconfig.h> 30#include <kconfig.h>
31 31
32 32
33#include "resource.h" 33#include "resource.h"
34 34
35namespace KRES { 35namespace KRES {
36 36
37//US
38struct PluginInfo
39{
40 QString library;
41 QString nameLabel;
42 QString descriptionLabel;
43};
44
45
37/** 46/**
38 * Class for loading resource plugins. 47 * Class for loading resource plugins.
39 * Do not use this class directly. Use ResourceManager instead 48 * Do not use this class directly. Use ResourceManager instead
40 * 49 *
41 * Example: 50 * Example:
42 * 51 *
43 * <pre> 52 * <pre>
44 * KABC::Factory<Calendar> *factory = KABC::Factory<Calendar>::self(); 53 * KABC::Factory<Calendar> *factory = KABC::Factory<Calendar>::self();
45 * 54 *
46 * QStringList list = factory->resources(); 55 * QStringList list = factory->resources();
47 * QStringList::Iterator it; 56 * QStringList::Iterator it;
48 * for ( it = list.begin(); it != list.end(); ++it ) { 57 * for ( it = list.begin(); it != list.end(); ++it ) {
49 * Resource<Calendar> *resource = factory->resource( (*it), 58 * Resource<Calendar> *resource = factory->resource( (*it),
50 * KABC::StdAddressBook::self(), 0 ); 59 * KABC::StdAddressBook::self(), 0 );
51 * // do something with resource 60 * // do something with resource
52 * } 61 * }
53 * </pre> 62 * </pre>
54 */ 63 */
55class Factory 64class Factory
56{ 65{
57 public: 66 public:
58 67
68
59 /** 69 /**
60 * Returns the global resource factory. 70 * Returns the global resource factory.
61 */ 71 */
62 static Factory *self( const QString& resourceFamily ); 72 static Factory *self( const QString& resourceFamily );
63 73
64 ~Factory(); 74 ~Factory();
65 75
66 /** 76 /**
67 * Returns the config widget for the given resource type, 77 * Returns the config widget for the given resource type,
68 * or a null pointer if resource type doesn't exist. 78 * or a null pointer if resource type doesn't exist.
69 * 79 *
70 * @param type The type of the resource, returned by @ref resources() 80 * @param type The type of the resource, returned by @ref resources()
71 * @param resource The resource to be editted. 81 * @param resource The resource to be editted.
72 * @param parent The parent widget 82 * @param parent The parent widget
73 */ 83 */
74 ConfigWidget *configWidget( const QString& type, QWidget *parent = 0 ); 84 ConfigWidget *configWidget( const QString& type, QWidget *parent = 0 );
75 85
76 /** 86 /**
77 * Returns a pointer to a resource object or a null pointer 87 * Returns a pointer to a resource object or a null pointer
78 * if resource type doesn't exist. 88 * if resource type doesn't exist.
79 * 89 *
80 * @param type The type of the resource, returned by @ref resources() 90 * @param type The type of the resource, returned by @ref resources()
81 * @param ab The address book, the resource should belong to 91 * @param ab The address book, the resource should belong to
82 * @param config The config object where the resource get it settings from, or 0 if a new resource should be created. 92 * @param config The config object where the resource get it settings from, or 0 if a new resource should be created.
@@ -85,29 +95,30 @@ class Factory
85 95
86 /** 96 /**
87 * Returns a list of all available resource types. 97 * Returns a list of all available resource types.
88 */ 98 */
89 QStringList typeNames() const; 99 QStringList typeNames() const;
90 100
91 /** 101 /**
92 * Returns the name for a special type. 102 * Returns the name for a special type.
93 */ 103 */
94 QString typeName( const QString &type ) const; 104 QString typeName( const QString &type ) const;
95 105
96 /** 106 /**
97 * Returns the description for a special type. 107 * Returns the description for a special type.
98 */ 108 */
99 QString typeDescription( const QString &type ) const; 109 QString typeDescription( const QString &type ) const;
100 110
101 protected: 111 protected:
102 Factory( const QString& resourceFamily ); 112 Factory( const QString& resourceFamily );
103 113
104 private: 114 private:
105 static QDict<Factory> *mSelves; 115 static QDict<Factory> *mSelves;
106 116
107 QString mResourceFamily; 117 QString mResourceFamily;
108//US QMap<QString, KService::Ptr> mTypeMap; 118//US QMap<QString, KService::Ptr> mTypeMap;
109 QMap<QString, PluginFactoryBase*> mTypeMap; 119//US lets store the pluginfo struct as value instead of a KService
120 QMap<QString, PluginInfo*> mTypeMap;
110}; 121};
111 122
112} 123}
113#endif 124#endif