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 {
  NoProxy, ManualProxy, PACProxy, WPADProxy,
  EnvVarProxy
}
enum  ProxyAuthMode { Prompt, Automatic }

Static Public Member Functions

QString defaultUserAgent ()
QString defaultUserAgent (const QString &keys)
QString userAgentForHost (const QString &hostname)
int readTimeout ()
int connectTimeout ()
int proxyConnectTimeout ()
int responseTimeout ()
bool useProxy ()
bool useReverseProxy ()
ProxyType proxyType ()
ProxyAuthMode proxyAuthMode ()
QString noProxyFor ()
QString proxyFor (const QString &protocol)
QString proxyForURL (const KURL &url)
void badProxy (const QString &proxy)
QString proxyConfigScript ()
bool useCache ()
int maxCacheAge ()
int maxCacheSize ()
QString cacheDir ()
KIO::CacheControl cacheControl ()
bool autoResume ()
bool markPartial ()
int minimumKeepSize ()
bool persistentProxyConnection ()
bool persistentConnections ()
void reparseConfiguration ()
QString slaveProtocol (const KURL &url, QString &proxy)
KConfigconfig ()


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>

See also:
KPAC

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 157 of file kprotocolmanager.h.

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

enum KProtocolManager::ProxyAuthMode
 

Proxy authorization modes.

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

Definition at line 178 of file kprotocolmanager.h.

Referenced by proxyAuthMode().


Member Function Documentation

QString KProtocolManager::defaultUserAgent  )  [static]
 

Returns the default user-agent string.

Returns:
the default user-agent string

Definition at line 429 of file kprotocolmanager.cpp.

Referenced by userAgentForHost().

QString KProtocolManager::defaultUserAgent const QString keys  )  [static]
 

Returns the default user-agent value.

Parameters:
keys can be any of the following:
  • 'o' Show OS
  • 'v' Show OS Version
  • 'p' Show platform
  • 'm' Show machine architecture
  • 'l' Show language
Returns:
the default user-agent value with the given keys

Definition at line 435 of file kprotocolmanager.cpp.

References KLocale::languageList(), and KGlobal::locale().

QString KProtocolManager::userAgentForHost const QString hostname  )  [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().

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

References KConfigBase::readNumEntry(), and KConfigBase::setGroup().

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

References KConfigBase::readNumEntry(), and KConfigBase::setGroup().

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

References KConfigBase::readNumEntry(), and KConfigBase::setGroup().

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

References KConfigBase::readNumEntry(), and KConfigBase::setGroup().

bool KProtocolManager::useProxy  )  [static]
 

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

Returns:
true to use a proxy

Definition at line 146 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.

Returns:
true to use a reversed proxy

Definition at line 151 of file kprotocolmanager.cpp.

References KConfigBase::readBoolEntry(), and KConfigBase::setGroup().

Referenced by slaveProtocol().

KProtocolManager::ProxyType KProtocolManager::proxyType  )  [static]
 

Returns the type of proxy configuration that is used.

Returns:
the proxy type

Definition at line 158 of file kprotocolmanager.cpp.

References ProxyType, KConfigBase::readNumEntry(), and KConfigBase::setGroup().

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

KProtocolManager::ProxyAuthMode KProtocolManager::proxyAuthMode  )  [static]
 

Returns the way proxy authorization should be handled.

Returns:
the proxy authorization mode
See also:
ProxyAuthMode

Definition at line 165 of file kprotocolmanager.cpp.

References ProxyAuthMode, KConfigBase::readNumEntry(), and KConfigBase::setGroup().

QString KProtocolManager::noProxyFor  )  [static]
 

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

Returns:
a list of (comma-separated) hostnames or partial host names

Definition at line 207 of file kprotocolmanager.cpp.

References proxyType(), ProxyType, KConfigBase::readEntry(), and KConfigBase::setGroup().

Referenced by slaveProtocol().

QString KProtocolManager::proxyFor const QString protocol  )  [static]
 

