• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdeio
 

tdeio/tdeio

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

#include <kservice.h>

Inherits KSycocaEntry.

Public Types

enum  DCOPServiceType_t { DCOP_None = 0 , DCOP_Unique , DCOP_Multi , DCOP_Wait }
 
typedef TDESharedPtr< KService > Ptr
 
typedef TQValueList< Ptr > List
 

Public Member Functions

 KService (const TQString &_name, const TQString &_exec, const TQString &_icon)
 
 KService (const TQString &_fullpath)
 
 KService (KDesktopFile *config)
 
 KService (TQDataStream &_str, int offset)
 
virtual TQString type () const
 
virtual TQString name () const
 
TQString exec () const
 
TQString library () const
 
TQString init () const
 
TQString icon () const
 
TQPixmap pixmap (TDEIcon::Group _group, int _force_size=0, int _state=0, TQString *_path=0L) const
 
bool terminal () const
 
TQString terminalOptions () const
 
bool substituteUid () const
 
TQString username () const
 
TQString desktopEntryPath () const
 
TQString desktopEntryName () const
 
TQString menuId () const
 
TQString storageId () const
 
DCOPServiceType_t DCOPServiceType () const
 
TQString path () const
 
TQString comment () const
 
TQString genericName () const
 
TQString untranslatedGenericName () const
 
TQStringList keywords () const
 
TQStringList categories () const
 
TQStringList serviceTypes () const
 
bool hasServiceType (const TQString &_service) const
 
bool allowAsDefault () const
 
bool allowMultipleFiles () const
 
int initialPreference () const
 
int initialPreferenceForMimeType (const TQString &mimeType) const
 
void setInitialPreference (int i)
 
bool noDisplay () const
 
bool SuSEunimportant () const
 
TQString parentApp () const
 
virtual TQVariant property (const TQString &_name) const
 
TQVariant property (const TQString &_name, TQVariant::Type t) const
 
virtual TQStringList propertyNames () const
 
bool isValid () const
 
TQString locateLocal ()
 
virtual void load (TQDataStream &)
 
virtual void save (TQDataStream &)
 
void setMenuId (const TQString &menuId)
 
void setTerminal (bool b)
 
void setTerminalOptions (const TQString &options)
 

Static Public Member Functions

static Ptr serviceByName (const TQString &_name)
 
static Ptr serviceByDesktopPath (const TQString &_path)
 
static Ptr serviceByDesktopName (const TQString &_name)
 
static Ptr serviceByMenuId (const TQString &_menuId)
 
static Ptr serviceByStorageId (const TQString &_storageId)
 
static List allServices ()
 
static List allInitServices ()
 
static TQString newServicePath (bool showInMenu, const TQString &suggestedName, TQString *menuId=0, const TQStringList *reservedMenuIds=0)
 
static void rebuildKSycoca (TQWidget *parent)
 

Protected Member Functions

void init (KDesktopFile *config)
 
TQStringList & accessServiceTypes ()
 
virtual void virtual_hook (int id, void *data)
 

Friends

class KBuildSycoca
 

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. Service types are stored as desktop files in the "service" resource..

See also
KServiceType
KServiceGroup
Author
Torben Weis weis@.nosp@m.kde..nosp@m.org

Definition at line 48 of file kservice.h.

Member Typedef Documentation

◆ List

typedef TQValueList<Ptr> KService::List

Definition at line 56 of file kservice.h.

◆ Ptr

typedef TDESharedPtr<KService> KService::Ptr

Definition at line 55 of file kservice.h.

Member Enumeration Documentation

◆ DCOPServiceType_t

enum KService::DCOPServiceType_t

Describes the DCOP type of the service.

  • None - This service has no DCOP support
  • Unique - This service provides a unique DCOP service. The service name is equal to the desktopEntryName.
  • Multi - This service provides a DCOP service which can be run with multiple instances in parallel. The service name of an instance is equal to the desktopEntryName + "-" + the PID of the process.
  • Wait - This service has no DCOP support, the launcher will wait till it is finished.

Definition at line 213 of file kservice.h.

Constructor & Destructor Documentation

◆ KService() [1/4]

KService::KService ( const TQString &  _name,
const TQString &  _exec,
const TQString &  _icon 
)

Construct a temporary service with a given name, exec-line and icon.

Parameters
_namethe name of the service
_execthe executable
_iconthe name of the icon

Definition at line 64 of file kservice.cpp.

◆ KService() [2/4]

