KIO
kprotocolmanager.h
Go to the documentation of this file.
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 Copyright (C) 2008 Jarosław Staniek <staniek@kde.org> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License version 2 as published by the Free Software Foundation. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00019 Boston, MA 02110-1301, USA. 00020 */ 00021 #ifndef KPROTOCOLMANAGER_H 00022 #define KPROTOCOLMANAGER_H 00023 00024 #include <QtCore/QStringList> 00025 00026 #include <kio/global.h> 00027 #include "kprotocolinfo.h" 00028 00029 class KSharedConfig; 00030 template<class T> 00031 class KSharedPtr; 00032 typedef KSharedPtr<KSharedConfig> KSharedConfigPtr; 00033 namespace KIO 00034 { 00035 class SlaveConfigPrivate; 00036 } // namespace KIO 00037 00059 class KIO_EXPORT KProtocolManager 00060 { 00061 public: 00062 00063 00064 /*=========================== USER-AGENT SETTINGS ===========================*/ 00065 00066 00072 static QString defaultUserAgent(); 00073 00086 static QString defaultUserAgent(const QString &keys); 00087 00102 static QString userAgentForApplication( const QString &appName, const QString& appVersion, 00103 const QStringList& extraInfo = QStringList() ); 00104 00116 static QString userAgentForHost( const QString &hostname ); 00117 00118 /* 00119 * Returns system name, version and machine type, for example "Windows", "5.1", "i686". 00120 * This information can be used for constructing custom user-agent strings. 00121 * 00122 * @param systemName system name 00123 * @param systemVersion system version 00124 * @param machine machine type 00125 00126 * @return true if system name, version and machine type has been provided 00127 * 00128 * @since 4.1 00129 */ 00130 static bool getSystemNameVersionAndMachine( 00131 QString& systemName, QString& systemVersion, QString& machine ); 00132 00133 00134 /*=========================== TIMEOUT CONFIG ================================*/ 00135 00136 00143 static int readTimeout(); 00144 00151 static int connectTimeout(); 00152 00159 static int proxyConnectTimeout(); 00160 00167 static int responseTimeout(); 00168 00169 00170 /*=============================== PROXY CONFIG ==============================*/ 00171 00172 00178 static bool useProxy(); 00179 00185 static bool useReverseProxy(); 00186 00195 enum ProxyType 00196 { 00197 NoProxy, 00198 ManualProxy, 00199 PACProxy, 00200 WPADProxy, 00201 EnvVarProxy 00202 }; 00203 00208 static ProxyType proxyType(); 00209 00216 enum ProxyAuthMode 00217 { 00218 Prompt, 00219 Automatic 00220 }; 00221 00228 static ProxyAuthMode proxyAuthMode(); 00229 00236 static QString noProxyFor(); 00237 00246 static QString proxyFor( const QString& protocol ); 00247 00260 static QString proxyForUrl( const KUrl& url ); 00261 00267 static void badProxy( const QString & proxy ); 00268 00273 static QString proxyConfigScript(); 00274 00275 00276 /*========================== CACHE CONFIG ===================================*/ 00277 00278 00285 static bool useCache(); 00286 00293 static int maxCacheAge(); 00294 00305 static int maxCacheSize(); // Maximum cache size in Kb. 00306 00311 static QString cacheDir(); 00312 00317 static KIO::CacheControl cacheControl(); 00318 00319 00320 /*============================ DOWNLOAD CONFIG ==============================*/ 00321 00327 static bool autoResume(); 00328 00334 static bool markPartial(); 00335 00346 static int minimumKeepSize(); 00347 00348 00349 /*============================ NETWORK CONNECTIONS ==========================*/ 00354 static bool persistentProxyConnection(); 00355 00360 static bool persistentConnections(); 00361 00362 00363 /*===================== PROTOCOL CAPABILITIES ===============================*/ 00364 00380 static bool supportsListing( const KUrl &url ); 00381 00391 static bool supportsReading( const KUrl &url ); 00392 00402 static bool supportsWriting( const KUrl &url ); 00403 00413 static bool supportsMakeDir( const KUrl &url ); 00414 00424 static bool supportsDeleting( const KUrl &url ); 00425 00435 static bool supportsLinking( const KUrl &url ); 00436 00447 static bool supportsMoving( const KUrl &url ); 00448 00458 static bool supportsOpening( const KUrl &url ); 00459 00472 static bool canCopyFromFile( const KUrl &url ); 00473 00486 static bool canCopyToFile( const KUrl &url ); 00487 00500 static bool canRenameFromFile( const KUrl &url ); 00501 00514 static bool canRenameToFile( const KUrl &url ); 00515 00527 static bool canDeleteRecursive( const KUrl &url ); 00528 00544 static KProtocolInfo::FileNameUsedForCopying fileNameUsedForCopying( const KUrl &url ); 00545 00554 static QString defaultMimetype( const KUrl& url ); 00555 00566 static KProtocolInfo::Type inputType( const KUrl &url ); 00567 00578 static KProtocolInfo::Type outputType( const KUrl &url ); 00579 00592 static QStringList listing( const KUrl &url ); 00593 00594 00608 static bool isSourceProtocol( const KUrl &url ); 00609 00621 static QString protocolForArchiveMimetype( const QString& mimeType ); 00622 00623 /*=============================== OTHERS ====================================*/ 00624 00625 00630 static void reparseConfiguration(); 00631 00642 static QString slaveProtocol(const KUrl &url, QString &proxy); 00643 00649 static QString acceptLanguagesHeader(); 00650 00651 private: 00652 friend class KIO::SlaveConfigPrivate; 00653 00658 KDE_NO_EXPORT static KSharedConfigPtr config(); 00659 }; 00660 #endif
KDE 4.6 API Reference