summaryrefslogtreecommitdiff
path: root/src/opensearch/opensearchreader.cpp
diff options
context:
space:
mode:
authormegabigbug <megabigbug@yahoo.fr>2010-10-04 08:32:21 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-10-30 11:38:06 +0200
commit72af78494652e97cf2caaf05a4ac1613359400f6 (patch)
treea3968f159fd075a10c20ad2165ecef66b14b9eef /src/opensearch/opensearchreader.cpp
parentAdded CtestConfig.cmake (diff)
downloadrekonq-72af78494652e97cf2caaf05a4ac1613359400f6.tar.xz
add an xml parser to the opensearch engine.
Diffstat (limited to 'src/opensearch/opensearchreader.cpp')
-rw-r--r--src/opensearch/opensearchreader.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/opensearch/opensearchreader.cpp b/src/opensearch/opensearchreader.cpp
index 5b7ece2c..7da4113f 100644
--- a/src/opensearch/opensearchreader.cpp
+++ b/src/opensearch/opensearchreader.cpp
@@ -32,6 +32,7 @@
// Local Includes
#include "opensearchengine.h"
+#include "suggestionparser.h"
// Qt Includes
#include <QtCore/QIODevice>
@@ -137,16 +138,25 @@ OpenSearchEngine *OpenSearchReader::read()
}
}
- if (type == QL1S("application/x-suggestions+json"))
- {
- engine->setSuggestionsUrlTemplate(url);
- engine->setSuggestionsParameters(parameters);
- }
- else
+ if (type == QLatin1String("text/html"))
{
engine->setSearchUrlTemplate(url);
engine->setSearchParameters(parameters);
}
+ else
+ {
+ engine->setSuggestionsUrlTemplate(url);
+ engine->setSuggestionsParameters(parameters);
+
+ if (type == QL1S("application/x-suggestions+xml"))
+ {
+ engine->setSuggestionParser(new XMLParser());
+ }
+ else if (type == QL1S("application/x-suggestions+json"))
+ {
+ engine->setSuggestionParser(new JSONParser());
+ }
+ }
continue;
}