KParts::PartBase

#include <KParts/PartBase>

Inheritance diagram for KParts::PartBase:

Public Member Functions

 PartBase ()
 
virtual ~PartBase ()
 
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

 PartBase (PartBasePrivate &dd)
 
void loadPlugins (QObject *parent, KXMLGUIClient *parentGUIClient, const KAboutData &aboutData)
 
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

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 49 of file partbase.h.

Member Enumeration Documentation

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 106 of file partbase.h.

Constructor & Destructor Documentation

PartBase::PartBase ( )

Constructor.

Definition at line 29 of file partbase.cpp.

PartBase::~PartBase ( )
virtual

Destructor.

Definition at line 39 of file partbase.cpp.

Member Function Documentation

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);
}
}

Definition at line 81 of file partbase.cpp.

void PartBase::setComponentData ( const KAboutData componentData)
protectedvirtual

Set the componentData(KAboutData) for this part.

Call this first in the inherited class constructor, because it loads the i18n catalogs.

Definition at line 64 of file partbase.cpp.

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

Set the componentData(KAboutData) for this part.

Call this first in the inherited class constructor, because it loads the i18n catalogs.

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).

Definition at line 69 of file partbase.cpp.

void PartBase::setPartObject ( QObject object)

Internal method.

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

Definition at line 44 of file partbase.cpp.

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.

Definition at line 97 of file partbase.cpp.

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.

Definition at line 90 of file partbase.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Aug 6 2020 22:53:47 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.