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>
32 #include <QtCore/QObject>
33 #include <QtCore/QStringList>
34 #include <QtCore/QPointer>
36 #include "kjavaappletwidget.h"
41 class KJavaAppletViewer
;
47 class KJavaAppletViewerBrowserExtension
: public KParts::BrowserExtension
{
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
);
58 void showDocument (const QString
& doc
, const QString
& frame
);
61 class KJavaAppletViewerLiveConnectExtension
: public KParts::LiveConnectExtension
{
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
; }
73 void jsEvent (const QStringList
& args
);
75 void partEvent (const unsigned long objid
, const QString
& event
, const KParts::LiveConnectExtension::ArgList
& args
);
78 KJavaAppletViewer
* m_viewer
;
79 static int m_jssessions
;
82 class KJavaAppletViewer
: public KParts::ReadOnlyPart
{
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;
99 virtual bool openUrl (const KUrl
& url
);
100 virtual bool closeUrl ();
101 void appletLoaded ();
102 void infoMessage (const QString
&);
106 void delayedCreateTimeOut ();
108 QPointer
<CoverWidget
> m_view
;
110 KJavaProcess
* process
;
111 KJavaAppletViewerBrowserExtension
* m_browserextension
;
112 KJavaAppletViewerLiveConnectExtension
* m_liveconnect
;
113 KParts::StatusBarExtension
* m_statusbar
;
114 QPointer
<QLabel
> m_statusbar_icon
;
119 class KJavaAppletViewerFactory
: public KParts::Factory
{
122 KJavaAppletViewerFactory ();
123 virtual ~KJavaAppletViewerFactory ();
124 virtual KParts::Part
*createPartObject
127 const char *className
, const QStringList
&args
);
128 static const KComponentData
&componentData() { return *s_componentData
; }
129 static KIconLoader
* iconLoader () { return s_iconLoader
; }
131 static KComponentData
*s_componentData
;
132 static KIconLoader
* s_iconLoader
;
135 class AppletParameterDialog
: public KDialog
{
138 AppletParameterDialog (KJavaAppletWidget
* parent
);
142 KJavaAppletWidget
* m_appletWidget
;
143 QTableWidget
* table
;