• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KParts

KParts::Plugin

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:

Inheritance graph
[legend]

List of all members.


Classes

struct  PluginInfo
 Struct holding information about a plugin. More...

Public Member Functions

virtual QString localXMLFile () const
 Plugin (QObject *parent=0, const char *name=0)
virtual QString xmlFile () const
virtual ~Plugin ()

Static Public Member Functions

static void loadPlugins (QObject *parent, KXMLGUIClient *parentGUIClient, KInstance *instance, bool enableNewPluginsByDefault=true)
static void loadPlugins (QObject *parent, const QValueList< PluginInfo > &pluginInfos, const KInstance *instance)
static void loadPlugins (QObject *parent, const QValueList< PluginInfo > &pluginInfos)
static void loadPlugins (QObject *parent, const KInstance *instance)
static QPtrList< Plugin > pluginObjects (QObject *parent)

Protected Member Functions

virtual void setInstance (KInstance *instance)

Static Protected Member Functions

static Plugin * loadPlugin (QObject *parent, const char *libname)
static QValueList
< Plugin::PluginInfo > 
pluginInfos (const KInstance *instance)

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.

You should also install a "plugin info" .desktop file with the same name.

See also:
PluginInfo

Definition at line 49 of file plugin.h.


Constructor & Destructor Documentation

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

Construct a new KParts plugin.

Definition at line 52 of file plugin.cpp.

Plugin::~Plugin (  )  [virtual]

Destructor.

Definition at line 59 of file plugin.cpp.


Member Function Documentation

Plugin * Plugin::loadPlugin ( QObject *  parent,
const char *  libname 
) [static, protected]

For internal use only.

Returns:
The plugin created from the library libname

Definition at line 176 of file plugin.cpp.

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. It can be overridden by the plugin if it sets the X-KDE-PluginInfo-EnabledByDefault key in the .desktop file (with the same name as the .rc file)

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.

If you call this method in an already constructed GUI (like when the user has changed which plugins are enabled) you need to add the new plugins to the KXMLGUIFactory:

 if( factory() )
 {
   QPtrList<KParts::Plugin> plugins = KParts::Plugin::pluginObjects( this );
   QPtrListIterator<KParts::Plugin> it( plugins );
   KParts::Plugin * plugin;
   while( ( plugin = it.current() ) != 0 )
   {
     ++it;
     factory()->addClient(  plugin );
   }
 }

Definition at line 227 of file plugin.cpp.

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 146 of file plugin.cpp.

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 170 of file plugin.cpp.

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 141 of file plugin.cpp.

QString Plugin::localXMLFile (  )  const [virtual]

Reimplemented for internal reasons.

Reimplemented from KXMLGUIClient.

Definition at line 76 of file plugin.cpp.

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 89 of file plugin.cpp.

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 185 of file plugin.cpp.

void Plugin::setInstance ( KInstance *  instance  )  [protected, virtual]

Reimplemented from KXMLGUIClient.

Definition at line 221 of file plugin.cpp.

QString Plugin::xmlFile (  )  const [virtual]

Reimplemented for internal reasons.

Reimplemented from KXMLGUIClient.

Definition at line 64 of file plugin.cpp.


The documentation for this class was generated from the following files:
  • plugin.h
  • plugin.cpp

KParts

Skip menu "KParts"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal