summaryrefslogtreecommitdiff
path: root/src/webpluginfactory.cpp
diff options
context:
space:
mode:
authormatgic78 <matgic78@gmail.com>2009-11-22 11:46:44 +0100
committermatgic78 <matgic78@gmail.com>2009-11-27 16:11:57 +0100
commite4c17c961d145bb6c4c945e1d7be4eea702abecf (patch)
tree42dd7057418bbfdd4a2065fb81d7828ff89eaac7 /src/webpluginfactory.cpp
parentsrc/CMakeLists.txt fix (diff)
downloadrekonq-e4c17c961d145bb6c4c945e1d7be4eea702abecf.tar.xz
ClickToFlash : first step
For now, no config and only working when there is only one flash in the page
Diffstat (limited to 'src/webpluginfactory.cpp')
-rw-r--r--src/webpluginfactory.cpp29
1 files changed, 28 insertions, 1 deletions
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 <KDebug>
@@ -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<QWebPluginFactory::Plugin> 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;
}