summaryrefslogtreecommitdiff
path: root/src/webpluginfactory.cpp
diff options
context:
space:
mode:
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;
}