X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=psa_harmattan%2Ffeedingit%2Fpysrc%2Ffeedingit.py;fp=psa_harmattan%2Ffeedingit%2Fpysrc%2Ffeedingit.py;h=6866f9b284fd427f48e76ea8c712a74c8d3a6a9c;hb=2e3d13f0400464104e011843428f48d3c03a9cab;hp=9d70a3c36c588cdb10c84818ef765988089d4e33;hpb=45f93ead6c7f91325997e78b8dd2629e98001427;p=feedingit diff --git a/psa_harmattan/feedingit/pysrc/feedingit.py b/psa_harmattan/feedingit/pysrc/feedingit.py index 9d70a3c..6866f9b 100644 --- a/psa_harmattan/feedingit/pysrc/feedingit.py +++ b/psa_harmattan/feedingit/pysrc/feedingit.py @@ -31,6 +31,7 @@ from cgi import escape from re import sub class Controller(QtCore.QObject): + cachedList = None def __init__(self, listing): QtCore.QObject.__init__(self) @@ -70,18 +71,30 @@ class Controller(QtCore.QObject): @QtCore.Slot(str,result=str) def getArticlesXml(self, key): + feed = listing.getFeed(key) + self.cachedList = feed.getIds(onlyUnread=True) #onlyUnread = arguments.get("onlyUnread","False") return self._handler.generateArticlesXml(key, config.getHideReadArticles()) - @QtCore.Slot(str,str,result=str) - def getNextId(self, key, articleid): - feed = listing.getFeed(key) - return feed.getNextId(articleid) + @QtCore.Slot(str,str,bool,result=str) + def getNextId(self, key, articleid, onlyUnread): + if (onlyUnread): + print self.cachedList, articleid + index = self.cachedList.index(articleid) + return self.cachedList[(index + 1) % len(self.cachedList)] + else: + feed = listing.getFeed(key) + return feed.getNextId(articleid) - @QtCore.Slot(str,str,result=str) - def getPreviousId(self, key, articleid): - feed = listing.getFeed(key) - return feed.getPreviousId(articleid) + @QtCore.Slot(str,str,bool,result=str) + def getPreviousId(self, key, articleid, onlyUnread): + if (onlyUnread): + print self.cachedList, articleid + index = self.cachedList.index(articleid) + return self.cachedList[(index - 1) % len(self.cachedList)] + else: + feed = listing.getFeed(key) + return feed.getPreviousId(articleid) @QtCore.Slot(result=str) def getCategoryXml(self):