#include <pluginloader.h>
Collaboration diagram for KIPI::PluginLoader:

Public Types | |
| typedef QValueList< Info * > | PluginList |
Signals | |
| void | plug (KIPI::PluginLoader::Info *) |
| void | unplug (KIPI::PluginLoader::Info *) |
| void | replug () |
Public Member Functions | |
| PluginLoader (const QStringList &ignores, Interface *interface) | |
| virtual | ~PluginLoader () |
| void | loadPlugins () |
| ConfigWidget * | configWidget (QWidget *parent) |
| const PluginList & | pluginList () |
| void | loadPlugin (Info *) |
Static Public Member Functions | |
| static PluginLoader * | instance () |
Friends | |
| class | ConfigWidget |
| class | PluginCheckBox |
Classes | |
| class | Info |
| struct | Private |
The host application must create an instance of the plugin loader, and call the method loadPlugins() to get the plugins loaded. To ensure that plugins are correctly removed from menus and toolbars when loaded and unloaded after constructions, the application must connect to either the signals plug() / unplug() or the signal replug(). These signals are emitted when a plugin is to be inserted into the menus.
If your application is using XMLGUI, the easiest way to get the plugins inserted into the menus is by adding an item in the ui.rc file looking list this: <ActionList name="image_actions"/>
Then plugin plugins into menus could be done with code similiar to this from KimDaBa:
void slotReplug() { unplugActionList( QString::fromLatin1("file_actions") ); unplugActionList( QString::fromLatin1("image_actions") ); unplugActionList( QString::fromLatin1("tool_actions") ); QPtrList<KAction> fileActions; QPtrList<KAction> imageActions; QPtrList<KAction> toolsActions; KIPI::PluginLoader::PluginList list = _pluginLoader->pluginList(); for( KIPI::PluginLoader::PluginList::Iterator it = list.begin(); it != list.end(); ++it ) { KIPI::Plugin* plugin = (*it)->plugin; if ( !plugin || !(*it)->shouldLoad ) continue; plugin->setup( this ); QPtrList<KAction>* popup = 0; if ( plugin->category() == KIPI::IMAGESPLUGIN ) popup = &imageActions; else if ( plugin->category() == KIPI::EXPORTPLUGIN || plugin->category() == KIPI::IMPORTPLUGIN ) popup = &fileActions; else if ( plugin->category() == KIPI::TOOLSPLUGIN ) popup = &toolsActions; if ( popup ) { KActionPtrList actions = plugin->actions(); for( KActionPtrList::Iterator it = actions.begin(); it != actions.end(); ++it ) { popup->append( *it ); } } else { kdDebug() << "No menu found\n"; } plugin->actionCollection()->readShortcutSettings(); } // For this to work I need to pass false as second arg for createGUI plugActionList( QString::fromLatin1("file_actions"), fileActions ); plugActionList( QString::fromLatin1("image_actions"), imageActions ); plugActionList( QString::fromLatin1("tool_actions"), toolsActions ); }
To configure which plugins should be loaded, simply call PluginLoader::configWidget(), and insert the widget into your normal configuration dialog.
Definition at line 37 of file pluginloader.h.
| typedef QValueList<Info*> KIPI::PluginLoader::PluginList |
Definition at line 69 of file pluginloader.h.
| KIPI::PluginLoader::PluginLoader | ( | const QStringList & | ignores, | |
| Interface * | interface | |||
| ) |
Definition at line 198 of file pluginloader.cpp.
References endl(), KIPI::Interface::hasFeature(), KIPI::PluginLoader::Private::m_ignores, KIPI::PluginLoader::Private::m_interface, and KIPI::PluginLoader::Private::m_pluginList.
Here is the call graph for this function:

| KIPI::PluginLoader::~PluginLoader | ( | ) | [virtual] |
Definition at line 250 of file pluginloader.cpp.
| void KIPI::PluginLoader::loadPlugins | ( | ) |
Definition at line 255 of file pluginloader.cpp.
References loadPlugin(), KIPI::PluginLoader::Private::m_pluginList, and replug().
Here is the call graph for this function:

| PluginLoader * KIPI::PluginLoader::instance | ( | ) | [static] |
Definition at line 297 of file pluginloader.cpp.
Referenced by KIPI::ConfigWidget::apply(), KIPI::ConfigWidget::ConfigWidget(), and loadPlugin().
| ConfigWidget * KIPI::PluginLoader::configWidget | ( | QWidget * | parent | ) |
| const PluginLoader::PluginList & KIPI::PluginLoader::pluginList | ( | ) |
Definition at line 292 of file pluginloader.cpp.
References KIPI::PluginLoader::Private::m_pluginList.
| void KIPI::PluginLoader::loadPlugin | ( | Info * | ) |
Definition at line 263 of file pluginloader.cpp.
References endl(), instance(), KIPI::PluginLoader::Info::library(), KIPI::PluginLoader::Private::m_interface, KIPI::PluginLoader::Info::name(), plug(), KIPI::PluginLoader::Info::plugin(), KIPI::PluginLoader::Info::setPlugin(), and KIPI::PluginLoader::Info::shouldLoad().
Referenced by KIPI::ConfigWidget::apply(), and loadPlugins().
Here is the call graph for this function:

| void KIPI::PluginLoader::plug | ( | KIPI::PluginLoader::Info * | ) | [signal] |
Referenced by loadPlugin().
| void KIPI::PluginLoader::unplug | ( | KIPI::PluginLoader::Info * | ) | [signal] |
Referenced by KIPI::ConfigWidget::apply().
| void KIPI::PluginLoader::replug | ( | ) | [signal] |
Referenced by KIPI::ConfigWidget::apply(), and loadPlugins().
friend class ConfigWidget [friend] |
friend class PluginCheckBox [friend] |
Definition at line 82 of file pluginloader.h.
1.5.0