KService::KService ( const TQString &  _fullpath)
explicit

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

Parameters
_fullpathFull path to the config file.

Definition at line 80 of file kservice.cpp.

◆ KService() [3/4]

KService::KService ( KDesktopFile *  config)

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

Parameters
configthe desktop file to read

Definition at line 88 of file kservice.cpp.

◆ KService() [4/4]

KService::KService ( TQDataStream &  _str,
int  offset 
)

Definition at line 320 of file kservice.cpp.

◆ ~KService()

KService::~KService ( )
virtual

Definition at line 326 of file kservice.cpp.

Member Function Documentation

◆ accessServiceTypes()

TQStringList & KService::accessServiceTypes ( )
inlineprotected

Definition at line 526 of file kservice.h.

◆ allInitServices()

KService::List KService::allInitServices ( )
static

Returns all services that require initialisation.

Only needed by "kcminit"

Returns
the list of all services that need to be initialized

Definition at line 721 of file kservice.cpp.

◆ allowAsDefault()

bool KService::allowAsDefault ( ) const
inline

Set to true if it is allowed to use this service as the default (main) action for the files it supports (e.g.

Left Click in a file manager, or KRun in general).

If not, then this service is only available in RMB popups, so it must be selected explicitely by the user in order to be used. Note that servicemenus supersede this functionality though, at least in konqueror.

Returns
true if the service may be used as the default (main) handler

Definition at line 292 of file kservice.h.

◆ allowMultipleFiles()

bool KService::allowMultipleFiles ( ) const

Checks whether this service can handle several files as startup arguments.

Returns
true if multiple files may be passed to this service at startup. False if only one file at a time may be passed.

Definition at line 824 of file kservice.cpp.

◆ allServices()

KService::List KService::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.

Returns
the list of all services

Definition at line 663 of file kservice.cpp.

◆ categories()

TQStringList KService::categories ( ) const

Returns a list of VFolder categories.

Returns
the list of VFolder categories
Since
3.1

Definition at line 833 of file kservice.cpp.

◆ comment()

TQString KService::comment ( ) const
inline

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

Returns
the descriptive comment for the service, or TQString::null if not set

Definition at line 233 of file kservice.h.

◆ DCOPServiceType()

DCOPServiceType_t KService::DCOPServiceType ( ) const
inline

Returns the DCOPServiceType supported by this service.

Returns
the DCOPServiceType supported by this service

Definition at line 219 of file kservice.h.

◆ desktopEntryName()

TQString KService::desktopEntryName ( ) const
inline

Returns the filename of the service desktop entry without any extension.

E.g. "kppp"

Returns
the name of the desktop entry without path or extension, or TQString::null if not set

Definition at line 182 of file kservice.h.

◆ desktopEntryPath()

TQString KService::desktopEntryPath ( ) const
inline

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 $TDEDIRS (e.g. "Internet/kppp.desktop") It is a full path if the desktop entry originates from another location.

Returns
the path of the service's desktop file, or TQString::null if not set

Definition at line 174 of file kservice.h.

◆ exec()

TQString KService::exec ( ) const
inline

Returns the executable.

Returns
the command that the service executes, or TQString::null if not set

Definition at line 104 of file kservice.h.

◆ genericName()

TQString KService::genericName ( ) const
inline

Returns the generic name for the service, if there is one (e.g.

"Mail Client").

Returns
the generic name, or TQString::null if not set

Definition at line 241 of file kservice.h.

◆ hasServiceType()

bool KService::hasServiceType ( const TQString &  _service) const

Checks whether the service supports this service type.

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.

Definition at line 405 of file kservice.cpp.

◆ icon()

TQString KService::icon ( ) const
inline

Returns the name of the icon.

Returns
the icon associated with the service, or "unknown" if not set

Definition at line 125 of file kservice.h.

◆ init() [1/2]

TQString KService::init ( ) const
inline

Returns the name of the init function to call (KControl modules).

Returns
the name of the init function to call in this service during startup of KDE. (KControl modules only), or TQString::null if not set

Definition at line 118 of file kservice.h.

◆ init() [2/2]

void KService::init ( KDesktopFile *  config)
protected

Definition at line 95 of file kservice.cpp.

◆ initialPreference()

int KService::initialPreference ( ) const
inline

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.

Returns
the service preference level of the service

Definition at line 308 of file kservice.h.

◆ initialPreferenceForMimeType()

int KService::initialPreferenceForMimeType ( const TQString &  mimeType) const

