KProtocolManager

Search for usage in LXR

KProtocolManager Class Reference

#include <KProtocolManager>

Static Public Member Functions

static bool autoResume ()
 
static bool canCopyFromFile (const QUrl &url)
 
static bool canCopyToFile (const QUrl &url)
 
static bool canDeleteRecursive (const QUrl &url)
 
static bool canRenameFromFile (const QUrl &url)
 
static bool canRenameToFile (const QUrl &url)
 
static QString charsetFor (const QUrl &url)
 
static int connectTimeout ()
 
static QString defaultMimetype (const QUrl &url)
 
static KProtocolInfo::FileNameUsedForCopying fileNameUsedForCopying (const QUrl &url)
 
static KProtocolInfo::Type inputType (const QUrl &url)
 
static bool isSourceProtocol (const QUrl &url)
 
static QStringList listing (const QUrl &url)
 
static bool markPartial ()
 
static int minimumKeepSize ()
 
static KProtocolInfo::Type outputType (const QUrl &url)
 
static QString protocolForArchiveMimetype (const QString &mimeType)
 
static int proxyConnectTimeout ()
 
static int readTimeout ()
 
static void reparseConfiguration ()
 
static int responseTimeout ()
 
static bool supportsDeleting (const QUrl &url)
 
static bool supportsLinking (const QUrl &url)
 
static bool supportsListing (const QUrl &url)
 
static bool supportsMakeDir (const QUrl &url)
 
static bool supportsMoving (const QUrl &url)
 
static bool supportsOpening (const QUrl &url)
 
static bool supportsPermissions (const QUrl &url)
 
static bool supportsReading (const QUrl &url)
 
static bool supportsTruncating (const QUrl &url)
 
static bool supportsWriting (const QUrl &url)
 

Detailed Description

Provides information about I/O (Internet, etc.) settings chosen/set by the end user.

KProtocolManager has a heap of static functions that allows only read access to KDE's IO related settings. These include proxy, cache, file transfer resumption, timeout and user-agent related settings.

The information provided by this class is generic enough to be applicable to any application that makes use of KDE's IO sub-system. Note that this mean the proxy, timeout etc. settings are saved in a separate user-specific config file and not in the config file of the application.

Original author:

Author
Torben Weis weis@.nosp@m.kde..nosp@m.org

Revised by:

Author
Waldo Bastain basta.nosp@m.in@k.nosp@m.de.or.nosp@m.g
Dawit Alemayehu adawi.nosp@m.t@kd.nosp@m.e.org
See also
KPAC

Definition at line 53 of file kprotocolmanager.h.

Member Function Documentation

◆ autoResume()

bool KProtocolManager::autoResume ( )
static

Returns true if partial downloads should be automatically resumed.

Returns
true to resume partial downloads

Definition at line 646 of file kprotocolmanager.cpp.

◆ canCopyFromFile()

bool KProtocolManager::canCopyFromFile ( const QUrl & 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).

Parameters
urlthe url to check
Returns
true if the protocol can copy files from the local file system

Definition at line 799 of file kprotocolmanager.cpp.

◆ canCopyToFile()

bool KProtocolManager::canCopyToFile ( const QUrl & 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).

Parameters
urlthe url to check
Returns
true if the protocol can copy files to the local file system

Definition at line 809 of file kprotocolmanager.cpp.

◆ canDeleteRecursive()

bool KProtocolManager::canDeleteRecursive ( const QUrl & url)
static

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
urlthe url to check
Returns
true if the protocol can delete non-empty directories by itself.

Definition at line 839 of file kprotocolmanager.cpp.

◆ canRenameFromFile()

bool KProtocolManager::canRenameFromFile ( const QUrl & url)
static

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
urlthe url to check
Returns
true if the protocol can rename/move files from the local file system

Definition at line 819 of file kprotocolmanager.cpp.

◆ canRenameToFile()

bool KProtocolManager::canRenameToFile ( const QUrl & url)
static

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
urlthe url to check
Returns
true if the protocol can rename files to the local file system

Definition at line 829 of file kprotocolmanager.cpp.

◆ charsetFor()

QString KProtocolManager::charsetFor ( const QUrl & url)
static

Returns the charset to use for the specified url.

Definition at line 885 of file kprotocolmanager.cpp.

◆ connectTimeout()

int KProtocolManager::connectTimeout ( )
static

Returns the preferred timeout value for remote connections in seconds.

Returns
timeout value for remote connection in secs.

Definition at line 280 of file kprotocolmanager.cpp.

◆ defaultMimetype()

QString KProtocolManager::defaultMimetype ( const QUrl & url)
static

Returns default MIME type for this URL based on the protocol.

This corresponds to the "defaultMimetype=" field in the protocol description file.

Parameters
urlthe url to check
Returns
the default MIME type of the protocol, or an empty string if unknown

Definition at line 859 of file kprotocolmanager.cpp.

◆ fileNameUsedForCopying()

KProtocolInfo::FileNameUsedForCopying KProtocolManager::fileNameUsedForCopying ( const QUrl & url)
static

This setting defines the strategy to use for generating a filename, when copying a file or directory to another directory.

By default the destination filename is made out of the filename in the source URL. However if the KIO worker displays names that are different from the filename of the URL (e.g. kio_fonts shows Arial for arial.ttf, or kio_trash shows foo.txt and uses some internal URL), using Name means that the display name (UDS_NAME) will be used to as the filename in the destination directory.

This corresponds to the "fileNameUsedForCopying=" field in the protocol description file. Valid values for this field are "Name" or "FromURL" (default).

Parameters
urlthe url to check
Returns
how to generate the filename in the destination directory when copying/moving

Definition at line 849 of file kprotocolmanager.cpp.

◆ inputType()

