delay a few things on startup, such as setting the visibility mode, which ensures...
[personal-kdebase.git] / apps / nsplugins / plugin_part.h
blob73d9145150b826fd5ba696e8a698b8211baa08e1
1 /*
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>
31 #include <QWidget>
32 #include <QPointer>
33 #include "nspluginloader.h"
35 class KAboutData;
36 class KComponentData;
37 class PluginBrowserExtension;
38 class PluginLiveConnectExtension;
39 class PluginPart;
41 class PluginFactory : public KParts::Factory
43 Q_OBJECT
45 public:
46 PluginFactory();
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();
55 private:
57 static KComponentData *s_instance;
58 class NSPluginLoader *_loader;
62 class PluginCanvasWidget : public QWidget
64 Q_OBJECT
65 public:
67 PluginCanvasWidget(QWidget *parent=0)
68 : QWidget(parent) {}
70 protected:
71 void resizeEvent(QResizeEvent *e);
73 Q_SIGNALS:
74 void resized(int,int);
78 class PluginPart: public KParts::ReadOnlyPart
80 Q_OBJECT
81 public:
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 );
91 void reloadPage();
93 void changeSrc(const QString& url);
95 protected:
96 virtual bool openUrl(const KUrl &url);
97 virtual bool closeUrl();
98 virtual bool openFile() { return false; }
100 protected Q_SLOTS:
101 void pluginResized(int,int);
102 void saveAs();
104 private:
105 QString callbackPath;
106 QPointer<QWidget> _widget;
107 QPointer<NSPluginInstance> _nspWidget;
108 PluginCanvasWidget *_canvas;
109 PluginBrowserExtension *_extension;
110 PluginLiveConnectExtension *_liveconnect;
111 QStringList _args;
112 class NSPluginLoader *_loader;
113 bool *_destructed;
117 class PluginLiveConnectExtension : public KParts::LiveConnectExtension
119 Q_OBJECT
120 public:
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 );
129 Q_SIGNALS:
130 void partEvent( const unsigned long objid, const QString & event, const KParts::LiveConnectExtension::ArgList & args );
132 private:
133 PluginPart *_part;
134 QString *_retval;
138 #endif