kio Library API Documentation

KProtocolManager Class Reference

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

#include <kprotocolmanager.h>

List of all members.

Public Types

enum  ProxyType
 Types of proxy configuration
  • NoProxy - No proxy is used
  • ManualProxy - Proxies are manually configured
  • PACProxy - A Proxy configuration URL has been given
  • WPADProxy - A proxy should be automatically discovered
  • EnvVarProxy - Use the proxy values set through environment variables.
More...


enum  ProxyAuthMode
 Proxy authorization modes. More...


Static Public Methods

QString defaultUserAgent ()
 Returns the default user-agent string.

QString defaultUserAgent (const QString &keys)
 Returns the default user-agent value.

QString userAgentForHost (const QString &)
 Returns the userAgent string configured for the specified host.

int readTimeout ()
 Returns the preferred timeout value for reading from remote connections in seconds.

int connectTimeout ()
 Returns the preferred timeout value for remote connections in seconds.

int proxyConnectTimeout ()
 Returns the preferred timeout value for proxy connections in seconds.

int responseTimeout ()
 Returns the preferred response timeout value for remote connecting in seconds.

int defaultConnectTimeout ()
 Returns the set default timeout value for connecting to remote machines.

bool useProxy ()
 Returns whether or not the user specified the use of proxy server to make connections.

bool useReverseProxy ()
 Returns whether or not the the proxy server lookup should be reversed or not.

ProxyType proxyType ()
 Returns the type of proxy configuration that is used.

ProxyAuthMode proxyAuthMode ()
 Returns the way proxy authorization should be handled.

QString noProxyFor ()
 Returns the strings for hosts that should contacted DIRECT bypassing any proxy settings.

QString proxyForURL (const KURL &)
 Returns the Proxy server address for a given URL If automatic proxy configuration is configured, KPAC is used to determine the proxy server, otherwise the return value of proxyFor for the URL's protocol is used.

void badProxy (const QString &)
 Marks this proxy as bad (down).

QString proxyConfigScript ()
bool useCache ()
 Returns true/false to indicate whether a cache should be used.

int maxCacheAge ()
 Returns the maximum age in seconds cached files should be kept before they are deleted as necessary.

int maxCacheSize ()
 Returns the maximum size that can be used for caching.

QString cacheDir ()
 The directory which contains the cache files.

KIO::CacheControl cacheControl ()
 Returns the Cache control directive to be used.

bool autoResume ()
 Returns true if partial downloads should be automatically resumed.

bool markPartial ()
 Returns true if partial downloads should be marked with a ".part" extension.

int minimumKeepSize ()
 Returns the minimum file size for keeping aborted downloads.

bool persistentProxyConnection ()
 Returns true if connections should be persistent
Since:
3.1.


bool persistentConnections ()
 Returns true if connections should be persistent.

void reparseConfiguration ()
 Force a reload of the general config file of io-slaves ( kioslaverc).

QString slaveProtocol (const KURL &url, QString &proxy)
 Return the protocol to use in order to handle the given url It's usually the same, except that FTP, when handled by a proxy, needs an HTTP ioslave.


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@kde.org>
Revised by:
Author:
Waldo Bastain <bastain@kde.org> , Dawit Alemayehu <adawit@kde.org>

Definition at line 54 of file kprotocolmanager.h.


Member Enumeration Documentation

enum KProtocolManager::ProxyType
 

Types of proxy configuration

  • NoProxy - No proxy is used
  • ManualProxy - Proxies are manually configured
  • PACProxy - A Proxy configuration URL has been given
  • WPADProxy - A proxy should be automatically discovered
  • EnvVarProxy - Use the proxy values set through environment variables.

Definition at line 167 of file kprotocolmanager.h.

Referenced by proxyForURL(), proxyType(), and slaveProtocol().

enum KProtocolManager::ProxyAuthMode
 

Proxy authorization modes.

  • Prompt - Ask for authorization as needed
  • Automatic - Use auto login as defined in kionetrc files.

Definition at line 187 of file kprotocolmanager.h.

Referenced by proxyAuthMode().


Member Function Documentation

QString KProtocolManager::defaultUserAgent   [static]
 

Returns the default user-agent string.

This function returns the default user-agent string

Definition at line 425 of file kprotocolmanager.cpp.

Referenced by userAgentForHost().

QString KProtocolManager::defaultUserAgent const QString   keys [static]
 

Returns the default user-agent value.

This function returns the default user-agent value taking into account 'keys'

Keys can be any of the folliwing: 'o' Show OS 'v' Show OS Version 'p' Show platform 'm' Show machine architecture 'l' Show language

Definition at line 431 of file kprotocolmanager.cpp.

References QString::arg(), QString::contains(), QString::fromLatin1(), QString::isEmpty(), QStringList::join(), KLocale::languageList(), KGlobal::locale(), and QString::lower().

QString KProtocolManager::userAgentForHost const QString   [static]
 

Returns the userAgent string configured for the specified host.

If hostname is not found or is empty (i.e. "" or QString::null) this function will return the default user agent.

Parameters:
hostname  name of the host
Returns:
specified userAgent string

Definition at line 413 of file kprotocolmanager.cpp.

References defaultUserAgent(), QString::isEmpty(), and QString::lower().

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 152 of file kprotocolmanager.cpp.

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 160 of file kprotocolmanager.cpp.

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 168 of file kprotocolmanager.cpp.

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 176 of file kprotocolmanager.cpp.

int KProtocolManager::defaultConnectTimeout   [static]
 

