summaryrefslogtreecommitdiff
path: root/src/opensearch
diff options
context:
space:
mode:
authorLionel Chauvin <megabigbug@yahoo.fr>2010-10-09 17:56:56 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-10-30 11:38:06 +0200
commitad9792b051c393e344cbf5ac833dc69f50cfea1c (patch)
tree7f0fb1a95eeec46a3e18f8ef0648dc315f652862 /src/opensearch
parentadd an xml parser to the opensearch engine. (diff)
downloadrekonq-ad9792b051c393e344cbf5ac833dc69f50cfea1c.tar.xz
add image field to opensearch
Diffstat (limited to 'src/opensearch')
-rw-r--r--src/opensearch/suggestionparser.cpp10
-rw-r--r--src/opensearch/suggestionparser.h7
2 files changed, 12 insertions, 5 deletions
diff --git a/src/opensearch/suggestionparser.cpp b/src/opensearch/suggestionparser.cpp
index 56cd2c8e..01581bf9 100644
--- a/src/opensearch/suggestionparser.cpp
+++ b/src/opensearch/suggestionparser.cpp
@@ -36,7 +36,7 @@
#include<QByteArray>
#include<QStringList>
-ResponseList SuggestionParser::parse(const QByteArray &resp)
+ResponseList SuggestionParser::parse(const QByteArray &)
{
return ResponseList();
}
@@ -70,6 +70,7 @@ ResponseList XMLParser::parse(const QByteArray &resp)
{
QString title;
QString url;
+ QString image;
QString description;
while (!m_reader.isEndElement() && !m_reader.atEnd())
@@ -77,11 +78,12 @@ ResponseList XMLParser::parse(const QByteArray &resp)
m_reader.readNext();
if (m_reader.name() == QL1S("Text")) title = m_reader.readElementText();
- if (m_reader.name() == QL1S("Url")) url = m_reader.readElementText();
+ if (m_reader.name() == QL1S("Url")) url = m_reader.readElementText();
+ if (m_reader.name() == QL1S("Image")) image = m_reader.readElementText();
if (m_reader.name() == QL1S("Description")) description = m_reader.readElementText();
}
- rlist << Response(url, title, description);
+ rlist << Response(url, title, image, description);
}
}
@@ -129,4 +131,4 @@ ResponseList JSONParser::parse(const QByteArray &resp)
}
return rlist;
-} \ No newline at end of file
+}
diff --git a/src/opensearch/suggestionparser.h b/src/opensearch/suggestionparser.h
index 7de54654..e59a092c 100644
--- a/src/opensearch/suggestionparser.h
+++ b/src/opensearch/suggestionparser.h
@@ -43,22 +43,27 @@ class Response
public:
QString url;
QString title;
+ QString image;
QString description;
Response(const Response &item) : url(item.url),
title(item.title),
+ image(item.image),
description(item.description)
{};
Response() : url(QString()),
title(QString()),
+ image(QString()),
description(QString())
{};
Response(const QString &_url,
const QString &_title = QString(),
+ const QString &_image = QString(),
const QString &description = QString()) : url(_url),
title(_title),
+ image(_image),
description(description)
{};
};
@@ -92,4 +97,4 @@ public:
ResponseList parse(const QByteArray &resp);
};
-#endif //SUGGESTIONPARSER_H \ No newline at end of file
+#endif //SUGGESTIONPARSER_H