summaryrefslogtreecommitdiff
path: root/src/protocolhandler.cpp
diff options
context:
space:
mode:
authorAndrea Diamantini <adjam7@gmail.com>2011-07-25 19:48:41 +0200
committerAndrea Diamantini <adjam7@gmail.com>2011-07-25 19:48:41 +0200
commit14664e54b1a2dbe9c06f474a0918a262dba04e20 (patch)
tree2f48b455d90b5a966045f8ba6388ac8c0620259f /src/protocolhandler.cpp
parentLast SSL fixes (diff)
downloadrekonq-14664e54b1a2dbe9c06f474a0918a262dba04e20.tar.xz
clean up
- QL1S - one stupid kDebug less - codingstyle
Diffstat (limited to 'src/protocolhandler.cpp')
-rw-r--r--src/protocolhandler.cpp66
1 files changed, 33 insertions, 33 deletions
diff --git a/src/protocolhandler.cpp b/src/protocolhandler.cpp
index 93f7bc37..2af4214f 100644
--- a/src/protocolhandler.cpp
+++ b/src/protocolhandler.cpp
@@ -70,7 +70,7 @@ static KFileItemList sortFileList(const KFileItemList &list)
// order dirs before files..
Q_FOREACH(const KFileItem & item, list)
{
- if(item.isDir())
+ if (item.isDir())
dirList << item;
else
fileList << item;
@@ -102,10 +102,10 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra
_frame = frame;
// javascript handling
- if(_url.protocol() == QL1S("javascript"))
+ if (_url.protocol() == QL1S("javascript"))
{
QString scriptSource = _url.authority();
- if(scriptSource.isEmpty())
+ if (scriptSource.isEmpty())
{
// if javascript:<code here> then authority() returns
// an empty string. Extract the source manually
@@ -115,7 +115,7 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra
// fromPercentEncoding() is used to decode all the % encoded
// characters to normal, so that it is treated as valid javascript
scriptSource = QUrl::fromPercentEncoding(_url.url().mid(11).toAscii());
- if(scriptSource.isEmpty())
+ if (scriptSource.isEmpty())
return false;
}
@@ -124,25 +124,25 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra
}
// "abp" handling
- if(_url.protocol() == QL1S("abp"))
+ if (_url.protocol() == QL1S("abp"))
{
abpHandling();
return true;
}
// "about" handling
- if(_url.protocol() == QL1S("about"))
+ if (_url.protocol() == QL1S("about"))
{
QByteArray encodedUrl = _url.toEncoded();
// let webkit manage the about:blank url...
- if(encodedUrl == QByteArray("about:blank"))
+ if (encodedUrl == QByteArray("about:blank"))
{
return false;
}
- if(encodedUrl == QByteArray("about:home"))
+ if (encodedUrl == QByteArray("about:home"))
{
- switch(ReKonfig::newTabStartPage())
+ switch (ReKonfig::newTabStartPage())
{
case 0: // favorites
_url = KUrl("about:favorites");
@@ -173,7 +173,7 @@ bool ProtocolHandler::preHandling(const QNetworkRequest &request, QWebFrame *fra
}
// let webkit try to load a known (or missing) protocol...
- if(KProtocolInfo::isKnownProtocol(_url))
+ if (KProtocolInfo::isKnownProtocol(_url))
return false;
// Error Message, for those protocols we cannot handle
@@ -189,12 +189,12 @@ bool ProtocolHandler::postHandling(const QNetworkRequest &request, QWebFrame *fr
_frame = frame;
// "http(s)" (fast) handling
- if(_url.protocol() == QL1S("http") || _url.protocol() == QL1S("https"))
+ if (_url.protocol() == QL1S("http") || _url.protocol() == QL1S("https"))
return false;
// "mailto" handling: It needs to be handled both here(mail links clicked)
// and in prehandling (mail url launched)
- if(_url.protocol() == QL1S("mailto"))
+ if (_url.protocol() == QL1S("mailto"))
{
KToolInvocation::invokeMailer(_url);
return true;
@@ -205,7 +205,7 @@ bool ProtocolHandler::postHandling(const QNetworkRequest &request, QWebFrame *fr
// My idea is: webkit cannot handle in any way ftp. So we have surely to return true here.
// We start trying to guess what the url represent: it's a dir? show its contents (and download them).
// it's a file? download it. It's another thing? beat me, but I don't know what to do...
- if(_url.protocol() == QL1S("ftp"))
+ if (_url.protocol() == QL1S("ftp"))
{
KIO::StatJob *job = KIO::stat(_url);
connect(job, SIGNAL(result(KJob*)), this, SLOT(slotMostLocalUrlResult(KJob*)));
@@ -213,10 +213,10 @@ bool ProtocolHandler::postHandling(const QNetworkRequest &request, QWebFrame *fr
}
// "file" handling. This is quite trivial :)
- if(_url.protocol() == QL1S("file"))
+ if (_url.protocol() == QL1S("file"))
{
QFileInfo fileInfo(_url.path());
- if(fileInfo.isDir())
+ if (fileInfo.isDir())
{
connect(_lister, SIGNAL(newItems(const KFileItemList &)), this, SLOT(showResults(const KFileItemList &)));
_lister->openUrl(_url);
@@ -227,7 +227,7 @@ bool ProtocolHandler::postHandling(const QNetworkRequest &request, QWebFrame *fr
// we cannot handle this protocol in any way.
// Try KRunning it...
- if(KProtocolInfo::isKnownProtocol(_url))
+ if (KProtocolInfo::isKnownProtocol(_url))
{
(void)new KRun(_url, rApp->mainWindow(), 0, _url.isLocalFile());
return true;
@@ -242,7 +242,7 @@ bool ProtocolHandler::postHandling(const QNetworkRequest &request, QWebFrame *fr
void ProtocolHandler::showResults(const KFileItemList &list)
{
- if(!_lister->rootItem().isNull() && _lister->rootItem().isReadable() && _lister->rootItem().isFile())
+ if (!_lister->rootItem().isNull() && _lister->rootItem().isReadable() && _lister->rootItem().isFile())
{
emit downloadUrl(_lister->rootItem().url());
}
@@ -261,7 +261,7 @@ void ProtocolHandler::showResults(const KFileItemList &list)
QString ProtocolHandler::dirHandling(const KFileItemList &list)
{
- if(!_lister)
+ if (!_lister)
{
return QString("rekonq error, sorry :(");
}
@@ -274,7 +274,7 @@ QString ProtocolHandler::dirHandling(const KFileItemList &list)
QFile file(infoFilePath);
bool isOpened = file.open(QIODevice::ReadOnly);
- if(!isOpened)
+ if (!isOpened)
{
return QString("rekonq error, sorry :(");
}
@@ -283,7 +283,7 @@ QString ProtocolHandler::dirHandling(const KFileItemList &list)
QString msg = i18nc("%1=an URL", "<h1>Index of %1</h1>", _url.prettyUrl());
- if(rootUrl.cd(".."))
+ if (rootUrl.cd(".."))
{
QString path = rootUrl.prettyUrl();
QString uparrow = KIconLoader::global()->iconPath("arrow-up", KIconLoader::Small);
@@ -309,7 +309,7 @@ QString ProtocolHandler::dirHandling(const KFileItemList &list)
msg += "</td>";
msg += "<td align=\"right\">";
- if(item.isFile())
+ if (item.isFile())
{
msg += KGlobal::locale()->formatByteSize(item.size(), 1);
}
@@ -335,7 +335,7 @@ QString ProtocolHandler::dirHandling(const KFileItemList &list)
void ProtocolHandler::slotMostLocalUrlResult(KJob *job)
{
- if(job->error())
+ if (job->error())
{
// TODO
}
@@ -343,7 +343,7 @@ void ProtocolHandler::slotMostLocalUrlResult(KJob *job)
{
KIO::StatJob *statJob = static_cast<KIO::StatJob*>(job);
KIO::UDSEntry entry = statJob->statResult();
- if(entry.isDir())
+ if (entry.isDir())
{
connect(_lister, SIGNAL(newItems(const KFileItemList &)), this, SLOT(showResults(const KFileItemList &)));
_lister->openUrl(_url);
@@ -363,7 +363,7 @@ void ProtocolHandler::slotMostLocalUrlResult(KJob *job)
void ProtocolHandler::abpHandling()
{
QString path = _url.path();
- if(path != QL1S("subscribe"))
+ if (path != QL1S("subscribe"))
return;
QMap<QString, QString> map = _url.queryItems(KUrl::CaseInsensitiveKeys);
@@ -374,7 +374,7 @@ void ProtocolHandler::abpHandling()
QString requirestitle = map.value(QL1S("requirestitle"));
QString info;
- if(requirestitle.isEmpty() || requireslocation.isEmpty())
+ if (requirestitle.isEmpty() || requireslocation.isEmpty())
{
info = title;
}
@@ -383,15 +383,15 @@ void ProtocolHandler::abpHandling()
info = i18n("\n %1,\n %2 (required by %3)\n", title, requirestitle, title);
}
- if(KMessageBox::questionYesNo(0,
- i18n("Do you want to add the following subscriptions to your adblock settings?\n") + info,
- i18n("Add automatic subscription to the adblock"),
- KGuiItem(i18n("Add")),
- KGuiItem(i18n("Discard"))
- )
- )
+ if (KMessageBox::questionYesNo(0,
+ i18n("Do you want to add the following subscriptions to your adblock settings?\n") + info,
+ i18n("Add automatic subscription to the adblock"),
+ KGuiItem(i18n("Add")),
+ KGuiItem(i18n("Discard"))
+ )
+ )
{
- if(!requireslocation.isEmpty() && !requirestitle.isEmpty())
+ if (!requireslocation.isEmpty() && !requirestitle.isEmpty())
{
rApp->adblockManager()->addSubscription(requirestitle, requireslocation);
}