KIO::DesktopExecParser

Search for usage in LXR

#include <KIO/DesktopExecParser>

Public Member Functions

 DesktopExecParser (const KService &service, const QList< QUrl > &urls)
 
 ~DesktopExecParser ()
 
QString errorMessage () const
 
QStringList resultingArguments () const
 
void setSuggestedFileName (const QString &suggestedFileName)
 
void setUrlsAreTempFiles (bool tempFiles)
 

Static Public Member Functions

static QString executableName (const QString &execLine)
 
static QString executablePath (const QString &execLine)
 
static bool hasSchemeHandler (const QUrl &url)
 
static bool isProtocolInSupportedList (const QUrl &url, const QStringList &supportedProtocols)
 
static QStringList supportedProtocols (const KService &service)
 

Detailed Description

Parses the Exec= line from a .desktop file, and process all the '%' placeholders, e.g. handling URLs vs local files.

The processing actually happens when calling resultingArguments(), after setting everything up.

Since
5.0

Constructor & Destructor Documentation

◆ DesktopExecParser()

KIO::DesktopExecParser::DesktopExecParser ( const KService & service,
const QList< QUrl > & urls )

Creates a parser for a desktop file Exec line.

Parameters
servicethe service to extract information from. The KService instance must remain alive as long as the parser is alive.
urlsThe urls the service should open.

Definition at line 257 of file desktopexecparser.cpp.

◆ ~DesktopExecParser()

KIO::DesktopExecParser::~DesktopExecParser ( )

Destructor.

Definition at line 262 of file desktopexecparser.cpp.

Member Function Documentation

◆ errorMessage()

QString KIO::DesktopExecParser::errorMessage ( ) const
Returns
an error message for when resultingArguments() returns an empty list
Since
5.71

Definition at line 576 of file desktopexecparser.cpp.

◆ executableName()

QString KIO::DesktopExecParser::executableName ( const QString & execLine)
static

Given a full command line (e.g. the Exec= line from a .desktop file), extract the name of the executable being run (removing the path, if specified).

Parameters
execLinethe full command line
Returns
the name of the executable to run, example: "ls"

Definition at line 582 of file desktopexecparser.cpp.

◆ executablePath()

QString KIO::DesktopExecParser::executablePath ( const QString & execLine)
static

Given a full command line (e.g. the Exec= line from a .desktop file), extract the name of the executable being run, including its full path, if specified.

Parameters
execLinethe full command line
Returns
the name of the executable to run, example: "/bin/ls"

Definition at line 589 of file desktopexecparser.cpp.

◆ hasSchemeHandler()

bool KIO::DesktopExecParser::hasSchemeHandler ( const QUrl & url)
static

Returns true if protocol should be opened by a "handler" application, i.e. an application associated to all URLs using this protocol (a.k.a.

scheme).

Definition at line 226 of file desktopexecparser.cpp.

◆ isProtocolInSupportedList()

bool KIO::DesktopExecParser::isProtocolInSupportedList ( const QUrl & url,
const QStringList & supportedProtocols )
static

Returns true if protocol is in the list of protocols returned by supportedProtocols().

The only reason for this method is the special handling of "KIO".

Definition at line 216 of file desktopexecparser.cpp.

◆ resultingArguments()

QStringList KIO::DesktopExecParser::resultingArguments ( ) const
Returns
a list of arguments suitable for QProcess. Returns an empty list on error, check errorMessage() for details.

Definition at line 331 of file desktopexecparser.cpp.

◆ setSuggestedFileName()

void KIO::DesktopExecParser::setSuggestedFileName ( const QString & suggestedFileName)

Sets the file name to use in the case of downloading the file to a tempfile in order to give to a non-url-aware application.

Some apps rely on the extension to determine the MIME type of the file. Usually the file name comes from the URL, but in the case of the HTTP Content-Disposition header, we need to override the file name.

Definition at line 271 of file desktopexecparser.cpp.

◆ setUrlsAreTempFiles()

void KIO::DesktopExecParser::setUrlsAreTempFiles ( bool tempFiles)

If tempFiles is set to true and the urls given to the constructor are local files, they will be deleted when the application exits.

Definition at line 266 of file desktopexecparser.cpp.

◆ supportedProtocols()

QStringList KIO::DesktopExecParser::supportedProtocols ( const KService & service)
static

Returns the list of protocols which the application supports.

This can be a list of actual protocol names, or just "KIO" for KIO-based apps.

Definition at line 187 of file desktopexecparser.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:58:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.