KService Class Reference
Represent a service, i.e. More...
#include <kservice.h>
Inheritance diagram for KService:


Public Types | |
typedef KSharedPtr< KService > | Ptr |
typedef QValueList< Ptr > | List |
enum | DCOPServiceType_t { DCOP_None = 0, DCOP_Unique, DCOP_Multi, DCOP_Wait } |
Public Member Functions | |
KService (const QString &_name, const QString &_exec, const QString &_icon) | |
KService (const QString &_fullpath) | |
KService (KDesktopFile *config) | |
KService (QDataStream &_str, int offset) | |
virtual QString | type () const |
virtual QString | name () const |
QString | exec () const |
QString | library () const |
QString | init () const |
QString | icon () const |
QPixmap | pixmap (KIcon::Group _group, int _force_size=0, int _state=0, QString *_path=0L) const |
bool | terminal () const |
QString | terminalOptions () const |
bool | substituteUid () const |
QString | username () const |
QString | desktopEntryPath () const |
QString | desktopEntryName () const |
QString | menuId () const |
QString | storageId () const |
DCOPServiceType_t | DCOPServiceType () const |
QString | path () const |
QString | comment () const |
QString | genericName () const |
QString | untranslatedGenericName () const |
QStringList | keywords () const |
QStringList | categories () const |
QStringList | serviceTypes () const |
bool | hasServiceType (const QString &_service) const |
bool | allowAsDefault () const |
bool | allowMultipleFiles () const |
int | initialPreference () const |
int | initialPreferenceForMimeType (const QString &mimeType) const |
void | setInitialPreference (int i) |
bool | noDisplay () const |
QString | parentApp () const |
virtual QVariant | property (const QString &_name) const |
QVariant | property (const QString &_name, QVariant::Type t) const |
virtual QStringList | propertyNames () const |
bool | isValid () const |
QString | locateLocal () |
virtual void | load (QDataStream &) |
virtual void | save (QDataStream &) |
void | setMenuId (const QString &menuId) |
void | setTerminal (bool b) |
void | setTerminalOptions (const QString &options) |
Static Public Member Functions | |
Ptr | serviceByName (const QString &_name) |
Ptr | serviceByDesktopPath (const QString &_path) |
Ptr | serviceByDesktopName (const QString &_name) |
Ptr | serviceByMenuId (const QString &_menuId) |
Ptr | serviceByStorageId (const QString &_storageId) |
List | allServices () |
List | allInitServices () |
QString | newServicePath (bool showInMenu, const QString &suggestedName, QString *menuId=0, const QStringList *reservedMenuIds=0) |
void | rebuildKSycoca (QWidget *parent) |
Protected Member Functions | |
void | init (KDesktopFile *config) |
QStringList & | accessServiceTypes () |
virtual void | virtual_hook (int id, void *data) |
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
- Author:
- Torben Weis <weis@kde.org>
Definition at line 48 of file kservice.h.
Member Enumeration Documentation
|
Describes the DCOP type of the service.
Definition at line 213 of file kservice.h. |
Constructor & Destructor Documentation
|
Construct a temporary service with a given name, exec-line and icon.
Definition at line 63 of file kservice.cpp. References KService(). Referenced by KService(). |
|
Construct a service and take all information from a config file.
Definition at line 79 of file kservice.cpp. References init(), and KService(). |
|
Construct a service and take all information from a desktop file.
Definition at line 87 of file kservice.cpp. References init(), and KService(). |
Member Function Documentation
|
Returns the type of the service.
Definition at line 92 of file kservice.h. |
|
Returns the name of the service.
Implements KSycocaEntry. Definition at line 98 of file kservice.h. Referenced by KRun::processDesktopExec(). |
|
Returns the executable.
Definition at line 104 of file kservice.h. Referenced by KRun::processDesktopExec(). |
|
Returns the name of the service's library.
Definition at line 111 of file kservice.h. |
|
Returns the name of the init function to call (KControl modules).
Definition at line 118 of file kservice.h. Referenced by KService(). |
|
Returns the name of the icon.
Definition at line 125 of file kservice.h. |
|
Returns the pixmap that represents the icon.
Definition at line 274 of file kservice.cpp. References KIconLoader::addExtraDesktopThemes(), KIconLoader::extraDesktopThemesAdded(), KGlobal::iconLoader(), QPixmap::isNull(), KIconLoader::loadIcon(), and pixmap(). Referenced by pixmap(). |
|
Checks whethe the service should be run in a terminal.
Definition at line 138 of file kservice.h. Referenced by KRun::processDesktopExec(). |
|
Returns any options associated with the terminal the service runs in, if it requires a terminal. The service must be a tty-oriented program.
Definition at line 147 of file kservice.h. Referenced by KRun::processDesktopExec(). |
|
Checks whether the service runs with a different user id.
Definition at line 666 of file kservice.cpp. References QVariant::isValid(), property(), and QVariant::toBool(). Referenced by KRun::processDesktopExec(). |
|
Returns the user name, if the service runs with a different user id.
Definition at line 671 of file kservice.cpp. References QString::isEmpty(), QVariant::isValid(), property(), and QVariant::toString(). Referenced by KRun::processDesktopExec(). |
|
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.
Definition at line 174 of file kservice.h. References KSycocaEntry::entryPath(). Referenced by locateLocal(), and KRun::run(). |
|
Returns the filename of the service desktop entry without any extension. E.g. "kppp"
Definition at line 182 of file kservice.h. Referenced by KRun::run(). |
|
Returns the menu ID of the service desktop entry. The menu ID is used to add or remove the entry to a menu.
Definition at line 745 of file kservice.cpp. Referenced by KServiceGroup::entries(). |
|
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()
Definition at line 755 of file kservice.cpp. References KSycocaEntry::entryPath(). |
|
Returns the DCOPServiceType supported by this service.
Definition at line 219 of file kservice.h. |
|
Returns the working directory to run the program in.
Definition at line 226 of file kservice.h. |
|
Returns the descriptive comment for the service, if there is one.
Definition at line 233 of file kservice.h. |
|
Returns the generic name for the service, if there is one (e.g. "Mail Client").
Definition at line 241 of file kservice.h. |
|
Returns the untranslated (US English) generic name for the service, if there is one (e.g. "Mail Client").
Definition at line 716 of file kservice.cpp. References QVariant::isValid(), property(), and QVariant::toString(). |
|
Returns a list of descriptive keywords the service, if there are any.
Definition at line 257 of file kservice.h. |
|
Returns a list of VFolder categories.
Definition at line 740 of file kservice.cpp. |
|
Returns the service types that this service supports.
Definition at line 270 of file kservice.h. |
|
Checks whether the service supports this service type.
Definition at line 347 of file kservice.cpp. References KMimeType::defaultMimeTypePtr(), and hasServiceType(). Referenced by hasServiceType(). |
|
Checks whether a service is used as a default setting, for example as plugin 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.
Definition at line 288 of file kservice.h. |
|
Checks whether this service can handle several files as startup arguments.
Definition at line 731 of file kservice.cpp. References QString::find(). |
|
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.
Definition at line 304 of file kservice.h. |
|
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.
Definition at line 380 of file kservice.cpp. References KMimeType::defaultMimeTypePtr(), and initialPreferenceForMimeType(). Referenced by initialPreferenceForMimeType(). |
|
Whether the entry should be suppressed in menus.
Definition at line 683 of file kservice.cpp. References QMap< QString, QVariant >::end(), and QMap< QString, QVariant >::find(). Referenced by KServiceGroup::childCount(), and KServiceGroup::entries(). |
|
Name of the application this service belongs to. (Useful for e.g. plugins)
Definition at line 721 of file kservice.cpp. References QMap< QString, QVariant >::end(), and QMap< QString, QVariant >::find(). |
|
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.
Definition at line 468 of file kservice.cpp. References property(). Referenced by KRun::processDesktopExec(), property(), substituteUid(), untranslatedGenericName(), and username(). |
|
Returns the requested property.
Definition at line 483 of file kservice.cpp. References QMap< QString, QVariant >::end(), KSycocaEntry::entryPath(), QMap< QString, QVariant >::find(), kdDebug(), property(), and QString::toInt(). |
|
Returns the list of all properties that this service can have. That means, that some of these properties may be empty.
Definition at line 574 of file kservice.cpp. References QMap< QString, QVariant >::begin(), and QMap< QString, QVariant >::end(). |
|
Checks whether the service is valid.
Implements KSycocaEntry. Definition at line 371 of file kservice.h. |
|
Returns a path that can be used for saving changes to this service.
Definition at line 762 of file kservice.cpp. References desktopEntryPath(), locateLocal(), and QString::startsWith(). |
|
Find a service by name, i.e. the translated Name field. You should really not use this method, since the name is translated.
Definition at line 608 of file kservice.cpp. References serviceByName(). Referenced by serviceByName(). |
|
Find a service based on its path as returned by desktopEntryPath(). It's usually better to use serviceByStorageId() instead.
Definition at line 614 of file kservice.cpp. References serviceByDesktopPath(). Referenced by serviceByDesktopPath(), and serviceByStorageId(). |
|
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.
Definition at line 620 of file kservice.cpp. References QString::lower(), serviceByDesktopName(), and QString::startsWith(). Referenced by serviceByDesktopName(), and serviceByStorageId(). |
|
Find a service by its menu-id.
Definition at line 628 of file kservice.cpp. References serviceByMenuId(). Referenced by newServicePath(), serviceByMenuId(), and serviceByStorageId(). |
|
Find a service by its storage-id or desktop-file path. This function will try very hard to find a matching service.
Definition at line 634 of file kservice.cpp. References QString::endsWith(), QFile::exists(), QString::findRev(), QString::length(), QString::mid(), serviceByDesktopName(), serviceByDesktopPath(), serviceByMenuId(), serviceByStorageId(), and QString::truncate(). Referenced by serviceByStorageId(). |
|
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.
Definition at line 603 of file kservice.cpp. |
|
Returns all services that require initialisation. Only needed by "kcminit"
Definition at line 661 of file kservice.cpp. |
|
Returns a path that can be used to create a new KService based on
Definition at line 771 of file kservice.cpp. References QString::arg(), QString::isEmpty(), locate(), locateLocal(), KStandardDirs::menu_type_by_version(), QString::mid(), newServicePath(), QString::prepend(), and serviceByMenuId(). Referenced by newServicePath(). |
|
Rebuild KSycoca and show a progress dialog while doing so.
Definition at line 851 of file kservice.cpp. References DCOPClient::callAsync(), and rebuildKSycoca(). Referenced by rebuildKSycoca(). |
The documentation for this class was generated from the following files: