• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KDECore

KPluginInfo Class Reference

#include <kplugininfo.h>

List of all members.


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.

Author:
Matthias Kretz <kretz@kde.org>

Definition at line 43 of file kplugininfo.h.


Public Types

typedef QList< KPluginInfo > List

Public Member Functions

QString author () const
QString category () const
QString comment () const
KConfigGroup config () const
void defaults ()
QStringList dependencies () const
QString email () const
QString entryPath () const
KAboutLicense fullLicense () const
QString icon () const
bool isHidden () const
bool isPluginEnabled () const
bool isPluginEnabledByDefault () const
bool isValid () const
QList< KService::Ptr > kcmServices () const
 KPluginInfo (const KPluginInfo &copy)
 KPluginInfo ()
 KPluginInfo (const KService::Ptr service)
 KPluginInfo (const QString &filename, const char *resource=0)
QString license () const
void load (const KConfigGroup &config=KConfigGroup())
QString name () const
bool operator!= (const KPluginInfo &rhs) const
bool operator< (const KPluginInfo &rhs) const
KPluginInfo & operator= (const KPluginInfo &rhs)
bool operator== (const KPluginInfo &rhs) const
bool operator> (const KPluginInfo &rhs) const
QString pluginName () const
QVariant property (const QString &key) const
void save (KConfigGroup config=KConfigGroup())
KService::Ptr service () const
void setConfig (const KConfigGroup &config)
void setPluginEnabled (bool enabled)
QString version () const
QString website () const
 ~KPluginInfo ()

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::List fromServices (const KService::List &services, const KConfigGroup &config=KConfigGroup())

Friends

uint qHash (const KPluginInfo &)

Member Typedef Documentation

typedef QList<KPluginInfo> KPluginInfo::List

Definition at line 46 of file kplugininfo.h.


Constructor & Destructor Documentation

KPluginInfo::KPluginInfo ( const QString &  filename,
const char *  resource = 0 
) [explicit]

Read plugin info from filename.

The file should be of the following form:

           [Desktop Entry]
           Encoding=UTF-8
           Icon=mypluginicon
           Type=Service
           ServiceTypes=KPluginInfo

           Name=User Visible Name
           Comment=Description of what the plugin does

           X-KDE-PluginInfo-Author=Author's Name
           X-KDE-PluginInfo-Email=author@foo.bar
           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 74 of file kplugininfo.cpp.

KPluginInfo::KPluginInfo ( const KService::Ptr  service  )  [explicit]

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-KDE-PluginInfo-Author=Author's Name
           X-KDE-PluginInfo-Email=author@foo.bar
           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.

Definition at line 101 of file kplugininfo.cpp.

KPluginInfo::KPluginInfo (  ) 

Creates an invalid plugin.

See also:
isValid

Definition at line 133 of file kplugininfo.cpp.

KPluginInfo::~KPluginInfo (  ) 

Definition at line 186 of file kplugininfo.cpp.

KPluginInfo::KPluginInfo ( const KPluginInfo &  copy  ) 

Creates a KPluginInfo object that shares the data with copy.

Definition at line 143 of file kplugininfo.cpp.


Member Function Documentation

QString KPluginInfo::author (  )  const

Returns:
The author of this plugin.

Definition at line 274 of file kplugininfo.cpp.

QString KPluginInfo::category (  )  const

Returns:
The category of this plugin (e.g.

playlist/skin).

Definition at line 286 of file kplugininfo.cpp.

QString KPluginInfo::comment (  )  const

Returns:
A comment describing the plugin.

Definition at line 256 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 356 of file kplugininfo.cpp.

void KPluginInfo::defaults (  ) 

Restore defaults (enabled or not).

Definition at line 401 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 322 of file kplugininfo.cpp.

QString KPluginInfo::email (  )  const

Returns:
The email address of the author.

Definition at line 280 of file kplugininfo.cpp.

QString KPluginInfo::entryPath (  )  const

Returns:
The file containing the information about the plugin.

Definition at line 268 of file kplugininfo.cpp.

QList< KPluginInfo > KPluginInfo::fromFiles ( const QStringList &  files,
const KConfigGroup &  config = KConfigGroup() 
) [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 203 of file kplugininfo.cpp.

QList< KPluginInfo > KPluginInfo::fromKPartsInstanceName ( const QString &  componentName,
const KConfigGroup &  config = KConfigGroup() 
) [static]

Returns:
A list of KPluginInfo objects for the KParts plugins of a component.

You only need the name of the component not a pointer to the KComponentData object.

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 215 of file kplugininfo.cpp.

QList< KPluginInfo > KPluginInfo::fromServices ( const KService::List &  services,
const KConfigGroup &  config = KConfigGroup() 
) [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

Definition at line 190 of file kplugininfo.cpp.

KAboutLicense KPluginInfo::fullLicense (  )  const

Returns:
The full license object, according to the license keyword.

It can be used to present friendlier and more detailed license info to the user, when the license is one of the widespread within KDE. For other licenses, the license object will state not very useful, "custom license" info (this can be identified by KAboutLicense::key() returning KAboutData::License_Custom).

See also:
KAboutLicense::byKeyword()
Since:
4.1

Definition at line 316 of file kplugininfo.cpp.

QString KPluginInfo::icon (  )  const

Returns:
The iconname for this plugin

Definition at line 262 of file kplugininfo.cpp.

bool KPluginInfo::isHidden (  )  const

Returns:
Whether the plugin should be hidden.

Definition at line 223 of file kplugininfo.cpp.

bool KPluginInfo::isPluginEnabled (  )  const

Returns:
Whether the plugin is currently loaded.

See also:
setPluginEnabled()

load()

Definition at line 236 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 243 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 138 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 334 of file kplugininfo.cpp.

QString KPluginInfo::license (  )  const

Returns:
The license keyword of this plugin.

Definition at line 310 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 386 of file kplugininfo.cpp.

QString KPluginInfo::name (  )  const

Returns:
The user visible name of the plugin.

Definition at line 250 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 159 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 164 of file kplugininfo.cpp.

KPluginInfo & KPluginInfo::operator= ( const KPluginInfo &  rhs  ) 

Copies the KPluginInfo object to share the data with copy.

Definition at line 148 of file kplugininfo.cpp.

bool KPluginInfo::operator== ( const KPluginInfo &  rhs  )  const

Compares two objects whether they share the same data.

Definition at line 154 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 175 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 292 of file kplugininfo.cpp.

QVariant KPluginInfo::property ( const QString &  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.

Definition at line 362 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 371 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()

Definition at line 328 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 350 of file kplugininfo.cpp.

void KPluginInfo::setPluginEnabled ( bool  enabled  ) 

Set whether the plugin is currently loaded.

See also:
isPluginEnabled()

save()

Definition at line 229 of file kplugininfo.cpp.

QString KPluginInfo::version (  )  const

Returns:
The version of the plugin.

Definition at line 298 of file kplugininfo.cpp.

QString KPluginInfo::website (  )  const

Returns:
The website of the plugin/author.

Definition at line 304 of file kplugininfo.cpp.


Friends And Related Function Documentation

uint qHash ( const KPluginInfo &   )  [friend]

Definition at line 407 of file kplugininfo.cpp.


The documentation for this class was generated from the following files:
  • kplugininfo.h
  • kplugininfo.cpp

KDECore

Skip menu "KDECore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal