generic: use the version from verification data for plugins

no additional symbol resolution will be performed that way and most plugins
(except one, GeolocationProvider) use KDE_VERSION anyway

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2020-11-26 03:46:01 +00:00
parent a2b88f9f6d
commit 680975fed8
11 changed files with 13 additions and 36 deletions

View file

@ -36,7 +36,6 @@ struct KDEPluginVerificationData
/**
* \internal
* The version of this structure. Do not ever delete or change a field.
* Increase it in the K_EXPORT_PLUGIN_VERSION macro whenever you
* append a field to this structure.
*/
quint8 dataVersion;
@ -53,15 +52,6 @@ struct KDEPluginVerificationData
Q_EXTERN_C Q_DECL_EXPORT const KDEPluginVerificationData kde_plugin_verification_data = \
{ KDEPluginVerificationData::PluginVerificationDataVersion, KDE_VERSION, KDE_VERSION_STRING };
/**
* \relates KPluginLoader
* Use this macro if you want to give your plugin a version number.
* You can later access the version number with KPluginLoader::pluginVersion()
*/
#define K_EXPORT_PLUGIN_VERSION(version) \
Q_EXTERN_C Q_DECL_EXPORT const quint32 kde_plugin_version = version;
/**
* \relates KPluginLoader
* This macro exports the main object of the plugin. Most times, this will be a KPluginFactory

View file

@ -35,7 +35,7 @@ class KPluginLoaderPrivate
Q_DECLARE_PUBLIC(KPluginLoader)
protected:
KPluginLoaderPrivate(const QString &libname)
: name(libname), pluginVersion(~0U), verificationData(0), lib(0)
: name(libname), pluginVersion(0), verificationData(0), lib(0)
{}
~KPluginLoaderPrivate()
{
@ -211,16 +211,12 @@ bool KPluginLoader::load()
unload();
return false;
}
d->pluginVersion = (d->verificationData->KDEVersion & 0xFFFF00);
} else {
kDebug() << "The plugin" << d->name << "doesn't contain a kde_plugin_verification_data structure";
d->pluginVersion = 0;
}
quint32 *version = (quint32 *) lib.resolve("kde_plugin_version");
if (version)
d->pluginVersion = *version;
else
d->pluginVersion = ~0U;
return true;
}

View file

@ -125,7 +125,7 @@ public:
/**
* Queries the plugin version.
* \returns The version given to K_EXPORT_PLUGIN_VERSION or (quint32) -1 if not set.
* \returns The version defined as KDE_VERSION or (quint32) 0 if plugin is not valid KDE plugin.
*/
quint32 pluginVersion() const;

View file

@ -487,8 +487,7 @@ class PLASMA_EXPORT AbstractRunner : public QObject
#define K_EXPORT_PLASMA_RUNNER( libname, classname ) \
K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
K_EXPORT_PLUGIN(factory("plasma_runner_" #libname)) \
K_EXPORT_PLUGIN_VERSION(KDE_VERSION)
K_EXPORT_PLUGIN(factory("plasma_runner_" #libname))
/**
* These plugins are Used by the plugin selector dialog to show
@ -497,7 +496,6 @@ K_EXPORT_PLUGIN_VERSION(KDE_VERSION)
*/
#define K_EXPORT_RUNNER_CONFIG( name, classname ) \
K_PLUGIN_FACTORY(ConfigFactory, registerPlugin<classname>();) \
K_EXPORT_PLUGIN(ConfigFactory("kcm_krunner_" #name)) \
K_EXPORT_PLUGIN_VERSION(KDE_VERSION)
K_EXPORT_PLUGIN(ConfigFactory("kcm_krunner_" #name))
#endif

View file

@ -153,8 +153,7 @@ private:
*/
#define K_EXPORT_PLASMA_TOOLBOX(libname, classname) \
K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
K_EXPORT_PLUGIN(factory("plasma_toolbox_" #libname)) \
K_EXPORT_PLUGIN_VERSION(KDE_VERSION)
K_EXPORT_PLUGIN(factory("plasma_toolbox_" #libname))
#endif // multiple inclusion guard

View file

@ -1141,7 +1141,6 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(Plasma::Applet::BackgroundHints)
*/
#define K_EXPORT_PLASMA_APPLET(libname, classname) \
K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
K_EXPORT_PLUGIN(factory("plasma_applet_" #libname)) \
K_EXPORT_PLUGIN_VERSION(KDE_VERSION)
K_EXPORT_PLUGIN(factory("plasma_applet_" #libname))
#endif // multiple inclusion guard

View file

@ -272,7 +272,6 @@ class PLASMA_EXPORT ContainmentActions : public QObject
*/
#define K_EXPORT_PLASMA_CONTAINMENTACTIONS(libname, classname) \
K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
K_EXPORT_PLUGIN(factory("plasma_containmentactions_" #libname)) \
K_EXPORT_PLUGIN_VERSION(KDE_VERSION)
K_EXPORT_PLUGIN(factory("plasma_containmentactions_" #libname))
#endif // PLASMA_CONTAINMENTACTIONS_H

View file

@ -515,8 +515,7 @@ NoAlignment) const;
*/
#define K_EXPORT_PLASMA_DATAENGINE(libname, classname) \
K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
K_EXPORT_PLUGIN(factory("plasma_engine_" #libname)) \
K_EXPORT_PLUGIN_VERSION(KDE_VERSION)
K_EXPORT_PLUGIN(factory("plasma_engine_" #libname))
Q_DECLARE_METATYPE(Plasma::DataEngine*)

View file

@ -350,8 +350,7 @@ private:
*/
#define K_EXPORT_PLASMA_PACKAGESTRUCTURE(libname, classname) \
K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
K_EXPORT_PLUGIN(factory("plasma_packagestructure_" #libname)) \
K_EXPORT_PLUGIN_VERSION(KDE_VERSION)
K_EXPORT_PLUGIN(factory("plasma_packagestructure_" #libname))
} // Plasma namespace
#endif

View file

@ -333,8 +333,7 @@ Q_DECLARE_METATYPE(Plasma::Service *)
*/
#define K_EXPORT_PLASMA_SERVICE(libname, classname) \
K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
K_EXPORT_PLUGIN(factory("plasma_service_" #libname)) \
K_EXPORT_PLUGIN_VERSION(KDE_VERSION)
K_EXPORT_PLUGIN(factory("plasma_service_" #libname))
#endif // multiple inclusion guard

View file

@ -582,7 +582,6 @@ class PLASMA_EXPORT Wallpaper : public QObject
*/
#define K_EXPORT_PLASMA_WALLPAPER(libname, classname) \
K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
K_EXPORT_PLUGIN(factory("plasma_wallpaper_" #libname)) \
K_EXPORT_PLUGIN_VERSION(KDE_VERSION)
K_EXPORT_PLUGIN(factory("plasma_wallpaper_" #libname))
#endif // multiple inclusion guard