summaryrefslogtreecommitdiff
path: root/src/opensearch/opensearchreader.cpp
diff options
context:
space:
mode:
authormegabigbug <megabigbug@yahoo.fr>2010-10-17 16:23:39 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-10-30 11:43:22 +0200
commitee71d4a5cef8544bff1c57cc7b81870982d55c93 (patch)
tree286f4d0701fa1af6c2c3fd2e71ae9120197cd39e /src/opensearch/opensearchreader.cpp
parentremove warnings (diff)
downloadrekonq-ee71d4a5cef8544bff1c57cc7b81870982d55c93.tar.xz
adapt opensearch reader and writer for xml suggestions
Diffstat (limited to 'src/opensearch/opensearchreader.cpp')
-rw-r--r--src/opensearch/opensearchreader.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/opensearch/opensearchreader.cpp b/src/opensearch/opensearchreader.cpp
index 7da4113f..ebca7877 100644
--- a/src/opensearch/opensearchreader.cpp
+++ b/src/opensearch/opensearchreader.cpp
@@ -145,16 +145,17 @@ OpenSearchEngine *OpenSearchReader::read()
}
else
{
- engine->setSuggestionsUrlTemplate(url);
- engine->setSuggestionsParameters(parameters);
-
- if (type == QL1S("application/x-suggestions+xml"))
+ if (engine->suggestionsUrlTemplate().isEmpty() && type == QL1S("application/x-suggestions+json")) //note: xml is prefered
{
- engine->setSuggestionParser(new XMLParser());
+ engine->setSuggestionsUrlTemplate(url);
+ engine->setSuggestionsParameters(parameters);
+ engine->setSuggestionParser(new JSONParser());
}
- else if (type == QL1S("application/x-suggestions+json"))
+ else if (type == QL1S("application/x-suggestions+xml"))
{
- engine->setSuggestionParser(new JSONParser());
+ engine->setSuggestionsUrlTemplate(url);
+ engine->setSuggestionsParameters(parameters);
+ engine->setSuggestionParser(new XMLParser());
}
}