-rw-r--r-- | microkde/kresources/factory.h | 13 |
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 | |||
@@ -25,46 +25,56 @@ | |||
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 | ||
35 | namespace KRES { | 35 | namespace KRES { |
36 | 36 | ||
37 | //US | ||
38 | struct 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 | */ |
55 | class Factory | 64 | class 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() |
@@ -97,17 +107,18 @@ class Factory | |||
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 |