KDE 4.2 PyKDE API Reference
  • KDE's Python API
  • Overview
  • PyKDE Home
  • Sitemap
  • Contact Us
 

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 }
Type { T_STREAM, T_FILESYSTEM, T_NONE, T_ERROR }

Methods

 __init__ (self, QDataStream _str, int offset)
 __init__ (self, QString path)
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.ExtraFieldList 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)
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

QStringList archiveMimeTypes (   self )

@internal. Use KProtocolManager instead.

bool canDeleteRecursive (   self )
bool canRenameFromFile (   self )
bool canRenameToFile (   self )
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 null if unknown

QString defaultMimeType (   self )

@internal. Use KProtocolManager instead.

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 null 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.ExtraFieldList 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

KProtocolInfo.FileNameUsedForCopying fileNameUsedForCopying (   self )
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 null if unknown

bool isFilterProtocol ( KUrl  url
)

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

bool isFilterProtocol ( QString  protocol
)

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

bool isHelperProtocol ( KUrl  url
)

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)

bool isHelperProtocol ( QString  protocol
)

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

bool isKnownProtocol ( KUrl  url
)

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

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

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 null 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

    bool supportsListing (   self )

    @internal. Use KProtocolManager instead.


    Enumeration Documentation

    FileNameUsedForCopying
    Enumerator:
    Name 
    FromUrl 

    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 
    T_FILESYSTEM 
    T_NONE 
    T_ERROR 

    • Full Index

    Modules

    • akonadi
    • dnssd
    • kdecore
    • kdeui
    • khtml
    • kio
    • knewstuff
    • kparts
    • kutils
    • nepomuk
    • phonon
    • plasma
    • solid
    • soprano
    This documentation is maintained by Simon Edwards.
    KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal