KProtocolInfo
#include <KProtocolInfo>
Classes | |
struct | ExtraField |
Public Types | |
typedef QList< ExtraField > | ExtraFieldList |
enum | FileNameUsedForCopying { Name, FromUrl, DisplayName } |
enum | Type { T_STREAM, T_FILESYSTEM, T_NONE, T_ERROR } |
Static Public Member Functions | |
static QStringList | archiveMimetypes (const QString &protocol) |
static QStringList | capabilities (const QString &protocol) |
static QString | config (const QString &protocol) |
static QString | defaultMimetype (const QString &protocol) |
static bool | determineMimetypeFromExtension (const QString &protocol) |
static QString | docPath (const QString &protocol) |
static QString | exec (const QString &protocol) |
static ExtraFieldList | extraFields (const QUrl &url) |
static QString | icon (const QString &protocol) |
static bool | isFilterProtocol (const QString &protocol) |
static bool | isFilterProtocol (const QUrl &url) |
static bool | isHelperProtocol (const QString &protocol) |
static bool | isHelperProtocol (const QUrl &url) |
static bool | isKnownProtocol (const QString &protocol) |
static bool | isKnownProtocol (const QUrl &url) |
static int | maxSlaves (const QString &protocol) |
static int | maxSlavesPerHost (const QString &protocol) |
static int | maxWorkers (const QString &protocol) |
static int | maxWorkersPerHost (const QString &protocol) |
static QString | protocolClass (const QString &protocol) |
static QStringList | protocols () |
static QString | proxiedBy (const QString &protocol) |
static bool | showFilePreview (const QString &protocol) |
static QStringList | slaveHandlesNotify (const QString &protocol) |
Detailed Description
Information about I/O (Internet, etc.) protocols supported by KDE.
KProtocolInfo is useful if you want to know which protocols KDE supports. In addition you can find out lots of information about a certain protocol. All of the functionality is provided by the static methods. The implementation scans the *.protocol files of all installed KIO workers to get this information and stores the result into an internal cache.
*.protocol files are installed in the "services" resource.
The KProtocolInfo methods are reentrant (i.e. can be called from multiple threads simultaneously).
Definition at line 33 of file kprotocolinfo.h.
Member Enumeration Documentation
◆ Type
enum KProtocolInfo::Type |
Describes the type of a protocol.
For instance ftp:// appears as a filesystem with folders and files, while bzip2:// appears as a single file (a stream of data), and telnet:// doesn't output anything.
- See also
- outputType
Enumerator | |
---|---|
T_STREAM | stream of data (e.g. single file) |
T_FILESYSTEM | structured directory |
T_NONE | no information about the type available |
T_ERROR | used to signal an error |
Definition at line 81 of file kprotocolinfo.h.
Member Function Documentation
◆ archiveMimetypes()
|
static |
Returns the list of archive MIME types handled by the KIO worker implementing this protocol.
This corresponds to the "archiveMimetype=" field in the protocol description file.
- Parameters
-
protocol the protocol to check
- Returns
- the list of archive MIME types (e.g. application/x-zip) handled.
- Since
- 5.23
Definition at line 393 of file kprotocolinfo.cpp.
◆ capabilities()
|
static |
Returns the list of capabilities provided by the KIO worker implementing this protocol.
This corresponds to the "Capabilities=" field in the protocol description file.
The capability names are not defined globally, they are up to each worker implementation. For example when adding support for a new special command for mounting, one would add the string "Mount" to the capabilities list, and applications could check for that string before sending a special() command that would otherwise do nothing on older KIO worker implementations.
- Parameters
-
protocol the protocol to check
- Returns
- the list of capabilities.
Definition at line 383 of file kprotocolinfo.cpp.
◆ config()
Returns the name of the config file associated with the specified protocol.
This is useful if two similar protocols need to share a single config file, e.g. http and https.
This corresponds to the "config=" field in the protocol description file. The default is the protocol name, see name()
- Parameters
-
protocol the protocol to check
- Returns
- the config file, or an empty string if unknown
Definition at line 270 of file kprotocolinfo.cpp.
◆ defaultMimetype()
Returns the default MIME type for the specified protocol, if one exists.
This corresponds to the "defaultMimetype=" field in the protocol description file.
- Parameters
-
protocol the protocol to check
- Returns
- the default MIME type of the protocol, or an empty string if none set or protocol unknown
- Since
- 5.60
Definition at line 344 of file kprotocolinfo.cpp.
◆ determineMimetypeFromExtension()
|
static |
Returns whether MIME types can be determined based on extension for this protocol.
For some protocols, e.g. http, the filename extension in the URL can not be trusted to truly reflect the file type.
This corresponds to the "determineMimetypeFromExtension=" field in the protocol description file. Valid values for this field are "true" (default) or "false".
- Parameters
-
protocol the protocol to check
- Returns
- true if the MIME types can be determined by extension
Definition at line 315 of file kprotocolinfo.cpp.
◆ docPath()
Returns the documentation path for the specified protocol.
This corresponds to the "X-DocPath=" or "DocPath=" field in the protocol description file.
- Parameters
-
protocol the protocol to check
- Returns
- the docpath of the protocol, or an empty string if unknown
Definition at line 354 of file kprotocolinfo.cpp.
◆ exec()
Returns the library / executable to open for the protocol protocol
Example : "kio_ftp", meaning either the executable "kio_ftp" or the library "kio_ftp.la" (recommended), whichever is available.
This corresponds to the "exec=" field in the protocol description file.
- Parameters
-
protocol the protocol to check
- Returns
- the executable of library to open, or QString() for unsupported protocols
- See also
- KUrl::protocol()
Definition at line 325 of file kprotocolinfo.cpp.
◆ extraFields()
|
static |
Definition of extra fields in the UDS entries, returned by a listDir operation.
This corresponds to the "ExtraNames=" and "ExtraTypes=" fields in the protocol description file. Those two lists should be separated with ',' in the protocol description file. See ExtraField for details about names and types
Definition at line 334 of file kprotocolinfo.cpp.
◆ icon()
Returns the name of the icon, associated with the specified protocol.
This corresponds to the "Icon=" field in the protocol description file.
- Parameters
-
protocol the protocol to check
- Returns
- the icon of the protocol, or an empty string if unknown
Definition at line 255 of file kprotocolinfo.cpp.
◆ isFilterProtocol() [1/2]
|
static |
Same as above except you can supply just the protocol instead of the whole URL.
Definition at line 244 of file kprotocolinfo.cpp.
◆ isFilterProtocol() [2/2]
|
static |
Returns whether the protocol can act as a filter protocol.
A filter protocol can operate on data that is passed to it but does not retrieve/store data itself, like gzip. A filter protocol is the opposite of a source protocol.
The "source=" field in the protocol description file determines whether a protocol is a source protocol or a filter protocol. Valid values for this field are "true" (default) for source protocol or "false" for filter protocol.
- Parameters
-
url the url to check
- Returns
- true if the protocol is a filter (e.g. gzip), false if the protocol is a helper or source
Definition at line 425 of file kprotocolinfo.cpp.
◆ isHelperProtocol() [1/2]
|
static |
Same as above except you can supply just the protocol instead of the whole URL.
Definition at line 435 of file kprotocolinfo.cpp.
◆ isHelperProtocol() [2/2]
|
static |
Returns whether the protocol can act as a helper protocol.
A helper protocol invokes an external application and does not return a file or stream.
This corresponds to the "helper=" field in the protocol description file. Valid values for this field are "true" or "false" (default).
- Parameters
-
url the url to check
- Returns
- true if the protocol is a helper protocol (e.g. vnc), false if not (e.g. http)
Definition at line 430 of file kprotocolinfo.cpp.
◆ isKnownProtocol() [1/2]
|
static |
Same as above except you can supply just the protocol instead of the whole URL.
Definition at line 450 of file kprotocolinfo.cpp.
◆ isKnownProtocol() [2/2]
|
static |
Returns whether a protocol is installed that is able to handle url
.
- Parameters
-
url the url to check
- Returns
- true if the protocol is known
- See also
- name()
Definition at line 445 of file kprotocolinfo.cpp.
◆ maxSlaves()
|
static |
Returns the soft limit on the number of slaves for this protocol.
This limits the number of slaves used for a single operation, note that multiple operations may result in a number of instances that exceeds this soft limit.
This corresponds to the "maxInstances=" field in the protocol description file. The default is 1.
- Parameters
-
protocol the protocol to check
- Returns
- the maximum number of slaves, or 1 if unknown
- Deprecated:
- Since 5.101, use maxWorkers(const QString &)
Definition at line 282 of file kprotocolinfo.cpp.
◆ maxSlavesPerHost()
|
static |
Returns the limit on the number of slaves for this protocol per host.
This corresponds to the "maxInstancesPerHost=" field in the protocol description file. The default is 0 which means there is no per host limit.
- Parameters
-
protocol the protocol to check
- Returns
- the maximum number of slaves, or 1 if unknown
- Since
- 4.4
- Deprecated:
- Since 5.101, use maxWorkersPerHost(const QString &)
Definition at line 289 of file kprotocolinfo.cpp.
◆ maxWorkers()
|
static |
Returns the soft limit on the number of KIO workers for this protocol.
This limits the number of workers used for a single operation, note that multiple operations may result in a number of instances that exceeds this soft limit.
This corresponds to the "maxInstances=" field in the protocol's worker metadata. The default is 1.
- Parameters
-
protocol the protocol to check
- Returns
- the maximum number of workers, or 1 if unknown
- Since
- 5.101
Definition at line 295 of file kprotocolinfo.cpp.
◆ maxWorkersPerHost()
|
static |
Returns the limit on the number of KIO workers for this protocol per host.
This corresponds to the "maxInstancesPerHost=" field in the protocol's worker metadata. The default is 0 which means there is no per host limit.
- Parameters
-
protocol the protocol to check
- Returns
- the maximum number of workers, or 1 if unknown
- Since
- 5.101
Definition at line 305 of file kprotocolinfo.cpp.
◆ protocolClass()
Returns the protocol class for the specified protocol.
This corresponds to the "Class=" field in the protocol description file.
The following classes are defined:
- ":internet" for common internet protocols
- ":local" for protocols that access local resources
Protocol classes always start with a ':' so that they can not be confused with the protocols themselves.
- Parameters
-
protocol the protocol to check
- Returns
- the class of the protocol, or an empty string if unknown
Definition at line 364 of file kprotocolinfo.cpp.
◆ protocols()
|
static |
Returns list of all known protocols.
- Returns
- a list of all known protocols
Definition at line 239 of file kprotocolinfo.cpp.
◆ proxiedBy()
Returns the name of the protocol through which the request will be routed if proxy support is enabled.
A good example of this is the ftp protocol for which proxy support is commonly handled by the http protocol.
This corresponds to the "ProxiedBy=" in the protocol description file.
Definition at line 415 of file kprotocolinfo.cpp.
◆ showFilePreview()
|
static |
Returns whether file previews should be shown for the specified protocol.
This corresponds to the "ShowPreviews=" field in the protocol description file.
By default previews are shown if protocolClass is :local.
- Parameters
-
protocol the protocol to check
- Returns
- true if previews should be shown by default, false otherwise
Definition at line 374 of file kprotocolinfo.cpp.
◆ slaveHandlesNotify()
|
static |
Returns the list of notification types the kioslave implementing this protocol will produce on its own, making it unnecessary for job implementations to do so.
An example would be returning "Rename" if the kioslave's rename() method takes care of calling KDirNotify::emitFileRenameWithLocalPath on its own.
This corresponds to "slaveHandlesNotify=" in the protocol description file.
- Since
- 5.20
- Deprecated:
- Since 5.101, no known users
Definition at line 404 of file kprotocolinfo.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Nov 30 2023 03:52:33 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.