class KService

Represents a service, i. More...

Definition#include <kservice.h>
InheritsKSycocaEntry
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Public Static Methods

Protected Methods


Detailed Description

Represents 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.

 KService ( const QString & _fullpath )

Construct a service and take all informations from a config file

Parameters:
_fullpathfull path to the config file
_relpathrelative path wrt to $KDEDIRS/+resource

 KService ( KDesktopFile *config )

Construct a service and take all informations from a desktop file

 KService ( QDataStream& _str, int offset )

The stream must already be positionned at the correct offset

QString  type ()

[const virtual]

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

QString  name ()

[const virtual]

Returns: the name of the service.

Reimplemented from KSycocaEntry

QString  exec ()

[const]

Returns: the command that the service executes.

QString  library ()

[const]

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

int  libraryMajor ()

[const]

Returns: the major number of the library.

See also: library, libraryMinor

int  libraryMinor ()

[const]

Returns: the minor number of the library.

See also: library, libraryMajor

QStringList  libraryDependencies ()

[const]

Returns: the libraries on which this service depends. That is only of interest if the service itelf is a library.

QString  icon ()

[const]

Returns: the icon associated with the service.

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

[const]

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

bool  terminal ()

[const]

Returns: Run the service in a terminal?

QString  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 ()

[const]

Returns: If the service has to be run under a different uid.

QString  username ()

[const]

Returns: The username as which the service has to be run.

QString  desktopEntryPath ()

[const]

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.

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

QString  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 }

DCOPServiceType_t  DCOPServiceType ()

[const]

Returns: The DCOPServiceType supported by this service.

QString  path ()

[const]

Returns: the working directory to run the program in

QString  comment ()

[const]

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

QStringList  serviceTypes ()

[const]

Returns: the service types that this service supports

bool  hasServiceType ( const QString& _service )

[const]

Parameters:
_serviceis the 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 ()

[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 ()

[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.

QVariant  property ( const QString& _name )

[const virtual]

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

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

QStringList  propertyNames ()

[const virtual]

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

bool  isValid ()

[const]

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

Reimplemented from KSycocaEntry

void  load ( QDataStream& )

[virtual]

Load the service from a stream.

Reimplemented from KSycocaEntry

void  save ( QDataStream& )

[virtual]

Save the service to a stream.

Reimplemented from KSycocaEntry

Ptr  serviceByName ( const QString& _name )

[static]

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 )

[static]

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 )

[static]

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

[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.