kio Library API Documentation

KProtocolInfo Class Reference

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

#include <kprotocolinfo.h>

Inheritance diagram for KProtocolInfo:

Inheritance graph
[legend]
Collaboration diagram for KProtocolInfo:

Collaboration graph
[legend]
List of all members.

Public Types

typedef KSharedPtr< KProtocolInfoPtr
enum  Type { T_STREAM, T_FILESYSTEM, T_NONE, T_ERROR }

Public Member Functions

 KProtocolInfo (const QString &path)
 Read a protocol description file.

virtual bool isValid () const
virtual QString name () const
 KProtocolInfo (QDataStream &_str, int offset)
virtual void load (QDataStream &)
virtual void save (QDataStream &)

Static Public Member Functions

QStringList protocols ()
bool isKnownProtocol (const KURL &url)
QString exec (const QString &protocol)
Type inputType (const KURL &url)
Type outputType (const KURL &url)
QStringList listing (const KURL &url)
bool isSourceProtocol (const KURL &url)
bool isHelperProtocol (const KURL &url)
bool isFilterProtocol (const KURL &url)
bool supportsListing (const KURL &url)
bool supportsReading (const KURL &url)
bool supportsWriting (const KURL &url)
bool supportsMakeDir (const KURL &url)
bool supportsDeleting (const KURL &url)
bool supportsLinking (const KURL &url)
bool supportsMoving (const KURL &url)
bool canCopyFromFile (const KURL &url)
bool canCopyToFile (const KURL &url)
QString defaultMimetype (const KURL &url)
QString icon (const QString &protocol)
QString config (const QString &protocol)
int maxSlaves (const QString &protocol)
bool determineMimetypeFromExtension (const QString &protocol)
Type inputType (const QString &protocol)
Type outputType (const QString &protocol)
QStringList listing (const QString &protocol)
bool isSourceProtocol (const QString &protocol)
bool isHelperProtocol (const QString &protocol)
bool isFilterProtocol (const QString &protocol)
bool isKnownProtocol (const QString &protocol)
bool supportsListing (const QString &protocol)
bool supportsReading (const QString &protocol)
bool supportsWriting (const QString &protocol)
bool supportsMakeDir (const QString &protocol)
bool supportsDeleting (const QString &protocol)
bool supportsLinking (const QString &protocol)
bool supportsMoving (const QString &protocol)
bool canCopyFromFile (const QString &protocol)
bool canCopyToFile (const QString &protocol)
QString defaultMimetype (const QString &protocol)

Protected Member Functions

virtual void virtual_hook (int id, void *data)

Protected Attributes

QString m_name
QString m_exec
Type m_inputType
Type m_outputType
QStringList m_listing
bool m_isSourceProtocol
bool m_isHelperProtocol
bool m_supportsListing
bool m_supportsReading
bool m_supportsWriting
bool m_supportsMakeDir
bool m_supportsDeleting
bool m_supportsLinking
bool m_supportsMoving
QString m_defaultMimetype
bool m_determineMimetypeFromExtension
QString m_icon
bool m_canCopyFromFile
bool m_canCopyToFile
QString m_config
int m_maxSlaves

Friends

class KProtocolInfoFactory

Detailed Description

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. KProtocolInfo scans 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>

Definition at line 40 of file kprotocolinfo.h.


Constructor & Destructor Documentation

KProtocolInfo::KProtocolInfo const QString path  ) 
 

Read a protocol description file.

Definition at line 35 of file kprotocolinfo.cpp.

References config(), locate(), KConfigBase::readBoolEntry(), KConfigBase::readEntry(), KConfigBase::readListEntry(), KConfigBase::readNumEntry(), KConfigBase::readPathEntry(), and KConfigBase::setGroup().


Member Function Documentation

virtual bool KProtocolInfo::isValid  )  const [inline, virtual]
 

Returns:
whether the protocol description file is valid.

Implements KSycocaEntry.

Definition at line 57 of file kprotocolinfo.h.

References QString::isEmpty().

virtual QString KProtocolInfo::name  )  const [inline, virtual]
 

Returns:
the name of the protocol.
This corresponds to the "protocol=" field in the protocol description file.

See also:
KURL::protocol()

Implements KSycocaEntry.

Definition at line 66 of file kprotocolinfo.h.

QStringList KProtocolInfo::protocols  )  [static]
 

Returns:
list of all known protocols

Definition at line 177 of file kprotocolinfo.cpp.

bool KProtocolInfo::isKnownProtocol const KURL url  )  [static]
 

Returns:
whether a protocol is installed that is able to handle url.
See also:
name()

