summaryrefslogtreecommitdiff
path: root/src/iconmanager.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2010-09-10 03:42:48 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-09-10 03:42:48 +0200
commit6502f35644bb42bee5d7638c8b77769c7bb06422 (patch)
tree315e10eb360e0c5a05f617d17ff2f9d6d5427aa0 /src/iconmanager.cpp
parentkill currentJob if it yet exists.. (diff)
downloadrekonq-6502f35644bb42bee5d7638c8b77769c7bb06422.tar.xz
IconManager cleanup
Diffstat (limited to 'src/iconmanager.cpp')
-rw-r--r--src/iconmanager.cpp26
1 files changed, 20 insertions, 6 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()));
}