void PluginLoaderBase::doScan( const char * path ) { mPluginMap.clear(); const QStringList list = KGlobal::dirs()->findAllResources( "data", path, true, true ); for ( QStringList::const_iterator it = list.begin() ; it != list.end() ; ++it ) { KSimpleConfig config( *it, true ); if ( config.hasGroup( "Misc" ) && config.hasGroup( "Plugin" ) ) { config.setGroup( "Plugin" ); const QString type = config.readEntry( "Type" ).lower(); if ( type.isEmpty() ) { warning() << "missing or empty [Plugin]Type value in \"" << *it << "\" - skipping" << endl; continue; } const QString library = config.readEntry( "X-KDE-Library" ); if ( library.isEmpty() ) { warning() << "missing or empty [Plugin]X-KDE-Library value in \"" << *it << "\" - skipping" << endl; continue; } config.setGroup( "Misc" ); QString name = config.readEntry( "Name" ); if ( name.isEmpty() ) { warning() << "missing or empty [Misc]Name value in \"" << *it << "\" - inserting default name" << endl; name = i18n("Unnamed plugin"); } QString comment = config.readEntry( "Comment" ); if ( comment.isEmpty() ) { warning() << "missing or empty [Misc]Comment value in \"" << *it << "\" - inserting default name" << endl; comment = i18n("No description available"); } mPluginMap.insert( type, PluginMetaData( library, name, comment ) ); } else { warning() << "Desktop file \"" << *it << "\" doesn't seem to describe a plugin " << "(misses Misc and/or Plugin group)" << endl; } } }
void PluginLoaderBase::doScan( const char * path ) { mPluginMap.clear(); const QStringList list = KGlobal::dirs()->findAllResources( "data", path, KStandardDirs::Recursive | KStandardDirs::NoDuplicates ); for ( QStringList::const_iterator it = list.constBegin(); it != list.constEnd(); ++it ) { KConfig config( *it, KConfig::SimpleConfig); if ( config.hasGroup( "Misc" ) && config.hasGroup( "Plugin" ) ) { KConfigGroup group( &config, "Plugin" ); const QString type = group.readEntry( "Type" ).toLower(); if ( type.isEmpty() ) { kWarning( 5300 ) << "missing or empty [Plugin]Type value in \"" << *it << "\" - skipping" << endl; continue; } const QString library = group.readEntry( "X-KDE-Library" ); if ( library.isEmpty() ) { kWarning( 5300 ) << "missing or empty [Plugin]X-KDE-Library value in \"" << *it << "\" - skipping" << endl; continue; } KConfigGroup group2( &config, "Misc" ); QString name = group2.readEntry( "Name" ); if ( name.isEmpty() ) { kWarning( 5300 ) << "missing or empty [Misc]Name value in \"" << *it << "\" - inserting default name" << endl; name = i18n("Unnamed plugin"); } QString comment = group2.readEntry( "Comment" ); if ( comment.isEmpty() ) { kWarning( 5300 ) << "missing or empty [Misc]Comment value in \"" << *it << "\" - inserting default name" << endl; comment = i18n("No description available"); } mPluginMap.insert( type, PluginMetaData( library, name, comment ) ); } else { kWarning( 5300 ) << "Desktop file \"" << *it << "\" doesn't seem to describe a plugin " << "(misses Misc and/or Plugin group)" << endl; } } }