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 00262 static QString proxyForUrl( const KUrl& url ); 00263 00280 static QStringList proxiesForUrl( const KUrl& url ); 00281 00287 static void badProxy( const QString & proxy ); 00288 00293 static QString proxyConfigScript(); 00294 00295 00296 /*========================== CACHE CONFIG ===================================*/ 00297 00298 00305 static bool useCache(); 00306 00313 static int maxCacheAge(); 00314 00325 static int maxCacheSize(); // Maximum cache size in Kb. 00326 00331 static QString cacheDir(); 00332 00337 static KIO::CacheControl cacheControl(); 00338 00339 00340 /*============================ DOWNLOAD CONFIG ==============================*/ 00341 00347 static bool autoResume(); 00348 00354 static bool markPartial(); 00355 00366 static int minimumKeepSize(); 00367 00368 00369 /*============================ NETWORK CONNECTIONS ==========================*/ 00374 static bool persistentProxyConnection(); 00375 00380 static bool persistentConnections(); 00381 00382 00383 /*===================== PROTOCOL CAPABILITIES ===============================*/ 00384 00400 static bool supportsListing( const KUrl &url ); 00401 00411 static bool supportsReading( const KUrl &url ); 00412 00422 static bool supportsWriting( const KUrl &url ); 00423 00433 static bool supportsMakeDir( const KUrl &url ); 00434 00444 static bool supportsDeleting( const KUrl &url ); 00445 00455 static bool supportsLinking( const KUrl &url ); 00456 00467 static bool supportsMoving( const KUrl &url ); 00468 00478 static bool supportsOpening( const KUrl &url ); 00479 00492 static bool canCopyFromFile( const KUrl &url ); 00493 00506 static bool canCopyToFile( const KUrl &url ); 00507 00520 static bool canRenameFromFile( const KUrl &url ); 00521 00534 static bool canRenameToFile( const KUrl &url ); 00535 00547 static bool canDeleteRecursive( const KUrl &url ); 00548 00564 static KProtocolInfo::FileNameUsedForCopying fileNameUsedForCopying( const KUrl &url ); 00565 00574 static QString defaultMimetype( const KUrl& url ); 00575 00586 static KProtocolInfo::Type inputType( const KUrl &url ); 00587 00598 static KProtocolInfo::Type outputType( const KUrl &url ); 00599 00612 static QStringList listing( const KUrl &url ); 00613 00614 00628 static bool isSourceProtocol( const KUrl &url ); 00629 00641 static QString protocolForArchiveMimetype( const QString& mimeType ); 00642 00643 /*=============================== OTHERS ====================================*/ 00644 00645 00650 static void reparseConfiguration(); 00651 00662 static QString slaveProtocol(const KUrl &url, QString &proxy); 00663 00669 static QString slaveProtocol(const KUrl &url, QStringList &proxy); 00670 00676 static QString acceptLanguagesHeader(); 00677 00678 private: 00679 friend class KIO::SlaveConfigPrivate; 00680 00685 KDE_NO_EXPORT static KSharedConfigPtr config(); 00686 }; 00687 #endif
KDE 4.7 API Reference