Plasma::PluginLoader Class

Loader for Plasma plugins. More...

Header: #include <Plasma/PluginLoader>
CMake: find_package(Plasma REQUIRED)
target_link_libraries(mytarget PRIVATE Plasma::Plasma)

Public Functions

QList<KPluginMetaData> listAppletMetaData(const QString &category)
QList<KPluginMetaData> listAppletMetaDataForMimeType(const QString &mimetype)
QList<KPluginMetaData> listAppletMetaDataForUrl(const QUrl &url)
QList<KPluginMetaData> listContainmentActionsMetaData(const QString &parentApp)
Plasma::Applet *loadApplet(const QString &name, uint appletId = 0, const QVariantList &args = QVariantList())
Plasma::ContainmentActions *loadContainmentActions(Plasma::Containment *parent, const QString &containmentActionsName, const QVariantList &args = QVariantList())

Static Public Members

QList<KPluginMetaData> listContainmentsMetaData(std::function<bool (const KPluginMetaData &)> filter = {})
QList<KPluginMetaData> listContainmentsMetaDataOfType(const QString &type)
Plasma::PluginLoader *self()

Detailed Description

This class is used to list and load various Plasma-related plugins.

Member Function Documentation

QList<KPluginMetaData> PluginLoader::listAppletMetaData(const QString &category)

Returns a list of all known applets.

This may skip applets based on security settings and ExcludeCategories in the application's config.

category Only applets matching this category will be returned. If "Misc" is passed in, then applets without a Categories= entry are also returned. If an empty string is passed in, all applets are returned.

QList<KPluginMetaData> PluginLoader::listAppletMetaDataForMimeType(const QString &mimetype)

Returns a list of all known applets associated with a certain mimetype.

QList<KPluginMetaData> PluginLoader::listAppletMetaDataForUrl(const QUrl &url)

Returns a list of all known applets associated with a certain URL.

QList<KPluginMetaData> PluginLoader::listContainmentActionsMetaData(const QString &parentApp)

Returns a list of all known ContainmentActions.

parentApp the application to filter ContainmentActions on. Uses the X-KDE-ParentApp entry (if any) in the plugin metadata. The default value of QString() will result in a list of all ContainmentActions.

[static] QList<KPluginMetaData> PluginLoader::listContainmentsMetaData(std::function<bool (const KPluginMetaData &)> filter = {})

Returns a list of all known containments.

filter An optional predicate that can be used for filtering.

[static] QList<KPluginMetaData> PluginLoader::listContainmentsMetaDataOfType(const QString &type)

Returns a list of containments of the specified type.

type The target containment type

Plasma::Applet *PluginLoader::loadApplet(const QString &name, uint appletId = 0, const QVariantList &args = QVariantList())

Load an Applet plugin.

name the plugin id, as returned by KPluginMetaData::pluginId()

appletId unique ID to assign the applet, or zero to have one assigned automatically.

args to send the applet extra arguments

Returns a pointer to the loaded applet, or nullptr on load failure

Plasma::ContainmentActions *PluginLoader::loadContainmentActions(Plasma::Containment *parent, const QString &containmentActionsName, const QVariantList &args = QVariantList())

Load a ContainmentActions plugin.

Returns a pointer to the containmentactions if successful.

The caller takes responsibility for the containmentactions, including deleting it when no longer needed.

parent the parent containment, or nullptr

name the plugin name, as returned by KPluginMetaData::pluginId()

args to send the containmentactions extra arguments

[static] Plasma::PluginLoader *PluginLoader::self()

Return the plugin loader instance