From e4c17c961d145bb6c4c945e1d7be4eea702abecf Mon Sep 17 00:00:00 2001 From: matgic78 Date: Sun, 22 Nov 2009 11:46:44 +0100 Subject: ClickToFlash : first step For now, no config and only working when there is only one flash in the page --- src/webpluginfactory.cpp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'src/webpluginfactory.cpp') diff --git a/src/webpluginfactory.cpp b/src/webpluginfactory.cpp index af799905..2c8ed181 100644 --- a/src/webpluginfactory.cpp +++ b/src/webpluginfactory.cpp @@ -32,6 +32,7 @@ #include "application.h" #include "mainwindow.h" #include "previewimage.h" +#include "clicktoflash.h" // KDE Includes #include @@ -40,6 +41,8 @@ WebPluginFactory::WebPluginFactory(QObject *parent) : KWebPluginFactory(parent) { + loadClickToFlash = false; + connect(this, SIGNAL(signalLoadClickToFlash(bool)), SLOT(setLoadClickToFlash(bool))); } @@ -48,6 +51,13 @@ WebPluginFactory::~WebPluginFactory() } + +void WebPluginFactory::setLoadClickToFlash(bool load) +{ + loadClickToFlash = load; +} + + QObject *WebPluginFactory::create(const QString &mimeType, const QUrl &url, const QStringList &argumentNames, @@ -74,7 +84,19 @@ QObject *WebPluginFactory::create(const QString &mimeType, return new PreviewImage(url, title, number, isFavorite); } - + + if(mimeType == QString("application/x-shockwave-flash") + && !loadClickToFlash) // the button wasn't clicked + { + ClickToFlash* ctf = new ClickToFlash(this); + connect(ctf, SIGNAL(signalLoadClickToFlash(bool)), this, SLOT(setLoadClickToFlash(bool))); + return ctf; + } + + // this let QtWebKit using builtin plugins + // to load in example flash contents and so on.. + kDebug() << "No plugins found for" << mimeType << ". Falling back to QtWebKit ones..."; + emit signalLoadClickToFlash(false); return KWebPluginFactory::create(mimeType, url, argumentNames, argumentValues); } @@ -88,5 +110,10 @@ QList WebPluginFactory::plugins() const p.description = "plugin for embedding Web snapped images"; plugins.append(p); + p.name = "application/x-shockwave-flash"; + p.description = "Plugin for flash animations"; + plugins.append(p); + + return plugins; } -- cgit v1.2.1