Expose the applet metadata in AppletInterface

Needed for displaying about pages of applets.
This commit is contained in:
David Redondo 2020-07-13 16:57:53 +02:00
parent e510d9d3ce
commit 6329eb7af4
2 changed files with 15 additions and 0 deletions

View File

@ -884,4 +884,9 @@ bool AppletInterface::isLoading() const
return m_loading; return m_loading;
} }
KPluginMetaData AppletInterface::metaData() const
{
return applet()->pluginMetaData();
}
#include "moc_appletinterface.cpp" #include "moc_appletinterface.cpp"

View File

@ -25,6 +25,8 @@
#include <QQuickItem> #include <QQuickItem>
#include <QQuickView> #include <QQuickView>
#include <KPluginMetaData>
#include <Plasma/Applet> #include <Plasma/Applet>
#include <Plasma/Theme> #include <Plasma/Theme>
@ -250,6 +252,12 @@ class AppletInterface : public PlasmaQuick::AppletQuickItem
Q_PROPERTY(bool loading MEMBER m_loading NOTIFY isLoadingChanged) Q_PROPERTY(bool loading MEMBER m_loading NOTIFY isLoadingChanged)
/**
* The metadata of the applet.
* @since 5.73
*/
Q_PROPERTY(KPluginMetaData metaData READ metaData CONSTANT)
public: public:
AppletInterface(DeclarativeAppletScript *script, const QVariantList &args = QVariantList(), QQuickItem *parent = nullptr); AppletInterface(DeclarativeAppletScript *script, const QVariantList &args = QVariantList(), QQuickItem *parent = nullptr);
~AppletInterface() override; ~AppletInterface() override;
@ -416,6 +424,8 @@ public:
QString configurationRequiredReason() const; QString configurationRequiredReason() const;
void setConfigurationRequiredReason(const QString &reason); void setConfigurationRequiredReason(const QString &reason);
KPluginMetaData metaData() const;
Q_SIGNALS: Q_SIGNALS:
/** /**
* somebody else, usually the containment sent some data to the applet * somebody else, usually the containment sent some data to the applet