summaryrefslogtreecommitdiff
path: root/src/opensearch/suggestionparser.cpp
diff options
context:
space:
mode:
authorLionel Chauvin <megabigbug@yahoo.fr>2010-10-10 19:59:11 +0200
committerAndrea Diamantini <adjam7@gmail.com>2010-10-30 11:43:03 +0200
commitd3718562fa556d67f715f542034a5870eccb8c3f (patch)
tree6f6328208e1f866ff96d4f174b08d63bbc7eff32 /src/opensearch/suggestionparser.cpp
parentImages in visual suggestion are now displayed !! (diff)
downloadrekonq-d3718562fa556d67f715f542034a5870eccb8c3f.tar.xz
improve layout of visual suggestions
Diffstat (limited to 'src/opensearch/suggestionparser.cpp')
-rw-r--r--src/opensearch/suggestionparser.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/opensearch/suggestionparser.cpp b/src/opensearch/suggestionparser.cpp
index 02f99644..8f0e7ba2 100644
--- a/src/opensearch/suggestionparser.cpp
+++ b/src/opensearch/suggestionparser.cpp
@@ -63,9 +63,11 @@ ResponseList XMLParser::parse(const QByteArray &resp)
if (m_reader.isStartElement() && m_reader.name() == QL1S("Item"))
{
QString title;
+ QString description;
QString url;
QString image;
- QString description;
+ int image_width=0;
+ int image_height=0;
m_reader.readNext();
@@ -75,13 +77,18 @@ ResponseList XMLParser::parse(const QByteArray &resp)
{
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("Image")) image = m_reader.attributes().value("source").toString();
+ if (m_reader.name() == QL1S("Image"))
+ {
+ image = m_reader.attributes().value("source").toString();
+ image_width = m_reader.attributes().value("width").toString().toInt();
+ image_height = m_reader.attributes().value("height").toString().toInt();
+ }
if (m_reader.name() == QL1S("Description")) description = m_reader.readElementText();
}
m_reader.readNext();
}
- rlist << Response(url, title, image, description);
+ rlist << Response(title, description, url, image, image_width, image_height);
}
m_reader.readNext();
@@ -127,7 +134,7 @@ ResponseList JSONParser::parse(const QByteArray &resp)
foreach(QString s, responsePartsList)
{
- rlist << Response(QString(), s, QString());
+ rlist << Response(s);
}
return rlist;