diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/iconmanager.cpp | 26 | ||||
-rw-r--r-- | src/iconmanager.h | 3 |
2 files changed, 22 insertions, 7 deletions
diff --git a/src/iconmanager.cpp b/src/iconmanager.cpp index 7ea1a6a0..3829776d 100644 --- a/src/iconmanager.cpp +++ b/src/iconmanager.cpp @@ -43,6 +43,7 @@ // Qt Includes #include <QtWebKit/QWebElement> #include <QtWebKit/QWebFrame> +#include <QtWebKit/QWebSettings> IconManager::IconManager(QObject *parent) @@ -62,6 +63,10 @@ KIcon IconManager::iconForUrl(const KUrl &url) if (url.isEmpty() || Application::instance()->mainWindowList().isEmpty()) return KIcon("text-html"); + // no icons in private browsing.. + if(QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) + return KIcon("view-media-artist"); + QByteArray encodedUrl = url.toEncoded(); // rekonq icons.. if (encodedUrl == QByteArray("about:home")) @@ -96,12 +101,24 @@ KIcon IconManager::iconForUrl(const KUrl &url) void IconManager::provideIcon(QWebPage *page, const KUrl &url, bool notify) { - if(url.scheme() == QL1S("about")) + // provide icons just for http/https sites + if( !url.scheme().startsWith(QL1S("http")) ) { - kDebug() << "URL: " << url << ". about scheme. Aborting..."; + kDebug() << "No http/https site..."; + if(notify) + emit iconChanged(); return; } + // no icons in private browsing.. + if(QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled)) + { + kDebug() << "Private browsing, private icon..."; + if(notify) + emit iconChanged(); + return; + } + QUrl u(url.url()); QString rootUrlString = u.toString( QUrl::RemovePassword | QUrl::RemoveUserInfo @@ -142,14 +159,11 @@ void IconManager::provideIcon(QWebPage *page, const KUrl &url, bool notify) 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); + KIO::FileCopyJob *job = KIO::file_copy(iconUrl, destUrl, -1, KIO::HideProgressInfo); if(notify) connect(job, SIGNAL(result(KJob*)), this, SIGNAL(iconChanged())); } diff --git a/src/iconmanager.h b/src/iconmanager.h index ce6c7d7b..826706b7 100644 --- a/src/iconmanager.h +++ b/src/iconmanager.h @@ -36,6 +36,7 @@ // Forward Declarations class KIcon; class QWebPage; +class KJob; class REKONQ_TESTS_EXPORT IconManager : public QObject @@ -51,7 +52,7 @@ public: void provideIcon(QWebPage *page, const KUrl &url, bool notify = true); void downloadIconFromUrl(const KUrl &url); - + Q_SIGNALS: void iconChanged(); }; |