KParts::PartBase

Search for usage in LXR

#include <KParts/PartBase>

Inheritance diagram for KParts::PartBase:

Public Member Functions

 PartBase ()
 
 ~PartBase () override
 
KAboutData componentData () const
 
QObjectpartObject () const
 
void setPartObject (QObject *object)
 
- 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)
 
virtual QString xmlFile () const
 
QDomDocument xmlguiBuildDocument () const
 

Protected Types

enum  PluginLoadingMode { DoNotLoadPlugins = 0, LoadPlugins = 1, LoadPluginsIfEnabled = 2 }
 

Protected Member Functions

KPARTS_NO_EXPORT PartBase (PartBasePrivate &dd)
 
void loadPlugins (QObject *parent, KXMLGUIClient *parentGUIClient, const KAboutData &aboutData)
 
void loadPlugins (QObject *parent, KXMLGUIClient *parentGUIClient, const QString &parentInstanceName)
 
virtual void setComponentData (const KAboutData &componentData)
 
virtual void setComponentData (const KAboutData &pluginData, bool loadPlugins)
 
void setPluginInterfaceVersion (int version)
 
void setPluginLoadingMode (PluginLoadingMode loadingMode)
 
- 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)
 

Protected Attributes

const std::unique_ptr< PartBasePrivate > d_ptr
 

Additional Inherited Members

- Static Public Member Functions inherited from KXMLGUIClient
static QString findVersionNumber (const QString &xml)
 
- Static Protected Member Functions inherited from KXMLGUIClient
static QString standardsXmlFileLocation ()
 

Detailed Description

Base class for all parts.

Definition at line 38 of file partbase.h.

Member Enumeration Documentation

◆ PluginLoadingMode

We have three different policies, whether to load new plugins or not.

The value in the KConfig object of the KAboutData object always overrides LoadPlugins and LoadPluginsIfEnabled.

Enumerator
DoNotLoadPlugins 

Don't load any plugins at all.

LoadPlugins 

Load new plugins automatically.

Can be overridden by the plugin if it sets EnabledByDefault=false in the corresponding .desktop file.

LoadPluginsIfEnabled 

New plugins are disabled by default.

Can be overridden by the plugin if it sets EnabledByDefault=true in the corresponding .desktop file.

Definition at line 155 of file partbase.h.

Constructor & Destructor Documentation

◆ PartBase()

PartBase::PartBase ( )

Constructor.

Definition at line 16 of file partbase.cpp.

◆ ~PartBase()

PartBase::~PartBase ( )
overridedefault

Destructor.

Member Function Documentation

◆ componentData()

KAboutData PartBase::componentData ( ) const
Deprecated:
Since 5.77, use Part::metaData() or KXMLGUIClient::componentName() instead.

Definition at line 43 of file partbase.cpp.

◆ loadPlugins() [1/2]

void PartBase::loadPlugins ( QObject parent,
KXMLGUIClient parentGUIClient,
const KAboutData aboutData 
)
protected

Load the Plugins honoring the PluginLoadingMode.

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 (auto *plugin : plugins) {
factory()->addClient(plugin);
}
}
Deprecated:
Since 5.77, use loadPlugins(QObject *parent, KXMLGUIClient *, const QString &) instead.

Definition at line 82 of file partbase.cpp.

◆ loadPlugins() [2/2]

void PartBase::loadPlugins ( QObject parent,
KXMLGUIClient parentGUIClient,
const QString parentInstanceName 
)
protected

Load the Plugins honoring the PluginLoadingMode.

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 (auto *plugin : plugins) {
factory()->addClient(plugin);
}
}
Since
5.77
Deprecated:
Since 5.90, the concept of KPart plugins is deprecated, see docs of KParts::Plugin class

Definition at line 89 of file partbase.cpp.

◆ setComponentData() [1/2]

void PartBase::setComponentData ( const KAboutData componentData)
protectedvirtual

Set the componentData(KAboutData) for this part.

Call this first in the inherited class constructor.

Deprecated:
Since 5.77, use Part::setMetaData(const KPluginMetaData&) or KXMLGUIClient::setComponentName(const QString &, const QString &) instead.

Definition at line 52 of file partbase.cpp.

◆ setComponentData() [2/2]

void PartBase::setComponentData ( const KAboutData pluginData,
bool  loadPlugins 
)
protectedvirtual

Set the componentData(KAboutData) for this part.

Call this first in the inherited class constructor.

It is recommended to call setComponentData with loadPlugins set to false, and to load plugins at the end of your part constructor (in the case of KParts::MainWindow, plugins are automatically loaded in createGUI anyway, so set loadPlugins to false for KParts::MainWindow as well).

Deprecated:
Since 5.77, use Part::setMetaData(const KPluginMetaData&) or KXMLGUIClient::setComponentName(const QString &, const QString &) instead.

Definition at line 59 of file partbase.cpp.

◆ setPartObject()

void PartBase::setPartObject ( QObject object)

Internal method.

Called by KParts::Part to specify the parent object for plugin objects.

Definition at line 28 of file partbase.cpp.

◆ setPluginInterfaceVersion()

void KParts::PartBase::setPluginInterfaceVersion ( int  version)
protected

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 calling setPluginInterfaceVersion( 2 ), 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.

Parameters
versionthe interface version that plugins must have in order to be loaded.

For a KParts::Part: call this before setComponentData. For a KParts::MainWindow: call this before createGUI.

Deprecated:
Since 5.90, the concept of KPart plugins is deprecated, see docs of KParts::Plugin class

Definition at line 107 of file partbase.cpp.

◆ setPluginLoadingMode()

void PartBase::setPluginLoadingMode ( PluginLoadingMode  loadingMode)
protected

Set how plugins should be loaded.

Parameters
loadingModesee PluginLoadingMode

For a KParts::Part: call this before setComponentData. For a KParts::MainWindow: call this before createGUI.

Deprecated:
Since 5.90, the concept of KPart plugins is deprecated, see docs of KParts::Plugin class

Definition at line 98 of file partbase.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
KXMLGUIFactory * factory() const
void addClient(KXMLGUIClient *client)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Dec 5 2023 03:54:20 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.