From kde-commits Thu Aug 18 14:52:31 2005 From: Will Stephenson Date: Thu, 18 Aug 2005 14:52:31 +0000 To: kde-commits Subject: branches/KDE/3.4/kdenetwork/kopete/libkopete Message-Id: <1124376751.645383.21216.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=112437677913103 SVN commit 450573 by wstephens: Reinstate fix for default plugins not loading. The check for missing config was incorrect, so that it never found any config and always loaded the default plugins. M +34 -20 kopetepluginmanager.cpp --- branches/KDE/3.4/kdenetwork/kopete/libkopete/kopetepluginmanager.cpp #450572:450573 @@ -257,32 +257,46 @@ // FIXME: We need session management here - Martijn KConfig *config = KGlobal::config(); - QMap entries = config->entryMap( QString::fromLatin1( "Plugins" ) ); - QMap::Iterator it; - for ( it = entries.begin(); it != entries.end(); ++it ) + if ( config->hasGroup( QString::fromLatin1( "Plugins" ) ) ) { - QString key = it.key(); - if ( key.endsWith( QString::fromLatin1( "Enabled" ) ) ) + QMap entries = config->entryMap( QString::fromLatin1( "Plugins" ) ); + QMap::Iterator it; + for ( it = entries.begin(); it != entries.end(); ++it ) { - key.setLength( key.length() - 7 ); - //kdDebug(14010) << k_funcinfo << "Set " << key << " to " << it.data() << endl; - - if ( it.data() == QString::fromLatin1( "true" ) ) + QString key = it.key(); + if ( key.endsWith( QString::fromLatin1( "Enabled" ) ) ) { - if ( !plugin( key ) ) - d->pluginsToLoad.push( key ); + key.setLength( key.length() - 7 ); + //kdDebug(14010) << k_funcinfo << "Set " << key << " to " << it.data() << endl; + + if ( it.data() == QString::fromLatin1( "true" ) ) + { + if ( !plugin( key ) ) + d->pluginsToLoad.push( key ); + } + else + { + //This happens if the user unloaded plugins with the config plugin page. + // No real need to be assync because the user usualy unload few plugins + // compared tto the number of plugin to load in a cold start. - Olivier + if ( plugin( key ) ) + unloadPlugin( key ); + } } - else - { - //This happens if the user unloaded plugins with the config plugin page. - // No real need to be assync because the user usualy unload few plugins - // compared tto the number of plugin to load in a cold start. - Olivier - if ( plugin( key ) ) - unloadPlugin( key ); - } } } - + else + { + // we had no config, so we load any plugins that should be loaded by default. + QValueList plugins = availablePlugins( QString::null ); + QValueList::ConstIterator it = plugins.begin(); + QValueList::ConstIterator end = plugins.end(); + for ( ; it != end; ++it ) + { + if ( (*it)->isPluginEnabledByDefault() ) + d->pluginsToLoad.push( (*it)->pluginName() ); + } + } // Schedule the plugins to load QTimer::singleShot( 0, this, SLOT( slotLoadNextPlugin() ) ); }