KProtocolInfo::Type KProtocolManager::inputType ( const QUrl & 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).

Parameters
urlthe url to check
Returns
the input type of the given url

Definition at line 669 of file kprotocolmanager.cpp.

◆ isSourceProtocol()

bool KProtocolManager::isSourceProtocol ( const QUrl & url)
static

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

Definition at line 689 of file kprotocolmanager.cpp.

◆ listing()

QStringList KProtocolManager::listing ( const QUrl & 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 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
urlthe url to check
Returns
a list of field names

Definition at line 709 of file kprotocolmanager.cpp.

◆ markPartial()

bool KProtocolManager::markPartial ( )
static

Returns true if partial downloads should be marked with a ".part" extension.

Returns
true if partial downloads should get an ".part" extension

Definition at line 631 of file kprotocolmanager.cpp.

◆ minimumKeepSize()

int KProtocolManager::minimumKeepSize ( )
static

Returns the minimum file size for keeping aborted downloads.

Any data downloaded that does not meet this minimum requirement will simply be discarded. The default size is 5 KB.

Returns
the minimum keep size for aborted downloads in bytes

Definition at line 638 of file kprotocolmanager.cpp.

◆ outputType()

KProtocolInfo::Type KProtocolManager::outputType ( const QUrl & 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).

Parameters
urlthe url to check
Returns
the output type of the given url

Definition at line 679 of file kprotocolmanager.cpp.

◆ protocolForArchiveMimetype()

QString KProtocolManager::protocolForArchiveMimetype ( const QString & mimeType)
static

Returns which protocol handles this MIME type, if it's an archive MIME type.

For instance zip:/ handles application/x-zip.

This is defined in the protocol description file using an entry like "archiveMimetype=application/x-zip"

Parameters
mimeTypethe MIME type to check
Returns
the protocol that can handle this archive MIME type, for instance "zip".

Definition at line 869 of file kprotocolmanager.cpp.

◆ proxyConnectTimeout()

int KProtocolManager::proxyConnectTimeout ( )
static

Returns the preferred timeout value for proxy connections in seconds.

Returns
timeout value for proxy connection in secs.

Definition at line 289 of file kprotocolmanager.cpp.

◆ readTimeout()

int KProtocolManager::readTimeout ( )
static

Returns the preferred timeout value for reading from remote connections in seconds.

Returns
timeout value for remote connection in secs.

Definition at line 271 of file kprotocolmanager.cpp.

◆ reparseConfiguration()

void KProtocolManager::reparseConfiguration ( )
static

Force a reload of the general config file of KIO workers ( kioslaverc).

Definition at line 211 of file kprotocolmanager.cpp.

◆ responseTimeout()

int KProtocolManager::responseTimeout ( )
static

Returns the preferred response timeout value for remote connecting in seconds.

Returns
timeout value for remote connection in seconds.

Definition at line 298 of file kprotocolmanager.cpp.

◆ supportsDeleting()

bool KProtocolManager::supportsDeleting ( const QUrl & 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).

Parameters
urlthe url to check
Returns
true if the protocol supports deleting

Definition at line 749 of file kprotocolmanager.cpp.

◆ supportsLinking()

bool KProtocolManager::supportsLinking ( const QUrl & 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).

Parameters
urlthe url to check
Returns
true if the protocol supports linking

Definition at line 759 of file kprotocolmanager.cpp.

◆ supportsListing()

bool KProtocolManager::supportsListing ( const QUrl & 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.)

Parameters
urlthe url to check
Returns
true if the protocol support listing
See also
listing()

Definition at line 699 of file kprotocolmanager.cpp.

◆ supportsMakeDir()

bool KProtocolManager::supportsMakeDir ( const QUrl & 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).

Parameters
urlthe url to check
Returns
true if the protocol can create directories

Definition at line 739 of file kprotocolmanager.cpp.

◆ supportsMoving()

bool KProtocolManager::supportsMoving ( const QUrl & 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).

Parameters
urlthe url to check
Returns
true if the protocol supports moving

Definition at line 769 of file kprotocolmanager.cpp.

◆ supportsOpening()

bool KProtocolManager::supportsOpening ( const QUrl & url)
static

Returns whether the protocol can be opened using KIO::open(const QUrl&).

This corresponds to the "opening=" field in the protocol description file. Valid values for this field are "true" or "false" (default).

Parameters
urlthe url to check
Returns
true if the protocol supports opening

Definition at line 779 of file kprotocolmanager.cpp.

◆ supportsPermissions()

bool KProtocolManager::supportsPermissions ( const QUrl & url)
static

Returns whether the protocol suppports KIO/POSIX permissions handling.

When this is false the Permissions properties tab may be hidden, for example. The protocol may still support permission control through other means, specific to the individual KIO worker.

Parameters
urlthe url to check
Returns
whether the protocol supports permissions
Since
5.98

Definition at line 890 of file kprotocolmanager.cpp.

◆ supportsReading()

bool KProtocolManager::supportsReading ( const QUrl & 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).

Parameters
urlthe url to check
Returns
true if it is possible to read from the URL

Definition at line 719 of file kprotocolmanager.cpp.

◆ supportsTruncating()

bool KProtocolManager::supportsTruncating ( const QUrl & url)
static

Returns whether the protocol can be truncated with FileJob::truncate(KIO::filesize_t length).

This corresponds to the "truncating=" field in the protocol description file. Valid values for this field are "true" or "false" (default).

Parameters
urlthe url to check
Returns
true if the protocol supports truncating
Since
5.66

Definition at line 789 of file kprotocolmanager.cpp.

◆ supportsWriting()

bool KProtocolManager::supportsWriting ( const QUrl & 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).

Parameters
urlthe url to check
Returns
true if the protocol supports writing

Definition at line 729 of file kprotocolmanager.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:53:29 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.