summaryrefslogtreecommitdiff
path: root/src/opensearch/opensearchreader.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/opensearch/opensearchreader.cpp
parentImproving tab previews (diff)
downloadrekonq-82167d2422a4b6e3071dca68cf65a66e1da41ab4.tar.xz
A round of the "new" astyle 2.01...
Diffstat (limited to 'src/opensearch/opensearchreader.cpp')
-rw-r--r--src/opensearch/opensearchreader.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/opensearch/opensearchreader.cpp b/src/opensearch/opensearchreader.cpp
index 2076338b..a789c413 100644
--- a/src/opensearch/opensearchreader.cpp
+++ b/src/opensearch/opensearchreader.cpp
@@ -42,7 +42,7 @@
OpenSearchReader::OpenSearchReader()
- : QXmlStreamReader()
+ : QXmlStreamReader()
{
}
@@ -60,7 +60,7 @@ OpenSearchEngine *OpenSearchReader::read(QIODevice *device)
{
clear();
- if (!device->isOpen())
+ if(!device->isOpen())
{
device->open(QIODevice::ReadOnly);
}
@@ -74,56 +74,56 @@ OpenSearchEngine *OpenSearchReader::read()
{
OpenSearchEngine *engine = new OpenSearchEngine();
- while (!isStartElement() && !atEnd())
+ while(!isStartElement() && !atEnd())
{
readNext();
}
- if (name() != QL1S("OpenSearchDescription")
+ if(name() != QL1S("OpenSearchDescription")
|| namespaceUri() != QL1S("http://a9.com/-/spec/opensearch/1.1/")
- )
+ )
{
raiseError(i18n("The file is not an OpenSearch 1.1 file."));
return engine;
}
- while (!(isEndElement() && name() == QL1S("OpenSearchDescription")) && !atEnd())
+ while(!(isEndElement() && name() == QL1S("OpenSearchDescription")) && !atEnd())
{
readNext();
- if (!isStartElement())
+ if(!isStartElement())
continue;
// ShortName
- if (name() == QL1S("ShortName"))
+ if(name() == QL1S("ShortName"))
{
engine->setName(readElementText());
continue;
}
// Description
- if (name() == QL1S("Description"))
+ if(name() == QL1S("Description"))
{
engine->setDescription(readElementText());
continue;
}
// Url
- if (name() == QL1S("Url"))
+ if(name() == QL1S("Url"))
{
QString type = attributes().value(QL1S("type")).toString();
QString url = attributes().value(QL1S("template")).toString();
- if (url.isEmpty())
+ if(url.isEmpty())
continue;
QList<OpenSearchEngine::Parameter> parameters;
readNext();
- while (!(isEndElement() && name() == QL1S("Url")))
+ while(!(isEndElement() && name() == QL1S("Url")))
{
- if (!isStartElement()
+ if(!isStartElement()
|| (name() != QL1S("Param")
&& name() != QL1S("Parameter")))
{
@@ -134,32 +134,32 @@ OpenSearchEngine *OpenSearchReader::read()
QString key = attributes().value(QL1S("name")).toString();
QString value = attributes().value(QL1S("value")).toString();
- if (!key.isEmpty() && !value.isEmpty())
+ if(!key.isEmpty() && !value.isEmpty())
{
parameters.append(OpenSearchEngine::Parameter(key, value));
}
- while (!isEndElement())
+ while(!isEndElement())
{
readNext();
}
}
- if (type == QL1S("text/html"))
+ if(type == QL1S("text/html"))
{
engine->setSearchUrlTemplate(url);
engine->setSearchParameters(parameters);
}
else
{
- if (engine->suggestionsUrlTemplate().isEmpty()
+ if(engine->suggestionsUrlTemplate().isEmpty()
&& type == QL1S("application/x-suggestions+json")) //note: xml is preferred
{
engine->setSuggestionsUrlTemplate(url);
engine->setSuggestionsParameters(parameters);
engine->setSuggestionParser(new JSONParser());
}
- else if (type == QL1S("application/x-suggestions+xml"))
+ else if(type == QL1S("application/x-suggestions+xml"))
{
engine->setSuggestionsUrlTemplate(url);
engine->setSuggestionsParameters(parameters);
@@ -171,19 +171,19 @@ OpenSearchEngine *OpenSearchReader::read()
}
// Image
- if (name() == QL1S("Image"))
+ if(name() == QL1S("Image"))
{
engine->setImageUrl(readElementText());
continue;
}
// Engine check
- if (!engine->name().isEmpty()
+ if(!engine->name().isEmpty()
&& !engine->description().isEmpty()
&& !engine->suggestionsUrlTemplate().isEmpty()
&& !engine->searchUrlTemplate().isEmpty()
&& !engine->imageUrl().isEmpty()
- )
+ )
{
break;
}