Skip to content

Enable KPluginFactory to optionally pass KPluginMetaData to plugins

This patch allows a new variant of plugin constructors taking a KPluginMetaData argument:

  • T(QWidget *pW, QObject *p, const KPluginMetaData &m, const QVariantList &a)
  • T(QWidget *p, const KPluginMetaData &m, const QVariantList &a)
  • T(QObject *p, const KPluginMetaData &m, const QVariantList &a)

next to the existing ones

  • T(QWidget *pW, QObject *p, const QVariantList &a)
  • T(QWidget *p, const QVariantList &a)
  • T(QObject *p, const QVariantList &a)

KPluginFactory gets a new property "metaData", and will pass its value as the argument to the new metaData-taking constructor signature for any plugin which registered with such.

KPluginLoader sets that new property for the facttory instance it provides to the JSON metadata embedded into the plugin binary, if present.

The Desktop2Json conversion tool also got extended to handle some new desktop entries for more complete counterparts to KAboutData properties:

  • X-KDE-PluginInfo-Copyright to contain the copyright expression
  • X-KDE-PluginInfo-Authors to support multiple authors
  • X-KDE-PluginInfo-Emails to support multiple authors

These changes allow all plugin systems to pass the metadata about a plugin directly to the plugin instance, without having to do custom code to e.g. pass this via the QVariantList argument (e.g. like done by KRunner). It also encourages to use the JSON metadata instead of duplicating metadata using KAboutData (e.g. KParts).

@dfaure @nicolasfella

Edited by Friedrich W. H. Kossebau

Merge request reports