What preference to associate with this service initially for handling the specified mimetype.

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

Returns
the service preference level of the service for this mimetype

Definition at line 438 of file kservice.cpp.

◆ isValid()

bool KService::isValid ( ) const
inline

Checks whether the service is valid.

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

Definition at line 379 of file kservice.h.

◆ keywords()

TQStringList KService::keywords ( ) const
inline

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

Returns
the list of keywords

Definition at line 257 of file kservice.h.

◆ library()

TQString KService::library ( ) const
inline

Returns the name of the service's library.

Returns
the name of the library that contains the services implementation, or TQString::null if not set

Definition at line 111 of file kservice.h.

◆ load()

void KService::load ( TQDataStream &  s)
virtual

Definition at line 346 of file kservice.cpp.

◆ locateLocal()

TQString KService::locateLocal ( )

Returns a path that can be used for saving changes to this service.

Returns
path that can be used for saving changes to this service
Since
3.2

Definition at line 855 of file kservice.cpp.

◆ menuId()

TQString KService::menuId ( ) const

Returns the menu ID of the service desktop entry.

The menu ID is used to add or remove the entry to a menu.

Returns
the menu ID
Since
3.2

Definition at line 838 of file kservice.cpp.

◆ name()

virtual TQString KService::name ( ) const
inlinevirtual

Returns the name of the service.

Returns
the name of the service, or TQString::null if not set

Definition at line 98 of file kservice.h.

◆ newServicePath()

TQString KService::newServicePath ( bool  showInMenu,
const TQString &  suggestedName,
TQString *  menuId = 0,
const TQStringList *  reservedMenuIds = 0 
)
static

Returns a path that can be used to create a new KService based on suggestedName.

Parameters
showInMenutrue, if the service should be shown in the TDE menu false, if the service should be hidden from the menu
suggestedNamename to base the file on, if a service with such name already exists, a prefix will be added to make it unique.
menuIdIf provided, menuId will be set to the menu id to use for the KService
reservedMenuIdsIf provided, the path and menu id will be chosen in such a way that the new menu id does not conflict with any of the reservedMenuIds
Returns
The path to use for the new KService.
Since
3.2

Definition at line 864 of file kservice.cpp.

◆ noDisplay()

bool KService::noDisplay ( ) const

Whether the entry should be suppressed in menus.

Returns
true to suppress this service

Definition at line 752 of file kservice.cpp.

◆ parentApp()

TQString KService::parentApp ( ) const

Name of the application this service belongs to.

(Useful for e.g. plugins)

Returns
the parent application, or TQString::null if not set
Since
3.1

Definition at line 814 of file kservice.cpp.

◆ path()

TQString KService::path ( ) const
inline

Returns the working directory to run the program in.

Returns
the working directory to run the program in, or TQString::null if not set

Definition at line 226 of file kservice.h.

◆ pixmap()

TQPixmap KService::pixmap ( TDEIcon::Group  _group,
int  _force_size = 0,
int  _state = 0,
TQString *  _path = 0L 
) const

Returns the pixmap that represents the icon.

Returns
a pixmap for this service (finds and loads icon()), null if not set
See also
icon()

Definition at line 332 of file kservice.cpp.

◆ property() [1/2]

TQVariant KService::property ( const TQString &  _name) const
virtual

Returns the requested property.

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.

Parameters
_namethe name of the property
Returns
the property, or invalid if not found
See also
KServiceType

Definition at line 528 of file kservice.cpp.

◆ property() [2/2]

TQVariant KService::property ( const TQString &  _name,
TQVariant::Type  t 
) const

Returns the requested property.

Parameters
_namethe name of the property
tthe assumed type of the property
Returns
the property, or invalid if not found
See also
KServiceType
Since
3.2

Definition at line 543 of file kservice.cpp.

◆ propertyNames()

TQStringList KService::propertyNames ( ) const
virtual

Returns the list of all properties that this service can have.

That means, that some of these properties may be empty.

Returns
the list of supported properties

Definition at line 634 of file kservice.cpp.

◆ rebuildKSycoca()

void KService::rebuildKSycoca ( TQWidget *  parent)
static

Rebuild KSycoca and show a progress dialog while doing so.

Parameters
parentParent widget for the progress dialog
Since
3.2

Definition at line 920 of file kservice.cpp.

◆ save()

void KService::save ( TQDataStream &  s)
virtual

Definition at line 379 of file kservice.cpp.

