summaryrefslogtreecommitdiff
path: root/src/webpluginfactory.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2009-09-18 15:16:19 +0200
committerAndrea Diamantini <adjam7@gmail.com>2009-09-18 15:16:19 +0200
commit81a22b4fb23c1704b22956f5d4a8855202d136ad (patch)
treeb6caf674b20f6e848b0002210d6a49a86fd1161e /src/webpluginfactory.cpp
parenttrivial fix (diff)
downloadrekonq-81a22b4fb23c1704b22956f5d4a8855202d136ad.tar.xz
First changes..
Diffstat (limited to 'src/webpluginfactory.cpp')
-rw-r--r--src/webpluginfactory.cpp39
1 files changed, 22 insertions, 17 deletions
diff --git a/src/webpluginfactory.cpp b/src/webpluginfactory.cpp
index b836e620..3754c03d 100644
--- a/src/webpluginfactory.cpp
+++ b/src/webpluginfactory.cpp
@@ -31,6 +31,8 @@
#include "webview.h"
#include "webpage.h"
+#include "websnap.h"
+
#include <QWebFrame>
#include "application.h"
@@ -52,22 +54,25 @@ QObject *WebPluginFactory::create(const QString &mimeType,
const QStringList &argumentNames,
const QStringList &argumentValues) const
{
- Q_UNUSED(mimeType)
- Q_UNUSED(argumentNames)
- Q_UNUSED(argumentValues)
-
- WebView* w = new WebView( Application::instance()->mainWindow()->currentTab() );
- w->load(url);
- QWebFrame *frame = w->page()->mainFrame();
+ if(mimeType == QString("application/image-preview") )
+ {
+ QString url, fileName;
+ int i = 0;
+ Q_FOREACH(const QString &key, argumentNames)
+ {
+ if(key == QString("url"))
+ url = argumentValues.at(i);
+ if(key == QString("fileName"))
+ url = argumentValues.at(i);
+ ++i;
+ }
+ return new WebSnap(url,fileName);
+ }
- QSize size = frame->contentsSize();
- qreal zoom = size.height()/150.;
- frame->setZoomFactor(zoom);
-
- frame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
- frame->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
-
- return w;
+ kDebug() << "No plugins found for" << mimeType;
+ QWebView* webView = new QWebView;
+ webView->load(url);
+ return webView;
}
@@ -76,8 +81,8 @@ QList<QWebPluginFactory::Plugin> WebPluginFactory::plugins() const
QList<QWebPluginFactory::Plugin> plugins;
QWebPluginFactory::Plugin p;
- p.name = "WebView";
- p.description = "plugin for embedding WebViews";
+ p.name = "application/image-preview";
+ p.description = "plugin for embedding Web snapped images";
plugins.append(p);
return plugins;