From b8546e2a1e86126702f65d63a9e090d13d91f328 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Tue, 27 Dec 2011 12:27:22 +0100 Subject: IconManager, small cleanup: use (QWeb)Frames instead of pages. --- src/iconmanager.cpp | 6 +++--- src/iconmanager.h | 4 ++-- src/webicon.cpp | 2 +- src/webpage.cpp | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/iconmanager.cpp b/src/iconmanager.cpp index 632a33af..8179ca07 100644 --- a/src/iconmanager.cpp +++ b/src/iconmanager.cpp @@ -92,7 +92,7 @@ KIcon IconManager::iconForUrl(const KUrl &url) } -void IconManager::provideIcon(QWebPage *page, const KUrl &url, bool notify) +void IconManager::provideIcon(QWebFrame *mFrame, const KUrl &url, bool notify) { // provide icons just for http/https sites if (!url.scheme().startsWith(QL1S("http"))) @@ -124,7 +124,7 @@ void IconManager::provideIcon(QWebPage *page, const KUrl &url, bool notify) // find favicon url KUrl faviconUrl; - QWebElement root = page->mainFrame()->documentElement(); + QWebElement root = mFrame->documentElement(); QWebElement e = root.findFirst(QL1S("link[rel~=\"icon\"]")); QString relUrlString = e.attribute(QL1S("href")); if (relUrlString.isEmpty()) @@ -147,7 +147,7 @@ void IconManager::provideIcon(QWebPage *page, const KUrl &url, bool notify) KUrl destUrl(_faviconsDir + url.host()); // download icon - KIO::FileCopyJob *job = KIO::file_copy(faviconUrl, destUrl, -1, KIO::HideProgressInfo); + KIO::FileCopyJob *job = KIO::file_copy(faviconUrl, destUrl, -1, KIO::HideProgressInfo | KIO::Overwrite); if (notify) connect(job, SIGNAL(result(KJob*)), this, SLOT(notifyLastStuffs(KJob *))); else diff --git a/src/iconmanager.h b/src/iconmanager.h index e7e317f0..a7d03edc 100644 --- a/src/iconmanager.h +++ b/src/iconmanager.h @@ -35,7 +35,7 @@ // Forward Declarations class KIcon; -class QWebPage; +class QWebFrame; class KJob; @@ -49,7 +49,7 @@ public: KIcon iconForUrl(const KUrl &url); QString iconPathForUrl(const KUrl &url); - void provideIcon(QWebPage *page, const KUrl &url, bool notify = true); + void provideIcon(QWebFrame *mFrame, const KUrl &url, bool notify = true); void downloadIconFromUrl(const KUrl &url); diff --git a/src/webicon.cpp b/src/webicon.cpp index 9527be04..03097956 100644 --- a/src/webicon.cpp +++ b/src/webicon.cpp @@ -59,7 +59,7 @@ void WebIcon::load() void WebIcon::saveIcon(bool b) { if (b) - rApp->iconManager()->provideIcon(&m_page, m_url, false); + rApp->iconManager()->provideIcon(m_page.mainFrame(), m_url, false); this->deleteLater(); } diff --git a/src/webpage.cpp b/src/webpage.cpp index 772cffb1..98a4a87e 100644 --- a/src/webpage.cpp +++ b/src/webpage.cpp @@ -399,7 +399,7 @@ void WebPage::loadFinished(bool ok) mainFrame()->setZoomFactor(QVariant(value).toReal() / 10); // Don't allox max +1 values // Provide site icon. Can this be moved to loadStarted?? - rApp->iconManager()->provideIcon(this, _loadingUrl); + rApp->iconManager()->provideIcon(mainFrame(), _loadingUrl); // Apply adblock manager hiding rules rApp->adblockManager()->applyHidingRules(this); -- cgit v1.2.1