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 @@ -2,3 +2,3 @@ This file is part of libkresources. - + Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> @@ -23,2 +23,9 @@ +/* +Enhanced Version of the file for platform independent KDE tools. +Copyright (c) 2004 Ulf Schenk + +$Id$ +*/ + #include <kglobal.h> @@ -36,4 +43,4 @@ 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 ) @@ -42,4 +49,4 @@ ManagerImpl::ManagerImpl( const QString &family ) kdDebug(5650) << "ManagerImpl::ManagerImpl()" << endl; - - + + } @@ -54,3 +61,3 @@ ManagerImpl::~ManagerImpl() } - + delete mStdConfig; @@ -61,3 +68,3 @@ void ManagerImpl::createStandardConfig() if ( !mStdConfig ) { - QString file = locateLocal( "data", KGlobal::getAppName() + QString file = locateLocal( "data", KGlobal::getAppName() + "/kresources/" + mFamily + "rc" ); @@ -65,3 +72,3 @@ void ManagerImpl::createStandardConfig() } - + mConfig = mStdConfig; @@ -81,3 +88,3 @@ void ManagerImpl::readConfig( KConfig *cfg ) } - + mStandard = 0; @@ -94,3 +101,3 @@ void ManagerImpl::readConfig( KConfig *cfg ) } - + } @@ -99,5 +106,5 @@ 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; @@ -109,3 +116,3 @@ void ManagerImpl::writeConfig( KConfig *cfg ) } - + QStringList activeKeys; @@ -131,3 +138,3 @@ void ManagerImpl::writeConfig( KConfig *cfg ) mConfig->writeEntry( "PassiveResourceKeys", passiveKeys ); - if ( mStandard ) + if ( mStandard ) mConfig->writeEntry( "Standard", mStandard->identifier() ); @@ -138,5 +145,5 @@ void ManagerImpl::writeConfig( KConfig *cfg ) 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); + } @@ -145,4 +152,4 @@ 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 ); @@ -157,3 +164,3 @@ qDebug("ManagerImpl::add begin this= %ul resource=%ul", this, resource); - qDebug("ManagerImpl::add end this= %ul resource=%ul", this, resource); + qDebug("ManagerImpl::add end this= %ul resource=%ul", this, resource); @@ -180,3 +187,3 @@ void ManagerImpl::setActive( Resource *resource, bool active ) -Resource *ManagerImpl::standardResource() +Resource *ManagerImpl::standardResource() { @@ -185,3 +192,3 @@ Resource *ManagerImpl::standardResource() -void ManagerImpl::setStandardResource( Resource *resource ) +void ManagerImpl::setStandardResource( Resource *resource ) { @@ -251,3 +258,3 @@ Resource* ManagerImpl::readResourceConfig( const QString& identifier, kdDebug() << "ManagerImpl::readResourceConfig() " << identifier << endl; - + // qDebug("ManagerImpl::readResourceConfig() %s", identifier.latin1()); @@ -263,3 +270,3 @@ Resource* ManagerImpl::readResourceConfig( const QString& identifier, QString name = mConfig->readEntry( "ResourceName" ); - Resource *resource = mFactory->resource( type, mConfig ); + Resource *resource = mFactory->resource( type, mConfig, mSyncable ); if ( !resource ) { @@ -307,3 +314,3 @@ void ManagerImpl::writeResourceConfig( Resource *resource, mConfig->writeEntry( "Standard", "" ); - + if ( checkActive ) { @@ -327,3 +334,3 @@ void ManagerImpl::removeResource( Resource *resource ) if ( !mConfig ) createStandardConfig(); - + mConfig->setGroup( "General" ); @@ -358 +365,10 @@ Resource* ManagerImpl::getResource( const QString& identifier ) } + +/** + Return true, if the manager manages syncable resources. +*/ +bool ManagerImpl::manageSyncable() const +{ + return mSyncable; +} + |