本文整理汇总了C++中ksharedconfig::Ptr::entryMap方法的典型用法代码示例。如果您正苦于以下问题:C++ Ptr::entryMap方法的具体用法?C++ Ptr::entryMap怎么用?C++ Ptr::entryMap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ksharedconfig::Ptr
的用法示例。
在下文中一共展示了Ptr::entryMap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadAllPlugins
void PluginManager::loadAllPlugins()
{
kDebug();
KSharedConfig::Ptr config = KGlobal::config();
if ( config->hasGroup( QLatin1String( "Plugins" ) ) )
{
QMap<QString, bool> pluginsMap;
QMap<QString, QString> entries = config->entryMap( QLatin1String( "Plugins" ) );
QMap<QString, QString>::Iterator it;
for ( it = entries.begin(); it != entries.end(); ++it )
{
QString key = it.key();
if ( key.endsWith( QLatin1String( "Enabled" ) ) )
pluginsMap.insert( key.left(key.length() - 7), (it.value() == QLatin1String( "true" )) );
}
QList<KPluginInfo> plugins = availablePlugins( QString::null ); //krazy:exclude=nullstrassign for old broken gcc
QList<KPluginInfo>::ConstIterator it2 = plugins.constBegin();
QList<KPluginInfo>::ConstIterator end = plugins.constEnd();
for ( ; it2 != end; ++it2 )
{
if ( it2->category() == QLatin1String( "MicroBlogs" ) ||
it2->category() == QLatin1String( "Shorteners" ) )
continue;
QString pluginName = it2->pluginName();
if ( pluginsMap.value( pluginName, it2->isPluginEnabledByDefault() ) )
{
if ( !plugin( pluginName ) )
_kpmp->pluginsToLoad.push( pluginName );
}
else
{
//This happens if the user unloaded plugins with the config plugin page.
// No real need to be assync because the user usually unload few plugins
// compared tto the number of plugin to load in a cold start. - Olivier
if ( plugin( pluginName ) )
unloadPlugin( pluginName );
}
}
}
else
{
// we had no config, so we load any plugins that should be loaded by default.
QList<KPluginInfo> plugins = availablePlugins( QString::null ); //krazy:exclude=nullstrassign for old broken gcc
QList<KPluginInfo>::ConstIterator it = plugins.constBegin();
QList<KPluginInfo>::ConstIterator end = plugins.constEnd();
for ( ; it != end; ++it )
{
if ( it->category() == QLatin1String( "MicroBlogs" ) ||
it->category() == QLatin1String( "Shorteners" ) )
continue;
if ( it->isPluginEnabledByDefault() )
_kpmp->pluginsToLoad.push( it->pluginName() );
}
}
// Schedule the plugins to load
QTimer::singleShot( 0, this, SLOT( slotLoadNextPlugin() ) );
}