summaryrefslogtreecommitdiffabout
path: root/microkde/kresources/factory.h
authorzautrix <zautrix>2004-06-26 19:01:18 (UTC)
committer zautrix <zautrix>2004-06-26 19:01:18 (UTC)
commitb9aad1f15dc600e4dbe4c62d3fcced6363188ba3 (patch) (unidiff)
tree2c3d4004fb21c72cba65793859f9bcd8ffd3a49c /microkde/kresources/factory.h
downloadkdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.zip
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.gz
kdepimpi-b9aad1f15dc600e4dbe4c62d3fcced6363188ba3.tar.bz2
Initial revision
Diffstat (limited to 'microkde/kresources/factory.h') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kresources/factory.h113
1 files changed, 113 insertions, 0 deletions
diff --git a/microkde/kresources/factory.h b/microkde/kresources/factory.h
new file mode 100644
index 0000000..f391bb3
--- a/dev/null
+++ b/microkde/kresources/factory.h
@@ -0,0 +1,113 @@
1/*
2 This file is part of libkresources.
3
4 Copyright (c) 2002 Tobias Koenig <tokoe@kde.org>
5 Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org>
6 Copyright (c) 2003 Cornelius Schumacher <schumacher@kde.org>
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
12
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
17
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
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.
22*/
23
24#ifndef KRESOURCES_FACTORY_H
25#define KRESOURCES_FACTORY_H
26
27#include <qdict.h>
28#include <qstring.h>
29
30#include <kconfig.h>
31
32
33#include "resource.h"
34
35namespace KRES {
36
37/**
38 * Class for loading resource plugins.
39 * Do not use this class directly. Use ResourceManager instead
40 *
41 * Example:
42 *
43 * <pre>
44 * KABC::Factory<Calendar> *factory = KABC::Factory<Calendar>::self();
45 *
46 * QStringList list = factory->resources();
47 * QStringList::Iterator it;
48 * for ( it = list.begin(); it != list.end(); ++it ) {
49 * Resource<Calendar> *resource = factory->resource( (*it),
50 * KABC::StdAddressBook::self(), 0 );
51 * // do something with resource
52 * }
53 * </pre>
54 */
55class Factory
56{
57 public:
58
59 /**
60 * Returns the global resource factory.
61 */
62 static Factory *self( const QString& resourceFamily );
63
64 ~Factory();
65
66 /**
67 * Returns the config widget for the given resource type,
68 * or a null pointer if resource type doesn't exist.
69 *
70 * @param type The type of the resource, returned by @ref resources()
71 * @param resource The resource to be editted.
72 * @param parent The parent widget
73 */
74 ConfigWidget *configWidget( const QString& type, QWidget *parent = 0 );
75
76 /**
77 * Returns a pointer to a resource object or a null pointer
78 * if resource type doesn't exist.
79 *
80 * @param type The type of the resource, returned by @ref resources()
81 * @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.
83 */
84 Resource *resource( const QString& type, const KConfig *config );
85
86 /**
87 * Returns a list of all available resource types.
88 */
89 QStringList typeNames() const;
90
91 /**
92 * Returns the name for a special type.
93 */
94 QString typeName( const QString &type ) const;
95
96 /**
97 * Returns the description for a special type.
98 */
99 QString typeDescription( const QString &type ) const;
100
101 protected:
102 Factory( const QString& resourceFamily );
103
104 private:
105 static QDict<Factory> *mSelves;
106
107 QString mResourceFamily;
108//US QMap<QString, KService::Ptr> mTypeMap;
109 QMap<QString, PluginFactoryBase*> mTypeMap;
110};
111
112}
113#endif