KDECore
kservice.cpp
Go to the documentation of this file.
105 } else if (m_strType != QLatin1String("Application") && m_strType != QLatin1String("Service")) {
174 m_strTerminalOptions = desktopGroup.readEntry( "TerminalOptions" ); // should be a property IMHO
212 if ( m_strType == QLatin1String("Application") && !lstServiceTypes.contains(QLatin1String("Application")) )
264 QMap<QString,QString>::Iterator entry = entryMap.find(QString::fromLatin1("X-KDE-PluginInfo-Category"));
279 // do not store other translations like Name[fr]; kbuildsycoca will rerun if we change languages anyway
305 kWarning(servicesDebugArea()) << "The action" << group << "in the desktop file" << q->entryPath()
426 return KServiceFactory::self()->hasOffer( ptr->offset(), ptr->serviceOffersOffset(), serviceOffset );
477 // But this should matter only in a very rare case, since most code gets KServices from ksycoca.
686 QMap<QString,QVariant>::ConstIterator it = d->m_mapProps.find( QString::fromLatin1("OnlyShowIn") );
724 QMap<QString,QVariant>::ConstIterator it = d->m_mapProps.find(QLatin1String("X-KDE-ParentApp"));
736 QMap<QString,QVariant>::ConstIterator it = d->m_mapProps.find(QString::fromLatin1("X-KDE-PluginKeyword"));
760 // Can we pass multiple files on the command line or do we have to start the application for every single file ?
761 return (d->m_strExec.contains( QLatin1String("%F") ) || d->m_strExec.contains( QLatin1String("%U") ) ||
T readEntry(const QString &key, const T &aDefault) const
Reads the value of an entry specified by pKey in the current group.
Definition: kconfiggroup.h:248
bool hasKey(const QString &key) const
Checks whether the key has an entry in this group.
Definition: kconfiggroup.cpp:1155
QMap< QString, QString > entryMap() const
Returns a map (tree) of entries for all entries in this group.
Definition: kconfiggroup.cpp:603
QStringList readXdgListEntry(const QString &pKey, const QStringList &aDefault=QStringList()) const
Reads a list of strings from the config object, following XDG desktop entry spec separator semantics.
Definition: kconfiggroup.cpp:741
QString readEntryUntranslated(const QString &pKey, const QString &aDefault=QString()) const
Reads an untranslated string entry.
Definition: kconfiggroup.cpp:637
static int registerArea(const QByteArray &areaName, bool enabled=true)
Definition: kdebug.cpp:856
static QString locateLocal(const QString &path)
Returns the location where changes for the .desktop file path should be written to.
Definition: kdesktopfile.cpp:79
Definition: kmimetypefactory.h:40
int entryOffset(const QString &mimeTypeName)
Returns the possible offset for a given mimetype entry.
Definition: kmimetypefactory.cpp:46
int serviceOffersOffset(const QString &mimeTypeName)
Returns the offset into the service offers for a given mimetype.
Definition: kmimetypefactory.cpp:55
QString canonicalName(const QString &mime)
Resolve mime if it's an alias, and return it otherwise.
Definition: kmimetyperepository.cpp:90
static Ptr mimeType(const QString &name, FindByNameOption options=ResolveAliases)
Retrieve a pointer to the mime type name.
Definition: kmimetype.cpp:58
Represents an action in a .desktop file Actions are defined with the config key Actions in the [Deskt...
Definition: kserviceaction.h:35
bool hasOffer(int serviceTypeOffset, int serviceOffersOffset, int testedServiceOffset)
Test if a specific service is associated with a specific servicetype.
Definition: kservicefactory.cpp:280
virtual KService::Ptr findServiceByDesktopPath(const QString &_name)
Find a service ( by desktop path, e.g.
Definition: kservicefactory.cpp:127
virtual KService::Ptr findServiceByMenuId(const QString &_menuId)
Find a service ( by menu id, e.g.
Definition: kservicefactory.cpp:154
virtual KService::Ptr findServiceByDesktopName(const QString &_name)
Find a service (by desktop file name, e.g.
Definition: kservicefactory.cpp:107
KService::Ptr findServiceByName(const QString &_name)
Find a service (by translated name, e.g.
Definition: kservicefactory.cpp:86
Definition: kservice_p.h:30
KService::DBusStartupType m_DBUSStartusType
Definition: kservice_p.h:90
void parseActions(const KDesktopFile *config, KService *q)
Definition: kservice.cpp:287
QVector< KService::ServiceTypeAndPreference > m_serviceTypes
Definition: kservice_p.h:87
virtual QVariant property(const QString &name) const
Definition: kservice.cpp:483
QVariant::Type findPropertyTypeByName(const QString &_name)
Find a the property type of a named property.
Definition: kservicetypefactory.cpp:85
A service type is, well, a type of service, where a service is an application or plugin.
Definition: kservicetype.h:44
bool inherits(const QString &servTypeName) const
Checks whether this service type is or inherits from servTypeName.
Definition: kservicetype.cpp:137
static Ptr serviceType(const QString &_name)
Returns a pointer to the servicetype '_name' or 0L if the service type is unknown.
Definition: kservicetype.cpp:191
Represent a service, like an application or plugin bound to one or several mimetypes (or servicetypes...
Definition: kservice.h:59
QString parentApp() const
Name of the application this service belongs to.
Definition: kservice.cpp:722
QStringList mimeTypes() const
Returns the list of mime types that this service supports.
Definition: kservice.cpp:942
static Ptr serviceByStorageId(const QString &_storageId)
Find a service by its storage-id or desktop-file path.
Definition: kservice.cpp:638
void setExec(const QString &exec)
Overrides the "Exec=" line of the service.
Definition: kservice.cpp:979
QString storageId() const
Returns a normalized ID suitable for storing in configuration files.
Definition: kservice.cpp:783
QString desktopEntryName() const
Returns the filename of the service desktop entry without any extension.
Definition: kservice.cpp:889
QStringList keywords() const
Returns a list of descriptive keywords the service, if there are any.
Definition: kservice.cpp:919
void setTerminalOptions(const QString &options)
Definition: kservice.cpp:973
QList< KServiceAction > actions() const
Returns the actions defined in this desktop file.
Definition: kservice.cpp:995
static Ptr serviceByName(const QString &_name)
Find a service by name, i.e.
Definition: kservice.cpp:609
bool allowMultipleFiles() const
Checks whether this service can handle several files as startup arguments.
Definition: kservice.cpp:758
QString genericName() const
Returns the generic name for the service, if there is one (e.g.
Definition: kservice.cpp:913
bool substituteUid() const
Checks whether the service runs with a different user id.
Definition: kservice.cpp:665
DBusStartupType dbusStartupType() const
Returns the DBUSStartupType supported by this service.
Definition: kservice.cpp:895
QString desktopEntryPath() const
Returns the path to the location where the service desktop entry is stored.
Definition: kservice.cpp:883
bool terminal() const
Checks whethe the service should be run in a terminal.
Definition: kservice.cpp:875
QString terminalOptions() const
Returns any options associated with the terminal the service runs in, if it requires a terminal.
Definition: kservice.cpp:869
bool hasServiceType(const QString &serviceTypePtr) const
Checks whether the service supports this service type.
Definition: kservice.cpp:413
QStringList serviceTypes() const
Returns the service types that this service supports.
Definition: kservice.cpp:936
bool showInKDE() const
Whether the service should be shown in KDE at all (including in context menus).
Definition: kservice.cpp:682
KService(const QString &name, const QString &exec, const QString &icon)
Construct a temporary service with a given name, exec-line and icon.
Definition: kservice.cpp:373
bool noDisplay() const
Whether the entry should be suppressed in the K menu.
Definition: kservice.cpp:704
QString username() const
Returns the user name, if the service runs with a different user id.
Definition: kservice.cpp:670
QString locateLocal() const
Returns a path that can be used for saving changes to this service.
Definition: kservice.cpp:789
static Ptr serviceByDesktopName(const QString &_name)
Find a service by the name of its desktop file, not depending on its actual location (as long as it's...
Definition: kservice.cpp:620
QVariant property(const QString &_name, QVariant::Type t) const
Returns the requested property.
Definition: kservice.cpp:498
QString comment() const
Returns the descriptive comment for the service, if there is one.
Definition: kservice.cpp:907
QString untranslatedGenericName() const
Returns the untranslated (US English) generic name for the service, if there is one (e....
Definition: kservice.cpp:717
int initialPreference() const
What preference to associate with this service initially (before the user has had any chance to defin...
Definition: kservice.cpp:961
QVector< ServiceTypeAndPreference > & _k_accessServiceTypes()
Definition: kservice.cpp:989
QString pluginKeyword() const
The keyword to be used when constructing the plugin using KPluginFactory.
Definition: kservice.cpp:733
static Ptr serviceByMenuId(const QString &_menuId)
Find a service by its menu-id.
Definition: kservice.cpp:633
bool allowAsDefault() const
Set to true if it is allowed to use this service as the default (main) action for the files it suppor...
Definition: kservice.cpp:955
static QString newServicePath(bool showInMenu, const QString &suggestedName, QString *menuId=0, const QStringList *reservedMenuIds=0)
Returns a path that can be used to create a new KService based on suggestedName.
Definition: kservice.cpp:799
bool hasMimeType(const KServiceType *mimeTypePtr) const
Checks whether the service supports this mime type.
Definition: kservice.cpp:446
QString path() const
Returns the working directory to run the program in.
Definition: kservice.cpp:901
bool isApplication() const
Services are either applications (executables) or dlopened libraries (plugins).
Definition: kservice.cpp:832
static Ptr serviceByDesktopPath(const QString &_path)
Find a service based on its path as returned by entryPath().
Definition: kservice.cpp:615
static QString locateLocal(const char *type, const QString &filename, const KComponentData &cData=KGlobal::mainComponent())
This function is much like locate.
Definition: kstandarddirs.cpp:2097
static QString locate(const char *type, const QString &filename, const KComponentData &cData=KGlobal::mainComponent())
This function is just for convenience.
Definition: kstandarddirs.cpp:2091
void setDeleted(bool deleted)
Sets whether or not this service is deleted.
Definition: ksycocaentry.cpp:122
static QVariant makeStringVariant(const QString &string)
Definition: kservice.cpp:491
QDataStream & operator<<(QDataStream &s, const KService::ServiceTypeAndPreference &st)
Definition: kservice.cpp:52
QDataStream & operator>>(QDataStream &s, KService::ServiceTypeAndPreference &st)
Definition: kservice.cpp:57
bool authorizeControlModule(const QString &menuId)
Returns whether access to a certain control module is authorized.
Definition: kauthorized.cpp:237
Definition: kservice.h:686
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.