KPluginInfo
#include <KPluginInfo>
Public Types | |
typedef QList< KPluginInfo > | List |
Static Public Member Functions | |
static KPluginInfo::List | fromFiles (const QStringList &files, const KConfigGroup &config=KConfigGroup()) |
static KPluginInfo::List | fromKPartsInstanceName (const QString &componentName, const KConfigGroup &config=KConfigGroup()) |
static KPluginInfo | fromMetaData (const KPluginMetaData &meta) |
static KPluginInfo::List | fromMetaData (const QVector< KPluginMetaData > &list) |
static KPluginInfo::List | fromServices (const KService::List &services, const KConfigGroup &config=KConfigGroup()) |
static KPluginMetaData | toMetaData (const KPluginInfo &info) |
static QVector< KPluginMetaData > | toMetaData (const KPluginInfo::List &list) |
Friends | |
KSERVICE_EXPORT uint | qHash (const KPluginInfo &) |
Detailed Description
Information about a plugin.
This holds all the information about a plugin there is. It's used for the user to decide whether he wants to use this plugin or not.
Definition at line 32 of file kplugininfo.h.
Member Typedef Documentation
typedef QList<KPluginInfo> KPluginInfo::List |
A list of KPluginInfo objects.
Definition at line 38 of file kplugininfo.h.
Constructor & Destructor Documentation
|
explicit |
Read plugin info from filename
.
The file should be of the following form:
[Desktop Entry]
Icon=mypluginicon
Type=Service
X-KDE-ServiceTypes=KPluginInfo
Name=User Visible Name
Comment=Description of what the plugin does
X-KDE-PluginInfo-Author=Author's Name
[email protected]
X-KDE-PluginInfo-Name=internalname
X-KDE-PluginInfo-Version=1.1
X-KDE-PluginInfo-Website=http://www.plugin.org/
X-KDE-PluginInfo-Category=playlist
X-KDE-PluginInfo-Depends=plugin1,plugin3
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
The Name and Comment fields must always be present.
The "X-KDE-PluginInfo" keys you may add further entries which will be available using property(). The Website,Category,Require keys are optional. For EnabledByDefault look at isPluginEnabledByDefault.
- Parameters
-
filename The filename of the .desktop file. resource If filename is relative, you need to specify a resource type (e.g. "service", "apps"... KStandardDirs). Otherwise, resource isn't used.
Definition at line 239 of file kplugininfo.cpp.
|
explicit |
Read plugin info from a KService object.
The .desktop file should look like this:
[Desktop Entry]
Icon=mypluginicon
Type=Service
X-KDE-ServiceTypes=KPluginInfo
X-KDE-PluginInfo-Author=Author's Name
[email protected]
X-KDE-PluginInfo-Name=internalname
X-KDE-PluginInfo-Version=1.1
X-KDE-PluginInfo-Website=http://www.plugin.org/
X-KDE-PluginInfo-Category=playlist
X-KDE-PluginInfo-Depends=plugin1,plugin3
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
Name=User Visible Name
Comment=Description of what the plugin does
In the first three entries the Icon entry is optional.
- Deprecated:
- since 5.0, use (Q|K)PluginLoader instead and build the metadata into the plugin using K_PLUGIN_CLASS_WITH_JSON( ..., "mypluginmetadata.json")
Definition at line 287 of file kplugininfo.cpp.
|
explicit |
Read plugin info from arguments passed to the plugin.
These arguments should contain the plugin's metadata (as read from QPluginLoader::metaData(). This constructor uses the metadata read from the QVariantList. It reads the first QVariantMap it finds in a field called "MetaData".
Use (Q|K)PluginLoader and build the metadata into the plugin using K_PLUGIN_CLASS_WITH_JSON( ..., "mypluginmetadata.json")
You can use the "desktoptojson tool to generate a .json file from your .desktop file. The .json file should look like this:
{
"Comment": "Date and time by timezone",
"Icon": "preferences-system-time",
"Name": "Date and Time",
"Type": "Service",
"X-KDE-Library": "plasma_engine_time",
"X-KDE-PluginInfo-Author": "Aaron Seigo",
"X-KDE-PluginInfo-Category": "Date and Time",
"X-KDE-PluginInfo-Depends": [
],
"X-KDE-PluginInfo-Email": "[email protected]",
"X-KDE-PluginInfo-EnabledByDefault": true,
"X-KDE-PluginInfo-License": "LGPL",
"X-KDE-PluginInfo-Name": "time",
"X-KDE-PluginInfo-Version": "1.0",
"X-KDE-PluginInfo-Website": "http://plasma.kde.org/",
"X-KDE-ServiceTypes": [
"Plasma/DataEngine"
],
"X-KDE-FormFactors": [
"tablet",
"handset"
]
}
- Parameters
-
args QVariantList with arguments, should contain a QVariantMap, keyed "MetaData" as provided by QPluginLoader::metaData() libraryPath The path to the plugin file on disk
- See also
- K_PLUGIN_CLASS_WITH_JSON()
- KPluginFactory::factory()
- Since
- 5.0
Definition at line 262 of file kplugininfo.cpp.
|
explicit |
Read plugin info from a KPluginMetaData object.
- Parameters
-
md The KPluginMetaData to read the information from
- Since
- 5.5
Definition at line 230 of file kplugininfo.cpp.
KPluginInfo::KPluginInfo | ( | ) |
KPluginInfo::KPluginInfo | ( | const KPluginInfo & | copy | ) |
Creates a KPluginInfo object that shares the data with copy
.
Definition at line 354 of file kplugininfo.cpp.
Member Function Documentation
QString KPluginInfo::author | ( | ) | const |
- Returns
- The author of this plugin.
Definition at line 492 of file kplugininfo.cpp.
QString KPluginInfo::category | ( | ) | const |
- Returns
- The category of this plugin (e.g. playlist/skin).
Definition at line 506 of file kplugininfo.cpp.
QString KPluginInfo::comment | ( | ) | const |
- Returns
- A comment describing the plugin.
Definition at line 474 of file kplugininfo.cpp.
KConfigGroup KPluginInfo::config | ( | ) | const |
- Returns
- If the KPluginInfo object has a KConfig object set return it, else returns an invalid KConfigGroup.
Definition at line 589 of file kplugininfo.cpp.
void KPluginInfo::defaults | ( | ) |
Restore defaults (enabled or not).
Definition at line 701 of file kplugininfo.cpp.
QStringList KPluginInfo::dependencies | ( | ) | const |
- Returns
- A list of plugins required for this plugin to be enabled. Use the pluginName in this list.
Definition at line 548 of file kplugininfo.cpp.
QString KPluginInfo::email | ( | ) | const |
- Returns
- The email address of the author.
Definition at line 499 of file kplugininfo.cpp.
QString KPluginInfo::entryPath | ( | ) | const |
- Returns
- The file containing the information about the plugin.
Definition at line 486 of file kplugininfo.cpp.
QStringList KPluginInfo::formFactors | ( | ) | const |
- Returns
- A list of FormFactors this plugin offers, corresponds to the "X-KDE-FormFactors" value in a .desktop service file, or to the "FormFactors" value in the "KPlugin" block of the json metadata. Formfactor values are freestyle, common values are "desktop", "handset", "tablet", "mediacenter". Values are comma-separated.
- Since
- 5.14
Definition at line 512 of file kplugininfo.cpp.
|
static |
- Returns
- A list of KPluginInfo objects constructed from a list of filenames. If you make a lookup using, for example, KStandardDirs::findAllResources() you pass the list of files to this function.
- Parameters
-
files The list of files to construct the list of KPluginInfo objects from config The config group where to save/load whether the plugin is enabled/disabled
Definition at line 417 of file kplugininfo.cpp.
|
static |
- Returns
- A list of KPluginInfo objects for the KParts plugins of a component.
- Parameters
-
componentName Use the component name to look up all KParts plugins for it. config The config group where to save/load whether the plugin is enabled/disabled
Definition at line 428 of file kplugininfo.cpp.
|
static |
- Parameters
-
meta the KPluginMetaData to convert
- Returns
- a KPluginInfo object with equivalent meta data.
- Since
- 5.3
Definition at line 712 of file kplugininfo.cpp.
|
static |
- Parameters
-
list the list of KPluginMetaData objects to convert
- Returns
- a list of KPluginInfo objects with equivalent meta data.
- Since
- 5.3
Definition at line 728 of file kplugininfo.cpp.
|
static |
- Returns
- A list of KPluginInfo objects constructed from a list of KService objects. If you get a trader offer of the plugins you want to use you can just pass them to this function.
- Parameters
-
services The list of services to construct the list of KPluginInfo objects from config The config group where to save/load whether the plugin is enabled/disabled
- Deprecated:
- since 5.0, use (Q|K)PluginLoader instead and build the metadata into the plugins using K_PLUGIN_CLASS_WITH_JSON( ..., "mypluginmetadata.json")
Definition at line 402 of file kplugininfo.cpp.
QString KPluginInfo::icon | ( | ) | const |
- Returns
- The iconname for this plugin
Definition at line 480 of file kplugininfo.cpp.
bool KPluginInfo::isHidden | ( | ) | const |
- Returns
- Whether the plugin should be hidden.
Definition at line 441 of file kplugininfo.cpp.
bool KPluginInfo::isPluginEnabled | ( | ) | const |
- Returns
- Whether the plugin is currently loaded.
- See also
- setPluginEnabled()
- load()
Definition at line 454 of file kplugininfo.cpp.
bool KPluginInfo::isPluginEnabledByDefault | ( | ) | const |
- Returns
- The default value whether the plugin is enabled or not. Defaults to the value set in the desktop file, or if that isn't set to false.
Definition at line 461 of file kplugininfo.cpp.
bool KPluginInfo::isValid | ( | ) | const |
Returns whether the object is valid.
Treat invalid KPluginInfo objects like you would treat a null pointer.
Definition at line 349 of file kplugininfo.cpp.
QList< KService::Ptr > KPluginInfo::kcmServices | ( | ) | const |
- Returns
- A list of Service pointers if the plugin installs one or more KCModule
Definition at line 569 of file kplugininfo.cpp.
QString KPluginInfo::libraryPath | ( | ) | const |
- Returns
- The absolute path of the plugin on disk. This can be used to load the plugin from, using KPluginLoader or QPluginLoader
- Since
- 5.0
Definition at line 524 of file kplugininfo.cpp.
QString KPluginInfo::license | ( | ) | const |
- Returns
- The license keyword of this plugin.
Definition at line 542 of file kplugininfo.cpp.
void KPluginInfo::load | ( | const KConfigGroup & | config = KConfigGroup() | ) |
Load the state of the plugin - enabled or not.
- Parameters
-
config The KConfigGroup holding the information whether plugin is enabled.
Definition at line 686 of file kplugininfo.cpp.
QString KPluginInfo::name | ( | ) | const |
- Returns
- The user visible name of the plugin.
Definition at line 468 of file kplugininfo.cpp.
bool KPluginInfo::operator!= | ( | const KPluginInfo & | rhs | ) | const |
Compares two objects whether they don't share the same data.
Definition at line 370 of file kplugininfo.cpp.
bool KPluginInfo::operator< | ( | const KPluginInfo & | rhs | ) | const |
Less than relation comparing the categories and if they are the same using the names.
Definition at line 375 of file kplugininfo.cpp.
KPluginInfo & KPluginInfo::operator= | ( | const KPluginInfo & | rhs | ) |
Copies the KPluginInfo object to share the data with copy
.
Definition at line 359 of file kplugininfo.cpp.
bool KPluginInfo::operator== | ( | const KPluginInfo & | rhs | ) | const |
Compares two objects whether they share the same data.
Definition at line 365 of file kplugininfo.cpp.
bool KPluginInfo::operator> | ( | const KPluginInfo & | rhs | ) | const |
Greater than relation comparing the categories and if they are the same using the names.
Definition at line 386 of file kplugininfo.cpp.
QString KPluginInfo::pluginName | ( | ) | const |
- Returns
- The internal name of the plugin (for KParts Plugins this is the same name as set in the .rc file).
Definition at line 518 of file kplugininfo.cpp.
QVariantMap KPluginInfo::properties | ( | ) | const |
- Returns
- All properties of this object. This can be used to read custom values.
- Since
- 5.3
- See also
- KPluginInfo::property()
Definition at line 666 of file kplugininfo.cpp.
- Returns
- The value associated to the
key
. You can use it if you want to read custom values. To do this you need to define your own servicetype and add it to the ServiceTypes keys.
Definition at line 595 of file kplugininfo.cpp.
void KPluginInfo::save | ( | KConfigGroup | config = KConfigGroup() | ) |
Save state of the plugin - enabled or not.
- Parameters
-
config The KConfigGroup holding the information whether plugin is enabled.
Definition at line 671 of file kplugininfo.cpp.
KService::Ptr KPluginInfo::service | ( | ) | const |
- Returns
- The KService object for this plugin. You might need it if you want to read custom values. To do this you need to define your own servicetype and add it to the ServiceTypes keys. Then you can use the KService::property() method to read your keys.
- See also
- property()
- Deprecated:
- since 5.70, use KPluginMetaData and KPluginLoader(info.libraryPath())
Definition at line 562 of file kplugininfo.cpp.
QStringList KPluginInfo::serviceTypes | ( | ) | const |
- Returns
- A list of ServiceTypes this plugin offers
- Since
- 5.0
Definition at line 554 of file kplugininfo.cpp.
void KPluginInfo::setConfig | ( | const KConfigGroup & | config | ) |
Set the KConfigGroup to use for load()ing and save()ing the configuration.
This will be overridden by the KConfigGroup passed to save() or load() (if one is passed).
Definition at line 583 of file kplugininfo.cpp.
void KPluginInfo::setPluginEnabled | ( | bool | enabled | ) |
Set whether the plugin is currently loaded.
- See also
- isPluginEnabled()
- save()
Definition at line 447 of file kplugininfo.cpp.
KPluginMetaData KPluginInfo::toMetaData | ( | ) | const |
- Returns
- a KPluginMetaData object with equivalent meta data.
- Since
- 5.3
Definition at line 717 of file kplugininfo.cpp.
|
static |
- Parameters
-
info the KPluginInfo object to convert
- Returns
- a KPluginMetaData object with equivalent meta data.
- Since
- 5.3
Definition at line 723 of file kplugininfo.cpp.
|
static |
- Parameters
-
list the list of KPluginInfo objects to convert
- Returns
- a list of KPluginMetaData objects with equivalent meta data.
- Since
- 5.3
Definition at line 738 of file kplugininfo.cpp.
QString KPluginInfo::version | ( | ) | const |
- Returns
- The version of the plugin.
Definition at line 530 of file kplugininfo.cpp.
QString KPluginInfo::website | ( | ) | const |
- Returns
- The website of the plugin/author.
Definition at line 536 of file kplugininfo.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2021 The KDE developers.
Generated on Wed Jan 20 2021 22:51:23 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.