Returns the proxy server address for a given protocol.

Parameters:
protocol the protocol whose proxy info is needed
Returns:
the proxy server address if one is available, or QString::null if not available

Definition at line 224 of file kprotocolmanager.cpp.

References KConfigBase::readEntry(), and KConfigBase::setGroup().

Referenced by proxyForURL().

QString KProtocolManager::proxyForURL const KURL url  )  [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 or QString::null otherwise

Definition at line 238 of file kprotocolmanager.cpp.

References KURL::host(), KURL::protocol(), proxyFor(), proxyType(), ProxyType, and KURL::setProtocol().

Referenced by slaveProtocol().

void KProtocolManager::badProxy const QString proxy  )  [static]
 

Marks this proxy as bad (down).

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

Parameters:
proxy the proxy to mark as bad (as URL)

Definition at line 283 of file kprotocolmanager.cpp.

QString KProtocolManager::proxyConfigScript  )  [static]
 

Returns the URL of the script for automatic proxy configuration.

Returns:
the proxy configuration script

Definition at line 523 of file kprotocolmanager.cpp.

References KConfigBase::readEntry(), and KConfigBase::setGroup().

bool KProtocolManager::useCache  )  [static]
 

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

Returns:
true to use the cache, false otherwisea

Definition at line 174 of file kprotocolmanager.cpp.

References KConfigBase::readBoolEntry().

int KProtocolManager::maxCacheAge  )  [static]
 

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

Returns:
the maximum cache age in seconds

Definition at line 195 of file kprotocolmanager.cpp.

References KConfigBase::readNumEntry().

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 in bytes

Definition at line 201 of file kprotocolmanager.cpp.

References KConfigBase::readNumEntry().

QString KProtocolManager::cacheDir  )  [static]
 

The directory which contains the cache files.

Returns:
the directory that contains the cache files

Definition at line 189 of file kprotocolmanager.cpp.

References KConfigBase::readPathEntry().

KIO::CacheControl KProtocolManager::cacheControl  )  [static]
 

Returns the Cache control directive to be used.

Returns:
the cache control value

Definition at line 180 of file kprotocolmanager.cpp.

References KIO::parseCacheControl(), and KConfigBase::readEntry().

bool KProtocolManager::autoResume  )  [static]
 

Returns true if partial downloads should be automatically resumed.

Returns:
true to resume partial downloads

Definition at line 502 of file kprotocolmanager.cpp.

References KConfigBase::readBoolEntry(), and KConfigBase::setGroup().

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

References KConfigBase::readBoolEntry(), and KConfigBase::setGroup().

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

References KConfigBase::readNumEntry(), and KConfigBase::setGroup().

bool KProtocolManager::persistentProxyConnection  )  [static]
 

Returns true if proxy connections should be persistent.

Returns:
true if proxy connections should be persistent
Since:
3.1

Definition at line 516 of file kprotocolmanager.cpp.

References KConfigBase::readBoolEntry(), and KConfigBase::setGroup().

bool KProtocolManager::persistentConnections  )  [static]
 

Returns true if connections should be persistent.

Returns:
true if the connections should be persistent

Definition at line 509 of file kprotocolmanager.cpp.

References KConfigBase::readBoolEntry(), and KConfigBase::setGroup().

void KProtocolManager::reparseConfiguration  )  [static]
 

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

Definition at line 78 of file kprotocolmanager.cpp.

References KStaticDeleter< type >::destructObject().

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.

Parameters:
url the url to check
proxy the URL of the proxy to use
Returns:
the slave protocol (e.g. 'http'), can be null if unknown

Definition at line 329 of file kprotocolmanager.cpp.

References KURL::hasSubURL(), KURL::host(), kdDebug(), noProxyFor(), KURL::port(), KURL::protocol(), proxyForURL(), proxyType(), KURL::split(), useProxy(), and useReverseProxy().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kio Library Version 3.4.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Thu Apr 28 01:37:57 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003