summaryrefslogtreecommitdiffabout
path: root/microkde/kresources/managerimpl.cpp
Side-by-side diff
Diffstat (limited to 'microkde/kresources/managerimpl.cpp') (more/less context) (show whitespace changes)
-rw-r--r--microkde/kresources/managerimpl.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/microkde/kresources/managerimpl.cpp b/microkde/kresources/managerimpl.cpp
index 1baa6be..785b6b4 100644
--- a/microkde/kresources/managerimpl.cpp
+++ b/microkde/kresources/managerimpl.cpp
@@ -208,102 +208,107 @@ QStringList ManagerImpl::resourceNames()
for ( it = mResources.begin(); it != mResources.end(); ++it ) {
result.append( (*it)->resourceName() );
}
return result;
}
Resource::List *ManagerImpl::resourceList()
{
return &mResources;
}
QPtrList<Resource> ManagerImpl::resources()
{
QPtrList<Resource> result;
Resource::List::ConstIterator it;
for ( it = mResources.begin(); it != mResources.end(); ++it ) {
result.append( *it );
}
return result;
}
QPtrList<Resource> ManagerImpl::resources( bool active )
{
QPtrList<Resource> result;
Resource::List::ConstIterator it;
for ( it = mResources.begin(); it != mResources.end(); ++it ) {
if ( (*it)->isActive() == active ) {
result.append( *it );
}
}
return result;
}
void ManagerImpl::setListener( ManagerImplListener *listener )
{
mListener = listener;
}
Resource* ManagerImpl::readResourceConfig( const QString& identifier,
bool checkActive )
{
kdDebug() << "ManagerImpl::readResourceConfig() " << identifier << endl;
// qDebug("ManagerImpl::readResourceConfig() %s", identifier.latin1());
mConfig->setGroup( "Resource_" + identifier );
-
+#ifdef _WIN32_
+ // we use plugins on win32. the group is stored in a static variable
+ // such that gourp info not avail on win32 plugins
+ // to fix that, it would be a looooot of work
+ mConfig->setTempGroup( "Resource_" + identifier );
+#endif
QString type = mConfig->readEntry( "ResourceType" );
QString name = mConfig->readEntry( "ResourceName" );
Resource *resource = mFactory->resource( type, mConfig );
if ( !resource ) {
- kdDebug(5650) << "Failed to create resource with id " << identifier << endl;
+ qDebug("Failed to create resource with id %s ",identifier.latin1() );
return 0;
}
if ( resource->identifier().isEmpty() )
resource->setIdentifier( identifier );
mConfig->setGroup( "General" );
QString standardKey = mConfig->readEntry( "Standard" );
if ( standardKey == identifier ) {
mStandard = resource;
}
if ( checkActive ) {
QStringList activeKeys = mConfig->readListEntry( "ResourceKeys" );
resource->setActive( activeKeys.contains( identifier ) );
}
mResources.append( resource );
return resource;
}
void ManagerImpl::writeResourceConfig( Resource *resource,
bool checkActive )
{
QString key = resource->identifier();
kdDebug(5650) << "Saving resource " << key << endl;
if ( !mConfig ) createStandardConfig();
mConfig->setGroup( "Resource_" + key );
resource->writeConfig( mConfig );
mConfig->setGroup( "General" );
QString standardKey = mConfig->readEntry( "Standard" );
if ( resource == mStandard && standardKey != key )
mConfig->writeEntry( "Standard", resource->identifier() );
else if ( resource != mStandard && standardKey == key )
mConfig->writeEntry( "Standard", "" );
if ( checkActive ) {
QStringList activeKeys = mConfig->readListEntry( "ResourceKeys" );
if ( resource->isActive() && !activeKeys.contains( key ) ) {
activeKeys.append( resource->identifier() );
mConfig->writeEntry( "ResourceKeys", activeKeys );
} else if ( !resource->isActive() && activeKeys.contains( key ) ) {