KDE 4.7 PyKDE API Reference

- KDE's Python API

# KServiceType Class Reference

`from PyKDE4.kdecore import *`

Inherits: KSycocaEntry

## Detailed Description

A service type is, well, a type of service, where a service is an application or plugin. For instance, "KOfficeFilter", which is the type of all koffice filters, is a service type. In order to discover services of a given type, using KServiceTypeTrader. Service types are stored as desktop files in $KDEDIR/share/servicetypes.

See also:
  KService, KServiceTypeTrader

## Methods
| __init__ (self, KDesktopFile config)
| __init__ (self, QDataStream _str, int offset)
| __init__ (self, KServiceType other)
QString | comment (self)
QString | desktopEntryPath (self)
bool | inherits (self, QString servTypeName)
bool | isDerived (self)
QString | parentServiceType (self)
KSharedPtr | parentType (self)
QVariant::Type | propertyDef (self, QString _name)
QStringList | propertyDefNames (self)
{QString:QVariant::Type} | propertyDefs (self)
int | serviceOffersOffset (self)
| setServiceOffersOffset (self, int offset)
## Static Methods
[KSharedPtr] | allServiceTypes ()
KSharedPtr | serviceType (QString _name)

## Method Documentation

__init__ | ( | self, |
|  | KDesktopFile | config
| ) |  |  |

Construct a service type and take all information from a desktop file.

Parameters:

  | config | the configuration file

__init__ | ( | self, |
|  | QDataStream | _str,
|  | int | offset
| ) |  |  |

Internal:
  construct a service from a stream. The stream must already be positionned at the correct offset

__init__ | ( | self, |
|  | KServiceType | other
| ) |  |  |

QString comment | ( |  | self ) |

Returns the descriptive comment associated, if any.

Returns:
  the comment, or QString()

QString desktopEntryPath | ( |  | self ) |

Returns the relative path to the desktop entry file responsible for this servicetype. For instance inode/directory.desktop, or kpart.desktop

Returns:
  the path of the desktop file

bool inherits | ( | self, |
|  | QString | servTypeName
| ) |  |  |

Checks whether this service type is or inherits from servTypeName.

Returns:
  true if this servicetype is or inherits from servTypeName

bool isDerived | ( |  | self ) |

Checks whether this service type inherits another one.

Returns:
  true if this service type inherits another one

See also:
  parentServiceType()

QString parentServiceType | ( |  | self ) |

If this service type inherits from another service type, return the name of the parent.

Returns:
  the parent service type, or QString. null if not set

See also:
  isDerived()

KSharedPtr parentType | ( |  | self ) |

Internal:
  Pointer to parent service type

QVariant::Type propertyDef | ( | self, |
|  | QString | _name
| ) |  |  |

Returns the type of the property definition with the given _name.

Parameters:

  | _name | the name of the property

Returns:
  the property type, or null if not found

See also:
  propertyDefNames

QStringList propertyDefNames | ( |  | self ) |

Returns the list of all property definitions for this servicetype. Those are properties of the services implementing this servicetype. For instance,

     [PropertyDef.X-KDevelop-Version]
     Type=int

means that all kdevelop plugins have in their .desktop file a line like

     X-KDevelop-Version=<some value>

{QString:QVariant::Type} propertyDefs | ( |  | self ) |

int serviceOffersOffset | ( |  | self ) |

Internal:

setServiceOffersOffset | ( | self, |
|  | int | offset
| ) |  |  |

Internal:
  only used by kbuildsycoca Register offset into offers list

## Static Method Documentation

[KSharedPtr] allServiceTypes | ( |  | ) |

Returns a list of all the supported servicetypes. Useful for showing the list of available servicetypes in a listbox, for example. More memory consuming than the ones above, don't use unless really necessary.

Returns:
  the list of all services

KSharedPtr serviceType | ( | QString | _name
| ) |  |  |

Returns a pointer to the servicetype '_name' or 0L if the service type is unknown. VERY IMPORTANT : don't store the result in a KServiceType * !

Parameters:

  | _name | the name of the service type to search

Returns:
  the pointer to the service type, or 0