Plasma::PluginLoader Class
Loader for Plasma plugins. More...
Header: | #include <Plasma/PluginLoader> |
CMake: | find_package(Plasma REQUIRED) target_link_libraries(mytarget PRIVATE Plasma::Plasma) |
Since: | 4.6 |
Public Functions
(since 5.28) QList<KPluginMetaData> | listAppletMetaData(const QString &category) |
(since 5.36) QList<KPluginMetaData> | listAppletMetaDataForMimeType(const QString &mimetype) |
(since 5.36) QList<KPluginMetaData> | listAppletMetaDataForUrl(const QUrl &url) |
(since 5.77) 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 is an abstract base class which defines an interface to which Plasma's Applet Loading logic can communicate with a parent application. The plugin loader must be set before any plugins are loaded, otherwise (for safety reasons), the default PluginLoader implementation will be used. The reimplemented version should not do more than simply returning a loaded plugin. It should not init() it, and it should not hang on to it. The associated methods will be called only when a component of Plasma needs to load a _new_ plugin.
Member Function Documentation
[since 5.28]
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. Returns list of applets
This function was introduced in 5.28.
[since 5.36]
QList<KPluginMetaData> PluginLoader::listAppletMetaDataForMimeType(const QString &mimetype)
Returns a list of all known applets associated with a certain mimetype.
This function was introduced in 5.36.
[since 5.36]
QList<KPluginMetaData> PluginLoader::listAppletMetaDataForUrl(const QUrl &url)
Returns a list of all known applets associated with a certain URL.
This function was introduced in 5.36.
[since 5.77]
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.
This function was introduced in 5.77.
[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 name, as returned by KPluginInfo::pluginName()
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 0 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. Since 4.6 null is allowed.
name the plugin name, as returned by KPluginInfo::pluginName()
args to send the containmentactions extra arguments
Returns a ContainmentActions object
[static]
Plasma::PluginLoader *PluginLoader::self()
Return the active plugin loader