-rw-r--r-- | microkde/kresources/manager.h | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/microkde/kresources/manager.h b/microkde/kresources/manager.h index b5e97fc..7e9e19a 100644 --- a/microkde/kresources/manager.h +++ b/microkde/kresources/manager.h | |||
@@ -1,12 +1,13 @@ | |||
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 | Copyright (c) 2004 Ulf Schenk | ||
7 | 8 | ||
8 | This library is free software; you can redistribute it and/or | 9 | This library is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU Library General Public | 10 | modify it under the terms of the GNU Library General Public |
10 | License as published by the Free Software Foundation; either | 11 | License as published by the Free Software Foundation; either |
11 | version 2 of the License, or (at your option) any later version. | 12 | version 2 of the License, or (at your option) any later version. |
12 | 13 | ||
@@ -18,12 +19,19 @@ | |||
18 | You should have received a copy of the GNU Library General Public License | 19 | 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 | 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 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
21 | Boston, MA 02111-1307, USA. | 22 | Boston, MA 02111-1307, USA. |
22 | */ | 23 | */ |
23 | 24 | ||
25 | /* | ||
26 | Enhanced Version of the file for platform independent KDE tools. | ||
27 | Copyright (c) 2004 Ulf Schenk | ||
28 | |||
29 | $Id$ | ||
30 | */ | ||
31 | |||
24 | #ifndef KRESOURCES_MANAGER_H | 32 | #ifndef KRESOURCES_MANAGER_H |
25 | #define KRESOURCES_MANAGER_H | 33 | #define KRESOURCES_MANAGER_H |
26 | 34 | ||
27 | #include <qdict.h> | 35 | #include <qdict.h> |
28 | #include <qstringlist.h> | 36 | #include <qstringlist.h> |
29 | 37 | ||
@@ -156,18 +164,23 @@ class Manager : private ManagerImplListener | |||
156 | it.mList = mImpl->resourceList(); | 164 | it.mList = mImpl->resourceList(); |
157 | return it; | 165 | return it; |
158 | } | 166 | } |
159 | 167 | ||
160 | bool isEmpty() const { return mImpl->resourceList()->isEmpty(); } | 168 | bool isEmpty() const { return mImpl->resourceList()->isEmpty(); } |
161 | 169 | ||
162 | Manager( const QString &family ) | 170 | /** |
171 | Return true, if the manager manages syncable resources. | ||
172 | */ | ||
173 | bool manageSyncable() { return mImpl->manageSyncable(); } | ||
174 | |||
175 | Manager( const QString &family, bool syncable ) | ||
163 | { | 176 | { |
164 | mFactory = Factory::self( family ); | 177 | mFactory = Factory::self( family ); |
165 | // The managerimpl will use the same Factory object as the manager | 178 | // The managerimpl will use the same Factory object as the manager |
166 | // because of the Factory::self() pattern | 179 | // because of the Factory::self() pattern |
167 | mImpl = new ManagerImpl( family ); | 180 | mImpl = new ManagerImpl( family, syncable ); |
168 | mImpl->setListener( this ); | 181 | mImpl->setListener( this ); |
169 | 182 | ||
170 | mListeners = new QPtrList<ManagerListener<T> >; | 183 | mListeners = new QPtrList<ManagerListener<T> >; |
171 | } | 184 | } |
172 | 185 | ||
173 | virtual ~Manager() | 186 | virtual ~Manager() |
@@ -244,16 +257,17 @@ class Manager : private ManagerImplListener | |||
244 | not added to the manager, the application has to do that. | 257 | not added to the manager, the application has to do that. |
245 | Returns a pointer to a resource object or a null pointer | 258 | Returns a pointer to a resource object or a null pointer |
246 | if resource type doesn't exist. | 259 | if resource type doesn't exist. |
247 | 260 | ||
248 | @param type The type of the resource, one of those returned | 261 | @param type The type of the resource, one of those returned |
249 | by @ref resourceTypeNames() | 262 | by @ref resourceTypeNames() |
263 | * @param syncable If the resource should support syncing capabilities. | ||
250 | */ | 264 | */ |
251 | T *createResource( const QString& type ) | 265 | T *createResource( const QString& type ) |
252 | { | 266 | { |
253 | return (T *)( mFactory->resource( type, 0 ) ); | 267 | return (T *)( mFactory->resource( type, 0, mImpl->manageSyncable() ) ); |
254 | } | 268 | } |
255 | 269 | ||
256 | /** | 270 | /** |
257 | Returns a list of the names of all available resource types. | 271 | Returns a list of the names of all available resource types. |
258 | */ | 272 | */ |
259 | QStringList resourceTypeNames() const | 273 | QStringList resourceTypeNames() const |