[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/3.4/kdenetwork/kopete/libkopete
From:       Will Stephenson <lists () stevello ! free-online ! co ! uk>
Date:       2005-08-18 14:52:31
Message-ID: 1124376751.645383.21216.nullmailer () svn ! kde ! org
[Download RAW message or body]

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<QString, QString> entries = config->entryMap( QString::fromLatin1( "Plugins" ) );
-	QMap<QString, QString>::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<QString, QString> entries = config->entryMap( QString::fromLatin1( "Plugins" ) );
+		QMap<QString, QString>::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<KPluginInfo *> plugins = availablePlugins( QString::null );
+		QValueList<KPluginInfo *>::ConstIterator it = plugins.begin();
+		QValueList<KPluginInfo *>::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() ) );
 }
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic