load nsplugins on user demand. The gui is ugly and I don't really care since

I don't even plan to use this feature personally.  If someone wants to,
clean it up.

Off by default, configuration option to come shortly.

FEATURE: 36020

svn path=/trunk/kdebase/nsplugins/; revision=393042
This commit is contained in:
George Staikos 2005-02-25 17:32:43 +00:00
parent 62743fc82f
commit 21fa1f3771
6 changed files with 91 additions and 10 deletions

View file

@ -5,6 +5,7 @@
Copyright (c) 2000 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
Stefan Schimanski <1Stein@gmx.de>
Copyright (c) 2002-2005 George Staikos <staikos@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -30,11 +31,14 @@
#include <kprocess.h>
#include <kdebug.h>
#include <kglobal.h>
#include <klocale.h>
#include <kstandarddirs.h>
#include <kconfig.h>
#include <dcopclient.h>
#include <dcopstub.h>
#include <qlayout.h>
#include <qobject.h>
#include <qpushbutton.h>
#include <qxembed.h>
#include <qtextstream.h>
#include <qregexp.h>
@ -53,14 +57,35 @@ int NSPluginLoader::s_refCount = 0;
NSPluginInstance::NSPluginInstance(QWidget *parent, const QCString& app, const QCString& id)
: DCOPStub(app, id), NSPluginInstanceIface_stub(app, id), EMBEDCLASS(parent)
{
_loader = 0L;
shown = false;
_loader = NSPluginLoader::instance();
setBackgroundMode(QWidget::NoBackground);
setProtocol(QXEmbed::XPLAIN);
embed( NSPluginInstanceIface_stub::winId() );
displayPlugin();
show();
shown = true;
QGridLayout *_layout = new QGridLayout(this, 1, 1);
KConfig cfg("kcmnspluginrc", false);
cfg.setGroup("Misc");
if (cfg.readBoolEntry("demandLoad", false)) {
_button = new QPushButton(i18n("Start Plugin"), dynamic_cast<EMBEDCLASS*>(this));
_layout->addWidget(_button, 0, 0);
connect(_button, SIGNAL(clicked()), this, SLOT(doLoadPlugin()));
show();
} else {
_button = 0L;
doLoadPlugin();
}
}
void NSPluginInstance::doLoadPlugin() {
if (!_loader) {
delete _button;
_button = 0L;
_loader = NSPluginLoader::instance();
setBackgroundMode(QWidget::NoBackground);
setProtocol(QXEmbed::XPLAIN);
embed( NSPluginInstanceIface_stub::winId() );
displayPlugin();
show();
shown = true;
}
}
@ -443,3 +468,4 @@ NSPluginInstance *NSPluginLoader::newInstance(QWidget *parent, QString url,
return plugin;
}
// vim: ts=4 sw=4 et

View file

@ -5,6 +5,7 @@
Copyright (c) 2000 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
Stefan Schimanski <1Stein@gmx.de>
Copyright (c) 2002-2005 George Staikos <staikos@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -39,6 +40,8 @@
#define EMBEDCLASS QXEmbed
class KProcess;
class QPushButton;
class QGridLayout;
class NSPluginInstance : public EMBEDCLASS, virtual public NSPluginInstanceIface_stub
{
@ -48,11 +51,16 @@ public:
NSPluginInstance(QWidget *parent, const QCString& app, const QCString& id);
~NSPluginInstance();
private slots:
void doLoadPlugin();
protected:
void resizeEvent(QResizeEvent *event);
void windowChanged(WId w);
class NSPluginLoader *_loader;
bool shown;
QPushButton *_button;
QGridLayout *_layout;
};

View file

@ -1,3 +1,25 @@
/*
Netscape Plugin Loader KPart
Copyright (c) 2000 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
Stefan Schimanski <1Stein@gmx.de>
Copyright (c) 2002-2005 George Staikos <staikos@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <dcopclient.h>
#include <kaboutdata.h>
#include <kaction.h>
@ -205,7 +227,8 @@ PluginPart::PluginPart(QWidget *parentWidget, const char *widgetName, QObject *p
// create a canvas to insert our widget
_canvas = new PluginCanvasWidget( parentWidget, widgetName );
_canvas->setFocusPolicy( QWidget::ClickFocus );
//_canvas->setFocusPolicy( QWidget::ClickFocus );
_canvas->setFocusPolicy( QWidget::WheelFocus );
_canvas->setBackgroundMode( QWidget::NoBackground );
setWidget(_canvas);
_canvas->show();
@ -221,7 +244,7 @@ PluginPart::~PluginPart()
delete _callback;
_loader->release();
if (_destructed)
*_destructed = true;;
*_destructed = true;
}

View file

@ -1,3 +1,26 @@
/*
Netscape Plugin Loader KPart
Copyright (c) 2000 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
Stefan Schimanski <1Stein@gmx.de>
Copyright (c) 2002-2005 George Staikos <staikos@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __plugin_part_h__
#define __plugin_part_h__

View file

@ -5,7 +5,7 @@
Copyright (c) 2000 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
Stefan Schimanski <1Stein@gmx.de>
2003 George Staikos <staikos@kde.org>
2003-2005 George Staikos <staikos@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -4,6 +4,7 @@
Copyright (c) 2000 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
Stefan Schimanski <1Stein@gmx.de>
Copyright (c) 2003-2005 George Staikos <staikos@kde.org>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by