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 - 2010 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/QPointer> 00028 #include <QtNetwork/QNetworkReply> 00029 00030 namespace KIO 00031 { 00032 class Job; 00033 class SimpleJob; 00034 } 00035 class KJob; 00036 class KUrl; 00037 00038 namespace KDEPrivate { 00039 00047 class AccessManagerReply : public QNetworkReply 00048 { 00049 Q_OBJECT 00050 public: 00051 AccessManagerReply(const QNetworkAccessManager::Operation &op, 00052 const QNetworkRequest &request, 00053 KIO::SimpleJob *kioJob, 00054 bool emitReadReadOnMetaDataChange = false, 00055 QObject *parent = 0); 00056 00057 virtual ~AccessManagerReply(); 00058 virtual qint64 bytesAvailable() const; 00059 virtual void abort(); 00060 00061 void setIgnoreContentDisposition(bool on); 00062 void setStatus(const QString& message, QNetworkReply::NetworkError); 00063 void putOnHold(); 00064 00065 protected: 00066 virtual qint64 readData(char *data, qint64 maxSize); 00067 void readHttpResponseHeaders(KIO::Job *); 00068 int jobError(KJob *kJob); 00069 bool ignoreContentDisposition(KIO::Job* job); 00070 00071 private Q_SLOTS: 00072 void slotData(KIO::Job *kioJob, const QByteArray &data); 00073 void slotMimeType(KIO::Job *kioJob, const QString &mimeType); 00074 void slotResult(KJob *kJob); 00075 void slotStatResult(KJob *kJob); 00076 void slotRedirection(KIO::Job *job, const KUrl &url); 00077 void slotPercent(KJob *job, unsigned long percent); 00078 00079 private: 00080 QByteArray m_data; 00081 bool m_metaDataRead; 00082 bool m_ignoreContentDisposition; 00083 bool m_emitReadReadOnMetaDataChange; 00084 QPointer<KIO::SimpleJob> m_kioJob; 00085 }; 00086 00087 00088 00089 bool AccessManager_isLocalRequest(const KUrl&); 00090 00091 } 00092 00093 #endif // KIO_ACCESSMANAGERREPLY_P_H
KDE 4.7 API Reference