From d0ab264b8aa5f5c7fcb21dd172a1f3f5b777356b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jon=20Ander=20Pe=C3=B1alba?= Date: Thu, 2 Sep 2010 18:10:46 +0200 Subject: Include clean-up in the big src directory --- src/iconmanager.cpp | 46 ++++++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 24 deletions(-) (limited to 'src/iconmanager.cpp') diff --git a/src/iconmanager.cpp b/src/iconmanager.cpp index 4381b53a..5b2f6c99 100644 --- a/src/iconmanager.cpp +++ b/src/iconmanager.cpp @@ -26,24 +26,22 @@ // Self Includes #include "iconmanager.h" -#include "iconmanager.moc" // Local Includes #include "application.h" #include "webicon.h" // KDE Includes -#include +#include + +#include +#include #include -#include -#include +#include // Qt Includes -#include -#include -#include -#include -#include +#include +#include IconManager::IconManager(QObject *parent) @@ -104,12 +102,12 @@ void IconManager::provideIcon(QWebPage *page, const KUrl &url, bool notify) } QUrl u(url.url()); - QString rootUrlString = u.toString( QUrl::RemovePassword - | QUrl::RemoveUserInfo - | QUrl::RemovePath - | QUrl::RemoveQuery + QString rootUrlString = u.toString( QUrl::RemovePassword + | QUrl::RemoveUserInfo + | QUrl::RemovePath + | QUrl::RemoveQuery | QUrl::StripTrailingSlash); - + // check if icon exists if(!KMimeType::favIconForUrl(url).isEmpty()) { @@ -118,10 +116,10 @@ void IconManager::provideIcon(QWebPage *page, const KUrl &url, bool notify) emit iconChanged(); return; } - + // find ico url KUrl iconUrl(rootUrlString + QL1S("/favicon.ico")); - + QWebElement root = page->mainFrame()->documentElement(); QWebElement e = root.findFirst(QL1S("link[rel~=\"icon\"]")); QString relUrlString = e.attribute(QL1S("href")); @@ -130,25 +128,25 @@ void IconManager::provideIcon(QWebPage *page, const KUrl &url, bool notify) e = root.findFirst(QL1S("link[rel~=\"shortcut icon\"]")); relUrlString = e.attribute(QL1S("href")); } - + if(!relUrlString.isEmpty()) - { + { iconUrl = relUrlString.startsWith("http") - ? KUrl(relUrlString) + ? KUrl(relUrlString) : KUrl(rootUrlString + relUrlString) ; } - + kDebug() << "ICON URL: " << iconUrl; - + QString faviconDir = KStandardDirs::locateLocal("cache" , "favicons/" , true); - + int r = rootUrlString.indexOf(':'); kDebug() << rootUrlString; kDebug() << r; - + KUrl destUrl(faviconDir + rootUrlString.mid(r+3) + ".png"); kDebug() << "DEST URL: " << destUrl; - + // download icon KIO::Job *job = KIO::file_copy(iconUrl, destUrl, -1, KIO::HideProgressInfo); if(notify) -- cgit v1.2.1