kprotocolmanager.h
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 1999 Torben Weis <weis@kde.org> 00003 Copyright (C) 2000- Waldo Bastain <bastain@kde.org> 00004 Copyright (C) 2000- Dawit Alemayehu <adawit@kde.org> 00005 00006 This library is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU Library General Public 00008 License version 2 as published by the Free Software Foundation. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public License 00016 along with this library; see the file COPYING.LIB. If not, write to 00017 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00018 Boston, MA 02111-1307, USA. 00019 */ 00020 #ifndef __kprotocolmanager_h__ 00021 #define __kprotocolmanager_h__ 00022 00023 #include <qstringlist.h> 00024 00025 #include <kapplication.h> 00026 #include <kio/global.h> 00027 00029 #define DEFAULT_USERAGENT_STRING "" 00030 00031 class KConfig; 00032 class KPAC; 00033 00054 class KProtocolManager 00055 { 00056 public: 00057 00058 00059 /*=========================== USER-AGENT SETTINGS ===========================*/ 00060 00061 00068 static QString defaultUserAgent(); 00069 00084 static QString defaultUserAgent(const QString &keys); 00085 00097 static QString userAgentForHost( const QString& ); 00098 00099 00100 /*=========================== TIMEOUT CONFIG ================================*/ 00101 00102 00109 static int readTimeout(); 00110 00117 static int connectTimeout(); 00118 00125 static int proxyConnectTimeout(); 00126 00133 static int responseTimeout(); 00134 00141 static int defaultConnectTimeout(); 00142 00143 00144 /*=============================== PROXY CONFIG ==============================*/ 00145 00146 00151 static bool useProxy(); 00152 00157 static bool useReverseProxy(); 00158 00167 enum ProxyType 00168 { 00169 NoProxy, 00170 ManualProxy, 00171 PACProxy, 00172 WPADProxy, 00173 EnvVarProxy 00174 }; 00175 00179 static ProxyType proxyType(); 00180 00187 enum ProxyAuthMode 00188 { 00189 Prompt, 00190 Automatic 00191 }; 00192 00198 static ProxyAuthMode proxyAuthMode(); 00199 00204 static QString noProxyFor(); 00205 00206 /* 00207 * Returns the proxy server address for a given 00208 * protocol 00209 * 00210 * @param protocol the protocol whose proxy info is needed 00211 * @returns the proxy server address if one is available 00212 */ 00213 static QString proxyFor( const QString& /* protocol */); 00214 00226 static QString proxyForURL( const KURL& /* url */ ); 00227 00232 static void badProxy( const QString & /* proxy */ ); 00233 00237 static QString proxyConfigScript(); 00238 00239 00240 /*========================== CACHE CONFIG ===================================*/ 00241 00242 00249 static bool useCache(); 00250 00257 static int maxCacheAge(); 00258 00269 static int maxCacheSize(); // Maximum cache size in Kb. 00270 00274 static QString cacheDir(); 00275 00279 static KIO::CacheControl cacheControl(); 00280 00281 00282 /*============================ DOWNLOAD CONFIG ==============================*/ 00283 00288 static bool autoResume(); 00289 00294 static bool markPartial(); 00295 00306 static int minimumKeepSize(); 00307 00308 00309 /*============================ NETWORK CONNECTIONS ==========================*/ 00314 static bool persistentProxyConnection(); 00315 00319 static bool persistentConnections(); 00320 00321 /*=============================== OTHERS ====================================*/ 00322 00323 00328 static void reparseConfiguration(); 00329 00337 static QString slaveProtocol(const KURL &url, QString &proxy); 00338 00343 static KConfig *config(); 00344 private: 00345 static KConfig *http_config(); 00346 static KPAC *pac(); 00347 }; 00348 #endif