Qt API | Qtopia API | Qtopia Documentation |

# PluginLoader Class Reference

The PluginLoader class simplifies plugin loading and allows plugins to be enabled/disabled. More...

`#include <qtopia/pluginloader.h>`

List of all member functions.

## Public Members

- PluginLoader ( const QString & type )
- ~PluginLoader ()
- void clear ()
- const QStringList & list () const
- const QStringList & disabledList () const
- QRESULT queryInterface ( const QString & name, const QUuid & id, QUnknownInterface ** iface )
- void releaseInterface ( QUnknownInterface * iface )
- void setEnabled ( const QString & name, bool enabled = TRUE )
- bool isEnabled ( const QString & name ) const

## Static Public Members

- bool inSafeMode ()

## Detailed Description

The PluginLoader class simplifies plugin loading and allows plugins to be enabled/disabled.

PluginLoader simplifies loading plugins. The most common use is to iterate over the list of plugins and load each one:

        PluginLoader loader( "Effects" );
        QStringList list = pluginLoader.list();
        QStringList::Iterator it;
        QValueList<EffectsInterface*> effectList;
        for ( it = list.begin(); it != list.end(); ++it ) {
            EffectsInterface *iface = 0;
            if ( pluginLoader.queryInterface( *it, IID_Effects, (QUnknownInterface**)&iface ) == QS_OK && iface ) {
                effectList.append( iface );
            }
        }

See also Qtopia Classes.

## Member Function Documentation

### PluginLoader::PluginLoader ( const QString & type )

Creates a PluginLoader for plugins of type type.

The plugins must be installed in the $QPEDIR/plugins/type directory.

### PluginLoader::~PluginLoader ()

Destroys the PluginLoader. Note that this does not release any interfaces.

### void PluginLoader::clear ()

Releases all interfaces.

### const QStringList & PluginLoader::disabledList () const

Returns the list of plugins that have been disabled.

### bool PluginLoader::inSafeMode ()`[static]`

Returns TRUE if Qtopia is currently in Safe Mode. In Safe Mode list() will return an empty list and no plugins should be loaded. This is to allow misbehaving plugins to be disbled.

### bool PluginLoader::isEnabled ( const QString & name ) const

Returns TRUE is the plugin name is enabled.

### const QStringList & PluginLoader::list () const

Returns the list of plugins that are available.

### QRESULT PluginLoader::queryInterface ( const QString & name, const QUuid & id, QUnknownInterface ** iface )

Query the plugin for the interface specified by id in plugin name. If the interface is available, iface will contain the pointer to it.

Returns QS_OK if the interface was found or QS_FALSE otherwise.

### void PluginLoader::releaseInterface ( QUnknownInterface * iface )

Releases the interface iface. The interface must have previously been returned by queryInterface.

### void PluginLoader::setEnabled ( const QString & name, bool enabled = TRUE )

Enables or disables plugin name depending on the value of enabled. A disabled plugin can still be queried, but it will not be returned by list().

This file is part of the Qtopia , copyright © 1995-2002 Trolltech, all rights reserved.