KDE 4.7 PyKDE API Reference

- KDE's Python API

# KProtocolInfo Class Reference

`from PyKDE4.kdecore import *`

Inherits: KSycocaEntry

## Detailed Description

\class KProtocolInfo kprotocolinfo.h <KProtocolInfo>

Information about I/O (Internet, etc.) protocols supported by KDE.

This class is useful if you want to know which protocols KDE supports. In addition you can find out lots of information about a certain protocol. A KProtocolInfo instance represents a single protocol. Most of the functionality is provided by the static methods that scan the *.protocol files of all installed kioslaves to get this information.

*.protocol files are installed in the "services" resource.

Author:
  Torben Weis <weis@kde.org>

## Enumerations

FileNameUsedForCopying | { Name, FromUrl, DisplayName }
Type | { T_STREAM, T_FILESYSTEM, T_NONE, T_ERROR }

## Methods

| __init__ (self, QDataStream _str, int offset)
| __init__ (self, QString path)
| __init__ (self, KProtocolInfo other)
QStringList | archiveMimeTypes (self)
bool | canDeleteRecursive (self)
bool | canRenameFromFile (self)
bool | canRenameToFile (self)
QString | defaultMimeType (self)
KProtocolInfo.FileNameUsedForCopying | fileNameUsedForCopying (self)
bool | supportsListing (self)

## Static Methods

QStringList | capabilities (QString protocol)
QString | config (QString protocol)
bool | determineMimetypeFromExtension (QString protocol)
QString | docPath (QString protocol)
QString | exec_ (QString protocol)
[KProtocolInfo.ExtraField] | extraFields (KUrl url)
QString | icon (QString protocol)
bool | isFilterProtocol (KUrl url)
bool | isFilterProtocol (QString protocol)
bool | isHelperProtocol (KUrl url)
bool | isHelperProtocol (QString protocol)
bool | isKnownProtocol (KUrl url)
bool | isKnownProtocol (QString protocol)
int | maxSlaves (QString protocol)
int | maxSlavesPerHost (QString protocol)
QString | protocolClass (QString protocol)
QStringList | protocols ()
QString | proxiedBy (QString protocol)
bool | showFilePreview (QString protocol)

## Method Documentation

__init__ | ( | self, |
|  | QDataStream | _str,
|  | int | offset
| ) |  |  |

Internal:
  construct a KProtocolInfo from a stream

__init__ | ( | self, |
|  | QString | path
| ) |  |  |

Read a protocol description file

Parameters:

  | path | the path of the description file

__init__ | ( | self, |
|  | KProtocolInfo | other
| ) |  |  |

QStringList archiveMimeTypes | ( |  | self ) |

bool canDeleteRecursive | ( |  | self ) |

bool canRenameFromFile | ( |  | self ) |

bool canRenameToFile | ( |  | self ) |

QString defaultMimeType | ( |  | self ) |

KProtocolInfo.FileNameUsedForCopying fileNameUsedForCopying | ( |  | self ) |

bool supportsListing | ( |  | self ) |

## Static Method Documentation

QStringList capabilities | ( | QString | protocol
| ) |  |  |

Returns the list of capabilities provided by the kioslave 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 slave 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 kioslave implementations.

Parameters:

  | protocol | the protocol to check

Returns:
  the list of capabilities.

QString config | ( | QString | protocol
| ) |  |  |

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

bool determineMimetypeFromExtension | ( | QString | protocol
| ) |  |  |

Returns whether mimetypes 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

QString docPath | ( | QString | protocol
| ) |  |  |

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

QString exec_ | ( | QString | protocol
| ) |  |  |

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()

[KProtocolInfo.ExtraField] extraFields | ( | KUrl | url
| ) |  |  |

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

QString icon | ( | QString | protocol
| ) |  |  |

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

bool isFilterProtocol | ( | KUrl | url
| ) |  |  |

Same as above except you can supply just the protocol instead of the whole URL.

bool isFilterProtocol | ( | QString | protocol
| ) |  |  |

Same as above except you can supply just the protocol instead of the whole URL.

bool isHelperProtocol | ( | KUrl | url
| ) |  |  |

Same as above except you can supply just the protocol instead of the whole URL.

bool isHelperProtocol | ( | QString | protocol
| ) |  |  |

Same as above except you can supply just the protocol instead of the whole URL.

bool isKnownProtocol | ( | KUrl | url
| ) |  |  |

Same as above except you can supply just the protocol instead of the whole URL.

bool isKnownProtocol | ( | QString | protocol
| ) |  |  |

Same as above except you can supply just the protocol instead of the whole URL.

int maxSlaves | ( | QString | protocol
| ) |  |  |

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

int maxSlavesPerHost | ( | QString | protocol
| ) |  |  |

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

QString protocolClass | ( | QString | protocol
| ) |  |  |

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

QStringList protocols | ( |  | ) |

Returns list of all known protocols.

Returns:
  a list of all known protocols

QString proxiedBy | ( | QString | protocol
| ) |  |  |

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.

bool showFilePreview | ( | QString | protocol
| ) |  |  |

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

## Enumeration Documentation

FileNameUsedForCopying

Enumerator:

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:

  String = QVariant::String |
  DateTime = QVariant::DateTime |
  Invalid = QVariant::Invalid |