summaryrefslogtreecommitdiff
path: root/src/webpluginfactory.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-11-28 18:49:35 +0100
committerAndrea Diamantini <adjam7@gmail.com>2009-11-28 18:49:35 +0100
commite7faff501cefd8fb773bf0616f7d43bd5cdf9f0a (patch)
tree9d03b385b1eca31487d5df6c0460e335bca6e663 /src/webpluginfactory.cpp
parentremoved current bugged adblock implementation. (diff)
parentclicktoflash : more cleanup (diff)
downloadrekonq-e7faff501cefd8fb773bf0616f7d43bd5cdf9f0a.tar.xz
Merge commit 'refs/merge-requests/2237' of git://gitorious.org/rekonq/mainline into FLASH
Conflicts: src/CMakeLists.txt
Diffstat (limited to 'src/webpluginfactory.cpp')
-rw-r--r--src/webpluginfactory.cpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/webpluginfactory.cpp b/src/webpluginfactory.cpp
index af799905..aec4e18d 100644
--- a/src/webpluginfactory.cpp
+++ b/src/webpluginfactory.cpp
@@ -29,9 +29,11 @@
#include "webpluginfactory.moc"
// Local Includes
+#include "rekonq.h"
#include "application.h"
#include "mainwindow.h"
#include "previewimage.h"
+#include "clicktoflash.h"
// KDE Includes
#include <KDebug>
@@ -40,6 +42,8 @@
WebPluginFactory::WebPluginFactory(QObject *parent)
: KWebPluginFactory(parent)
{
+ loadClickToFlash = false;
+ connect(this, SIGNAL(signalLoadClickToFlash(bool)), SLOT(setLoadClickToFlash(bool)));
}
@@ -48,6 +52,13 @@ WebPluginFactory::~WebPluginFactory()
}
+
+void WebPluginFactory::setLoadClickToFlash(bool load)
+{
+ loadClickToFlash = load;
+}
+
+
QObject *WebPluginFactory::create(const QString &mimeType,
const QUrl &url,
const QStringList &argumentNames,
@@ -74,7 +85,25 @@ QObject *WebPluginFactory::create(const QString &mimeType,
return new PreviewImage(url, title, number, isFavorite);
}
-
+
+ if(ReKonfig::pluginsEnabled() == 0) // plugins are enabled
+ {
+ kDebug() << "No plugins found for" << mimeType << ". Falling back to QtWebKit ones...";
+ return 0;
+ }
+
+ if(mimeType == QString("application/x-shockwave-flash")
+ && !loadClickToFlash)
+ {
+ ClickToFlash* ctf = new ClickToFlash(url);
+ 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 +117,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;
}