summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2013-06-16 16:31:58 +0200
committerAndrea Diamantini <adjam7@gmail.com>2013-06-16 18:41:55 +0200
commit3365560d535f837aaab328d8096e6af5bdfaaf50 (patch)
tree6a89167fb677a06927dd00768cef9a58c2b1c0f1 /src
parentManage local mimetype icons (diff)
downloadrekonq-3365560d535f837aaab328d8096e6af5bdfaaf50.tar.xz
Fix rekonq pages icons according to last changes in IconManager
Diffstat (limited to 'src')
-rw-r--r--src/icons/iconmanager.cpp24
-rw-r--r--src/icons/iconmanager.h5
-rw-r--r--src/icons/webicon.cpp11
3 files changed, 19 insertions, 21 deletions
diff --git a/src/icons/iconmanager.cpp b/src/icons/iconmanager.cpp
index 1fa4f662..2948fde3 100644
--- a/src/icons/iconmanager.cpp
+++ b/src/icons/iconmanager.cpp
@@ -65,6 +65,7 @@ IconManager::IconManager(QObject *parent)
: QObject(parent)
{
_faviconsDir = KStandardDirs::locateLocal("cache" , "favicons/" , true);
+ _tempIconsDir = KStandardDirs::locateLocal("tmp", "favicons/", true);
// Use webkit icon database path
QWebSettings::setIconDatabasePath(_faviconsDir);
@@ -190,10 +191,14 @@ QString IconManager::iconPathForUrl(const KUrl &url)
return icon;
}
- QString i = favIconForUrl(url);
- if (!i.isEmpty())
+ QIcon ic = QWebSettings::iconForUrl(url);
+ if (!ic.isNull())
{
- return QL1S("file://") + _faviconsDir + i;
+ QPixmap px = ic.pixmap(16, 16);
+ QString tempIconPath = _tempIconsDir + url.host() + QL1S(".png");
+ bool b = px.save(tempIconPath);
+ if (b)
+ return QL1S("file://") + tempIconPath;
}
// Not found icon. Return default one.
@@ -202,19 +207,6 @@ QString IconManager::iconPathForUrl(const KUrl &url)
}
-QString IconManager::favIconForUrl(const KUrl &url)
-{
- if (url.isLocalFile()
- || !url.protocol().startsWith(QL1S("http")))
- return QString();
-
- if (QFile::exists(_faviconsDir + url.host() + QL1S(".png")))
- return url.host() + QL1S(".png");
- else
- return QString();
-}
-
-
void IconManager::provideEngineFavicon(const KUrl &url)
{
// will autodelete itself when done
diff --git a/src/icons/iconmanager.h b/src/icons/iconmanager.h
index 4903d7c4..a120be16 100644
--- a/src/icons/iconmanager.h
+++ b/src/icons/iconmanager.h
@@ -67,10 +67,9 @@ public:
private:
IconManager(QObject *parent = 0);
- QString favIconForUrl(const KUrl &url);
-
QString _faviconsDir;
-
+ QString _tempIconsDir;
+
static QWeakPointer<IconManager> s_iconManager;
};
diff --git a/src/icons/webicon.cpp b/src/icons/webicon.cpp
index 6e9ec0d5..3bcf18f3 100644
--- a/src/icons/webicon.cpp
+++ b/src/icons/webicon.cpp
@@ -100,11 +100,18 @@ void WebIcon::saveIcon(bool b)
faviconUrl = KUrl(relUrlString);
if (!faviconUrl.isValid())
- {
-
+ {
faviconUrl = KUrl(rootUrlString + QL1C('/') + relUrlString);
}
+
+ if (faviconUrl.host().isEmpty())
+ {
+ faviconUrl = KUrl(rootUrlString + relUrlString);
+ }
}
+
+ kDebug() << "FAVICON RETRIEVING URL: " << faviconUrl;
+
QString faviconsDir = KStandardDirs::locateLocal("cache" , "favicons/" , true);
// dest url