summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2012-01-02 17:44:58 +0100
committerAndrea Diamantini <adjam7@gmail.com>2012-01-02 17:44:58 +0100
commit6b59f402f33e5c78279429850fb11de558fb6ea2 (patch)
tree0527f59c917d6ddf67691d1d01759ce6386e33fe /src
parentFix "share" action (diff)
downloadrekonq-6b59f402f33e5c78279429850fb11de558fb6ea2.tar.xz
Do NOT load previews if not present
This fixes problems on unwanted connections while using rekonq.
Diffstat (limited to 'src')
-rw-r--r--src/newtabpage.cpp63
-rw-r--r--src/newtabpage.h3
-rw-r--r--src/webpage.cpp13
-rw-r--r--src/webpage.h3
4 files changed, 34 insertions, 48 deletions
diff --git a/src/newtabpage.cpp b/src/newtabpage.cpp
index e9aa0626..0372aad3 100644
--- a/src/newtabpage.cpp
+++ b/src/newtabpage.cpp
@@ -2,7 +2,7 @@
*
* This file is a part of the rekonq project
*
-* Copyright (C) 2009-2011 by Andrea Diamantini <adjam7 at gmail dot com>
+* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com>
* Copyright (C) 2010 by Matthieu Gicquel <matgic78 at gmail dot com>
*
*
@@ -300,14 +300,10 @@ void NewTabPage::favoritesPage()
for (int i = 0; i < urls.count() ; ++i)
{
KUrl url = KUrl(urls.at(i));
- QWebElement prev;
- if (url.isEmpty())
- prev = emptyPreview(i);
- else if (!WebSnap::existsImage(url))
- prev = loadingPreview(i, url);
- else
- prev = validPreview(i, url, QString::number(i + 1) + " - " + names.at(i));
+ QWebElement prev = url.isEmpty()
+ ? emptyPreview(i)
+ : validPreview(i, url, QString::number(i + 1) + " - " + names.at(i));
m_root.appendInside(prev);
}
@@ -426,9 +422,7 @@ void NewTabPage::closedTabsPage()
if (item.url.isEmpty())
continue;
- prev = WebSnap::existsImage(KUrl(item.url))
- ? validPreview(i, item.url, item.title)
- : loadingPreview(i, item.url);
+ prev = validPreview(i, item.url, item.title);
prev.setAttribute(QL1S("id"), QL1S("preview") + QVariant(i).toString());
hideControls(prev);
@@ -555,32 +549,37 @@ QWebElement NewTabPage::emptyPreview(int index)
}
-QWebElement NewTabPage::loadingPreview(int index, const KUrl &url)
-{
- QWebElement prev = markup(QL1S(".thumbnail"));
-
- prev.findFirst(QL1S(".preview img")).setAttribute(QL1S("src"),
- QL1S("file:///") + KStandardDirs::locate("appdata", "pics/busywidget.gif"));
- prev.findFirst(QL1S("span a")).setPlainText(i18n("Loading Preview..."));
- prev.findFirst(QL1S("a")).setAttribute(QL1S("href"), url.toMimeDataString());
-
- setupPreview(prev, index);
- showControls(prev);
-
- // NOTE: we need the page frame for two reasons
- // 1) to link to the WebPage calling the snapFinished slot
- // 2) to "auto-destroy" snaps on tab closing :)
- QWebFrame *frame = qobject_cast<QWebFrame *>(parent());
- WebSnap *snap = new WebSnap(url, frame);
- connect(snap, SIGNAL(snapDone(bool)), frame->page(), SLOT(updateImage(bool)), Qt::UniqueConnection);
- return prev;
-}
+// NOTE: comment this out WITHOUT really deleting. May be of inspiration...
+// QWebElement NewTabPage::loadingPreview(int index, const KUrl &url)
+// {
+// QWebElement prev = markup(QL1S(".thumbnail"));
+//
+// prev.findFirst(QL1S(".preview img")).setAttribute(QL1S("src"),
+// QL1S("file:///") + KStandardDirs::locate("appdata", "pics/busywidget.gif"));
+// prev.findFirst(QL1S("span a")).setPlainText(i18n("Loading Preview..."));
+// prev.findFirst(QL1S("a")).setAttribute(QL1S("href"), url.toMimeDataString());
+//
+// setupPreview(prev, index);
+// showControls(prev);
+//
+// // NOTE: we need the page frame for two reasons
+// // 1) to link to the WebPage calling the snapFinished slot
+// // 2) to "auto-destroy" snaps on tab closing :)
+// QWebFrame *frame = qobject_cast<QWebFrame *>(parent());
+// WebSnap *snap = new WebSnap(url, frame);
+// connect(snap, SIGNAL(snapDone(bool)), frame->page(), SLOT(updateImage(bool)), Qt::UniqueConnection);
+// return prev;
+// }
QWebElement NewTabPage::validPreview(int index, const KUrl &url, const QString &title)
{
QWebElement prev = markup(QL1S(".thumbnail"));
- QString previewPath = QL1S("file://") + WebSnap::imagePathFromUrl(url);
+
+ QString previewPath = WebSnap::existsImage(url)
+ ? QL1S("file://") + WebSnap::imagePathFromUrl(url)
+ : rApp->iconManager()->iconPathForUrl(url)
+ ;
prev.findFirst(QL1S(".preview img")).setAttribute(QL1S("src") , previewPath);
prev.findFirst(QL1S("a")).setAttribute(QL1S("href"), url.toMimeDataString());
diff --git a/src/newtabpage.h b/src/newtabpage.h
index aae8da1e..40627c6c 100644
--- a/src/newtabpage.h
+++ b/src/newtabpage.h
@@ -2,7 +2,7 @@
*
* This file is a part of the rekonq project
*
-* Copyright (C) 2009-2011 by Andrea Diamantini <adjam7 at gmail dot com>
+* Copyright (C) 2009-2012 by Andrea Diamantini <adjam7 at gmail dot com>
* Copyright (C) 2010 by Matthieu Gicquel <matgic78 at gmail dot com>
*
*
@@ -82,7 +82,6 @@ private:
// Previews handling
QWebElement emptyPreview(int index);
- QWebElement loadingPreview(int index, const KUrl &url);
QWebElement validPreview(int index, const KUrl &url, const QString &title);
QWebElement tabPreview(int winIndex, int tabIndex, const KUrl &url, const QString &title);
diff --git a/src/webpage.cpp b/src/webpage.cpp
index 61cc50d6..9dee0967 100644
--- a/src/webpage.cpp
+++ b/src/webpage.cpp
@@ -6,7 +6,7 @@
* Copyright (C) 2008 Dirk Mueller <mueller@kde.org>
* Copyright (C) 2008 Urs Wolfer <uwolfer @ kde.org>
* Copyright (C) 2008 Michael Howell <mhowell123@gmail.com>
-* Copyright (C) 2008-2011 by Andrea Diamantini <adjam7 at gmail dot com>
+* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
* Copyright (C) 2010 by Matthieu Gicquel <matgic78 at gmail dot com>
* Copyright (C) 2009-2010 Dawit Alemayehu <adawit at kde dot org>
*
@@ -45,7 +45,6 @@
#include "mainview.h"
#include "mainwindow.h"
#include "networkaccessmanager.h"
-#include "newtabpage.h"
#include "urlbar.h"
#include "webpluginfactory.h"
#include "websnap.h"
@@ -615,16 +614,6 @@ void WebPage::showSSLInfo(QPoint pos)
}
-void WebPage::updateImage(bool ok)
-{
- if (ok)
- {
- NewTabPage p(mainFrame());
- p.updateThumbs();
- }
-}
-
-
void WebPage::copyToTempFileResult(KJob* job)
{
if (job->error())
diff --git a/src/webpage.h b/src/webpage.h
index 6a717f78..7e5df309 100644
--- a/src/webpage.h
+++ b/src/webpage.h
@@ -6,7 +6,7 @@
* Copyright (C) 2008 Dirk Mueller <mueller@kde.org>
* Copyright (C) 2008 Urs Wolfer <uwolfer @ kde.org>
* Copyright (C) 2008 Michael Howell <mhowell123@gmail.com>
-* Copyright (C) 2008-2011 by Andrea Diamantini <adjam7 at gmail dot com>
+* Copyright (C) 2008-2012 by Andrea Diamantini <adjam7 at gmail dot com>
* Copyright (C) 2010 by Matthieu Gicquel <matgic78 at gmail dot com>
*
*
@@ -103,7 +103,6 @@ private Q_SLOTS:
void loadStarted();
void loadFinished(bool);
void showSSLInfo(QPoint);
- void updateImage(bool ok);
void copyToTempFileResult(KJob*);