Fixed a few bugs introduced by switching to json.
authorJan Dumon <j.dumon@option.com>
Wed, 17 Mar 2010 20:30:17 +0000 (21:30 +0100)
committerJan Dumon <j.dumon@option.com>
Wed, 17 Mar 2010 20:30:17 +0000 (21:30 +0100)
src/googlereader.cpp

index 9949977..e9dfc19 100644 (file)
@@ -55,7 +55,6 @@ void Feed::fetchFinished() {
        QJson::Parser parser;
        bool ok;
        QVariantMap result = parser.parse(reply->readAll(), &ok).toMap();
-       QString continuation;
 
        continuation = result["continuation"].toString();
        updated = result["updated"].toUInt();
@@ -69,7 +68,11 @@ void Feed::fetchFinished() {
                entry->published = QDateTime::fromTime_t(e["published"].toUInt());
                entry->author = e["author"].toString();
                entry->source = (e["origin"].toMap())["streamId"].toString();
-               entry->link = (e["alternate"].toMap())["href"].toString();
+               foreach(QVariant a, e["alternate"].toList()) {
+                       QVariantMap alt = a.toMap();
+                       if(alt["type"].toString() == "text/html")
+                               entry->link = alt["href"].toString();
+               }
 
                content = (e["content"].toMap())["content"].toString();
                summary = (e["summary"].toMap())["content"].toString();