KIO
accessmanager.h
Go to the documentation of this file.
00001 /* 00002 * This file is part of the KDE project. 00003 * 00004 * Copyright (C) 2008 - 2009 Urs Wolfer <uwolfer @ 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 as published by the Free Software Foundation; either 00009 * version 2 of the License, or (at your option) any later version. 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 */ 00022 00023 #ifndef KIO_ACCESSMANAGER_H 00024 #define KIO_ACCESSMANAGER_H 00025 00026 #include <kio/global.h> 00027 00028 #include <QtNetwork/QNetworkAccessManager> 00029 #include <QtNetwork/QNetworkRequest> 00030 #include <QtNetwork/QNetworkCookieJar> 00031 00032 class QWidget; 00033 00034 namespace KIO { 00035 00072 class KIO_EXPORT AccessManager : public QNetworkAccessManager 00073 { 00074 Q_OBJECT 00075 public: 00080 enum Attribute { 00081 MetaData = QNetworkRequest::User, 00082 KioError 00083 }; 00084 00088 AccessManager(QObject *parent); 00089 00093 virtual ~AccessManager(); 00094 00099 void setExternalContentAllowed(bool allowed); 00100 00106 bool isExternalContentAllowed() const; 00107 00124 #ifndef KDE_NO_DEPRECATED 00125 KDE_DEPRECATED void setCookieJarWindowId(WId id); 00126 #endif 00127 00138 void setWindow(QWidget* widget); 00139 00152 #ifndef KDE_NO_DEPRECATED 00153 KDE_DEPRECATED WId cookieJarWindowid() const; 00154 #endif 00155 00162 QWidget* window() const; 00163 00174 KIO::MetaData& requestMetaData(); 00175 00190 KIO::MetaData& sessionMetaData(); 00191 00202 static void putReplyOnHold(QNetworkReply* reply); 00203 00215 void setEmitReadyReadOnMetaDataChange(bool); 00216 00217 protected: 00224 virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &req, QIODevice *outgoingData = 0); 00225 00226 private: 00227 class AccessManagerPrivate; 00228 AccessManagerPrivate* const d; 00229 }; 00230 00231 namespace Integration { 00232 // KDE5: Move AccessManager into the KIO::Integration namespace. 00233 typedef KIO::AccessManager AccessManager; 00234 00241 KIO_EXPORT bool sslConfigFromMetaData(const KIO::MetaData& metadata, QSslConfiguration& sslconfig); 00242 00274 class KIO_EXPORT CookieJar : public QNetworkCookieJar 00275 { 00276 Q_OBJECT 00277 public: 00281 explicit CookieJar(QObject *parent = 0); 00282 00286 ~CookieJar(); 00287 00291 WId windowId() const; 00292 00305 void setWindowId(WId id); 00306 00310 void reparseConfiguration(); 00311 00318 QList<QNetworkCookie> cookiesForUrl(const QUrl &url) const; 00319 00326 bool setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url); 00327 00334 bool isCookieStorageDisabled() const; 00335 00345 void setDisableCookieStorage (bool disable); 00346 00347 private: 00348 class CookieJarPrivate; 00349 CookieJarPrivate* const d; 00350 }; 00351 00352 } 00353 00354 } 00355 00356 #endif // KIO_ACCESSMANAGER_H
KDE 4.7 API Reference