summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2013-12-15 21:29:36 +0100
committerAndrea Diamantini <adjam7@gmail.com>2013-12-15 21:29:36 +0100
commit501871d0c4155336f5ebe3842c7d0d453fc69ad8 (patch)
tree1f8bd7461a2f7f8d4a1a2524adc571b497119946
parentFix && uniform UI width (diff)
downloadrekonq-501871d0c4155336f5ebe3842c7d0d453fc69ad8.tar.xz
Get sure we try downloading just once engine favicon(s)...
-rw-r--r--src/icons/iconmanager.cpp14
-rw-r--r--src/icons/iconmanager.h5
2 files changed, 15 insertions, 4 deletions
diff --git a/src/icons/iconmanager.cpp b/src/icons/iconmanager.cpp
index 7bc47eec..0a1645d7 100644
--- a/src/icons/iconmanager.cpp
+++ b/src/icons/iconmanager.cpp
@@ -209,12 +209,20 @@ QString IconManager::iconPathForUrl(const KUrl &url)
KIcon IconManager::engineFavicon(const KUrl &url)
{
- if (QFile::exists(_faviconsDir + url.host() + QL1S(".png")))
- return KIcon(QIcon(_faviconsDir + url.host() + QL1S(".png")));
+ QString h = url.host();
+ if (QFile::exists(_faviconsDir + h + QL1S(".png")))
+ {
+ _engineFaviconHosts.removeAll(h);
+ return KIcon(QIcon(_faviconsDir + h + QL1S(".png")));
+ }
// if engine favicon is NOT found, download it
// will autodelete itself when done
- new WebIcon(url);
+ if (!_engineFaviconHosts.contains(h))
+ {
+ _engineFaviconHosts << h;
+ new WebIcon(url);
+ }
kDebug() << "NO ENGINE FAVICON";
return KIcon("text-html");
diff --git a/src/icons/iconmanager.h b/src/icons/iconmanager.h
index 659eff88..74cf706a 100644
--- a/src/icons/iconmanager.h
+++ b/src/icons/iconmanager.h
@@ -34,6 +34,7 @@
#include <QObject>
#include <QWeakPointer>
#include <QString>
+#include <QStringList>
// Forward Declarations
class KIcon;
@@ -68,7 +69,9 @@ private:
QString _faviconsDir;
QString _tempIconsDir;
-
+
+ QStringList _engineFaviconHosts;
+
static QWeakPointer<IconManager> s_iconManager;
};