3 This is an encapsulation of the Netscape plugin API.
6 Copyright (c) 2000 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
7 Stefan Schimanski <1Stein@gmx.de>
8 Copyright (c) 2002-2005 George Staikos <staikos@kde.org>
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 #ifndef NS_PLUGINLOADER_H
28 #define NS_PLUGINLOADER_H
33 #include <QtGui/QX11EmbedContainer>
36 #include <kdemacros.h>
39 #define EMBEDCLASS QX11EmbedContainer
41 class OrgKdeNspluginsViewerInterface
;
44 class OrgKdeNspluginsInstanceInterface
;
46 class NSPluginInstance
: public EMBEDCLASS
51 NSPluginInstance(QWidget
*parent
, const QString
& app
, const QString
& id
, const KUrl
& baseUrl
);
54 void javascriptResult(int id
, const QString
&result
);
56 void pluginResized(int w
, int h
);
62 void resizeEvent(QResizeEvent
*event
);
63 void showEvent(QShowEvent
*event
);
64 void windowChanged(WId w
);
65 virtual void focusInEvent( QFocusEvent
* event
);
66 virtual void focusOutEvent( QFocusEvent
* event
);
68 class NSPluginLoader
*_loader
;
69 OrgKdeNspluginsInstanceInterface
*_instanceInterface
;
72 void doLoadPlugin(int w
, int h
);
73 void embedIfNeeded(int w
, int h
);
74 void resizePlugin(int w
, int h
);
80 // class exported for the test program
81 class KDE_EXPORT NSPluginLoader
: public QObject
89 NSPluginInstance
*newInstance(QWidget
*parent
,
90 const QString
& url
, const QString
& mimeType
, bool embed
,
91 const QStringList
& argn
, const QStringList
& argv
,
92 const QString
& ownDBusId
, const QString
& callbackId
, bool reload
);
94 static NSPluginLoader
*instance();
100 QString
lookup(const QString
&mimeType
);
101 QString
lookupMimeType(const QString
&url
);
107 void processTerminated();
110 QStringList _searchPaths
;
111 QMultiHash
<QString
, QString
> _mapping
;
112 QHash
<QString
, QString
> _filetype
;
115 QString _viewerDBusId
;
116 OrgKdeNspluginsViewerInterface
*_viewer
;
118 static NSPluginLoader
*s_instance
;
119 static int s_refCount
;