◆ serviceByDesktopName()

KService::Ptr KService::serviceByDesktopName ( const TQString &  _name)
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.

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

Definition at line 680 of file kservice.cpp.

◆ serviceByDesktopPath()

KService::Ptr KService::serviceByDesktopPath ( const TQString &  _path)
static

Find a service based on its path as returned by desktopEntryPath().

It's usually better to use serviceByStorageId() instead.

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

Definition at line 674 of file kservice.cpp.

◆ serviceByMenuId()

KService::Ptr KService::serviceByMenuId ( const TQString &  _menuId)
static

Find a service by its menu-id.

Parameters
_menuIdthe menu id of the service
Returns
a pointer to the requested service or 0 if the service is unknown. Very important: Don't store the result in a KService* !
Since
3.2

Definition at line 688 of file kservice.cpp.

◆ serviceByName()

KService::Ptr KService::serviceByName ( const TQString &  _name)
static

Find a service by name, i.e.

the translated Name field. You should really not use this method, since the name is translated.

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

Definition at line 668 of file kservice.cpp.

◆ serviceByStorageId()

KService::Ptr KService::serviceByStorageId ( const TQString &  _storageId)
static

Find a service by its storage-id or desktop-file path.

This function will try very hard to find a matching service.

Parameters
_storageIdthe storage id or desktop-file path of the service
Returns
a pointer to the requested service or 0 if the service is unknown. Very important: Don't store the result in a KService* !
Since
3.2

Definition at line 694 of file kservice.cpp.

◆ serviceTypes()

TQStringList KService::serviceTypes ( ) const
inline

Returns the service types that this service supports.

Returns
the list of service types that are supported

Definition at line 270 of file kservice.h.

◆ setInitialPreference()

void KService::setInitialPreference ( int  i)
inline

Definition at line 323 of file kservice.h.

◆ setMenuId()

void KService::setMenuId ( const TQString &  menuId)

Definition at line 843 of file kservice.cpp.

◆ setTerminal()

void KService::setTerminal ( bool  b)
inline

Definition at line 408 of file kservice.h.

◆ setTerminalOptions()

void KService::setTerminalOptions ( const TQString &  options)
inline

Definition at line 413 of file kservice.h.

◆ storageId()

TQString KService::storageId ( ) const

Returns a normalized ID suitable for storing in configuration files.

It will be based on the menu-id when available and otherwise falls back to desktopEntryPath()

Returns
the storage ID
Since
3.2

Definition at line 848 of file kservice.cpp.

◆ substituteUid()

bool KService::substituteUid ( ) const

Checks whether the service runs with a different user id.

Returns
true if the service has to be run under a different uid.
See also
username()

Definition at line 726 of file kservice.cpp.

◆ SuSEunimportant()

bool KService::SuSEunimportant ( ) const

check if the application entry is important

Definition at line 800 of file kservice.cpp.

◆ terminal()

bool KService::terminal ( ) const
inline

Checks whethe the service should be run in a terminal.

Returns
true if the service is to be run in a terminal.

Definition at line 138 of file kservice.h.

◆ terminalOptions()

TQString KService::terminalOptions ( ) const
inline

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

The service must be a tty-oriented program.

Returns
the terminal options, or TQString::null if not set

Definition at line 147 of file kservice.h.

◆ type()

virtual TQString KService::type ( ) const
inlinevirtual

Returns the type of the service.

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

Definition at line 92 of file kservice.h.

◆ untranslatedGenericName()

TQString KService::untranslatedGenericName ( ) const

Returns the untranslated (US English) generic name for the service, if there is one (e.g.

"Mail Client").

Returns
the generic name, or TQString::null if not set
Since
3.2

Definition at line 795 of file kservice.cpp.

◆ username()

TQString KService::username ( ) const

Returns the user name, if the service runs with a different user id.

Returns
the username under which the service has to be run, or TQString::null if not set
See also
substututeUid()a

Definition at line 740 of file kservice.cpp.

◆ virtual_hook()

void KService::virtual_hook ( int  id,
void *  data 
)
protectedvirtual

Definition at line 916 of file kservice.cpp.

Friends And Related Function Documentation

◆ KBuildSycoca

friend class KBuildSycoca
friend

Definition at line 52 of file kservice.h.


The documentation for this class was generated from the following files:
  • kservice.h
  • kservice.cpp

tdeio/tdeio

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

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.9.4
This website is maintained by Timothy Pearson.