class KService

Represent a service, i. More...

Definition#include <kservice.h>
InheritsKSycocaEntry (kdecore) [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Public Static Methods

Protected Methods


Detailed Description

Represent a service, i.e. an application bound to one or several mimetypes (or servicetypes) as written in its desktop entry file.

A service may be a library, too. The starting point you need is often the static methods.

typedef KSharedPtr<KService> Ptr

Ptr

typedef QValueList List

List

 KService ( const QString & _fullpath )

KService

Construct a service and take all information from a config file.

Parameters:
_fullpathFull path to the config file.

 KService ( KDesktopFile *config )

KService

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

 KService ( QDataStream& _str, int offset )

KService

Construct a service from a stream. The stream must already be positionned at the correct offset.

 ~KService ()

~KService

[virtual]

QString  type ()

type

[const virtual]

Returns the type of the service ("Application" or "Service").

QString  name ()

name

[const virtual]

Returns the name of the service.

Reimplemented from KSycocaEntry.

QString  exec ()

exec

[const]

Returns the command that the service executes.

QString  library ()

library

[const]

Returns the name of the library that contains the services implementation.

QString  init ()

init

[const]

Returns the name of the init function to call in this service during startup of KDE. (KControl modules only)

int  libraryMajor ()

libraryMajor

[const]

int  libraryMinor ()

libraryMinor

[const]

QStringList  libraryDependencies ()

libraryDependencies

[const]

QString  icon ()

icon

[const]

Returns the icon associated with the service.

QPixmap  pixmap ( int _group, int _force_size = 0, int _state = 0, QString * _path = 0L )

pixmap

[const]

Returns a pixmap for this service (finds and loads icon())

bool  terminal ()

terminal

[const]

Returns true is the service is run in a terminal.

QString  terminalOptions ()

terminalOptions

[const]

Returns any options associated with the terminal the service runs in, if it requires a terminal.

The service must be a tty-oriented program.

bool  substituteUid ()

substituteUid

[const]

Returns true if the service has to be run under a different uid.

QString  username ()

username

[const]

Returns the username under which the service has to be run.

QString  desktopEntryPath ()

desktopEntryPath

[const]

Returns the path to the location where the service desktop entry is stored.

This is a relative path if the desktop entry was found in any of the locations pointed to by $KDEDIRS (e.g. "Internet/kppp.desktop") It is a full path if the desktop entry originates from another location.

QString  desktopEntryName ()

desktopEntryName

[const]

Returns the filename of the service desktop entry without any extension. E.g. "kppp"

enum DCOPServiceType_t { DCOP_None = 0, DCOP_Unique, DCOP_Multi, DCOP_Wait }

DCOPServiceType_t

DCOPServiceType_t  DCOPServiceType ()

DCOPServiceType

[const]

Returns The DCOPServiceType supported by this service.

QString  path ()

path

[const]

Returns the working directory to run the program in.

QString  comment ()

comment

[const]

Returns the descriptive comment for the service, if there is one.

QStringList  keywords ()

keywords

[const]

Returns a list of descriptive keywords the service, if there are any.

bool  mapNotify ()

mapNotify

[const]

QStringList  serviceTypes ()

serviceTypes

[const]

Returns the service types that this service supports.

bool  hasServiceType ( const QString& _service )

hasServiceType

[const]

Parameters:
_serviceThe name of the service type you are interested in determining whether this services supports.

Returns: true if the service you specified is supported, otherwise false.

bool  allowAsDefault ()

allowAsDefault

[const]

Returns true if the service may be used as a default setting, for example in a file manager. Usually that is the case, but some services may only be started when the user selected them. This kind of services returns false here.

int  initialPreference ()

initialPreference

[const]

What preference to associate with this service initially (before the user has had any chance to define a profile for it) The bigger the value, the most preferred the service is.

void  setInitialPreference ( int i )

setInitialPreference

bool  noDisplay ()

noDisplay

[const]

Whether the entry should be suppressed in menus.

QVariant  property ( const QString& _name )

property

[const virtual]

Returns the requested properties. Some often used properties have convenience access functions like exec(), serviceTypes etc.

It depends upon the serviceTypes() of this service which properties a service can have.

See also: KServiceType

QStringList  propertyNames ()

propertyNames

[const virtual]

Returns the list of all properties that this service can have. That means, that some properties may be empty.

bool  isValid ()

isValid

[const]

Returns true if the service is valid (e.g. name is not empty)

Reimplemented from KSycocaEntry.

void  load ( QDataStream& )

load

[virtual]

Load the service from a stream.

Reimplemented from KSycocaEntry.

void  save ( QDataStream& )

save

[virtual]

Save the service to a stream.

Reimplemented from KSycocaEntry.

Ptr  serviceByName ( const QString& _name )

serviceByName

[static]

Find a service by name, i.e. the translated Name field. You should really not use this method, since the name is translated.

Returns a pointer to the requested service or 0 if the service is unknown. Very important: Don't store the result in a KService * !

Ptr  serviceByDesktopPath ( const QString& _name )

serviceByDesktopPath

[static]

Find a service by its relative path to the applnk or services directory, for instance "Internet/konqbrowser.desktop". Better not use it for menu entries though, since the user can move them. It's ok to use it for services though (e.g. "http_cache_cleaner.desktop")

Returns a pointer to the requested service or 0 if the service is unknown. Very important: Don't store the result in a KService * !

Ptr  serviceByDesktopName ( const QString& _name )

serviceByDesktopName

[static]

Find a service by the name of its desktop file, not depending on its actual location (as long as it's under the applnk or service directories). For instance "konqbrowser" or "kcookiejar". Note that the ".desktop" extension is implicit.

This is the recommended method (safe even if the user moves stuff) but note that it assumes that no two entries have the same filename.

Returns a pointer to the requested service or 0 if the service is unknown. Very important: Don't store the result in a KService * !

List  allServices ()

allServices

[static]

Returns the whole list of services.

Useful for being able to to display them in a list box, for example. More memory consuming than the ones above, don't use unless really necessary.

List  allInitServices ()

allInitServices

[static]

Returns all services that require initialisation.

Only needed by "kcminit"

void  init (KDesktopFile *config)

init

[protected]

QStringListaccessServiceTypes ()

accessServiceTypes

[protected]