File indexing completed on 2024-04-28 11:38:26
0001 /* This file is part of the KDE project 0002 Copyright (C) 2002 David Faure <david@mandrakesoft.com> 0003 0004 This library is free software; you can redistribute it and/or 0005 modify it under the terms of the GNU Library General Public 0006 License as published by the Free Software Foundation; either 0007 version 2 of the License, or (at your option) any later version. 0008 0009 This library is distributed in the hope that it will be useful, 0010 but WITHOUT ANY WARRANTY; without even the implied warranty of 0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0012 Library General Public License for more details. 0013 0014 You should have received a copy of the GNU Library General Public License 0015 along with this library; see the file COPYING.LIB. If not, write to 0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0017 Boston, MA 02110-1301, USA. 0018 */ 0019 0020 #ifndef __kmultipart_h__ 0021 #define __kmultipart_h__ 0022 0023 #include <QPointer> 0024 0025 #include <kparts/part.h> 0026 #include <kparts/browserextension.h> 0027 #include <QDate> 0028 #include <QElapsedTimer> 0029 0030 class HTTPFilterGZip; 0031 class QTemporaryFile; 0032 class QTimer; 0033 class KLineParser; 0034 0035 /** 0036 * http://wp.netscape.com/assist/net_sites/pushpull.html 0037 */ 0038 class KMultiPart : public KParts::ReadOnlyPart 0039 { 0040 Q_OBJECT 0041 public: 0042 KMultiPart(QWidget *parentWidget, 0043 QObject *parent, const QVariantList &); 0044 virtual ~KMultiPart(); 0045 0046 bool openFile() override 0047 { 0048 return false; 0049 } 0050 bool openUrl(const QUrl &url) override; 0051 0052 bool closeUrl() override; 0053 0054 protected: 0055 void guiActivateEvent(KParts::GUIActivateEvent *e) override; 0056 void setPart(const QString &mimeType); 0057 0058 void startOfData(); 0059 void sendData(const QByteArray &line); 0060 void endOfData(); 0061 0062 private Q_SLOTS: 0063 void reallySendData(const QByteArray &line); 0064 //void slotPopupMenu( KXMLGUIClient *cl, const QPoint &pos, const QUrl &u, const QString &mime, mode_t mode ); 0065 void slotJobFinished(KJob *job); 0066 void slotData(KIO::Job *, const QByteArray &); 0067 //void updateWindowCaption(); 0068 0069 void slotPartCompleted(); 0070 0071 void startHeader(); 0072 0073 void slotProgressInfo(); 0074 0075 private: 0076 KParts::BrowserExtension *m_extension; 0077 QPointer<KParts::ReadOnlyPart> m_part; 0078 bool m_isHTMLPart; 0079 bool m_partIsLoading; 0080 KIO::Job *m_job; 0081 QByteArray m_boundary; 0082 int m_boundaryLength; 0083 QString m_mimeType; // the one handled by m_part - store the kservice instead? 0084 QString m_nextMimeType; // while parsing headers 0085 QTemporaryFile *m_tempFile; 0086 KLineParser *m_lineParser; 0087 bool m_bParsingHeader; 0088 bool m_bGotAnyHeader; 0089 bool m_gzip; 0090 HTTPFilterGZip *m_filter; 0091 // Speed measurements 0092 long m_totalNumberOfFrames; 0093 long m_numberOfFrames; 0094 long m_numberOfFramesSkipped; 0095 QElapsedTimer m_qtime; 0096 QTimer *m_timer; 0097 }; 0098 0099 #if 0 0100 class KMultiPartBrowserExtension : public KParts::BrowserExtension 0101 { 0102 //Q_OBJECT 0103 public: 0104 KMultiPartBrowserExtension(KMultiPart *parent, const char *name = 0); 0105 0106 virtual int xOffset(); 0107 virtual int yOffset(); 0108 0109 //protected Q_SLOTS: 0110 void print(); 0111 void reparseConfiguration(); 0112 0113 private: 0114 KMultiPart *m_imgPart; 0115 }; 0116 #endif 0117 0118 #endif