Definition at line 427 of file kprotocolinfo.cpp.

References KURL::protocol().

Referenced by KURLBar::readItem().

QString KProtocolInfo::exec const QString protocol  )  [static]
 

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.

Definition at line 351 of file kprotocolinfo.cpp.

KProtocolInfo::Type KProtocolInfo::inputType const KURL url  )  [static]
 

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

Definition at line 379 of file kprotocolinfo.cpp.

KProtocolInfo::Type KProtocolInfo::outputType const KURL url  )  [static]
 

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

Definition at line 388 of file kprotocolinfo.cpp.

QStringList KProtocolInfo::listing const KURL url  )  [static]
 

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
This corresponds to the "listing=" field in the protocol description file. The supported fields should be seperated with ',' in the protocol description file.

Definition at line 443 of file kprotocolinfo.cpp.

bool KProtocolInfo::isSourceProtocol const KURL url  )  [static]
 

Returns:
whether the protocol can act as a source protocol. TODO: What does that mean? Obsolete? 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. Valid values for this field are "true" (default) for source protocol or "false" for filter protocol.

Definition at line 398 of file kprotocolinfo.cpp.

bool KProtocolInfo::isHelperProtocol const KURL url  )  [static]
 

Returns:
whether the protocol can act as a helper protocol. TODO: What does that mean?
This corresponds to the "helper=" field in the protocol description file. Valid values for this field are "true" or "false" (default).

Definition at line 417 of file kprotocolinfo.cpp.

References KURL::protocol().

bool KProtocolInfo::isFilterProtocol const KURL url  )  [static]
 

Returns:
whether the protocol can act as a filter protocol. TODO: What does that mean? A filter protocol can operate on data that is passed to it but does not retrieve/store data itself. 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.

Definition at line 407 of file kprotocolinfo.cpp.

References KURL::protocol().

bool KProtocolInfo::supportsListing const KURL url  )  [static]
 

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.)
See also:
listing()

Definition at line 434 of file kprotocolinfo.cpp.

Referenced by KFileDialog::getStartURL(), KFileDialog::setSelection(), and KURLRequester::slotOpenDialog().

bool KProtocolInfo::supportsReading const KURL url  )  [static]
 

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

Definition at line 452 of file kprotocolinfo.cpp.

bool KProtocolInfo::supportsWriting const KURL url  )  [static]
 

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

Definition at line 461 of file kprotocolinfo.cpp.

bool KProtocolInfo::supportsMakeDir const KURL url  )  [static]
 

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

Definition at line 470 of file kprotocolinfo.cpp.

bool KProtocolInfo::supportsDeleting const KURL url  )  [static]
 

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

Definition at line 479 of file kprotocolinfo.cpp.

bool KProtocolInfo::supportsLinking const KURL url  )  [static]
 

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

Definition at line 488 of file kprotocolinfo.cpp.

bool KProtocolInfo::supportsMoving const KURL url  )  [static]
 

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

Definition at line 497 of file kprotocolinfo.cpp.

bool KProtocolInfo::canCopyFromFile const KURL url  )  [static]
 

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

Definition at line 506 of file kprotocolinfo.cpp.

bool KProtocolInfo::canCopyToFile const KURL url  )  [static]
 

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

Definition at line 516 of file kprotocolinfo.cpp.

QString KProtocolInfo::defaultMimetype const KURL url  )  [static]
 

Returns:
default mimetype for this URL based on the protocol
This corresponds to the "defaultMimetype=" field in the protocol description file.

Definition at line 525 of file kprotocolinfo.cpp.

Referenced by KMimeType::findByURL().

QString KProtocolInfo::icon const QString protocol  )  [static]
 

Returns:
the name of the icon, associated with the specified protocol
This corresponds to the "Icon=" field in the protocol description file.

Definition at line 306 of file kprotocolinfo.cpp.

References QString::fromLatin1().

Referenced by KMimeType::iconForURL().

QString KProtocolInfo::config const QString protocol  )  [static]
 

Returns:
the name of the config file associated with the specified protocol. This is usefull 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()

Definition at line 315 of file kprotocolinfo.cpp.

Referenced by KProtocolInfo().

int KProtocolInfo::maxSlaves const QString protocol  )  [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.

Definition at line 324 of file kprotocolinfo.cpp.

bool KProtocolInfo::determineMimetypeFromExtension const QString protocol  )  [static]
 

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".

Definition at line 342 of file kprotocolinfo.cpp.

Referenced by KMimeType::findByURL().

QStringList KProtocolInfo::listing const QString protocol  )  [static]
 

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

Definition at line 224 of file kprotocolinfo.cpp.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:20:57 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001