fix tricky regression noticed by Vyacheslav Tokarev on Google Reader.
[kdelibs.git] / khtml / java / kjavaappletviewer.h
blob9ef3c8ce1627b904f2c6a15ae33335c64dfe2237
1 // -*- c++ -*-
3 /* This file is part of the KDE project
5 * Copyright (C) 2003 Koos Vriezen <koos.vriezen@xs4all.nl>
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public License
18 * along with this library; see the file COPYING.LIB. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
23 #ifndef KJAVAAPPLETVIEWER_H
24 #define KJAVAAPPLETVIEWER_H
26 #include <kparts/part.h>
27 #include <kparts/browserextension.h>
28 #include <kparts/statusbarextension.h>
29 #include <kparts/factory.h>
30 #include <kdialog.h>
31 #include <kurl.h>
32 #include <QtCore/QObject>
33 #include <QtCore/QStringList>
34 #include <QtCore/QPointer>
36 #include "kjavaappletwidget.h"
38 class QTableWidget;
39 class QLabel;
40 class KJavaProcess;
41 class KJavaAppletViewer;
42 class KAboutData;
43 class KComponentData;
44 class KConfig;
45 class CoverWidget;
47 class KJavaAppletViewerBrowserExtension : public KParts::BrowserExtension {
48 Q_OBJECT
49 public:
50 KJavaAppletViewerBrowserExtension (KJavaAppletViewer *parent);
51 void urlChanged (const QString & url);
52 void setLoadingProgress (int percentage);
54 void setBrowserArguments(const KParts::BrowserArguments & args);
55 void saveState (QDataStream & stream);
56 void restoreState (QDataStream & stream);
57 public Q_SLOTS:
58 void showDocument (const QString & doc, const QString & frame);
61 class KJavaAppletViewerLiveConnectExtension : public KParts::LiveConnectExtension {
62 Q_OBJECT
63 public:
64 KJavaAppletViewerLiveConnectExtension(KJavaAppletViewer * parent);
66 bool get (const unsigned long objid, const QString & field, KParts::LiveConnectExtension::Type & type, unsigned long & retobjid, QString & value);
67 bool put(const unsigned long, const QString & field, const QString & value);
68 bool call (const unsigned long , const QString & func, const QStringList & args, KParts::LiveConnectExtension::Type & type, unsigned long & retobjid, QString & value);
69 void unregister (const unsigned long objid);
71 int jsSessions () const { return m_jssessions; }
72 public Q_SLOTS:
73 void jsEvent (const QStringList & args);
74 Q_SIGNALS:
75 void partEvent (const unsigned long objid, const QString & event, const KParts::LiveConnectExtension::ArgList & args);
77 private:
78 KJavaAppletViewer * m_viewer;
79 static int m_jssessions;
82 class KJavaAppletViewer : public KParts::ReadOnlyPart {
83 Q_OBJECT
84 public:
85 KJavaAppletViewer (QWidget * wparent, QObject * parent, const QStringList &args);
86 ~KJavaAppletViewer ();
87 CoverWidget * view () const;
88 static KAboutData* createAboutData ();
90 KJavaAppletViewerBrowserExtension * browserextension() const
91 { return m_browserextension; }
92 KParts::LiveConnectExtension * liveConnectExtension () const
93 { return m_liveconnect; }
95 bool eventFilter (QObject *o, QEvent *e);
97 bool appletAlive () const;
98 public Q_SLOTS:
99 virtual bool openUrl (const KUrl & url);
100 virtual bool closeUrl ();
101 void appletLoaded ();
102 void infoMessage (const QString &);
103 protected:
104 bool openFile();
105 private Q_SLOTS:
106 void delayedCreateTimeOut ();
107 private:
108 QPointer <CoverWidget> m_view;
109 KConfig * m_config;
110 KJavaProcess * process;
111 KJavaAppletViewerBrowserExtension * m_browserextension;
112 KJavaAppletViewerLiveConnectExtension * m_liveconnect;
113 KParts::StatusBarExtension * m_statusbar;
114 QPointer <QLabel> m_statusbar_icon;
115 QString baseurl;
116 bool m_closed;
119 class KJavaAppletViewerFactory : public KParts::Factory {
120 Q_OBJECT
121 public:
122 KJavaAppletViewerFactory ();
123 virtual ~KJavaAppletViewerFactory ();
124 virtual KParts::Part *createPartObject
125 (QWidget *wparent,
126 QObject *parent,
127 const char *className, const QStringList &args);
128 static const KComponentData &componentData() { return *s_componentData; }
129 static KIconLoader * iconLoader () { return s_iconLoader; }
130 private:
131 static KComponentData *s_componentData;
132 static KIconLoader * s_iconLoader;
135 class AppletParameterDialog : public KDialog {
136 Q_OBJECT
137 public:
138 AppletParameterDialog (KJavaAppletWidget * parent);
139 protected Q_SLOTS:
140 void slotClose ();
141 private:
142 KJavaAppletWidget * m_appletWidget;
143 QTableWidget * table;
146 #endif