KParts::Plugin

Search for usage in LXR

#include <KParts/Plugin>

Inheritance diagram for KParts::Plugin:

Public Member Functions

 Plugin (QObject *parent=nullptr)
 
 ~Plugin () override
 
QString localXMLFile () const override
 
QString xmlFile () const override
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 
- Public Member Functions inherited from KXMLGUIClient
 KXMLGUIClient (KXMLGUIClient *parent)
 
QActionaction (const char *name) const
 
virtual QActionaction (const QDomElement &element) const
 
virtual KActionCollectionactionCollection () const
 
QList< KXMLGUIClient * > childClients ()
 
KXMLGUIBuilderclientBuilder () const
 
virtual QString componentName () const
 
virtual QDomDocument domDocument () const
 
KXMLGUIFactoryfactory () const
 
void insertChildClient (KXMLGUIClient *child)
 
KXMLGUIClientparentClient () const
 
void plugActionList (const QString &name, const QList< QAction * > &actionList)
 
void reloadXML ()
 
void removeChildClient (KXMLGUIClient *child)
 
void replaceXMLFile (const QString &xmlfile, const QString &localxmlfile, bool merge=false)
 
void setClientBuilder (KXMLGUIBuilder *builder)
 
void setFactory (KXMLGUIFactory *factory)
 
void setXMLGUIBuildDocument (const QDomDocument &doc)
 
void unplugActionList (const QString &name)
 
QDomDocument xmlguiBuildDocument () const
 

Static Public Member Functions

static void loadPlugins (QObject *parent, const QList< PluginInfo > &pluginInfos)
 
static void loadPlugins (QObject *parent, const QList< PluginInfo > &pluginInfos, const QString &instance)
 
static void loadPlugins (QObject *parent, const QString &instance)
 
static void loadPlugins (QObject *parent, KXMLGUIClient *parentGUIClient, const QString &instance, bool enableNewPluginsByDefault=true, int interfaceVersionRequired=0)
 
static QList< Plugin * > pluginObjects (QObject *parent)
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
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)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Static Public Member Functions inherited from KXMLGUIClient
static QString findVersionNumber (const QString &xml)
 

Protected Member Functions

virtual void setComponentData (const KAboutData &pluginData)
 
void setMetaData (const KPluginMetaData &metaData)
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 
- Protected Member Functions inherited from KXMLGUIClient
void loadStandardsXmlFile ()
 
virtual void setComponentName (const QString &componentName, const QString &componentDisplayName)
 
virtual void setDOMDocument (const QDomDocument &document, bool merge=false)
 
virtual void setLocalXMLFile (const QString &file)
 
virtual void setXML (const QString &document, bool merge=false)
 
virtual void setXMLFile (const QString &file, bool merge=false, bool setXMLDoc=true)
 
virtual void stateChanged (const QString &newstate, ReverseStateChange reverse=StateNoReverse)
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Static Protected Member Functions inherited from KXMLGUIClient
static QString standardsXmlFileLocation ()
 

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
KPluginInfo
Deprecated:
Since 5.90, the concept of KPart plugins is deprecated. In the Konqueror KF5Konq lib is a reimplementation of this class, which is not deprecated. Consider porting your usage to this class or import the plugin in Konqueror.

Definition at line 51 of file plugin.h.

Constructor & Destructor Documentation

◆ Plugin()

Plugin::Plugin ( QObject parent = nullptr)
explicit

Construct a new KParts plugin.

Definition at line 45 of file plugin.cpp.

◆ ~Plugin()

Plugin::~Plugin ( )
overridedefault

Destructor.

Member Function Documentation

◆ loadPlugins() [1/4]

void Plugin::loadPlugins ( QObject parent,
const QList< 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 148 of file plugin.cpp.

◆ loadPlugins() [2/4]

void Plugin::loadPlugins ( QObject parent,
const QList< PluginInfo > &  pluginInfos,
const QString 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 129 of file plugin.cpp.

◆ loadPlugins() [3/4]

void Plugin::loadPlugins ( QObject parent,
const QString 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 124 of file plugin.cpp.

◆ loadPlugins() [4/4]

void Plugin::loadPlugins ( QObject parent,
KXMLGUIClient parentGUIClient,
const QString instance,
bool  enableNewPluginsByDefault = true,
int  interfaceVersionRequired = 0 
)
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.

If you change the binary interface offered by your part, you can avoid crashes from old plugins lying around by setting X-KDE-InterfaceVersion=2 in the .desktop files of the plugins, and passing 2 to interfaceVersionRequired, so that the old plugins are not loaded. Increase both numbers every time a binary incompatible change in the application's plugin interface is made.

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

See also
PartBase::setPluginLoadingMode, PartBase::setPluginInterfaceVersion

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() )
{
for ( KParts::Plugin * plugin : plugins )
factory()->addClient( plugin );
}

Definition at line 223 of file plugin.cpp.

◆ localXMLFile()

QString Plugin::localXMLFile ( ) const
override

Reimplemented for internal reasons.

Definition at line 67 of file plugin.cpp.

◆ pluginObjects()

QList< KParts::Plugin * > Plugin::pluginObjects ( QObject parent)
static

Returns a list of plugin objects loaded for parent.

This functions basically iterates over the children of the given object and returns those that inherit from KParts::Plugin.

Definition at line 171 of file plugin.cpp.

◆ setComponentData()

void Plugin::setComponentData ( const KAboutData pluginData)
protectedvirtual
Deprecated:
Since 5.77, use setMetaData(const KPluginMetaData&) instead.

Definition at line 194 of file plugin.cpp.

◆ setMetaData()

void Plugin::setMetaData ( const KPluginMetaData metaData)
protected
Since
5.77

Definition at line 209 of file plugin.cpp.

◆ xmlFile()

QString Plugin::xmlFile ( ) const
overridevirtual

Reimplemented for internal reasons.

Reimplemented from KXMLGUIClient.

Definition at line 54 of file plugin.cpp.


The documentation for this class was generated from the following files:
static QList< Plugin * > pluginObjects(QObject *parent)
Returns a list of plugin objects loaded for parent.
Definition: plugin.cpp:171
A plugin is the way to add actions to an existing KParts application, or to a Part.
Definition: plugin.h:51
KXMLGUIFactory * factory() const
void addClient(KXMLGUIClient *client)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon May 8 2023 03:53:51 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.