KIO
accessmanagerreply_p.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 * Copyright (C) 2009 - 2012 Dawit Alemayehu <adawit @ 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 as published by the Free Software Foundation; either 00010 * version 2 of the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Library General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Library General Public License 00018 * along with this library; see the file COPYING.LIB. If not, write to 00019 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 * Boston, MA 02110-1301, USA. 00021 * 00022 */ 00023 00024 #ifndef KIO_ACCESSMANAGERREPLY_P_H 00025 #define KIO_ACCESSMANAGERREPLY_P_H 00026 00027 #include <QtCore/QWeakPointer> 00028 #include <QtNetwork/QNetworkReply> 00029 00030 namespace KIO 00031 { 00032 class Job; 00033 class SimpleJob; 00034 class MetaData; 00035 } 00036 class KJob; 00037 class KUrl; 00038 00039 namespace KDEPrivate { 00040 00048 class AccessManagerReply : public QNetworkReply 00049 { 00050 Q_OBJECT 00051 public: 00052 explicit AccessManagerReply(const QNetworkAccessManager::Operation op, 00053 const QNetworkRequest &request, 00054 KIO::SimpleJob *kioJob, 00055 bool emitReadyReadOnMetaDataChange = false, 00056 QObject *parent = 0); 00057 00058 explicit AccessManagerReply(const QNetworkAccessManager::Operation op, 00059 const QNetworkRequest &request, 00060 const QByteArray& data, 00061 const QUrl& url, 00062 const KIO::MetaData& metaData, 00063 QObject *parent = 0); 00064 00065 explicit AccessManagerReply(const QNetworkAccessManager::Operation op, 00066 const QNetworkRequest &request, 00067 QNetworkReply::NetworkError errorCode, 00068 const QString& errorMessage, 00069 QObject *parent = 0); 00070 00071 virtual ~AccessManagerReply(); 00072 virtual qint64 bytesAvailable() const; 00073 virtual void abort(); 00074 00075 void setIgnoreContentDisposition(bool on); 00076 void putOnHold(); 00077 00078 static bool isLocalRequest(const KUrl& url); 00079 00080 protected: 00081 virtual qint64 readData(char *data, qint64 maxSize); 00082 bool ignoreContentDisposition(const KIO::MetaData&); 00083 void setHeaderFromMetaData(const KIO::MetaData&); 00084 void readHttpResponseHeaders(KIO::Job *); 00085 int jobError(KJob *kJob); 00086 void emitFinished(bool state, Qt::ConnectionType type = Qt::AutoConnection); 00087 00088 private Q_SLOTS: 00089 void slotData(KIO::Job *kioJob, const QByteArray &data); 00090 void slotMimeType(KIO::Job *kioJob, const QString &mimeType); 00091 void slotResult(KJob *kJob); 00092 void slotStatResult(KJob *kJob); 00093 void slotRedirection(KIO::Job *job, const KUrl &url); 00094 void slotPercent(KJob *job, unsigned long percent); 00095 00096 private: 00097 QByteArray m_data; 00098 bool m_metaDataRead; 00099 bool m_ignoreContentDisposition; 00100 bool m_emitReadyReadOnMetaDataChange; 00101 QWeakPointer<KIO::SimpleJob> m_kioJob; 00102 }; 00103 00104 } 00105 00106 #endif // KIO_ACCESSMANAGERREPLY_P_H
This file is part of the KDE documentation.
Documentation copyright © 1996-2019 The KDE developers.
Generated on Mon Jan 21 2019 12:34:57 by doxygen 1.7.5.1 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2019 The KDE developers.
Generated on Mon Jan 21 2019 12:34:57 by doxygen 1.7.5.1 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.