summaryrefslogtreecommitdiffabout
path: root/microkde/kresources/factory.h
Unidiff
Diffstat (limited to 'microkde/kresources/factory.h') (more/less context) (show whitespace changes)
-rw-r--r--microkde/kresources/factory.h15
1 files changed, 1 insertions, 14 deletions
diff --git a/microkde/kresources/factory.h b/microkde/kresources/factory.h
index 0e4231b..ea01b23 100644
--- a/microkde/kresources/factory.h
+++ b/microkde/kresources/factory.h
@@ -1,139 +1,126 @@
1/* 1/*
2 This file is part of libkresources. 2 This file is part of libkresources.
3 3
4 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> 4 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
5 Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> 5 Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
6 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org> 6 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version. 11 version 2 of the License, or (at your option) any later version.
12 12
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
37class SyncWidgetContainer;
38class ConfigWidget; 37class ConfigWidget;
39 38
40//US 39//US
41struct PluginInfo 40struct PluginInfo
42{ 41{
43 QString library; 42 QString library;
44 QString nameLabel; 43 QString nameLabel;
45 QString descriptionLabel; 44 QString descriptionLabel;
46}; 45};
47 46
48 47
49/** 48/**
50 * Class for loading resource plugins. 49 * Class for loading resource plugins.
51 * Do not use this class directly. Use ResourceManager instead 50 * Do not use this class directly. Use ResourceManager instead
52 * 51 *
53 * Example: 52 * Example:
54 * 53 *
55 * <pre> 54 * <pre>
56 * KABC::Factory<Calendar> *factory = KABC::Factory<Calendar>::self(); 55 * KABC::Factory<Calendar> *factory = KABC::Factory<Calendar>::self();
57 * 56 *
58 * QStringList list = factory->resources(); 57 * QStringList list = factory->resources();
59 * QStringList::Iterator it; 58 * QStringList::Iterator it;
60 * for ( it = list.begin(); it != list.end(); ++it ) { 59 * for ( it = list.begin(); it != list.end(); ++it ) {
61 * Resource<Calendar> *resource = factory->resource( (*it), 60 * Resource<Calendar> *resource = factory->resource( (*it),
62 * KABC::StdAddressBook::self(), 0 ); 61 * KABC::StdAddressBook::self(), 0 );
63 * // do something with resource 62 * // do something with resource
64 * } 63 * }
65 * </pre> 64 * </pre>
66 */ 65 */
67class Factory 66class Factory
68{ 67{
69 public: 68 public:
70 69
71 70
72 /** 71 /**
73 * Returns the global resource factory. 72 * Returns the global resource factory.
74 */ 73 */
75 static Factory *self( const QString& resourceFamily ); 74 static Factory *self( const QString& resourceFamily );
76 75
77 ~Factory(); 76 ~Factory();
78 77
79 /** 78 /**
80 * Returns the config widget for the given resource type, 79 * Returns the config widget for the given resource type,
81 * or a null pointer if resource type doesn't exist. 80 * or a null pointer if resource type doesn't exist.
82 * 81 *
83 * @param type The type of the resource, returned by @ref resources() 82 * @param type The type of the resource, returned by @ref resources()
84 * @param resource The resource to be editted. 83 * @param resource The resource to be editted.
85 * @param parent The parent widget 84 * @param parent The parent widget
86 */ 85 */
87 ConfigWidget *configWidget( const QString& type, QWidget *parent = 0 ); 86 ConfigWidget *configWidget( const QString& type, QWidget *parent = 0 );
88 87
89 /** 88 /**
90 * Returns the sync widget for the given resource type,
91 * or a null pointer if resource type doesn't exist,
92 * or a null pointer if resource does not support syncing.
93 *
94 * @param type The type of the resource, returned by @ref resources()
95 * @param resource The resource to be editted.
96 * @param parent The parent widget
97 */
98 SyncWidgetContainer *syncWidgetContainer( const QString& type );
99
100 /**
101 * Returns a pointer to a resource object or a null pointer 89 * Returns a pointer to a resource object or a null pointer
102 * if resource type doesn't exist. 90 * if resource type doesn't exist.
103 * 91 *
104 * @param type The type of the resource, returned by @ref resources() 92 * @param type The type of the resource, returned by @ref resources()
105 * @param ab The address book, the resource should belong to 93 * @param ab The address book, the resource should belong to
106 * @param config The config object where the resource get it settings from, or 0 if a new resource should be created. 94 * @param config The config object where the resource get it settings from, or 0 if a new resource should be created.
107 * @param syncable If the resource should support syncing capabilities.
108 */ 95 */
109 Resource *resource( const QString& type, const KConfig *config, bool syncable ); 96 Resource *resource( const QString& type, const KConfig *config);
110 97
111 /** 98 /**
112 * Returns a list of all available resource types. 99 * Returns a list of all available resource types.
113 */ 100 */
114 QStringList typeNames() const; 101 QStringList typeNames() const;
115 102
116 /** 103 /**
117 * Returns the name for a special type. 104 * Returns the name for a special type.
118 */ 105 */
119 QString typeName( const QString &type ) const; 106 QString typeName( const QString &type ) const;
120 107
121 /** 108 /**
122 * Returns the description for a special type. 109 * Returns the description for a special type.
123 */ 110 */
124 QString typeDescription( const QString &type ) const; 111 QString typeDescription( const QString &type ) const;
125 112
126 protected: 113 protected:
127 Factory( const QString& resourceFamily); 114 Factory( const QString& resourceFamily);
128 115
129 private: 116 private:
130 static QDict<Factory> *mSelves; 117 static QDict<Factory> *mSelves;
131 118
132 QString mResourceFamily; 119 QString mResourceFamily;
133//US QMap<QString, KService::Ptr> mTypeMap; 120//US QMap<QString, KService::Ptr> mTypeMap;
134//US lets store the pluginfo struct as value instead of a KService 121//US lets store the pluginfo struct as value instead of a KService
135 QMap<QString, PluginInfo*> mTypeMap; 122 QMap<QString, PluginInfo*> mTypeMap;
136}; 123};
137 124
138} 125}
139#endif 126#endif