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.h26
1 files changed, 19 insertions, 7 deletions
diff --git a/microkde/kresources/factory.h b/microkde/kresources/factory.h
index ad67ab3..a265bc8 100644
--- a/microkde/kresources/factory.h
+++ b/microkde/kresources/factory.h
@@ -25,25 +25,25 @@
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 37//US
38struct PluginInfo 38struct PluginInfo
39{ 39{
40 QString library; 40 QString library;
41 QString nameLabel; 41 QString nameLabel;
42 QString descriptionLabel; 42 QString descriptionLabel;
43}; 43};
44 44
45 45
46/** 46/**
47 * Class for loading resource plugins. 47 * Class for loading resource plugins.
48 * Do not use this class directly. Use ResourceManager instead 48 * Do not use this class directly. Use ResourceManager instead
49 * 49 *
@@ -56,69 +56,81 @@ struct PluginInfo
56 * QStringList::Iterator it; 56 * QStringList::Iterator it;
57 * for ( it = list.begin(); it != list.end(); ++it ) { 57 * for ( it = list.begin(); it != list.end(); ++it ) {
58 * Resource<Calendar> *resource = factory->resource( (*it), 58 * Resource<Calendar> *resource = factory->resource( (*it),
59 * KABC::StdAddressBook::self(), 0 ); 59 * KABC::StdAddressBook::self(), 0 );
60 * // do something with resource 60 * // do something with resource
61 * } 61 * }
62 * </pre> 62 * </pre>
63 */ 63 */
64class Factory 64class Factory
65{ 65{
66 public: 66 public:
67 67
68 68
69 /** 69 /**
70 * Returns the global resource factory. 70 * Returns the global resource factory.
71 */ 71 */
72 static Factory *self( const QString& resourceFamily ); 72 static Factory *self( const QString& resourceFamily );
73 73
74 ~Factory(); 74 ~Factory();
75 75
76 /** 76 /**
77 * Returns the config widget for the given resource type, 77 * Returns the config widget for the given resource type,
78 * or a null pointer if resource type doesn't exist. 78 * or a null pointer if resource type doesn't exist.
79 * 79 *
80 * @param type The type of the resource, returned by @ref resources() 80 * @param type The type of the resource, returned by @ref resources()
81 * @param resource The resource to be editted. 81 * @param resource The resource to be editted.
82 * @param parent The parent widget 82 * @param parent The parent widget
83 */ 83 */
84 ConfigWidget *configWidget( const QString& type, QWidget *parent = 0 ); 84 ConfigWidget *configWidget( const QString& type, QWidget *parent = 0 );
85 85
86 /** 86 /**
87 * Returns the sync widget for the given resource type,
88 * or a null pointer if resource type doesn't exist,
89 * or a null pointer if resource does not support syncing.
90 *
91 * @param type The type of the resource, returned by @ref resources()
92 * @param resource The resource to be editted.
93 * @param parent The parent widget
94 */
95 SyncWidget *syncWidget( const QString& type, QWidget *parent = 0 );
96
97 /**
87 * Returns a pointer to a resource object or a null pointer 98 * Returns a pointer to a resource object or a null pointer
88 * if resource type doesn't exist. 99 * if resource type doesn't exist.
89 * 100 *
90 * @param type The type of the resource, returned by @ref resources() 101 * @param type The type of the resource, returned by @ref resources()
91 * @param ab The address book, the resource should belong to 102 * @param ab The address book, the resource should belong to
92 * @param config The config object where the resource get it settings from, or 0 if a new resource should be created. 103 * @param config The config object where the resource get it settings from, or 0 if a new resource should be created.
104 * @param syncable If the resource should support syncing capabilities.
93 */ 105 */
94 Resource *resource( const QString& type, const KConfig *config ); 106 Resource *resource( const QString& type, const KConfig *config, bool syncable );
95 107
96 /** 108 /**
97 * Returns a list of all available resource types. 109 * Returns a list of all available resource types.
98 */ 110 */
99 QStringList typeNames() const; 111 QStringList typeNames() const;
100 112
101 /** 113 /**
102 * Returns the name for a special type. 114 * Returns the name for a special type.
103 */ 115 */
104 QString typeName( const QString &type ) const; 116 QString typeName( const QString &type ) const;
105 117
106 /** 118 /**
107 * Returns the description for a special type. 119 * Returns the description for a special type.
108 */ 120 */
109 QString typeDescription( const QString &type ) const; 121 QString typeDescription( const QString &type ) const;
110 122
111 protected: 123 protected:
112 Factory( const QString& resourceFamily ); 124 Factory( const QString& resourceFamily);
113 125
114 private: 126 private:
115 static QDict<Factory> *mSelves; 127 static QDict<Factory> *mSelves;
116 128
117 QString mResourceFamily; 129 QString mResourceFamily;
118//US QMap<QString, KService::Ptr> mTypeMap; 130//US QMap<QString, KService::Ptr> mTypeMap;
119//US lets store the pluginfo struct as value instead of a KService 131//US lets store the pluginfo struct as value instead of a KService
120 QMap<QString, PluginInfo*> mTypeMap; 132 QMap<QString, PluginInfo*> mTypeMap;
121}; 133};
122 134
123} 135}
124#endif 136#endif