From b4203356adb6008a4b4e6782afdae7dd34178697 Mon Sep 17 00:00:00 2001 From: ulf69 Date: Mon, 02 Aug 2004 18:12:49 +0000 Subject: added support for syncing of resources --- (limited to 'microkde/kresources/manager.h') 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 @@ -4,6 +4,7 @@ Copyright (c) 2002 Tobias Koenig Copyright (c) 2002 Jan-Pascal van Best Copyright (c) 2003 Cornelius Schumacher + Copyright (c) 2004 Ulf Schenk This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public @@ -21,6 +22,13 @@ Boston, MA 02111-1307, USA. */ +/* +Enhanced Version of the file for platform independent KDE tools. +Copyright (c) 2004 Ulf Schenk + +$Id$ +*/ + #ifndef KRESOURCES_MANAGER_H #define KRESOURCES_MANAGER_H @@ -48,7 +56,7 @@ class ManagerListener // to warn applications that resources have been added, // removed or modified. // -// The manager should also keep track of which (or at least +// The manager should also keep track of which (or at least // how many) applications hve opened a resource, so that it // is only closed if none of them is using it any more @@ -71,7 +79,7 @@ class Manager : private ManagerImplListener bool operator==( const Iterator &it ) { return mIt == it.mIt; } bool operator!=( const Iterator &it ) { return mIt != it.mIt; } - private: + private: Resource::List::Iterator mIt; }; @@ -81,7 +89,7 @@ class Manager : private ManagerImplListener it.mIt = mImpl->resourceList()->begin(); return it; } - + Iterator end() { Iterator it; @@ -159,19 +167,24 @@ class Manager : private ManagerImplListener bool isEmpty() const { return mImpl->resourceList()->isEmpty(); } - Manager( const QString &family ) + /** + Return true, if the manager manages syncable resources. + */ + bool manageSyncable() { return mImpl->manageSyncable(); } + + Manager( const QString &family, bool syncable ) { mFactory = Factory::self( family ); // The managerimpl will use the same Factory object as the manager // because of the Factory::self() pattern - mImpl = new ManagerImpl( family ); + mImpl = new ManagerImpl( family, syncable ); mImpl->setListener( this ); - + mListeners = new QPtrList >; } virtual ~Manager() - { + { mImpl->setListener( 0 ); delete mListeners; delete mImpl; @@ -239,18 +252,19 @@ class Manager : private ManagerImplListener } /** - Creates a new resource of type @param type, with default - settings. The resource is + Creates a new resource of type @param type, with default + settings. The resource is not added to the manager, the application has to do that. Returns a pointer to a resource object or a null pointer if resource type doesn't exist. - - @param type The type of the resource, one of those returned + + @param type The type of the resource, one of those returned by @ref resourceTypeNames() + * @param syncable If the resource should support syncing capabilities. */ T *createResource( const QString& type ) { - return (T *)( mFactory->resource( type, 0 ) ); + return (T *)( mFactory->resource( type, 0, mImpl->manageSyncable() ) ); } /** @@ -278,8 +292,8 @@ class Manager : private ManagerImplListener } void resourceChanged( T *resource ) - { - mImpl->resourceChanged( resource ); + { + mImpl->resourceChanged( resource ); } void addListener( ManagerListener *listener ) @@ -309,7 +323,7 @@ class Manager : private ManagerImplListener for ( listener = mListeners->first(); listener; listener = mListeners->next() ) listener->resourceModified( resource ); } - + virtual void resourceDeleted( Resource *res ) { kdDebug(5650) << "Manager::resourceDeleted " << res->resourceName() << endl; -- cgit v0.9.0.2