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

KUtils

KPluginInfo Class Reference
[Main classes, Plugin handling classes]

Information about a plugin. More...

#include <kplugininfo.h>

List of all members.


Public Types

typedef QValueList< KPluginInfo * > List

Public Member Functions

const QString & author () const
const QString & category () const
const QString & comment () const
KConfig * config () const
const QString & configgroup () const
virtual void defaults ()
const QStringList & dependencies () const
const QString & email () const
const QString & icon () const
bool isHidden () const
virtual bool isPluginEnabled () const
bool isPluginEnabledByDefault () const
const QValueList< KService::Ptr > & kcmServices () const
 KPluginInfo (const KService::Ptr service)
 KPluginInfo (const QString &filename, const char *resource=0)
const QString & license () const
virtual void load (KConfigGroup *config=0)
const QString & name () const
QVariant operator[] (const QString &key) const
const QString & pluginName () const
QVariant property (const QString &key) const
virtual void save (KConfigGroup *config=0)
KService::Ptr service () const
void setConfig (KConfig *config, const QString &group)
virtual void setPluginEnabled (bool enabled)
const QString & specfile () const
const QString & version () const
const QString & website () const
virtual ~KPluginInfo ()

Static Public Member Functions

static KPluginInfo::List fromFiles (const QStringList &files, KConfig *config=0, const QString &group=QString::null)
static KPluginInfo::List fromKPartsInstanceName (const QString &, KConfig *config=0, const QString &group=QString::null)
static KPluginInfo::List fromServices (const KService::List &services, KConfig *config=0, const QString &group=QString::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.

Author:
Matthias Kretz <kretz@kde.org>
Since:
3.2

Definition at line 42 of file kplugininfo.h.


Member Typedef Documentation

typedef QValueList<KPluginInfo*> KPluginInfo::List

Definition at line 45 of file kplugininfo.h.


Constructor & Destructor Documentation

KPluginInfo::KPluginInfo ( const QString &  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-KDE 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-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 70 of file kplugininfo.cpp.

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

KPluginInfo::~KPluginInfo (  )  [virtual]

Definition at line 149 of file kplugininfo.cpp.


Member Function Documentation

const QString & KPluginInfo::author (  )  const

Returns:
The author of this plugin.

Definition at line 230 of file kplugininfo.cpp.

const QString & KPluginInfo::category (  )  const

Returns:
The category of this plugin (e.g. playlist/skin).

Definition at line 240 of file kplugininfo.cpp.

const QString & KPluginInfo::comment (  )  const

Returns:
A comment describing the plugin.

Definition at line 215 of file kplugininfo.cpp.

KConfig * KPluginInfo::config (  )  const

Returns:
If the KPluginInfo object has a KConfig object set return it, else return 0.

Definition at line 296 of file kplugininfo.cpp.

const QString & KPluginInfo::configgroup (  )  const

Returns:
The groupname used in the KConfig object for load()ing and save()ing whether the plugin is enabled.

Definition at line 301 of file kplugininfo.cpp.

void KPluginInfo::defaults (  )  [virtual]

Restore defaults (enabled or not).

Definition at line 353 of file kplugininfo.cpp.

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

const QString & KPluginInfo::email (  )  const

Returns:
The email address of the author.

Definition at line 235 of file kplugininfo.cpp.

QValueList< KPluginInfo * > KPluginInfo::fromFiles ( const QStringList &  files,
KConfig *  config = 0,
const QString &  group = QString::null 
) [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.

Definition at line 168 of file kplugininfo.cpp.

QValueList< KPluginInfo * > KPluginInfo::fromKPartsInstanceName ( const QString &  name,
KConfig *  config = 0,
const QString &  group = QString::null 
) [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 KInstance object.

Definition at line 180 of file kplugininfo.cpp.

QValueList< KPluginInfo * > KPluginInfo::fromServices ( const KService::List &  services,
KConfig *  config = 0,
const QString &  group = QString::null 
) [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.

const QString & KPluginInfo::icon (  )  const

Returns:
The iconname for this plugin

Definition at line 220 of file kplugininfo.cpp.

bool KPluginInfo::isHidden (  )  const

Returns:
Whether the plugin should be hidden.

Definition at line 187 of file kplugininfo.cpp.

bool KPluginInfo::isPluginEnabled (  )  const [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.

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.

const QValueList< KService::Ptr > & KPluginInfo::kcmServices (  )  const

Returns:
A list of Service pointers if the plugin installs one or more KCModule

Definition at line 275 of file kplugininfo.cpp.

const QString & KPluginInfo::license (  )  const

Returns:
The license of this plugin.

Definition at line 260 of file kplugininfo.cpp.

void KPluginInfo::load ( KConfigGroup *  config = 0  )  [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 KConfigGroup holding the information whether plugin is enabled.

Definition at line 336 of file kplugininfo.cpp.

const QString & KPluginInfo::name (  )  const

Returns:
The user visible name of the plugin.

Definition at line 210 of file kplugininfo.cpp.

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

const 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 245 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.
See also:
operator[]

Definition at line 306 of file kplugininfo.cpp.

void KPluginInfo::save ( KConfigGroup *  config = 0  )  [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 KConfigGroup holding the information whether plugin is enabled.

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

void KPluginInfo::setConfig ( KConfig *  config,
const QString &  group 
)

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

void KPluginInfo::setPluginEnabled ( bool  enabled  )  [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.

const QString & KPluginInfo::specfile (  )  const

Returns:
The file containing the information about the plugin.

Definition at line 225 of file kplugininfo.cpp.

const QString & KPluginInfo::version (  )  const

Returns:
The version of the plugin.

Definition at line 250 of file kplugininfo.cpp.

const QString & 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:
  • kplugininfo.h
  • kplugininfo.cpp

KUtils

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

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
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