Diffstat (limited to 'microkde/kresources/managerimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kresources/managerimpl.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/microkde/kresources/managerimpl.cpp b/microkde/kresources/managerimpl.cpp index a6d2007..4c0751c 100644 --- a/microkde/kresources/managerimpl.cpp +++ b/microkde/kresources/managerimpl.cpp | |||
@@ -6,64 +6,66 @@ | |||
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 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <kglobal.h> | 31 | #include <kglobal.h> |
32 | 32 | ||
33 | #include <kapplication.h> | 33 | #include <kapplication.h> |
34 | #include <kdebug.h> | 34 | #include <kdebug.h> |
35 | #include <kconfig.h> | 35 | #include <kconfig.h> |
36 | #include <kstandarddirs.h> | 36 | #include <kstandarddirs.h> |
37 | #include <qfile.h> | 37 | #include <qfile.h> |
38 | //Added by qt3to4: | ||
39 | #include <Q3PtrList> | ||
38 | 40 | ||
39 | #include "resource.h" | 41 | #include "resource.h" |
40 | #include "factory.h" | 42 | #include "factory.h" |
41 | #include "managerimpl.h" | 43 | #include "managerimpl.h" |
42 | 44 | ||
43 | 45 | ||
44 | 46 | ||
45 | using namespace KRES; | 47 | using namespace KRES; |
46 | 48 | ||
47 | ManagerImpl::ManagerImpl( const QString &family ) | 49 | ManagerImpl::ManagerImpl( const QString &family ) |
48 | : mFamily( family ), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ), | 50 | : mFamily( family ), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ), |
49 | mFactory( 0 ) | 51 | mFactory( 0 ) |
50 | 52 | ||
51 | { | 53 | { |
52 | kdDebug(5650) << "ManagerImpl::ManagerImpl()" << endl; | 54 | kdDebug(5650) << "ManagerImpl::ManagerImpl()" << endl; |
53 | 55 | ||
54 | 56 | ||
55 | } | 57 | } |
56 | 58 | ||
57 | ManagerImpl::~ManagerImpl() | 59 | ManagerImpl::~ManagerImpl() |
58 | { | 60 | { |
59 | kdDebug(5650) << "ManagerImpl::~ManagerImpl()" << endl; | 61 | kdDebug(5650) << "ManagerImpl::~ManagerImpl()" << endl; |
60 | 62 | ||
61 | Resource::List::ConstIterator it; | 63 | Resource::List::ConstIterator it; |
62 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { | 64 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { |
63 | delete *it; | 65 | delete *it; |
64 | } | 66 | } |
65 | 67 | ||
66 | delete mStdConfig; | 68 | delete mStdConfig; |
67 | } | 69 | } |
68 | 70 | ||
69 | void ManagerImpl::createStandardConfig() | 71 | void ManagerImpl::createStandardConfig() |
@@ -203,78 +205,78 @@ void ManagerImpl::setStandardResource( Resource *resource ) | |||
203 | { | 205 | { |
204 | mStandard = resource; | 206 | mStandard = resource; |
205 | } | 207 | } |
206 | 208 | ||
207 | void ManagerImpl::resourceChanged( Resource *resource ) | 209 | void ManagerImpl::resourceChanged( Resource *resource ) |
208 | { | 210 | { |
209 | writeResourceConfig( resource, true ); | 211 | writeResourceConfig( resource, true ); |
210 | 212 | ||
211 | 213 | ||
212 | // ManagerIface_stub allManagers( "*", "ManagerIface_" + mFamily.utf8() ); | 214 | // ManagerIface_stub allManagers( "*", "ManagerIface_" + mFamily.utf8() ); |
213 | // allManagers.dcopResourceModified( resource->identifier() ); | 215 | // allManagers.dcopResourceModified( resource->identifier() ); |
214 | } | 216 | } |
215 | 217 | ||
216 | // DCOP asynchronous functions | 218 | // DCOP asynchronous functions |
217 | //US since we work from inside the application, we call the methods directly. | 219 | //US since we work from inside the application, we call the methods directly. |
218 | 220 | ||
219 | QStringList ManagerImpl::resourceNames() | 221 | QStringList ManagerImpl::resourceNames() |
220 | { | 222 | { |
221 | QStringList result; | 223 | QStringList result; |
222 | 224 | ||
223 | Resource::List::ConstIterator it; | 225 | Resource::List::ConstIterator it; |
224 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { | 226 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { |
225 | result.append( (*it)->resourceName() ); | 227 | result.append( (*it)->resourceName() ); |
226 | } | 228 | } |
227 | return result; | 229 | return result; |
228 | } | 230 | } |
229 | 231 | ||
230 | Resource::List *ManagerImpl::resourceList() | 232 | Resource::List *ManagerImpl::resourceList() |
231 | { | 233 | { |
232 | return &mResources; | 234 | return &mResources; |
233 | } | 235 | } |
234 | 236 | ||
235 | QPtrList<Resource> ManagerImpl::resources() | 237 | Q3PtrList<Resource> ManagerImpl::resources() |
236 | { | 238 | { |
237 | QPtrList<Resource> result; | 239 | Q3PtrList<Resource> result; |
238 | 240 | ||
239 | Resource::List::ConstIterator it; | 241 | Resource::List::ConstIterator it; |
240 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { | 242 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { |
241 | result.append( *it ); | 243 | result.append( *it ); |
242 | } | 244 | } |
243 | return result; | 245 | return result; |
244 | } | 246 | } |
245 | 247 | ||
246 | QPtrList<Resource> ManagerImpl::resources( bool active ) | 248 | Q3PtrList<Resource> ManagerImpl::resources( bool active ) |
247 | { | 249 | { |
248 | QPtrList<Resource> result; | 250 | Q3PtrList<Resource> result; |
249 | 251 | ||
250 | Resource::List::ConstIterator it; | 252 | Resource::List::ConstIterator it; |
251 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { | 253 | for ( it = mResources.begin(); it != mResources.end(); ++it ) { |
252 | if ( (*it)->isActive() == active ) { | 254 | if ( (*it)->isActive() == active ) { |
253 | result.append( *it ); | 255 | result.append( *it ); |
254 | } | 256 | } |
255 | } | 257 | } |
256 | return result; | 258 | return result; |
257 | } | 259 | } |
258 | 260 | ||
259 | void ManagerImpl::setListener( ManagerImplListener *listener ) | 261 | void ManagerImpl::setListener( ManagerImplListener *listener ) |
260 | { | 262 | { |
261 | mListener = listener; | 263 | mListener = listener; |
262 | } | 264 | } |
263 | 265 | ||
264 | Resource* ManagerImpl::readResourceConfig( const QString& identifier, | 266 | Resource* ManagerImpl::readResourceConfig( const QString& identifier, |
265 | bool checkActive ) | 267 | bool checkActive ) |
266 | { | 268 | { |
267 | kdDebug() << "ManagerImpl::readResourceConfig() " << identifier << endl; | 269 | kdDebug() << "ManagerImpl::readResourceConfig() " << identifier << endl; |
268 | 270 | ||
269 | // qDebug("ManagerImpl::readResourceConfig() %s", identifier.latin1()); | 271 | // qDebug("ManagerImpl::readResourceConfig() %s", identifier.latin1()); |
270 | 272 | ||
271 | mConfig->setGroup( "Resource_" + identifier ); | 273 | mConfig->setGroup( "Resource_" + identifier ); |
272 | #ifdef _WIN32_ | 274 | #ifdef _WIN32_ |
273 | // we use plugins on win32. the group is stored in a static variable | 275 | // we use plugins on win32. the group is stored in a static variable |
274 | // such that gourp info not avail on win32 plugins | 276 | // such that gourp info not avail on win32 plugins |
275 | // to fix that, it would be a looooot of work | 277 | // to fix that, it would be a looooot of work |
276 | mConfig->setTempGroup( "Resource_" + identifier ); | 278 | mConfig->setTempGroup( "Resource_" + identifier ); |
277 | #endif | 279 | #endif |
278 | QString type = mConfig->readEntry( "ResourceType" ); | 280 | QString type = mConfig->readEntry( "ResourceType" ); |
279 | QString name = mConfig->readEntry( "ResourceName" ); | 281 | QString name = mConfig->readEntry( "ResourceName" ); |
280 | Resource *resource = mFactory->resource( type, mConfig ); | 282 | Resource *resource = mFactory->resource( type, mConfig ); |