KParts

partbase.cpp
1 /*
2  This file is part of the KDE project
3  SPDX-FileCopyrightText: 1999 Simon Hausmann <[email protected]>
4  SPDX-FileCopyrightText: 1999-2005 David Faure <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #include "partbase.h"
10 #include "partbase_p.h"
11 
12 #include "plugin.h"
13 
14 using namespace KParts;
15 
17  : d_ptr(new PartBasePrivate(this))
18 {
19 }
20 
21 PartBase::PartBase(PartBasePrivate &dd)
22  : d_ptr(&dd)
23 {
24 }
25 
26 PartBase::~PartBase() = default;
27 
29 {
30  Q_D(PartBase);
31 
32  d->m_obj = obj;
33 }
34 
35 QObject *PartBase::partObject() const
36 {
37  Q_D(const PartBase);
38 
39  return d->m_obj;
40 }
41 
42 #if KPARTS_BUILD_DEPRECATED_SINCE(5, 77)
44 {
45  Q_D(const PartBase);
46 
47  return d->componentData();
48 }
49 #endif
50 
51 #if KPARTS_BUILD_DEPRECATED_SINCE(5, 77)
53 {
54  setComponentData(componentData, true);
55 }
56 #endif
57 
58 #if KPARTS_BUILD_DEPRECATED_SINCE(5, 77)
59 void PartBase::setComponentData(const KAboutData &pluginData, bool bLoadPlugins)
60 {
61  Q_D(PartBase);
62 
63  d->setComponentData(pluginData);
64 
65  // backward-compatible registration, usage deprecated
66 #if KCOREADDONS_BUILD_DEPRECATED_SINCE(5, 76)
67  QT_WARNING_PUSH
68  QT_WARNING_DISABLE_CLANG("-Wdeprecated-declarations")
69  QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations")
71  QT_WARNING_POP
72 #endif
73 
74  KXMLGUIClient::setComponentName(pluginData.componentName(), pluginData.displayName());
75  if (bLoadPlugins) {
76  loadPlugins(d->m_obj, this, pluginData.componentName());
77  }
78 }
79 #endif
80 
81 #if KPARTS_BUILD_DEPRECATED_SINCE(5, 77)
82 void PartBase::loadPlugins(QObject *parent, KXMLGUIClient *parentGUIClient, const KAboutData &instance)
83 {
84  loadPlugins(parent, parentGUIClient, instance.componentName());
85 }
86 #endif
87 
88 void PartBase::loadPlugins(QObject *parent, KXMLGUIClient *parentGuiClient, const QString &parentInstanceName)
89 {
90  Q_D(PartBase);
91 
92  if (d->m_pluginLoadingMode != DoNotLoadPlugins) {
93  Plugin::loadPlugins(parent, parentGuiClient, parentInstanceName, d->m_pluginLoadingMode == LoadPlugins, d->m_pluginInterfaceVersion);
94  }
95 }
96 
98 {
99  Q_D(PartBase);
100 
101  d->m_pluginLoadingMode = loadingMode;
102 }
103 
105 {
106  Q_D(PartBase);
107 
108  d->m_pluginInterfaceVersion = version;
109 }
virtual void setComponentData(const KAboutData &componentData)
Set the componentData(KAboutData) for this part.
Definition: partbase.cpp:52
QString componentName() const
Don&#39;t load any plugins at all.
Definition: partbase.h:112
void setPartObject(QObject *object)
Internal method.
Definition: partbase.cpp:28
Load new plugins automatically.
Definition: partbase.h:119
static void registerPluginData(const KAboutData &aboutData)
virtual ~PartBase()
Destructor.
void loadPlugins(QObject *parent, KXMLGUIClient *parentGUIClient, const KAboutData &aboutData)
Load the Plugins honoring the PluginLoadingMode.
Definition: partbase.cpp:82
KAboutData componentData() const
Definition: partbase.cpp:43
Base class for all parts.
Definition: partbase.h:38
void setPluginLoadingMode(PluginLoadingMode loadingMode)
Set how plugins should be loaded.
Definition: partbase.cpp:97
static void loadPlugins(QObject *parent, const QString &instance)
Load the plugin libraries from the directories appropriate to instance and make the Plugin objects ch...
Definition: plugin.cpp:118
void setPluginInterfaceVersion(int version)
If you change the binary interface offered by your part, you can avoid crashes from old plugins lying...
Definition: partbase.cpp:104
PluginLoadingMode
We have three different policies, whether to load new plugins or not.
Definition: partbase.h:108
virtual void setComponentName(const QString &componentName, const QString &componentDisplayName)
QString displayName() const
PartBase()
Constructor.
Definition: partbase.cpp:16
The KParts namespace,.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Oct 16 2021 22:56:28 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.