#include <kplugininfo.h>
Public Types | |
typedef TQValueList< KPluginInfo * > | List |
Public Member Functions | |
KPluginInfo (const TQString &filename, const char *resource=0) | |
KPluginInfo (const KService::Ptr service) | |
bool | isHidden () const |
virtual void | setPluginEnabled (bool enabled) |
virtual bool | isPluginEnabled () const |
bool | isPluginEnabledByDefault () const |
TQVariant | property (const TQString &key) const |
TQVariant | operator[] (const TQString &key) const |
const TQString & | name () const |
const TQString & | comment () const |
const TQString & | icon () const |
const TQString & | specfile () const |
const TQString & | author () const |
const TQString & | email () const |
const TQString & | category () const |
const TQString & | pluginName () const |
const TQString & | version () const |
const TQString & | website () const |
const TQString & | license () const |
const TQStringList & | dependencies () const |
KService::Ptr | service () const |
const TQValueList< KService::Ptr > & | kcmServices () const |
void | setConfig (TDEConfig *config, const TQString &group) |
TDEConfig * | config () const |
const TQString & | configgroup () const |
virtual void | save (TDEConfigGroup *config=0) |
virtual void | load (TDEConfigGroup *config=0) |
virtual void | defaults () |
Static Public Member Functions | |
static KPluginInfo::List | fromServices (const KService::List &services, TDEConfig *config=0, const TQString &group=TQString::null) |
static KPluginInfo::List | fromFiles (const TQStringList &files, TDEConfig *config=0, const TQString &group=TQString::null) |
static KPluginInfo::List | fromKPartsInstanceName (const TQString &, TDEConfig *config=0, const TQString &group=TQString::null) |
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.
- Since
- 3.2
Definition at line 42 of file kplugininfo.h.
Constructor & Destructor Documentation
◆ KPluginInfo() [1/2]
KPluginInfo::KPluginInfo | ( | const TQString & | filename, |
const char * | resource = 0 |
||
) |
Read plugin info from filename
.
The file should be of the following form:
[Desktop Entry] Name=User Visible Name Comment=Description of what the plugin does [X-TDE Plugin Info] Author=Author's Name Email=author@foo.bar PluginName=internalname Version=1.1 Website=http://www.plugin.org/ Category=playlist Depends=plugin1,plugin3 License=GPL EnabledByDefault=true
The first two entries in the "Desktop Entry" group always need to be present.
The "X-TDE-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"... TDEStandardDirs). Otherwise, resource isn't used.
Definition at line 70 of file kplugininfo.cpp.
◆ KPluginInfo() [2/2]
KPluginInfo::KPluginInfo | ( | const KService::Ptr | service | ) |
Read plugin info from a KService object.
The .desktop file should look like this:
[Desktop Entry] Encoding=UTF-8 Icon=mypluginicon Type=Service ServiceTypes=KPluginInfo X-TDE-PluginInfo-Author=Author's Name X-TDE-PluginInfo-Email=author@foo.bar X-TDE-PluginInfo-Name=internalname X-TDE-PluginInfo-Version=1.1 X-TDE-PluginInfo-Website=http://www.plugin.org/ X-TDE-PluginInfo-Category=playlist X-TDE-PluginInfo-Depends=plugin1,plugin3 X-TDE-PluginInfo-License=GPL X-TDE-PluginInfo-EnabledByDefault=true Name=User Visible Name Comment=Description of what the plugin does
In the first three entries the Icon entry is optional.
Definition at line 115 of file kplugininfo.cpp.
Member Function Documentation
◆ author()
const TQString & KPluginInfo::author | ( | ) | const |
- Returns
- The author of this plugin.
Definition at line 230 of file kplugininfo.cpp.
◆ category()
const TQString & KPluginInfo::category | ( | ) | const |
- Returns
- The category of this plugin (e.g. playlist/skin).
Definition at line 240 of file kplugininfo.cpp.
◆ comment()
const TQString & KPluginInfo::comment | ( | ) | const |
- Returns
- A comment describing the plugin.
Definition at line 215 of file kplugininfo.cpp.
◆ config()
TDEConfig * KPluginInfo::config | ( | ) | const |
- Returns
- If the KPluginInfo object has a TDEConfig object set return it, else return 0.
Definition at line 296 of file kplugininfo.cpp.
◆ configgroup()
const TQString & KPluginInfo::configgroup | ( | ) | const |
- Returns
- The groupname used in the TDEConfig object for load()ing and save()ing whether the plugin is enabled.
Definition at line 301 of file kplugininfo.cpp.
◆ defaults()
|
virtual |
Restore defaults (enabled or not).
Definition at line 353 of file kplugininfo.cpp.
◆ dependencies()
const TQStringList & KPluginInfo::dependencies | ( | ) | const |
- Returns
- A list of plugins required for this plugin to be enabled. Use the pluginName in this list.
Definition at line 265 of file kplugininfo.cpp.
◆ email()
const TQString & KPluginInfo::email | ( | ) | const |
- Returns
- The email address of the author.
Definition at line 235 of file kplugininfo.cpp.
◆ fromFiles()
|
static |
- Returns
- A list of KPluginInfo objects constructed from a list of filenames. If you make a lookup using, for example, TDEStandardDirs::findAllResources() you pass the list of files to this function.
Definition at line 168 of file kplugininfo.cpp.
◆ fromKPartsInstanceName()
|
static |
- Returns
- A list of KPluginInfo objects for the KParts plugins of an instance. You only need the name of the instance not a pointer to the TDEInstance object.
Definition at line 180 of file kplugininfo.cpp.
◆ fromServices()
|
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.
Definition at line 154 of file kplugininfo.cpp.
◆ icon()
const TQString & KPluginInfo::icon | ( | ) | const |
- Returns
- The iconname for this plugin
Definition at line 220 of file kplugininfo.cpp.
◆ isHidden()
bool KPluginInfo::isHidden | ( | ) | const |
- Returns
- Whether the plugin should be hidden.
Definition at line 187 of file kplugininfo.cpp.
◆ isPluginEnabled()
|
virtual |
- Returns
- Whether the plugin is currently loaded.
You might need to reimplement this method for special needs.
- See also
- setPluginEnabled()
- load()
Definition at line 198 of file kplugininfo.cpp.
◆ isPluginEnabledByDefault()
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 204 of file kplugininfo.cpp.
◆ kcmServices()
const TQValueList< KService::Ptr > & KPluginInfo::kcmServices | ( | ) | const |
- Returns
- A list of Service pointers if the plugin installs one or more TDECModule
Definition at line 275 of file kplugininfo.cpp.
◆ license()
const TQString & KPluginInfo::license | ( | ) | const |
- Returns
- The license of this plugin.
Definition at line 260 of file kplugininfo.cpp.
◆ load()
|
virtual |
Load the state of the plugin - enabled or not.
This function is provided for reimplementation if you need to save somewhere else.
- Parameters
-
config The TDEConfigGroup holding the information whether plugin is enabled.
Definition at line 336 of file kplugininfo.cpp.
◆ name()
const TQString & KPluginInfo::name | ( | ) | const |
- Returns
- The user visible name of the plugin.
Definition at line 210 of file kplugininfo.cpp.
◆ operator[]()
TQVariant KPluginInfo::operator[] | ( | const TQString & | key | ) | const |
This is the same as property().
It is provided for convenience.
- Returns
- The value associated with the
key
.
- See also
- property()
Definition at line 314 of file kplugininfo.cpp.
◆ pluginName()
const TQString & 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 245 of file kplugininfo.cpp.
◆ property()
TQVariant KPluginInfo::property | ( | const TQString & | key | ) | const |
- Returns
- The value associated the 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.
- See also
- operator[]
Definition at line 306 of file kplugininfo.cpp.
◆ save()
|
virtual |
Save state of the plugin - enabled or not.
This function is provided for reimplementation if you need to save somewhere else.
- Parameters
-
config The TDEConfigGroup holding the information whether plugin is enabled.
Definition at line 319 of file kplugininfo.cpp.
◆ service()
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()
Definition at line 270 of file kplugininfo.cpp.
◆ setConfig()
void KPluginInfo::setConfig | ( | TDEConfig * | config, |
const TQString & | group | ||
) |
Set the TDEConfigGroup to use for load()ing and save()ing the configuration.
This will be overridden by the TDEConfigGroup passed to save() or load() (if one is passed).
Definition at line 290 of file kplugininfo.cpp.
◆ setPluginEnabled()
|
virtual |
Set whether the plugin is currently loaded.
You might need to reimplement this method for special needs.
- See also
- isPluginEnabled()
- save()
Definition at line 192 of file kplugininfo.cpp.
◆ specfile()
const TQString & KPluginInfo::specfile | ( | ) | const |
- Returns
- The file containing the information about the plugin.
Definition at line 225 of file kplugininfo.cpp.
◆ version()
const TQString & KPluginInfo::version | ( | ) | const |
- Returns
- The version of the plugin.
Definition at line 250 of file kplugininfo.cpp.
◆ website()
const TQString & KPluginInfo::website | ( | ) | const |
- Returns
- The website of the plugin/author.
Definition at line 255 of file kplugininfo.cpp.
The documentation for this class was generated from the following files: