kparts Library API Documentation

KParts::Plugin Class Reference

A plugin is the way to add actions to an existing KParts application, or to a Part. More...

#include <plugin.h>

Inheritance diagram for KParts::Plugin:

QObject KXMLGUIClient List of all members.

Public Methods

 Plugin (QObject *parent=0, const char *name=0)
 Construct a new KParts plugin.

virtual ~Plugin ()
 Destructor.

virtual QString xmlFile () const
 Reimplemented for internal reasons.

virtual QString localXMLFile () const
 Reimplemented for internal reasons.


Static Public Methods

void loadPlugins (QObject *parent, const KInstance *instance)
 Load the plugin libraries from the directories appropriate to instance and make the Plugin objects children of parent.

void loadPlugins (QObject *parent, const QValueList< PluginInfo > &pluginInfos)
 Load the plugin libraries specified by the list docs and make the Plugin objects children of parent .

void loadPlugins (QObject *parent, const QValueList< PluginInfo > &pluginInfos, const KInstance *instance)
 Load the plugin libraries specified by the list pluginInfos, make the Plugin objects children of parent, and use the given instance.

void loadPlugins (QObject *parent, KXMLGUIClient *parentGUIClient, KInstance *instance, bool enableNewPluginsByDefault=true)
 Load the plugin libraries for the given instance, make the Plugin objects children of parent, and insert the plugin as a child GUI client of parentGUIClient.

QPtrList< Plugin > pluginObjects (QObject *parent)
 Returns a list of plugin objects loaded for parent.


Protected Methods

virtual void setInstance (KInstance *instance)

Static Protected Methods

QValueList< Plugin::PluginInfo > pluginInfos (const KInstance *instance)
 Look for plugins in the instance's "data" directory (+"/kpartplugins").


Detailed Description

A plugin is the way to add actions to an existing KParts application, or to a Part.

The XML of those plugins looks exactly like of the shell or parts, with one small difference: The document tag should have an additional attribute, named "library", and contain the name of the library implementing the plugin.

If you want this plugin to be used by a part, you need to install the rc file under the directory "data" (KDEDIR/share/apps usually)+"/instancename/kpartplugins/" where instancename is the name of the part's instance.

Definition at line 46 of file plugin.h.


Constructor & Destructor Documentation

Plugin::Plugin QObject   parent = 0,
const char *    name = 0
 

Construct a new KParts plugin.

Definition at line 51 of file plugin.cpp.

Plugin::~Plugin   [virtual]
 

Destructor.

Definition at line 58 of file plugin.cpp.


Member Function Documentation

QString Plugin::xmlFile   [virtual]
 

Reimplemented for internal reasons.

Definition at line 63 of file plugin.cpp.

References QString::fromLatin1(), QString::isEmpty(), QString::length(), and KXMLGUIClient::xmlFile().

QString Plugin::localXMLFile   [virtual]
 

Reimplemented for internal reasons.

Definition at line 75 of file plugin.cpp.

References QString::fromLatin1(), QString::isEmpty(), QString::length(), and KXMLGUIClient::xmlFile().

void Plugin::loadPlugins QObject   parent,
const KInstance   instance
[static]
 

Load the plugin libraries from the directories appropriate to instance and make the Plugin objects children of parent.

It is recommended to use the last loadPlugins method instead, to support enabling and disabling of plugins.

Definition at line 134 of file plugin.cpp.

References KNotifyClient::instance(), and pluginInfos().

Referenced by loadPlugins().

void Plugin::loadPlugins QObject   parent,
const QValueList< PluginInfo > &    pluginInfos
[static]
 

Load the plugin libraries specified by the list docs and make the Plugin objects children of parent .

It is recommended to use the last loadPlugins method instead, to support enabling and disabling of plugins.

Definition at line 163 of file plugin.cpp.

References loadPlugins().

void Plugin::loadPlugins QObject   parent,
const QValueList< PluginInfo > &    pluginInfos,
const KInstance   instance
[static]
 

Load the plugin libraries specified by the list pluginInfos, make the Plugin objects children of parent, and use the given instance.

It is recommended to use the last loadPlugins method instead, to support enabling and disabling of plugins.

Definition at line 139 of file plugin.cpp.

References QValueList::begin(), QFile::encodeName(), QValueList::end(), KNotifyClient::instance(), and QString::isEmpty().

void Plugin::loadPlugins QObject   parent,
KXMLGUIClient   parentGUIClient,
KInstance   instance,
bool    enableNewPluginsByDefault = true
[static]
 

Load the plugin libraries for the given instance, make the Plugin objects children of parent, and insert the plugin as a child GUI client of parentGUIClient.

This method uses the KConfig object of the given instance, to find out which plugins are enabled and which are disabled. What happens by default (i.e. for new plugins that are not in that config file) is controlled by enableNewPluginsByDefault.

If a disabled plugin is already loaded it will be removed from the GUI factory and deleted.

This method is automatically called by KParts::Plugin and by KParts::MainWindow.

Definition at line 220 of file plugin.cpp.

References QDomElement::attribute(), QValueList::begin(), KInstance::config(), QFile::encodeName(), QValueList::end(), KXMLGUIClient::factory(), KXMLGUIClient::insertChildClient(), KNotifyClient::instance(), QString::isEmpty(), QObject::name(), pluginInfos(), QObject::queryList(), and KXMLGUIFactory::removeClient().

QPtrList< KParts::Plugin > Plugin::pluginObjects QObject   parent [static]
 

Returns a list of plugin objects loaded for parent.

This functions basically calls the queryList method of QObject to retrieve the list of child objects inheriting KParts::Plugin .

Definition at line 178 of file plugin.cpp.

References QPtrList::append(), and QObject::queryList().

QValueList< Plugin::PluginInfo > Plugin::pluginInfos const KInstance   instance [static, protected]
 

Look for plugins in the instance's "data" directory (+"/kpartplugins").

Returns:
A list of QDomDocument s, containing the parsed xml documents returned by plugins.

Definition at line 88 of file plugin.cpp.

References QValueList::append(), QMap::begin(), KInstance::dirs(), QMap::end(), QFileInfo::fileName(), QMap::find(), KStandardDirs::findAllResources(), QMap::insert(), KNotifyClient::instance(), and KInstance::instanceName().

Referenced by loadPlugins().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:46 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001