diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-09-18 15:16:19 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-09-18 15:16:19 +0200 |
commit | 81a22b4fb23c1704b22956f5d4a8855202d136ad (patch) | |
tree | b6caf674b20f6e848b0002210d6a49a86fd1161e | |
parent | trivial fix (diff) | |
download | rekonq-81a22b4fb23c1704b22956f5d4a8855202d136ad.tar.xz |
First changes..
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/homepage.cpp | 6 | ||||
-rw-r--r-- | 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 += "<div class=\"thumbnail\">"; speed += "<a href=\"" + urls.at(i) + "\">"; - speed += "<object type=\"application/x-qt-plugin\" data=\"" + urls.at(i) + "\" classId=\"WebView\" name=\"" + pageName + "\" width=\"200\">"; - speed += "<param name=\"load\" value=\"" + urls.at(i) + "\">"; + speed += "<object type=\"application/image-preview\" width=\"200\">"; + speed += "<param name=\"url\" value=\"" + urls.at(i) + "\">"; + speed += "<param name=\"fileName\" value=\"" + pageName + "\">"; speed += "</object>"; -// speed += "<img src=\"" + path + "\" width=\"200\" alt=\"" + names.at(i) + "\" />"; speed += "<br />"; speed += names.at(i) + "</a></div>"; } 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; |