diff options
author | Jon Ander Peñalba <jonan88@gmail.com> | 2010-09-02 18:10:46 +0200 |
---|---|---|
committer | Jon Ander Peñalba <jonan88@gmail.com> | 2010-09-03 08:27:20 +0200 |
commit | d0ab264b8aa5f5c7fcb21dd172a1f3f5b777356b (patch) | |
tree | f89adefce79c8bf0d5cde2e1bc015a443ccb39fe /src/iconmanager.cpp | |
parent | This commit hacks a merge request, to fast fixing a crash calling the bk toolbar (diff) | |
download | rekonq-d0ab264b8aa5f5c7fcb21dd172a1f3f5b777356b.tar.xz |
Include clean-up in the big src directory
Diffstat (limited to 'src/iconmanager.cpp')
-rw-r--r-- | src/iconmanager.cpp | 46 |
1 files changed, 22 insertions, 24 deletions
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 <kmimetype.h> +#include <KIO/Job> + +#include <KIcon> +#include <KMimeType> #include <KStandardDirs> -#include <KFileItem> -#include <KDirLister> +#include <KUrl> // Qt Includes -#include <QDBusInterface> -#include <QDBusReply> -#include <QWebElement> -#include <QWebFrame> -#include <QAction> +#include <QtWebKit/QWebElement> +#include <QtWebKit/QWebFrame> 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) |