From e367678afc6bc1f5bc2a0c5ca3081418a4502de7 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Thu, 21 Nov 2013 02:14:18 +0100 Subject: Do NOT download everytime engines favicons if present --- src/icons/webicon.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/icons/webicon.cpp b/src/icons/webicon.cpp index b27b2e36..7230b3a6 100644 --- a/src/icons/webicon.cpp +++ b/src/icons/webicon.cpp @@ -38,6 +38,7 @@ #include // Qt Includes +#include #include #include #include @@ -72,6 +73,19 @@ void WebIcon::saveIcon(bool b) return; } + QString faviconsDir = KStandardDirs::locateLocal("cache" , "favicons/" , true); + QString faviconPath = faviconsDir + m_url.host(); + + if ( QFile::exists(faviconPath + QL1S(".png")) ) + { + this->deleteLater(); + return; + } + + // dest url + KUrl destUrl(faviconPath); + kDebug() << "DEST URL: " << destUrl; + // the simplest way.. const QString rootUrlString = m_url.scheme() + QL1S("://") + m_url.host(); @@ -111,12 +125,6 @@ void WebIcon::saveIcon(bool b) } kDebug() << "FAVICON RETRIEVING URL: " << faviconUrl; - - QString faviconsDir = KStandardDirs::locateLocal("cache" , "favicons/" , true); - - // dest url - KUrl destUrl(faviconsDir + m_url.host()); - kDebug() << "DEST URL: " << destUrl; // will autodelete itself when done new IconDownloader(faviconUrl, destUrl); -- cgit v1.2.1