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 <qdatetime.h> 00030 00031 class KHTMLPart; 00032 class KInstance; 00033 class KTempFile; 00034 class KLineParser; 00035 00039 class KMultiPart : public KParts::ReadOnlyPart 00040 { 00041 Q_OBJECT 00042 public: 00043 KMultiPart( QWidget *parentWidget, const char *widgetName, 00044 QObject *parent, const char *name, const QStringList& ); 00045 virtual ~KMultiPart(); 00046 00047 virtual bool openFile() { return false; } 00048 virtual bool openURL( const KURL &url ); 00049 00050 virtual bool closeURL(); 00051 00052 static KAboutData* createAboutData(); 00053 00054 protected: 00055 virtual void guiActivateEvent( KParts::GUIActivateEvent *e ); 00056 void setPart( const QString& mimeType ); 00057 00058 void startOfData(); 00059 void sendData( const QByteArray& line ); 00060 void endOfData(); 00061 00062 private slots: 00063 void reallySendData( const QByteArray& line ); 00064 //void slotPopupMenu( KXMLGUIClient *cl, const QPoint &pos, const KURL &u, const QString &mime, mode_t mode ); 00065 void slotJobFinished( KIO::Job *job ); 00066 void slotData( KIO::Job *, const QByteArray & ); 00067 //void updateWindowCaption(); 00068 00069 void slotPartCompleted(); 00070 00071 void startHeader(); 00072 00073 void slotProgressInfo(); 00074 00075 private: 00076 KParts::BrowserExtension* m_extension; 00077 QGuardedPtr<KParts::ReadOnlyPart> m_part; 00078 bool m_isHTMLPart; 00079 bool m_partIsLoading; 00080 KIO::Job* m_job; 00081 QCString m_boundary; 00082 int m_boundaryLength; 00083 QString m_mimeType; // the one handled by m_part - store the kservice instead? 00084 QString m_nextMimeType; // while parsing headers 00085 KTempFile* m_tempFile; 00086 KLineParser* m_lineParser; 00087 bool m_bParsingHeader; 00088 bool m_bGotAnyHeader; 00089 bool m_gzip; 00090 HTTPFilterBase *m_filter; 00091 // Speed measurements 00092 long m_totalNumberOfFrames; 00093 long m_numberOfFrames; 00094 long m_numberOfFramesSkipped; 00095 QTime m_qtime; 00096 QTimer* m_timer; 00097 }; 00098 00099 #if 0 00100 class KMultiPartBrowserExtension : public KParts::BrowserExtension 00101 { 00102 //Q_OBJECT 00103 public: 00104 KMultiPartBrowserExtension( KMultiPart *parent, const char *name = 0 ); 00105 00106 virtual int xOffset(); 00107 virtual int yOffset(); 00108 00109 //protected slots: 00110 void print(); 00111 void reparseConfiguration(); 00112 00113 private: 00114 KMultiPart *m_imgPart; 00115 }; 00116 #endif 00117 00118 #endif