summaryrefslogtreecommitdiff
path: root/src/iconmanager.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-07-17 16:46:24 +0200
committerAndrea Diamantini <adjam7@gmail.com>2011-07-17 16:46:24 +0200
commit82167d2422a4b6e3071dca68cf65a66e1da41ab4 (patch)
tree03c1f95a2aa60c48822a463cc3812b5c3415991e /src/iconmanager.cpp
parentImproving tab previews (diff)
downloadrekonq-82167d2422a4b6e3071dca68cf65a66e1da41ab4.tar.xz
A round of the "new" astyle 2.01...
Diffstat (limited to 'src/iconmanager.cpp')
-rw-r--r--src/iconmanager.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/src/iconmanager.cpp b/src/iconmanager.cpp
index c4082d27..18e31f6e 100644
--- a/src/iconmanager.cpp
+++ b/src/iconmanager.cpp
@@ -49,7 +49,7 @@
IconManager::IconManager(QObject *parent)
- : QObject(parent)
+ : QObject(parent)
{
_faviconsDir = KStandardDirs::locateLocal("cache" , "favicons/" , true);
}
@@ -58,32 +58,32 @@ IconManager::IconManager(QObject *parent)
KIcon IconManager::iconForUrl(const KUrl &url)
{
// first things first.. avoid infinite loop at startup
- if (url.isEmpty() || rApp->mainWindowList().isEmpty())
+ if(url.isEmpty() || rApp->mainWindowList().isEmpty())
return KIcon("text-html");
QByteArray encodedUrl = url.toEncoded();
// rekonq icons..
- if (encodedUrl == QByteArray("about:home"))
+ if(encodedUrl == QByteArray("about:home"))
return KIcon("go-home");
- if (encodedUrl == QByteArray("about:closedTabs"))
+ if(encodedUrl == QByteArray("about:closedTabs"))
return KIcon("tab-close");
- if (encodedUrl == QByteArray("about:history"))
+ if(encodedUrl == QByteArray("about:history"))
return KIcon("view-history");
- if (encodedUrl == QByteArray("about:bookmarks"))
+ if(encodedUrl == QByteArray("about:bookmarks"))
return KIcon("bookmarks");
- if (encodedUrl == QByteArray("about:favorites"))
+ if(encodedUrl == QByteArray("about:favorites"))
return KIcon("emblem-favorite");
- if (encodedUrl == QByteArray("about:downloads"))
+ if(encodedUrl == QByteArray("about:downloads"))
return KIcon("download");
// TODO: return other mimetype icons
- if (url.isLocalFile())
+ if(url.isLocalFile())
{
return KIcon("folder");
}
QString i = KMimeType::favIconForUrl(url);
- if (!i.isEmpty())
+ if(!i.isEmpty())
{
QString faviconDir = KStandardDirs::locateLocal("cache" , "" , true);
return KIcon(faviconDir + i);
@@ -97,28 +97,28 @@ KIcon IconManager::iconForUrl(const KUrl &url)
void IconManager::provideIcon(QWebPage *page, const KUrl &url, bool notify)
{
// provide icons just for http/https sites
- if (!url.scheme().startsWith(QL1S("http")))
+ if(!url.scheme().startsWith(QL1S("http")))
{
kDebug() << "No http/https site...";
- if (notify)
+ if(notify)
emit iconChanged();
return;
}
// do not load new icons in private browsing..
- if (QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled))
+ if(QWebSettings::globalSettings()->testAttribute(QWebSettings::PrivateBrowsingEnabled))
{
kDebug() << "Private browsing, private icon...";
- if (notify)
+ if(notify)
emit iconChanged();
return;
}
// check if icon exists
- if (!KMimeType::favIconForUrl(url).isEmpty())
+ if(!KMimeType::favIconForUrl(url).isEmpty())
{
kDebug() << "icon JUST present. Aborting...";
- if (notify)
+ if(notify)
emit iconChanged();
return;
}
@@ -132,13 +132,13 @@ void IconManager::provideIcon(QWebPage *page, const KUrl &url, bool notify)
QWebElement root = page->mainFrame()->documentElement();
QWebElement e = root.findFirst(QL1S("link[rel~=\"icon\"]"));
QString relUrlString = e.attribute(QL1S("href"));
- if (relUrlString.isEmpty())
+ if(relUrlString.isEmpty())
{
e = root.findFirst(QL1S("link[rel~=\"shortcut icon\"]"));
relUrlString = e.attribute(QL1S("href"));
}
- if (!relUrlString.isEmpty())
+ if(!relUrlString.isEmpty())
{
faviconUrl = relUrlString.startsWith(QL1S("http"))
? KUrl(relUrlString)
@@ -153,7 +153,7 @@ void IconManager::provideIcon(QWebPage *page, const KUrl &url, bool notify)
// download icon
KIO::FileCopyJob *job = KIO::file_copy(faviconUrl, destUrl, -1, KIO::HideProgressInfo);
- if (notify)
+ if(notify)
connect(job, SIGNAL(result(KJob*)), this, SLOT(notifyLastStuffs(KJob *)));
else
connect(job, SIGNAL(result(KJob*)), this, SLOT(doLastStuffs(KJob *)));
@@ -170,7 +170,7 @@ void IconManager::clearIconCache()
{
QDir d(_faviconsDir);
QStringList favicons = d.entryList();
- Q_FOREACH(const QString &fav, favicons)
+ Q_FOREACH(const QString & fav, favicons)
{
d.remove(fav);
}
@@ -179,7 +179,7 @@ void IconManager::clearIconCache()
void IconManager::doLastStuffs(KJob *j)
{
- if (j->error())
+ if(j->error())
{
kDebug() << "FAVICON JOB ERROR";
return;
@@ -190,14 +190,14 @@ void IconManager::doLastStuffs(KJob *j)
QString s = dest.url().remove(QL1S("file://"));
QFile fav(s);
- if (!fav.exists())
+ if(!fav.exists())
{
kDebug() << "FAVICON DOES NOT EXISTS";
fav.remove();
return;
}
- if (fav.size() == 0)
+ if(fav.size() == 0)
{
kDebug() << "SIZE ZERO FAVICON";
fav.remove();
@@ -205,13 +205,13 @@ void IconManager::doLastStuffs(KJob *j)
}
QPixmap px;
- if (!px.load(s))
+ if(!px.load(s))
{
kDebug() << "PIXMAP NOT LOADED";
return;
}
- if (px.isNull())
+ if(px.isNull())
{
kDebug() << "PIXMAP IS NULL";
fav.remove();
@@ -219,7 +219,7 @@ void IconManager::doLastStuffs(KJob *j)
}
px = px.scaled(16, 16);
- if (!px.save(s))
+ if(!px.save(s))
{
kDebug() << "PIXMAP NOT SAVED";
return;