summaryrefslogtreecommitdiffstats
path: root/khtml/kmultipart/kmultipart.h
blob: f3bf952196a0e531545e51f745e7858fef56dae5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/* This file is part of the KDE project
   Copyright (C) 2002 David Faure <david@mandrakesoft.com>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef __kmultipart_h__
#define __kmultipart_h__

#include <httpfilter/httpfilter.h>

#include <kparts/part.h>
#include <kparts/factory.h>
#include <kparts/browserextension.h>
#include <kaboutdata.h>
#include <tqdatetime.h>

class KHTMLPart;
class KInstance;
class KTempFile;
class KLineParser;

/**
 * http://www.netscape.com/assist/net_sites/pushpull.html
 */
class KMultiPart : public KParts::ReadOnlyPart
{
    Q_OBJECT
public:
    KMultiPart( TQWidget *parentWidget, const char *widgetName,
                TQObject *parent, const char *name, const TQStringList& );
    virtual ~KMultiPart();

    virtual bool openFile() { return false; }
    virtual bool openURL( const KURL &url );

    virtual bool closeURL();

    static KAboutData* createAboutData();

protected:
    virtual void guiActivateEvent( KParts::GUIActivateEvent *e );
    void setPart( const TQString& mimeType );

    void startOfData();
    void sendData( const TQByteArray& line );
    void endOfData();

private slots:
    void reallySendData( const TQByteArray& line );
    //void slotPopupMenu( KXMLGUIClient *cl, const TQPoint &pos, const KURL &u, const TQString &mime, mode_t mode );
    void slotJobFinished( KIO::Job *job );
    void slotData( KIO::Job *, const TQByteArray & );
    //void updateWindowCaption();

    void slotPartCompleted();

    void startHeader();

    void slotProgressInfo();

private:
    KParts::BrowserExtension* m_extension;
    TQGuardedPtr<KParts::ReadOnlyPart> m_part;
    bool m_isHTMLPart;
    bool m_partIsLoading;
    KIO::Job* m_job;
    TQCString m_boundary;
    int m_boundaryLength;
    TQString m_mimeType; // the one handled by m_part - store the kservice instead?
    TQString m_nextMimeType; // while parsing headers
    KTempFile* m_tempFile;
    KLineParser* m_lineParser;
    bool m_bParsingHeader;
    bool m_bGotAnyHeader;
    bool m_gzip;
    HTTPFilterBase *m_filter;
    // Speed measurements
    long m_totalNumberOfFrames;
    long m_numberOfFrames;
    long m_numberOfFramesSkipped;
    TQTime m_qtime;
    TQTimer* m_timer;
};

#if 0
class KMultiPartBrowserExtension : public KParts::BrowserExtension
{
    //Q_OBJECT
public:
    KMultiPartBrowserExtension( KMultiPart *parent, const char *name = 0 );

    virtual int xOffset();
    virtual int yOffset();

//protected slots:
    void print();
    void reparseConfiguration();

private:
    KMultiPart *m_imgPart;
};
#endif

#endif