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

KDECore

Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
KPluginInfo Class Reference

#include <kplugininfo.h>

Public Types

typedef QList< KPluginInfo > List
 

Public Member Functions

 KPluginInfo (const QString &filename, const char *resource=0)
 
 KPluginInfo (const KService::Ptr service)
 
 KPluginInfo ()
 
 KPluginInfo (const KPluginInfo &copy)
 
 ~KPluginInfo ()
 
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
 
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
 

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 &)
 

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.nosp@m.@kde.nosp@m..org

Definition at line 43 of file kplugininfo.h.

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
filenameThe filename of the .desktop file.
resourceIf filename is relative, you need to specify a resource type (e.g. "service", "apps"... KStandardDirs). Otherwise, resource isn't used.

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

KPluginInfo::KPluginInfo ( )

Creates an invalid plugin.

See also
isValid

Definition at line 138 of file kplugininfo.cpp.

KPluginInfo::~KPluginInfo ( )

Definition at line 191 of file kplugininfo.cpp.

KPluginInfo::KPluginInfo ( const KPluginInfo &  copy)

Creates a KPluginInfo object that shares the data with copy.

Definition at line 148 of file kplugininfo.cpp.

Member Function Documentation

QString KPluginInfo::author ( ) const
Returns
The author of this plugin.

Definition at line 279 of file kplugininfo.cpp.

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

Definition at line 291 of file kplugininfo.cpp.

QString KPluginInfo::comment ( ) const
Returns
A comment describing the plugin.

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

void KPluginInfo::defaults ( )

Restore defaults (enabled or not).

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

QString KPluginInfo::email ( ) const
Returns
The email address of the author.

Definition at line 285 of file kplugininfo.cpp.

QString KPluginInfo::entryPath ( ) const
Returns
The file containing the information about the plugin.

Definition at line 273 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
filesThe list of files to construct the list of KPluginInfo objects from
configThe config group where to save/load whether the plugin is enabled/disabled

Definition at line 208 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
componentNameUse the component name to look up all KParts plugins for it.
configThe config group where to save/load whether the plugin is enabled/disabled

Definition at line 220 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
servicesThe list of services to construct the list of KPluginInfo objects from
configThe config group where to save/load whether the plugin is enabled/disabled

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

QString KPluginInfo::icon ( ) const
Returns
The iconname for this plugin

Definition at line 267 of file kplugininfo.cpp.

bool KPluginInfo::isHidden ( ) const
Returns
Whether the plugin should be hidden.

Definition at line 228 of file kplugininfo.cpp.

bool KPluginInfo::isPluginEnabled ( ) const
Returns
Whether the plugin is currently loaded.
See also
setPluginEnabled()
load()

Definition at line 241 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 248 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 143 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 339 of file kplugininfo.cpp.

QString KPluginInfo::license ( ) const
Returns
The license keyword of this plugin.

Definition at line 315 of file kplugininfo.cpp.

void KPluginInfo::load ( const KConfigGroup &  config = KConfigGroup())

Load the state of the plugin - enabled or not.

Parameters
configThe KConfigGroup holding the information whether plugin is enabled.

Definition at line 390 of file kplugininfo.cpp.

QString KPluginInfo::name ( ) const
Returns
The user visible name of the plugin.

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

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

Copies the KPluginInfo object to share the data with copy.

Definition at line 153 of file kplugininfo.cpp.

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

Compares two objects whether they share the same data.

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

QVariant KPluginInfo::property ( const QString &  key) const
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 366 of file kplugininfo.cpp.

void KPluginInfo::save ( KConfigGroup  config = KConfigGroup())

Save state of the plugin - enabled or not.

Parameters
configThe KConfigGroup holding the information whether plugin is enabled.

Definition at line 375 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 333 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 354 of file kplugininfo.cpp.

void KPluginInfo::setPluginEnabled ( bool  enabled)

Set whether the plugin is currently loaded.

See also
isPluginEnabled()
save()

Definition at line 234 of file kplugininfo.cpp.

QString KPluginInfo::version ( ) const
Returns
The version of the plugin.

Definition at line 303 of file kplugininfo.cpp.

QString KPluginInfo::website ( ) const
Returns
The website of the plugin/author.

Definition at line 309 of file kplugininfo.cpp.

Friends And Related Function Documentation

uint qHash ( const KPluginInfo &  )
friend

Definition at line 411 of file kplugininfo.cpp.


The documentation for this class was generated from the following files:
  • kplugininfo.h
  • kplugininfo.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:13 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDECore

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal