author | ulf69 <ulf69> | 2004-08-02 18:12:49 (UTC) |
---|---|---|
committer | ulf69 <ulf69> | 2004-08-02 18:12:49 (UTC) |
commit | b4203356adb6008a4b4e6782afdae7dd34178697 (patch) (side-by-side diff) | |
tree | 13ec830c5748106467c2d610d65db5d1a2cf9263 /microkde/kresources/managerimpl.cpp | |
parent | 09e8e7e5d4c3cafcf2b05511e5c78717fb5380e7 (diff) | |
download | kdepimpi-b4203356adb6008a4b4e6782afdae7dd34178697.zip kdepimpi-b4203356adb6008a4b4e6782afdae7dd34178697.tar.gz kdepimpi-b4203356adb6008a4b4e6782afdae7dd34178697.tar.bz2 |
added support for syncing of resources
Diffstat (limited to 'microkde/kresources/managerimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | microkde/kresources/managerimpl.cpp | 70 |
1 files changed, 43 insertions, 27 deletions
diff --git a/microkde/kresources/managerimpl.cpp b/microkde/kresources/managerimpl.cpp index 785b6b4..3655f50 100644 --- a/microkde/kresources/managerimpl.cpp +++ b/microkde/kresources/managerimpl.cpp @@ -1,5 +1,5 @@ /* This file is part of libkresources. - + Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> Copyright (c) 2002 Jan-Pascal van Best <janpascal@vanbest.org> @@ -22,4 +22,11 @@ */ +/* +Enhanced Version of the file for platform independent KDE tools. +Copyright (c) 2004 Ulf Schenk + +$Id$ +*/ + #include <kglobal.h> @@ -35,12 +42,12 @@ using namespace KRES; -ManagerImpl::ManagerImpl( const QString &family ) - : mFamily( family ), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ), +ManagerImpl::ManagerImpl( const QString &family, bool syncable ) + : mFamily( family ), mSyncable(syncable), mConfig( 0 ), mStdConfig( 0 ), mStandard( 0 ), mFactory( 0 ) { kdDebug(5650) << "ManagerImpl::ManagerImpl()" << endl; - - + + } @@ -53,5 +60,5 @@ ManagerImpl::~ManagerImpl() delete *it; } - + delete mStdConfig; } @@ -60,9 +67,9 @@ void ManagerImpl::createStandardConfig() { if ( !mStdConfig ) { - QString file = locateLocal( "data", KGlobal::getAppName() + QString file = locateLocal( "data", KGlobal::getAppName() + "/kresources/" + mFamily + "rc" ); mStdConfig = new KConfig( file ); } - + mConfig = mStdConfig; } @@ -80,5 +87,5 @@ void ManagerImpl::readConfig( KConfig *cfg ) mConfig = cfg; } - + mStandard = 0; @@ -93,12 +100,12 @@ void ManagerImpl::readConfig( KConfig *cfg ) readResourceConfig( *it, false ); } - + } void ManagerImpl::writeConfig( KConfig *cfg ) { -//USqDebug("ManagerImpl::writeConfig begin this= %ul cfg=%ul", this, cfg); - - +//USqDebug("ManagerImpl::writeConfig begin this= %ul cfg=%ul", this, cfg); + + kdDebug(5650) << "ManagerImpl::writeConfig()" << endl; @@ -108,5 +115,5 @@ void ManagerImpl::writeConfig( KConfig *cfg ) mConfig = cfg; } - + QStringList activeKeys; QStringList passiveKeys; @@ -130,5 +137,5 @@ void ManagerImpl::writeConfig( KConfig *cfg ) mConfig->writeEntry( "ResourceKeys", activeKeys ); mConfig->writeEntry( "PassiveResourceKeys", passiveKeys ); - if ( mStandard ) + if ( mStandard ) mConfig->writeEntry( "Standard", mStandard->identifier() ); else @@ -137,13 +144,13 @@ void ManagerImpl::writeConfig( KConfig *cfg ) mConfig->sync(); kdDebug(5650) << "ManagerImpl::save() finished" << endl; - -//US qDebug("ManagerImpl::writeConfig end this= %ul cfg=%ul", this, cfg); - + +//US qDebug("ManagerImpl::writeConfig end this= %ul cfg=%ul", this, cfg); + } void ManagerImpl::add( Resource *resource, bool useDCOP ) { -qDebug("ManagerImpl::add begin this= %ul resource=%ul", this, resource); - +qDebug("ManagerImpl::add begin this= %ul resource=%ul", this, resource); + resource->setActive( true ); @@ -156,5 +163,5 @@ qDebug("ManagerImpl::add begin this= %ul resource=%ul", this, resource); writeResourceConfig( resource, true ); - qDebug("ManagerImpl::add end this= %ul resource=%ul", this, resource); + qDebug("ManagerImpl::add end this= %ul resource=%ul", this, resource); } @@ -179,10 +186,10 @@ void ManagerImpl::setActive( Resource *resource, bool active ) } -Resource *ManagerImpl::standardResource() +Resource *ManagerImpl::standardResource() { return mStandard; } -void ManagerImpl::setStandardResource( Resource *resource ) +void ManagerImpl::setStandardResource( Resource *resource ) { mStandard = resource; @@ -250,5 +257,5 @@ Resource* ManagerImpl::readResourceConfig( const QString& identifier, { kdDebug() << "ManagerImpl::readResourceConfig() " << identifier << endl; - + // qDebug("ManagerImpl::readResourceConfig() %s", identifier.latin1()); @@ -262,5 +269,5 @@ Resource* ManagerImpl::readResourceConfig( const QString& identifier, QString type = mConfig->readEntry( "ResourceType" ); QString name = mConfig->readEntry( "ResourceName" ); - Resource *resource = mFactory->resource( type, mConfig ); + Resource *resource = mFactory->resource( type, mConfig, mSyncable ); if ( !resource ) { qDebug("Failed to create resource with id %s ",identifier.latin1() ); @@ -306,5 +313,5 @@ void ManagerImpl::writeResourceConfig( Resource *resource, else if ( resource != mStandard && standardKey == key ) mConfig->writeEntry( "Standard", "" ); - + if ( checkActive ) { QStringList activeKeys = mConfig->readListEntry( "ResourceKeys" ); @@ -326,5 +333,5 @@ void ManagerImpl::removeResource( Resource *resource ) if ( !mConfig ) createStandardConfig(); - + mConfig->setGroup( "General" ); QStringList activeKeys = mConfig->readListEntry( "ResourceKeys" ); @@ -357,2 +364,11 @@ Resource* ManagerImpl::getResource( const QString& identifier ) return 0; } + +/** + Return true, if the manager manages syncable resources. +*/ +bool ManagerImpl::manageSyncable() const +{ + return mSyncable; +} + |