KMoreToolsService Class Reference

#include <kmoretools.h>

Public Member Functions

 KMoreToolsService (const KMoreToolsService &)=delete
QString appstreamId () const
QString desktopEntryName () const
QString formatString (const QString &formatString) const
QUrl homepageUrl () const
QIcon icon () const
KService::Ptr installedService () const
bool isInstalled () const
QIcon kmtProvidedIcon () const
KService::Ptr kmtProvidedService () const
int maxUrlArgCount () const
KMoreToolsServiceoperator= (const KMoreToolsService &)=delete
void setAppstreamId (const QString &)
void setExec (const QString &exec)
void setHomepageUrl (const QUrl &url)
void setMaxUrlArgCount (int maxUrlArgCount)

Detailed Description

A service described in a .desktop file (kmt-desktopfile) which will be called "registered service".

A registered service can either be installed (isInstalled() == true) or - if not found on the system - not installed (isInstalled() == false).


Definition at line 361 of file kmoretools.h.

Member Function Documentation

QString KMoreToolsService::appstreamId ( ) const

Returns the associated appstream id that was previously set with setAppstreamId().

If no appstream id was set, an empty string is returned.

The service's appstream id.

Definition at line 342 of file kmoretools.cpp.

QString KMoreToolsService::desktopEntryName ( ) const
the desktop entry name which the service is identified by and with which it was registered (see registerServiceByDesktopEntryName).

Filename without .desktop: e.g. if the desktop file is named "org.kde.ksnapshot.desktop" then the desktop entry name is "org.kde.ksnapshot".

Definition at line 254 of file kmoretools.cpp.

QString KMoreToolsService::formatString ( const QString formatString) const
formatStringsupports the following placeholders:
  1. $GenericName
  2. $Name
  3. $DesktopEntryName

which are replaced by the corresponding desktop file entries.

If a value for a placeholder is not available (or empty) (e.g. if no desktop file is available (not installed or not provided via kmt-desktopfiles)) then the next one is used until 3. is reached which is always available. Example: the formatString is "$GenericName", but the GenericName field is not available. So $Name is used. If this is also not available, $DesktopEntryName is used.

See also

Definition at line 299 of file kmoretools.cpp.

QUrl KMoreToolsService::homepageUrl ( ) const
See also

Definition at line 279 of file kmoretools.cpp.

QIcon KMoreToolsService::icon ( ) const
  1. Icon from installed desktop file If 1. is not found not found then...
  2. icon from kmt desktop file (which is then searched in the kmt-desktopfiles directory, must have extension .svg or .png) If 2. is not not found then...
  3. no icon

Definition at line 323 of file kmoretools.cpp.

KService::Ptr KMoreToolsService::installedService ( ) const
the KService represented by an installed desktop file.
that this might be nullptr even if isInstalled() is true. This can only happen when ServiceLocatingMode::ServiceLocatingMode_ByProvidedExecLine is used in registerServiceByDesktopEntryName. (Then the kmt-desktopfile's Exec line is used to determine if a program is installed)

Definition at line 264 of file kmoretools.cpp.

bool KMoreToolsService::isInstalled ( ) const
true if the desktopfile with the given desktopname (name of the .desktop file without the .desktop) is installed on the system

Definition at line 259 of file kmoretools.cpp.

QIcon KMoreToolsService::kmtProvidedIcon ( ) const
the icon provided by the KMoreTools' user and not the installed one. (e.g. QGit currently has got a blank icon installed)

Definition at line 274 of file kmoretools.cpp.

KService::Ptr KMoreToolsService::kmtProvidedService ( ) const
a non-null KService::Ptr if app-local kmt-desktopfile is found and valid

Definition at line 269 of file kmoretools.cpp.

int KMoreToolsService::maxUrlArgCount ( ) const
See also

Definition at line 289 of file kmoretools.cpp.

void KMoreToolsService::setAppstreamId ( const QString id)

Sets the appstream id of the service.

This is used to create a appstream url for installing the service via a software store (e.g. Discover). For instance, the appstream id for filelight is "org.kde.filelight.desktop".

idthe appstream id

Definition at line 347 of file kmoretools.cpp.

void KMoreToolsService::setExec ( const QString exec)

Will override the "Exec=" line of the service.

Will only apply if the service is installed.

See also

Definition at line 334 of file kmoretools.cpp.

void KMoreToolsService::setHomepageUrl ( const QUrl url)

Sets the homepage url the user is shown when a service is not installed.

This way the user gets some information of how to install the application.

Definition at line 284 of file kmoretools.cpp.

void KMoreToolsService::setMaxUrlArgCount ( int  maxUrlArgCount)

In KMoreToolsMenuFactory some minor magic is done.

In the context of connecting the action trigger signal we need to know the maximum number of URL arguments a given service can accept. Usually a number between 0 and 1. Sometimes 2. E.g. kdf must not be called with any positional argument. E.g. gitg can be called with zero or one arguments.

Definition at line 294 of file kmoretools.cpp.

The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 18 2021 22:43:50 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.