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") ) ||
virtual KService::Ptr findServiceByDesktopPath(const QString &_name)
Find a service ( by desktop path, e.g.
Definition: kservicefactory.cpp:127
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
QVariant::Type findPropertyTypeByName(const QString &_name)
Find a the property type of a named property.
Definition: kservicetypefactory.cpp:85
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
bool tryExec() const
Checks whether the TryExec field contains a binary which is found on the local system.
Definition: kdesktopfile.cpp:282
virtual KService::Ptr findServiceByDesktopName(const QString &_name)
Find a service (by desktop file name, e.g.
Definition: kservicefactory.cpp:107
QString pluginKeyword() const
The keyword to be used when constructing the plugin using KPluginFactory.
Definition: kservice.cpp:733
iterator erase(iterator pos)
void truncate(int position)
bool noDisplay() const
Whether the entry should be suppressed in the K menu.
Definition: kservice.cpp:704
void setExec(const QString &exec)
Overrides the "Exec=" line of the service.
Definition: kservice.cpp:979
bool contains(const Key &key) const
const T & next()
QVector< ServiceTypeAndPreference > & _k_accessServiceTypes()
Definition: kservice.cpp:989
Definition: kservice.h:212
QString locateLocal() const
Returns a path that can be used for saving changes to this service.
Definition: kservice.cpp:789
Definition: kservice.h:685
virtual QVariant property(const QString &name) const
Definition: kservice.cpp:483
iterator begin()
QVector< KService::ServiceTypeAndPreference > m_serviceTypes
Definition: kservice_p.h:87
Definition: kmacroexpander_unix.cpp:34
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
QString readComment() const
Returns the value of the "Comment=" entry.
Definition: kdesktopfile.cpp:198
Represent a service, like an application or plugin bound to one or several mimetypes (or servicetypes...
Definition: kservice.h:58
static QString locate(const char *type, const QString &filename, const KComponentData &cData=KGlobal::mainComponent())
This function is just for convenience.
Definition: kstandarddirs.cpp:2085
const_iterator constBegin() const
QStringList mimeTypes() const
Returns the list of mime types that this service supports.
Definition: kservice.cpp:942
const T & peekNext() const
QVariant property(const QString &_name, QVariant::Type t) const
Returns the requested property.
Definition: kservice.cpp:498
void parseActions(const KDesktopFile *config, KService *q)
Definition: kservice.cpp:287
bool contains(const QString &str, Qt::CaseSensitivity cs) const
bool isEmpty() const
Definition: kmimetypefactory.h:39
bool hasServiceType(const QString &serviceTypePtr) const
Checks whether the service supports this service type.
Definition: kservice.cpp:413
virtual QStringList propertyNames() const
Definition: kservice.cpp:574
QString genericName() const
Returns the generic name for the service, if there is one (e.g.
Definition: kservice.cpp:913
QString docPath() const
The path to the documentation for this service.
Definition: kservice.cpp:744
A service type is, well, a type of service, where a service is an application or plugin.
Definition: kservicetype.h:43
QString terminalOptions() const
Returns any options associated with the terminal the service runs in, if it requires a terminal...
Definition: kservice.cpp:869
bool exists() const
bool substituteUid() const
Checks whether the service runs with a different user id.
Definition: kservice.cpp:665
QString comment() const
Returns the descriptive comment for the service, if there is one.
Definition: kservice.cpp:907
Represents an action in a .desktop file Actions are defined with the config key Actions in the [Deskt...
Definition: kserviceaction.h:34
bool isApplication() const
Services are either applications (executables) or dlopened libraries (plugins).
Definition: kservice.cpp:832
int size() const
Definition: kservice.h:212
int lastIndexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
QString path() const
Returns the working directory to run the program in.
Definition: kservice.cpp:901
void clear()
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
bool hasOffer(int serviceTypeOffset, int serviceOffersOffset, int testedServiceOffset)
Test if a specific service is associated with a specific servicetype.
Definition: kservicefactory.cpp:280
DBusStartupType dbusStartupType() const
Returns the DBUSStartupType supported by this service.
Definition: kservice.cpp:895
QDataStream & operator>>(QDataStream &s, KService::ServiceTypeAndPreference &st)
Definition: kservice.cpp:57
QString fromLocal8Bit(const char *str, int size)
void append(const T &value)
QString readEntryUntranslated(const QString &pKey, const QString &aDefault=QString()) const
Reads an untranslated string entry.
Definition: kconfiggroup.cpp:637
bool isNull() const
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
int entryOffset(const QString &mimeTypeName)
Returns the possible offset for a given mimetype entry.
Definition: kmimetypefactory.cpp:46
QDataStream & operator<<(QDataStream &s, const KService::ServiceTypeAndPreference &st)
Definition: kservice.cpp:52
bool isEmpty() const
bool isEmpty() const
const_iterator constEnd() const
const char * constData() const
QString menuId() const
Returns the menu ID of the service desktop entry.
Definition: kservice.cpp:771
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const
static int registerArea(const QByteArray &areaName, bool enabled=true)
Definition: kdebug.cpp:856
int initialPreference() const
What preference to associate with this service initially (before the user has had any chance to defin...
Definition: kservice.cpp:961
QString desktopEntryPath() const
Returns the path to the location where the service desktop entry is stored.
Definition: kservice.cpp:883
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
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
iterator end()
void setDeleted(bool deleted)
Sets whether or not this service is deleted.
Definition: ksycocaentry.cpp:122
static Ptr serviceByDesktopPath(const QString &_path)
Find a service based on its path as returned by entryPath().
Definition: kservice.cpp:615
iterator begin()
bool allowMultipleFiles() const
Checks whether this service can handle several files as startup arguments.
Definition: kservice.cpp:758
QString username() const
Returns the user name, if the service runs with a different user id.
Definition: kservice.cpp:670
iterator end()
QString toLower() const
void reserve(int size)
bool contains(QChar ch, Qt::CaseSensitivity cs) const
bool terminal() const
Checks whethe the service should be run in a terminal.
Definition: kservice.cpp:875
static Ptr serviceByMenuId(const QString &_menuId)
Find a service by its menu-id.
Definition: kservice.cpp:633
QStringList readActions() const
Returns a list of the "Actions=" entries.
Definition: kdesktopfile.cpp:241
bool isRelativePath(const QString &path)
bool hasKey(const QString &key) const
Checks whether the key has an entry in this group.
Definition: kconfiggroup.cpp:1155
const Key key(const T &value) const
QString readGenericName() const
Returns the value of the "GenericName=" entry.
Definition: kdesktopfile.cpp:204
Definition: kservice.h:212
QStringList serviceTypes() const
Returns the service types that this service supports.
Definition: kservice.cpp:936
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
QString mid(int position, int n) const
static Ptr serviceByName(const QString &_name)
Find a service by name, i.e.
Definition: kservice.cpp:609
QString desktopEntryName() const
Returns the filename of the service desktop entry without any extension.
Definition: kservice.cpp:889
static QString locateLocal(const char *type, const QString &filename, const KComponentData &cData=KGlobal::mainComponent())
This function is much like locate.
Definition: kstandarddirs.cpp:2091
static QString locateLocal(const QString &path)
Returns the location where changes for the .desktop file path should be written to.
Definition: kdesktopfile.cpp:79
bool inherits(const QString &servTypeName) const
Checks whether this service type is or inherits from servTypeName.
Definition: kservicetype.cpp:137
static QVariant makeStringVariant(const QString &string)
Definition: kservice.cpp:491
Definition: kservice_p.h:29
QString storageId() const
Returns a normalized ID suitable for storing in configuration files.
Definition: kservice.cpp:783
KService::Ptr findServiceByName(const QString &_name)
Find a service (by translated name, e.g.
Definition: kservicefactory.cpp:86
typedef ConstIterator
virtual KService::Ptr findServiceByMenuId(const QString &_menuId)
Find a service ( by menu id, e.g.
Definition: kservicefactory.cpp:154
int length() const
bool toBool() const
void setTerminalOptions(const QString &options)
Definition: kservice.cpp:973
bool hasActionGroup(const QString &group) const
Returns true if the action group exists, false otherwise.
Definition: kdesktopfile.cpp:257
QString left(int n) const
void push_back(const T &value)
QString fromLatin1(const char *str, int size)
bool isValid() const
static Ptr mimeType(const QString &name, FindByNameOption options=ResolveAliases)
Retrieve a pointer to the mime type name.
Definition: kmimetype.cpp:58
KConfigGroup actionGroup(const QString &group)
Sets the desktop action group.
Definition: kdesktopfile.cpp:247
QString untranslatedGenericName() const
Returns the untranslated (US English) generic name for the service, if there is one (e...
Definition: kservice.cpp:717
iterator insert(const Key &key, const T &value)
Definition: kservice.h:212
QList< KServiceAction > actions() const
Returns the actions defined in this desktop file.
Definition: kservice.cpp:995
int serviceOffersOffset(const QString &mimeTypeName)
Returns the offset into the service offers for a given mimetype.
Definition: kmimetypefactory.cpp:55
QStringList keywords() const
Returns a list of descriptive keywords the service, if there are any.
Definition: kservice.cpp:919
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
QString canonicalName(const QString &mime)
Resolve mime if it's an alias, and return it otherwise.
Definition: kmimetyperepository.cpp:90
QString toString() const
bool hasMimeType(const KServiceType *mimeTypePtr) const
Checks whether the service supports this mime type.
Definition: kservice.cpp:446
iterator end()
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
KService::DBusStartupType m_DBUSStartusType
Definition: kservice_p.h:90
iterator find(const Key &key)
bool authorizeControlModule(const QString &menuId)
Returns whether access to a certain control module is authorized.
Definition: kauthorized.cpp:237
iterator begin()
bool showInKDE() const
Whether the service should be shown in KDE at all (including in context menus).
Definition: kservice.cpp:682
QMap< QString, QString > entryMap() const
Returns a map (tree) of entries for all entries in this group.
Definition: kconfiggroup.cpp:603
QString parentApp() const
Name of the application this service belongs to.
Definition: kservice.cpp:722
static Ptr serviceByStorageId(const QString &_storageId)
Find a service by its storage-id or desktop-file path.
Definition: kservice.cpp:638
int remove(const Key &key)
QByteArray toUtf8() const
bool hasNext() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:22:11 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.