/usr/include/KF5/KParts/kparts/partbase.h is in libkf5parts-dev 5.44.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | /* This file is part of the KDE project
Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
(C) 1999 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _KPARTS_PARTBASE_H
#define _KPARTS_PARTBASE_H
#include <kparts/kparts_export.h>
#include <QObject>
#include <kxmlguiclient.h>
#define KPARTS_DECLARE_PRIVATE(Class) \
inline Class##Private* d_func() { return reinterpret_cast<Class##Private *>(PartBase::d_ptr); } \
inline const Class##Private* d_func() const { return reinterpret_cast<const Class##Private *>(PartBase::d_ptr); } \
friend class Class##Private;
class KAboutData;
namespace KParts
{
class PartBasePrivate;
/**
* @short Base class for all parts.
*/
class KPARTS_EXPORT PartBase : virtual public KXMLGUIClient
{
KPARTS_DECLARE_PRIVATE(PartBase)
public:
/**
* Constructor.
*/
PartBase();
/**
* Destructor.
*/
virtual ~PartBase();
/**
* Internal method. Called by KParts::Part to specify the parent object for plugin objects.
*
* @internal
*/
void setPartObject(QObject *object);
QObject *partObject() const;
KAboutData componentData() const;
protected:
/**
* Set the componentData(KAboutData) for this part.
*
* Call this *first* in the inherited class constructor,
* because it loads the i18n catalogs.
*/
virtual void setComponentData(const KAboutData &componentData);
/**
* 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).
*/
virtual void setComponentData(const KAboutData &pluginData, bool loadPlugins);
// TODO KDE5: merge the above two methods, using loadPlugins=true. Or better, remove loadPlugins
// altogether and change plugins to call loadPlugins() manually at the end of their ctor.
// In the case of KParts MainWindows, plugins are automatically loaded in createGUI anyway,
// so setComponentData() should really not load the plugins.
/**
* 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.
*/
enum PluginLoadingMode {
/**
* Don't load any plugins at all.
*/
DoNotLoadPlugins = 0,
/**
* Load new plugins automatically. Can be
* overridden by the plugin if it sets
* EnabledByDefault=false in the corresponding
* .desktop file.
*/
LoadPlugins = 1,
/**
* New plugins are disabled by default. Can be
* overridden by the plugin if it sets
* EnabledByDefault=true in the corresponding
* .desktop file.
*/
LoadPluginsIfEnabled = 2
};
/**
* 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:
* \code
* if( factory() )
* {
* QList<KParts::Plugin *> plugins = KParts::Plugin::pluginObjects( this );
* for(int i = 0; i != plugins.size(); ++i) {
* factory()->addClient( plugins[i] );
* }
* }
* \endcode
*/
void loadPlugins(QObject *parent, KXMLGUIClient *parentGUIClient, const KAboutData &aboutData);
/**
* Set how plugins should be loaded
* @param loadingMode see PluginLoadingMode
*
* For a KParts::Part: call this before setComponentData.
* For a KParts::MainWindow: call this before createGUI.
*/
void setPluginLoadingMode(PluginLoadingMode loadingMode);
/**
* 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.
*
* @param version the 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.
*/
void setPluginInterfaceVersion(int version);
protected:
PartBase(PartBasePrivate &dd);
PartBasePrivate *d_ptr;
private:
Q_DISABLE_COPY(PartBase)
};
} // namespace
#endif
|