From 81a22b4fb23c1704b22956f5d4a8855202d136ad Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Fri, 18 Sep 2009 15:16:19 +0200 Subject: First changes.. --- src/CMakeLists.txt | 1 + src/homepage.cpp | 6 +++--- src/webpluginfactory.cpp | 39 ++++++++++++++++++++++----------------- 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 755ae33d..4aa01913 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,6 +2,7 @@ SET( rekonq_SRCS homepage.cpp + websnap.cpp networkaccessmanager.cpp autosaver.cpp application.cpp diff --git a/src/homepage.cpp b/src/homepage.cpp index f6867c7e..00f0611a 100644 --- a/src/homepage.cpp +++ b/src/homepage.cpp @@ -98,10 +98,10 @@ QString HomePage::speedDial() speed += "
"; speed += ""; - speed += ""; - speed += ""; + speed += ""; + speed += ""; + speed += ""; speed += ""; -// speed += "\"""; speed += "
"; speed += names.at(i) + ""; } 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 #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 WebPluginFactory::plugins() const QList 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; -- cgit v1.2.1