KHTML
kmultipart.h
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 Copyright (C) 2002 David Faure <david@mandrakesoft.com> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef __kmultipart_h__ 00021 #define __kmultipart_h__ 00022 00023 #include <httpfilter/httpfilter.h> 00024 00025 #include <kparts/part.h> 00026 #include <kparts/factory.h> 00027 #include <kparts/browserextension.h> 00028 #include <kaboutdata.h> 00029 #include <QtCore/QDate> 00030 00031 class KTemporaryFile; 00032 class KLineParser; 00033 00037 class KMultiPart : public KParts::ReadOnlyPart 00038 { 00039 Q_OBJECT 00040 public: 00041 KMultiPart( QWidget *parentWidget, 00042 QObject *parent, const QStringList& ); 00043 virtual ~KMultiPart(); 00044 00045 virtual bool openFile() { return false; } 00046 virtual bool openUrl( const KUrl &url ); 00047 00048 virtual bool closeUrl(); 00049 00050 static KAboutData* createAboutData(); 00051 00052 protected: 00053 virtual void guiActivateEvent( KParts::GUIActivateEvent *e ); 00054 void setPart( const QString& mimeType ); 00055 00056 void startOfData(); 00057 void sendData( const QByteArray& line ); 00058 void endOfData(); 00059 00060 private Q_SLOTS: 00061 void reallySendData( const QByteArray& line ); 00062 //void slotPopupMenu( KXMLGUIClient *cl, const QPoint &pos, const KUrl &u, const QString &mime, mode_t mode ); 00063 void slotJobFinished( KJob *job ); 00064 void slotData( KIO::Job *, const QByteArray & ); 00065 //void updateWindowCaption(); 00066 00067 void slotPartCompleted(); 00068 00069 void startHeader(); 00070 00071 void slotProgressInfo(); 00072 00073 private: 00074 KParts::BrowserExtension* m_extension; 00075 QPointer<KParts::ReadOnlyPart> m_part; 00076 bool m_isHTMLPart; 00077 bool m_partIsLoading; 00078 KIO::Job* m_job; 00079 QByteArray m_boundary; 00080 int m_boundaryLength; 00081 QString m_mimeType; // the one handled by m_part - store the kservice instead? 00082 QString m_nextMimeType; // while parsing headers 00083 KTemporaryFile* m_tempFile; 00084 KLineParser* m_lineParser; 00085 bool m_bParsingHeader; 00086 bool m_bGotAnyHeader; 00087 bool m_gzip; 00088 HTTPFilterBase *m_filter; 00089 // Speed measurements 00090 long m_totalNumberOfFrames; 00091 long m_numberOfFrames; 00092 long m_numberOfFramesSkipped; 00093 QTime m_qtime; 00094 QTimer* m_timer; 00095 }; 00096 00097 #if 0 00098 class KMultiPartBrowserExtension : public KParts::BrowserExtension 00099 { 00100 //Q_OBJECT 00101 public: 00102 KMultiPartBrowserExtension( KMultiPart *parent, const char *name = 0 ); 00103 00104 virtual int xOffset(); 00105 virtual int yOffset(); 00106 00107 //protected Q_SLOTS: 00108 void print(); 00109 void reparseConfiguration(); 00110 00111 private: 00112 KMultiPart *m_imgPart; 00113 }; 00114 #endif 00115 00116 #endif