void Feed::fetch(bool cont) {
QNetworkRequest request;
- //QByteArray ba = "http://www.google.com/reader/atom/";
QByteArray ba = "http://www.google.com/reader/api/0/stream/contents/";
ba.append(QUrl::toPercentEncoding(id));
QUrl url = QUrl::fromEncoded(ba);
if(continuation != "" && cont)
url.addEncodedQueryItem("c", continuation.toUtf8());
+ if(!cont && updated) {
+ /* Add 1 to the timestamp, otherwise we get the latest item
+ * again. Also the order has to be reversed for this to work. */
+ url.addEncodedQueryItem("ot", QByteArray::number(updated + 1));
+ url.addEncodedQueryItem("r", "o");
+ }
+
request.setUrl(url);
reply = reader->getManager()->get(request);
connect(reply, SIGNAL(finished()), SLOT(fetchFinished()));
QString continuation;
continuation = result["continuation"].toString();
+ updated = result["updated"].toUInt();
foreach(QVariant l, result["items"].toList()) {
QVariantMap e = l.toMap();
if(f) {
f->unread = count;
f->newestitem = newestitem;
+
+ /* Not a good idea if it doesn't happen sequentially. */
+ /* Pre-fetch feeds with unread items */
+ /* f->fetch(false); */
}
}