2 Netscape Plugin Loader KPart
4 Copyright (c) 2000 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
5 Stefan Schimanski <1Stein@gmx.de>
6 Copyright (c) 2002-2005 George Staikos <staikos@kde.org>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 #ifndef __plugin_part_h__
25 #define __plugin_part_h__
27 #include <kparts/browserextension.h>
28 #include <kparts/factory.h>
29 #include <kparts/part.h>
30 #include <klibloader.h>
33 #include "nspluginloader.h"
37 class PluginBrowserExtension
;
38 class PluginLiveConnectExtension
;
41 class PluginFactory
: public KParts::Factory
47 virtual ~PluginFactory();
49 virtual KParts::Part
* createPartObject(QWidget
*parentWidget
= 0, QObject
*parent
= 0,
50 const char *classname
= "KParts::Part",
51 const QStringList
&args
= QStringList());
53 static const KComponentData
&componentData();
57 static KComponentData
*s_instance
;
58 class NSPluginLoader
*_loader
;
62 class PluginCanvasWidget
: public QWidget
67 PluginCanvasWidget(QWidget
*parent
=0)
71 void resizeEvent(QResizeEvent
*e
);
74 void resized(int,int);
78 class PluginPart
: public KParts::ReadOnlyPart
82 PluginPart(QWidget
*parentWidget
, QObject
*parent
,
83 const QStringList
&args
= QStringList());
84 virtual ~PluginPart();
86 // CallBack interface (DBus-exported)
87 void postURL(const QString
& url
, const QString
& target
, const QByteArray
& data
, const QString
& mime
);
88 void requestURL(const QString
& url
, const QString
& target
);
89 void statusMessage( const QString
&msg
);
90 void evalJavaScript( int id
, const QString
& script
);
93 void changeSrc(const QString
& url
);
96 virtual bool openUrl(const KUrl
&url
);
97 virtual bool closeUrl();
98 virtual bool openFile() { return false; }
101 void pluginResized(int,int);
105 QString callbackPath
;
106 QPointer
<QWidget
> _widget
;
107 QPointer
<NSPluginInstance
> _nspWidget
;
108 PluginCanvasWidget
*_canvas
;
109 PluginBrowserExtension
*_extension
;
110 PluginLiveConnectExtension
*_liveconnect
;
112 class NSPluginLoader
*_loader
;
117 class PluginLiveConnectExtension
: public KParts::LiveConnectExtension
121 PluginLiveConnectExtension(PluginPart
* part
);
122 virtual ~PluginLiveConnectExtension();
123 virtual bool put(const unsigned long, const QString
&field
, const QString
&value
);
124 virtual bool get(const unsigned long, const QString
&, Type
&, unsigned long&, QString
&);
125 virtual bool call(const unsigned long, const QString
&, const QStringList
&, Type
&, unsigned long&, QString
&);
127 QString
evalJavaScript( const QString
& script
);
130 void partEvent( const unsigned long objid
, const QString
& event
, const KParts::LiveConnectExtension::ArgList
& args
);