summaryrefslogtreecommitdiff
authorzecke <zecke>2004-05-29 18:43:13 (UTC)
committer zecke <zecke>2004-05-29 18:43:13 (UTC)
commit43c1ce80bc5faf16fe9d86c4685512659f5180bc (patch) (unidiff)
treeebd64b019954d702a39bad96d3324bbe79d7f9b6
parentf568ff9c68bdc61cbc4482f9b2c6e1096cecaae0 (diff)
downloadopie-43c1ce80bc5faf16fe9d86c4685512659f5180bc.zip
opie-43c1ce80bc5faf16fe9d86c4685512659f5180bc.tar.gz
opie-43c1ce80bc5faf16fe9d86c4685512659f5180bc.tar.bz2
Make Enabled/Disabled work.
Problem was /home/ich/foo//plugins/foo where /home/ich/foo/ was OPIEDIR and we added /
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/opluginloader.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/libopie2/opiecore/opluginloader.cpp b/libopie2/opiecore/opluginloader.cpp
index 3d286e5..e7eddc2 100644
--- a/libopie2/opiecore/opluginloader.cpp
+++ b/libopie2/opiecore/opluginloader.cpp
@@ -260,49 +260,49 @@ void OPluginItem::setPosition( int pos ) {
260 * Opie::Core::OPluginItem::List lst = loader.filtered(); 260 * Opie::Core::OPluginItem::List lst = loader.filtered();
261 * for(Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it!=lst.end();++it){ 261 * for(Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it!=lst.end();++it){
262 * MyIface* iface = static_cast<MyIface*>(loader.load(*it,IID_MyIface)); 262 * MyIface* iface = static_cast<MyIface*>(loader.load(*it,IID_MyIface));
263 * } 263 * }
264 * \endcode 264 * \endcode
265 * 265 *
266 * \code 266 * \code
267 * Opie::Core::OGenericPluginLoader loader("myapp-plugin"); 267 * Opie::Core::OGenericPluginLoader loader("myapp-plugin");
268 * Opie::Core::OPluginItem::List lst = loader.filtered(); 268 * Opie::Core::OPluginItem::List lst = loader.filtered();
269 * for(Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it!=lst.end();++it){ 269 * for(Opie::Core::OPluginItem::List::Iterator it = lst.begin(); it!=lst.end();++it){
270 * MyIface* iface = static_cast<MyIface*>(loader.load(*it,IID_MyIface)); 270 * MyIface* iface = static_cast<MyIface*>(loader.load(*it,IID_MyIface));
271 * } 271 * }
272 * ... 272 * ...
273 * loader.clear(); 273 * loader.clear();
274 * 274 *
275 * \endcode 275 * \endcode
276 * 276 *
277 * @param name The name of the plugin directory. 277 * @param name The name of the plugin directory.
278 * @param isSorted Tell the PluginLoader if your Plugins are sorted 278 * @param isSorted Tell the PluginLoader if your Plugins are sorted
279 */ 279 */
280OGenericPluginLoader::OGenericPluginLoader( const QString& name, bool isSorted) 280OGenericPluginLoader::OGenericPluginLoader( const QString& name, bool isSorted)
281 : m_dir( name ), m_autoDelete( false ), m_isSafeMode( false ), 281 : m_dir( name ), m_autoDelete( false ), m_isSafeMode( false ),
282 m_isSorted( isSorted ) 282 m_isSorted( isSorted )
283{ 283{
284 setPluginDir( QPEApplication::qpeDir() + "/plugins/"+name ); 284 setPluginDir( QPEApplication::qpeDir() + "plugins/"+name );
285 readConfig(); 285 readConfig();
286} 286}
287 287
288 288
289/** 289/**
290 * \brief simple d'tor that cleans up depending on autoDelete 290 * \brief simple d'tor that cleans up depending on autoDelete
291 * 291 *
292 * calls clear if autoDelete is true. This will release all interfaces 292 * calls clear if autoDelete is true. This will release all interfaces
293 * and remove the library from this process if the refcount falls to zero 293 * and remove the library from this process if the refcount falls to zero
294 */ 294 */
295OGenericPluginLoader::~OGenericPluginLoader() { 295OGenericPluginLoader::~OGenericPluginLoader() {
296 if ( m_autoDelete ) 296 if ( m_autoDelete )
297 clear(); 297 clear();
298} 298}
299 299
300/** 300/**
301 * \brief Enable or disable autoDelete on destruction 301 * \brief Enable or disable autoDelete on destruction
302 * 302 *
303 * enable autoDelete. This will call clear on the d'tor 303 * enable autoDelete. This will call clear on the d'tor
304 * 304 *
305 * @see ~OGenericPluginLoader 305 * @see ~OGenericPluginLoader
306 * @see clear() 306 * @see clear()
307 */ 307 */
308void OGenericPluginLoader::setAutoDelete( bool t ) { 308void OGenericPluginLoader::setAutoDelete( bool t ) {
@@ -512,48 +512,49 @@ QString OGenericPluginLoader::unlibify( const QString& str ) {
512#else 512#else
513 return st.left( st.findRev( ".so" ) ); 513 return st.left( st.findRev( ".so" ) );
514#endif 514#endif
515} 515}
516 516
517/** 517/**
518 * @internal 518 * @internal
519 * 519 *
520 * \brief method to return available plugins. Internal and for reeimplementations 520 * \brief method to return available plugins. Internal and for reeimplementations
521 * 521 *
522 *Return a List of Plugins for a dir and add positions and remove disabled. 522 *Return a List of Plugins for a dir and add positions and remove disabled.
523 * If a plugin is on the excluded list assign position -2 523 * If a plugin is on the excluded list assign position -2
524 * 524 *
525 * @param dir The dir to look in 525 * @param dir The dir to look in
526 * @param sorted Should positions be read? 526 * @param sorted Should positions be read?
527 * @param disabled Remove excluded from the list 527 * @param disabled Remove excluded from the list
528 */ 528 */
529OPluginItem::List OGenericPluginLoader::plugins( const QString& _dir, bool sorted, bool disabled )const { 529OPluginItem::List OGenericPluginLoader::plugins( const QString& _dir, bool sorted, bool disabled )const {
530#ifdef Q_OS_MACX 530#ifdef Q_OS_MACX
531 QDir dir( _dir, "lib*.dylib" ); 531 QDir dir( _dir, "lib*.dylib" );
532#else 532#else
533 QDir dir( _dir, "lib*.so" ); 533 QDir dir( _dir, "lib*.so" );
534#endif 534#endif
535 535
536
536 OPluginItem::List lst; 537 OPluginItem::List lst;
537 538
538 /* 539 /*
539 * get excluded list and then iterate over them 540 * get excluded list and then iterate over them
540 * Excluded list contains the name 541 * Excluded list contains the name
541 * Position is a list with 'name.pos.name.pos.name.pos' 542 * Position is a list with 'name.pos.name.pos.name.pos'
542 * 543 *
543 * For the look up we will create two QMap<QString,pos> 544 * For the look up we will create two QMap<QString,pos>
544 */ 545 */
545 QMap<QString, int> positionMap; 546 QMap<QString, int> positionMap;
546 QMap<QString, int> excludedMap; 547 QMap<QString, int> excludedMap;
547 548
548 549
549 OConfig cfg( m_dir+"-odpplugins" ); 550 OConfig cfg( m_dir+"-odpplugins" );
550 cfg.setGroup( _dir ); 551 cfg.setGroup( _dir );
551 552
552 553
553 QStringList excludes = cfg.readListEntry( "Excluded", ',' ); 554 QStringList excludes = cfg.readListEntry( "Excluded", ',' );
554 for ( QStringList::Iterator it = excludes.begin(); it != excludes.end(); ++it ) 555 for ( QStringList::Iterator it = excludes.begin(); it != excludes.end(); ++it )
555 excludedMap.insert( *it, -2 ); 556 excludedMap.insert( *it, -2 );
556 557
557 if ( m_isSorted ) { 558 if ( m_isSorted ) {
558 QStringList pos = cfg.readListEntry( "Positions", '.' ); 559 QStringList pos = cfg.readListEntry( "Positions", '.' );
559 QStringList::Iterator it = pos.begin(); 560 QStringList::Iterator it = pos.begin();