• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegraphics API Reference
  • KDE Home
  • Contact Us
 

libs/libkipi/libkipi

  • KIPI
  • PluginLoader
Classes | Public Types | Signals | Public Member Functions | Static Public Member Functions | List of all members
KIPI::PluginLoader Class Reference

#include <pluginloader.h>

Inheritance diagram for KIPI::PluginLoader:
Inheritance graph
[legend]

Classes

class  Info
 

Public Types

typedef QList< Info * > PluginList
 

Signals

void plug (KIPI::PluginLoader::Info *)
 
void replug ()
 
void unplug (KIPI::PluginLoader::Info *)
 

Public Member Functions

 PluginLoader ()
 
 PluginLoader (KXmlGuiWindow *const parent)
 
virtual ~PluginLoader ()
 
ConfigWidget * configWidget (QWidget *const parent) const
 
QStringList disabledPluginActions () const
 
void init ()
 
Interface * interface () const
 
QString kipiPluginsVersion () const
 
void loadPlugins ()
 
const PluginList & pluginList ()
 
void setDisabledPluginActions (const QStringList &disabledActions)
 
void setIgnoredPluginsList (const QStringList &ignores)
 
void setInterface (Interface *const interface)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObject * child (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
T findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThread * thread () const
 

Static Public Member Functions

static PluginLoader * instance ()
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Additional Inherited Members

- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Author
Gilles Caulier
Maintainer: Victor Dodon

This is the class that will help host applications to load plugins.

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 KDE XMLGUI, the easiest(nicest) way to get the plugins inserted into the menus is by adding an item in your application XML ui.rc file looking like this:

<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<gui version="1" name="MyKipiApplication" >
<MenuBar>
<Menu name="Image" ><text>&amp;Image</text>
<DefineGroup name="kipi_image_group" append="kipi_image_group" />
</Menu>
<Menu name="Tools"><text>&amp;Tools</text>
<DefineGroup name="kipi_album_group" append="kipi_album_group" />
<Separator/>
<DefineGroup name="kipi_tool_group" append="kipi_tool_group" />
<Separator/>
<DefineGroup name="kipi_batch_group" append="kipi_batch_group" />
</Menu>
<Merge/>
</MenuBar>
<ToolBar name="mainToolBar">
<text>Main Toolbar</text>
</Toolbar>
<ActionProperties/>
</gui>

Then loading plugins into menus could be done with code similar to this implementation:

class MyKipiApplication : public KXmlGuiWindow
{
Q_OBJECT
public:
MyKipiApplication();
private Q_SLOTS:
void slotKipiPluginPlug();
private:
KIPI::Interface* m_iface;
KIPI::PluginLoader* m_loader;
};
// -------------------------------------------------------------------------------
MyKipiApplication::MyKipiApplication() : KXmlGuiWindow(0)
{
m_iface = new KIPI::Interface(this, "MyKipiApplication_KIPI_interface");
m_loader = new KIPI::PluginLoader(this);
m_loader->setInterface(m_iface);
m_loader->init();
connect(m_loader, SIGNAL(replug()),
this, SLOT(slotKipiPluginPlug()));
m_loader->loadPlugins();
}
void MyKipiApplication::slotKipiPluginPlug()
{
QList<QAction*> kipiImageActions, kipiExportActions, kipiToolsActions;
PluginLoader::PluginList list = m_loader->pluginList();
// We need to remove loaded plugins from the gui factory
for (PluginLoader::PluginList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it )
{
Plugin* plugin = (*it)->plugin();
if ( !plugin || !(*it)->shouldLoad() )
continue;
guiFactory()->removeClient(plugin);
}
for (PluginLoader::PluginList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it )
{
Plugin* plugin = (*it)->plugin();
if ( !plugin || !(*it)->shouldLoad() )
continue;
plugin->setup(this);
}
// We add plugins to the factory
for (PluginLoader::PluginList::ConstIterator it = list.constBegin(); it != list.constEnd(); ++it )
{
Plugin* plugin = (*it)->plugin();
if ( !plugin || !(*it)->shouldLoad() )
continue;
guiFactory()->addClient(plugin);
}
}

For a complete implementation used to manage Kipi-plugins in digiKam, look into this class, or you can look the code of the kxmlkipicmd test application in the "test" folder from libkipi.

To configure which plugins should be loaded, simply call PluginLoader::configWidget(), and insert the widget into your normal configuration dialog.

Definition at line 189 of file pluginloader.h.

Member Typedef Documentation

typedef QList<Info*> KIPI::PluginLoader::PluginList

Definition at line 224 of file pluginloader.h.

Constructor & Destructor Documentation

KIPI::PluginLoader::PluginLoader ( )

Use this constructor if your application does not use KDE XML GUI technology.

Definition at line 242 of file pluginloader.cpp.

KIPI::PluginLoader::PluginLoader ( KXmlGuiWindow *const  parent)

Standard constructor.

You must pass the instance of KDE XML GUI application as argument.

Parameters
parentthe pointer to the KXmlGuiWindow of your application

Definition at line 251 of file pluginloader.cpp.

KIPI::PluginLoader::~PluginLoader ( )
virtual

Standard destructor.

Definition at line 359 of file pluginloader.cpp.

Member Function Documentation

ConfigWidget * KIPI::PluginLoader::configWidget ( QWidget *const  parent) const

Return the config widget with list of plugins to manage.

Definition at line 389 of file pluginloader.cpp.

QStringList KIPI::PluginLoader::disabledPluginActions ( ) const

Return the list of disabled plugin actions.

Definition at line 283 of file pluginloader.cpp.

void KIPI::PluginLoader::init ( )

Init plugin loader.

Call this method to parse relevant plugins installed on your system. Before to call this method, you must setup KIPI insterface instance. Optionally, setup list of plugins to ignore, the constraint list, and the disabled plugin actions

Definition at line 288 of file pluginloader.cpp.

PluginLoader * KIPI::PluginLoader::instance ( )
static

Returns plugin loader instance.

Definition at line 374 of file pluginloader.cpp.

Interface * KIPI::PluginLoader::interface ( ) const

Return KIPI host interface instance.

Definition at line 384 of file pluginloader.cpp.

QString KIPI::PluginLoader::kipiPluginsVersion ( ) const

Return the kipi-plugins version installed on your computer if it's found through kipiplugins.desktop file.

Definition at line 394 of file pluginloader.cpp.

void KIPI::PluginLoader::loadPlugins ( )

Call this method to load relevant plugins installed on your system to your KIPI host application NOTE: plugins can be loaded through Info item.

Definition at line 364 of file pluginloader.cpp.

void KIPI::PluginLoader::plug ( KIPI::PluginLoader::Info *  )
signal
const PluginLoader::PluginList & KIPI::PluginLoader::pluginList ( )

Returns the list of loaded plugins.

Definition at line 369 of file pluginloader.cpp.

void KIPI::PluginLoader::replug ( )
signal
void KIPI::PluginLoader::setDisabledPluginActions ( const QStringList &  disabledActions)

Set disabled plugin actions that will not be plugged into the gui,.

Definition at line 278 of file pluginloader.cpp.

void KIPI::PluginLoader::setIgnoredPluginsList ( const QStringList &  ignores)

Set Plugins ignore list, with name of obsoletes plugins to not load through init().

Definition at line 273 of file pluginloader.cpp.

void KIPI::PluginLoader::setInterface ( Interface *const  interface)

Set KIPI interface instance from host application.

Definition at line 267 of file pluginloader.cpp.

void KIPI::PluginLoader::unplug ( KIPI::PluginLoader::Info *  )
signal

The documentation for this class was generated from the following files:
  • pluginloader.h
  • pluginloader.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:19:43 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

libs/libkipi/libkipi

Skip menu "libs/libkipi/libkipi"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdegraphics API Reference

Skip menu "kdegraphics API Reference"
  •     libkdcraw
  •     libkexiv2
  •     libkipi
  •     libksane
  • okular

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal