org.kde.koala

Class KProtocolInfo

public class KProtocolInfo extends KSycocaEntry

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

UNKNOWN: Information about I/O (Internet, etc.

Field Summary
static intT_ERROR
static intT_FILESYSTEM
static intT_NONE
static intT_STREAM
Describes the type of a protocol.
Constructor Summary
protected KProtocolInfo(Class dummy)
KProtocolInfo(String path)
Read a protocol description file
KProtocolInfo(QDataStream _str, int offset)
Method Summary
static booleancanCopyFromFile(KURL url)
Returns whether the protocol can copy files/objects directly from the filesystem itself.
static booleancanCopyToFile(KURL url)
Returns whether the protocol can copy files/objects directly to the filesystem itself.
static booleancanDeleteRecursive(KURL url)
Returns whether the protocol can recursively delete directories by itself.
protected booleancanDeleteRecursive()
static booleancanRenameFromFile(KURL url)
Returns whether the protocol can rename (i.e. move fast) files/objects directly from the filesystem itself.
protected booleancanRenameFromFile()
static booleancanRenameToFile(KURL url)
Returns whether the protocol can rename (i.e. move fast) files/objects directly to the filesystem itself.
protected booleancanRenameToFile()
static ArrayListcapabilities(String protocol)
Returns the list of capabilities provided by the kioslave implementing this protocol.
static Stringconfig(String protocol)
Returns the name of the config file associated with the specified protocol.
static StringdefaultMimetype(KURL url)
Returns default mimetype for this URL based on the protocol.
static booleandetermineMimetypeFromExtension(String protocol)
Returns whether mimetypes can be determined based on extension for this protocol.
voiddispose()
Delete the wrapped C++ instance ahead of finalize()
static StringdocPath(String protocol)
Returns the documentation path for the specified protocol.
static Stringexec(String 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.
protected voidfinalize()
Deletes the wrapped C++ instance
protected static KProtocolInfofindProtocol(KURL url)
static Stringicon(String protocol)
Returns the name of the icon, associated with the specified protocol.
static intinputType(KURL url)
Returns whether the protocol should be treated as a filesystem or as a stream when reading from it.
booleanisDisposed()
Has the wrapped C++ instance been deleted?
static booleanisFilterProtocol(KURL url)
Returns whether the protocol can act as a filter protocol.
static booleanisFilterProtocol(String protocol)
Same as above except you can supply just the protocol instead of the whole URL.
static booleanisHelperProtocol(KURL url)
Returns whether the protocol can act as a helper protocol.
static booleanisHelperProtocol(String protocol)
Same as above except you can supply just the protocol instead of the whole URL.
static booleanisKnownProtocol(KURL url)
Returns whether a protocol is installed that is able to handle url.
static booleanisKnownProtocol(String protocol)
Same as above except you can supply just the protocol instead of the whole URL.
static booleanisSourceProtocol(KURL url)
Returns whether the protocol can act as a source protocol.
booleanisValid()
Returns whether the protocol description file is valid.
static ArrayListlisting(KURL url)
Returns the list of fields this protocol returns when listing The current possibilities are Name, Type, Size, Date, AccessDate, Access, Owner, Group, Link, URL, MimeType as well as Extra1, Extra2 etc. for extra fields (see extraFields).
voidload(QDataStream arg1)
Load the protocol info from a stream.
static intmaxSlaves(String protocol)
Returns the soft limit on the number of slaves for this protocol.
Stringname()
Returns the name of the protocol.
static intoutputType(KURL url)
Returns whether the protocol should be treated as a filesystem or as a stream when writing to it.
static StringprotocolClass(String protocol)
Returns the protocol class for the specified protocol.
static ArrayListprotocols()
Returns list of all known protocols.
static StringproxiedBy(String protocol)
Returns the name of the protocol through which the request will be routed if proxy support is enabled.
voidsave(QDataStream arg1)
Save the protocol info to a stream.
static booleanshowFilePreview(String protocol)
Returns whether file previews should be shown for the specified protocol.
static booleansupportsDeleting(KURL url)
Returns whether the protocol can delete files/objects.
static booleansupportsLinking(KURL url)
Returns whether the protocol can create links between files/objects.
static booleansupportsListing(KURL url)
Returns whether the protocol can list files/objects.
static booleansupportsMakeDir(KURL url)
Returns whether the protocol can create directories/folders.
static booleansupportsMoving(KURL url)
Returns whether the protocol can move files/objects between different locations.
static booleansupportsReading(KURL url)
Returns whether the protocol can retrieve data from URLs.
static booleansupportsWriting(KURL url)
Returns whether the protocol can store data to URLs.
static inturiParseMode(String protocol)
Returns the suggested URI parsing mode for the KURL parser.

Field Detail

T_ERROR

public static final int T_ERROR

T_FILESYSTEM

public static final int T_FILESYSTEM

T_NONE

public static final int T_NONE

T_STREAM

public static final int T_STREAM
Describes the type of a protocol.

UNKNOWN: Describes the type of a protocol.

Constructor Detail

KProtocolInfo

protected KProtocolInfo(Class dummy)

KProtocolInfo

public KProtocolInfo(String path)
Read a protocol description file

Parameters: path the path of the description file

UNKNOWN: Read a protocol description file

KProtocolInfo

public KProtocolInfo(QDataStream _str, int offset)

UNKNOWN:

Method Detail

canCopyFromFile

public static boolean canCopyFromFile(KURL url)
Returns whether the protocol can copy files/objects directly from the filesystem itself. If not, the application will read files from the filesystem using the file-protocol and pass the data on to the destination protocol. This corresponds to the "copyFromFile=" 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 can copy files from the local file system

UNKNOWN: Returns whether the protocol can copy files/objects directly from the filesystem itself.

canCopyToFile

public static boolean canCopyToFile(KURL url)
Returns whether the protocol can copy files/objects directly to the filesystem itself. If not, the application will receive the data from the source protocol and store it in the filesystem using the file-protocol. This corresponds to the "copyToFile=" 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 can copy files to the local file system

UNKNOWN: Returns whether the protocol can copy files/objects directly to the filesystem itself.

canDeleteRecursive

public static boolean canDeleteRecursive(KURL url)
Returns whether the protocol can recursively delete directories by itself. If not (the usual case) then KIO will list the directory and delete files and empty directories one by one. This corresponds to the "deleteRecursive=" 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 can delete non-empty directories by itself.

UNKNOWN: Returns whether the protocol can recursively delete directories by itself.

canDeleteRecursive

protected boolean canDeleteRecursive()

canRenameFromFile

public static boolean canRenameFromFile(KURL url)
Returns whether the protocol can rename (i.e. move fast) files/objects directly from the filesystem itself. If not, the application will read files from the filesystem using the file-protocol and pass the data on to the destination protocol. This corresponds to the "renameFromFile=" 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 can rename/move files from the local file system

UNKNOWN: Returns whether the protocol can rename (i.

canRenameFromFile

protected boolean canRenameFromFile()

canRenameToFile

public static boolean canRenameToFile(KURL url)
Returns whether the protocol can rename (i.e. move fast) files/objects directly to the filesystem itself. If not, the application will receive the data from the source protocol and store it in the filesystem using the file-protocol. This corresponds to the "renameToFile=" 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 can rename files to the local file system

UNKNOWN: Returns whether the protocol can rename (i.

canRenameToFile

protected boolean canRenameToFile()

capabilities

public static ArrayList capabilities(String 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.

UNKNOWN: Returns the list of capabilities provided by the kioslave implementing this protocol.

config

public static String config(String 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

UNKNOWN: Returns the name of the config file associated with the specified protocol.

defaultMimetype

public static String defaultMimetype(KURL url)
Returns default mimetype for this URL based on the protocol. This corresponds to the "defaultMimetype=" field in the protocol description file.

Parameters: url the url to check

Returns: the default mime type of the protocol, or null if unknown

UNKNOWN: Returns default mimetype for this URL based on the protocol.

determineMimetypeFromExtension

public static boolean determineMimetypeFromExtension(String 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

UNKNOWN: Returns whether mimetypes can be determined based on extension for this protocol.

dispose

public void dispose()
Delete the wrapped C++ instance ahead of finalize()

docPath

public static String docPath(String protocol)
Returns the documentation path for the specified protocol. This corresponds to the "DocPath=" field in the protocol description file.

Parameters: protocol the protocol to check

Returns: the docpath of the protocol, or null if unknown

UNKNOWN: Returns the documentation path for the specified protocol.

exec

public static String exec(String 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 null for unsupported protocols

See Also: KURL

UNKNOWN: Returns the library / executable to open for the protocol protocol Example : "kio_ftp", meaning either the executable "kio_ftp" or the library "kio_ftp.

finalize

protected void finalize()
Deletes the wrapped C++ instance

findProtocol

protected static KProtocolInfo findProtocol(KURL url)

icon

public static String icon(String 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

UNKNOWN: Returns the name of the icon, associated with the specified protocol.

inputType

public static int inputType(KURL url)
Returns whether the protocol should be treated as a filesystem or as a stream when reading from it. This corresponds to the "input=" field in the protocol description file. Valid values for this field are "filesystem", "stream" or "none" (default).

Parameters: url the url to check

Returns: the input type of the given url

UNKNOWN: Returns whether the protocol should be treated as a filesystem or as a stream when reading from it.

isDisposed

public boolean isDisposed()
Has the wrapped C++ instance been deleted?

isFilterProtocol

public static boolean 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

UNKNOWN: Returns whether the protocol can act as a filter protocol.

isFilterProtocol

public static boolean isFilterProtocol(String protocol)
Same as above except you can supply just the protocol instead of the whole URL.

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

isHelperProtocol

public static boolean 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)

UNKNOWN: Returns whether the protocol can act as a helper protocol.

isHelperProtocol

public static boolean isHelperProtocol(String protocol)
Same as above except you can supply just the protocol instead of the whole URL.

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

isKnownProtocol

public static boolean 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: KProtocolInfo

UNKNOWN: Returns whether a protocol is installed that is able to handle url.

isKnownProtocol

public static boolean isKnownProtocol(String protocol)
Same as above except you can supply just the protocol instead of the whole URL.

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

isSourceProtocol

public static boolean isSourceProtocol(KURL url)
Returns whether the protocol can act as a source protocol. A source protocol retrieves data from or stores data to the location specified by a URL. A source protocol is the opposite of a filter protocol. The "source=" field in the protocol description file determines whether a protocol is a source protocol or a filter protocol.

Parameters: url the url to check

Returns: true if the protocol is a source of data (e.g. http), false if the protocol is a filter (e.g. gzip)

UNKNOWN: Returns whether the protocol can act as a source protocol.

isValid

public boolean isValid()
Returns whether the protocol description file is valid.

Returns: true if valid, false otherwise

UNKNOWN: Returns whether the protocol description file is valid.

listing

public static ArrayList listing(KURL url)
Returns the list of fields this protocol returns when listing The current possibilities are Name, Type, Size, Date, AccessDate, Access, Owner, Group, Link, URL, MimeType as well as Extra1, Extra2 etc. for extra fields (see extraFields). This corresponds to the "listing=" field in the protocol description file. The supported fields should be separated with ',' in the protocol description file.

Parameters: url the url to check

Returns: a list of field names

UNKNOWN: Returns the list of fields this protocol returns when listing The current possibilities are Name, Type, Size, Date, AccessDate, Access, Owner, Group, Link, URL, MimeType as well as Extra1, Extra2 etc.

load

public void load(QDataStream arg1)
Load the protocol info from a stream.

UNKNOWN:

maxSlaves

public static int maxSlaves(String 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

UNKNOWN: Returns the soft limit on the number of slaves for this protocol.

name

public String name()
Returns the name of the protocol. This corresponds to the "protocol=" field in the protocol description file.

Returns: the name of the protocol

See Also: KURL

UNKNOWN: Returns the name of the protocol.

outputType

public static int outputType(KURL url)
Returns whether the protocol should be treated as a filesystem or as a stream when writing to it. This corresponds to the "output=" field in the protocol description file. Valid values for this field are "filesystem", "stream" or "none" (default).

Parameters: url the url to check

Returns: the output type of the given url

UNKNOWN: Returns whether the protocol should be treated as a filesystem or as a stream when writing to it.

protocolClass

public static String protocolClass(String 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

    UNKNOWN: Returns the protocol class for the specified protocol.

    protocols

    public static ArrayList protocols()
    Returns list of all known protocols.

    Returns: a list of all known protocols

    UNKNOWN: Returns list of all known protocols.

    proxiedBy

    public static String proxiedBy(String 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.

    UNKNOWN: Returns the name of the protocol through which the request will be routed if proxy support is enabled.

    save

    public void save(QDataStream arg1)
    Save the protocol info to a stream.

    UNKNOWN:

    showFilePreview

    public static boolean showFilePreview(String 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

    UNKNOWN: Returns whether file previews should be shown for the specified protocol.

    supportsDeleting

    public static boolean supportsDeleting(KURL url)
    Returns whether the protocol can delete files/objects. This corresponds to the "deleting=" 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 supports deleting

    UNKNOWN: Returns whether the protocol can delete files/objects.

    supportsLinking

    public static boolean supportsLinking(KURL url)
    Returns whether the protocol can create links between files/objects. This corresponds to the "linking=" 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 supports linking

    UNKNOWN: Returns whether the protocol can create links between files/objects.

    supportsListing

    public static boolean supportsListing(KURL url)
    Returns whether the protocol can list files/objects. If a protocol supports listing it can be browsed in e.g. file-dialogs and konqueror. Whether a protocol supports listing is determined by the "listing=" field in the protocol description file. If the protocol support listing it should list the fields it provides in this field. If the protocol does not support listing this field should remain empty (default.)

    Parameters: url the url to check

    Returns: true if the protocol support listing

    See Also: KProtocolInfo

    UNKNOWN: Returns whether the protocol can list files/objects.

    supportsMakeDir

    public static boolean supportsMakeDir(KURL url)
    Returns whether the protocol can create directories/folders. This corresponds to the "makedir=" 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 can create directories

    UNKNOWN: Returns whether the protocol can create directories/folders.

    supportsMoving

    public static boolean supportsMoving(KURL url)
    Returns whether the protocol can move files/objects between different locations. This corresponds to the "moving=" 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 supports moving

    UNKNOWN: Returns whether the protocol can move files/objects between different locations.

    supportsReading

    public static boolean supportsReading(KURL url)
    Returns whether the protocol can retrieve data from URLs. This corresponds to the "reading=" 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 it is possible to read from the URL

    UNKNOWN: Returns whether the protocol can retrieve data from URLs.

    supportsWriting

    public static boolean supportsWriting(KURL url)
    Returns whether the protocol can store data to URLs. This corresponds to the "writing=" 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 supports writing

    UNKNOWN: Returns whether the protocol can store data to URLs.

    uriParseMode

    public static int uriParseMode(String protocol)
    Returns the suggested URI parsing mode for the KURL parser. This corresponds to the "URIMode=" field in the protocol description file. The following parsing modes are defined:
  • "url" for a standards compliant URL
  • "rawuri" for a non-conformant URI for which URL parsing would be meaningless
  • "mailto" for a mailto style URI (the path part contains only an email address)
  • Parameters: protocol the protocol to check

    Returns: the suggested parsing mode, or KURL.Auto if unspecified

    UNKNOWN: Returns the suggested URI parsing mode for the KURL parser.