Returns the set default timeout value for connecting to remote machines.

Returns:
timeout value in seconds

bool KProtocolManager::useProxy   [static]
 

Returns whether or not the user specified the use of proxy server to make connections.

Definition at line 186 of file kprotocolmanager.cpp.

References proxyType().

Referenced by slaveProtocol().

bool KProtocolManager::useReverseProxy   [static]
 

Returns whether or not the the proxy server lookup should be reversed or not.

Definition at line 191 of file kprotocolmanager.cpp.

Referenced by slaveProtocol().

KProtocolManager::ProxyType KProtocolManager::proxyType   [static]
 

Returns the type of proxy configuration that is used.

Definition at line 198 of file kprotocolmanager.cpp.

References ProxyType.

Referenced by proxyForURL(), slaveProtocol(), and useProxy().

KProtocolManager::ProxyAuthMode KProtocolManager::proxyAuthMode   [static]
 

Returns the way proxy authorization should be handled.

See also:
ProxyAuthMode

Definition at line 205 of file kprotocolmanager.cpp.

References ProxyAuthMode.

QString KProtocolManager::noProxyFor   [static]
 

Returns the strings for hosts that should contacted DIRECT bypassing any proxy settings.

Definition at line 247 of file kprotocolmanager.cpp.

Referenced by slaveProtocol().

QString KProtocolManager::proxyForURL const KURL   [static]
 

Returns the Proxy server address for a given URL If automatic proxy configuration is configured, KPAC is used to determine the proxy server, otherwise the return value of proxyFor for the URL's protocol is used.

If an empty string is returned, the request is to be aborted, a return value of "DIRECT" requests a direct connection.

Parameters:
url  the URL whose proxy info is needed
Returns:
the proxy server address if one is available

Definition at line 261 of file kprotocolmanager.cpp.

References QString::find(), QString::fromLatin1(), QString::fromLocal8Bit(), KURL::host(), QString::isEmpty(), QString::local8Bit(), QString::lower(), KURL::protocol(), KPAC::proxyForURL(), proxyType(), ProxyType, QString::replace(), KURL::setProtocol(), QString::startsWith(), and QString::stripWhiteSpace().

Referenced by slaveProtocol().

void KProtocolManager::badProxy const QString   [static]
 

Marks this proxy as bad (down).

It will not be used for the next 30 minutes. (The script may supply an alternate proxy)

Definition at line 301 of file kprotocolmanager.cpp.

QString KProtocolManager::proxyConfigScript   [static]
 

Returns:
the URL of the script for automatic proxy configuration

Definition at line 519 of file kprotocolmanager.cpp.

bool KProtocolManager::useCache   [static]
 

Returns true/false to indicate whether a cache should be used.

Returns:

Definition at line 214 of file kprotocolmanager.cpp.

int KProtocolManager::maxCacheAge   [static]
 

Returns the maximum age in seconds cached files should be kept before they are deleted as necessary.

Returns:

Definition at line 235 of file kprotocolmanager.cpp.

int KProtocolManager::maxCacheSize   [static]
 

Returns the maximum size that can be used for caching.

By default this function returns the DEFAULT_MAX_CACHE_SIZE value as defined in http_slave_defaults.h. Not that the value returned is in bytes, hence a value of 5120 would mean 5 Kb.

Returns:
the maximum cache size to

Definition at line 241 of file kprotocolmanager.cpp.

QString KProtocolManager::cacheDir   [static]
 

The directory which contains the cache files.

Definition at line 229 of file kprotocolmanager.cpp.

References KGlobal::dirs().

KIO::CacheControl KProtocolManager::cacheControl   [static]
 

Returns the Cache control directive to be used.

Definition at line 220 of file kprotocolmanager.cpp.

References QString::isEmpty().

bool KProtocolManager::autoResume   [static]
 

Returns true if partial downloads should be automatically resumed.

Definition at line 498 of file kprotocolmanager.cpp.

Referenced by KIO::FileCopyJob::slotCanResume().

bool KProtocolManager::markPartial   [static]
 

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

Definition at line 483 of file kprotocolmanager.cpp.

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.

@ return the minimum keep size for aborted downloads in bytes.

Definition at line 490 of file kprotocolmanager.cpp.

bool KProtocolManager::persistentProxyConnection   [static]
 

Returns true if connections should be persistent

Since:
3.1.

Definition at line 512 of file kprotocolmanager.cpp.

bool KProtocolManager::persistentConnections   [static]
 

Returns true if connections should be persistent.

Definition at line 505 of file kprotocolmanager.cpp.

void KProtocolManager::reparseConfiguration   [static]
 

Force a reload of the general config file of io-slaves ( kioslaverc).

Definition at line 81 of file kprotocolmanager.cpp.

QString KProtocolManager::slaveProtocol const KURL   url,
QString   proxy
[static]
 

Return the protocol to use in order to handle the given url It's usually the same, except that FTP, when handled by a proxy, needs an HTTP ioslave.

When a proxy is to be used, proxy contains the URL for the proxy.

Definition at line 346 of file kprotocolmanager.cpp.

References QString::fromLatin1(), KURL::host(), QString::isEmpty(), QString::latin1(), QString::lower(), noProxyFor(), KURL::protocol(), proxyForURL(), proxyType(), ProxyType, QString::stripWhiteSpace(), useProxy(), and useReverseProxy().


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.0.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Oct 8 12:21:37 2003 by doxygen 1.2.18 written by Dimitri van Heesch, © 1997-2001