psa: added onlyUnread parameter for getNext/PreviousID
authorYves Marcoz <yves@marcoz.org>
Tue, 10 Jan 2012 05:17:15 +0000 (21:17 -0800)
committerYves Marcoz <yves@marcoz.org>
Tue, 10 Jan 2012 05:17:15 +0000 (21:17 -0800)
psa_harmattan/feedingit/pysrc/rss_sqlite.py

index 867e1af..ff0fcba 100644 (file)
@@ -814,17 +814,17 @@ class Feed(BaseObject):
         #ids.reverse()
         return ids
     
-    def getNextId(self, id, forward=True):
+    def getNextId(self, id, forward=True, onlyUnread=False):
         if forward:
             delta = 1
         else:
             delta = -1
-        ids = self.getIds()
+        ids = self.getIds(onlyUnread=onlyUnread)
         index = ids.index(id)
         return ids[(index + delta) % len(ids)]
         
-    def getPreviousId(self, id):
-        return self.getNextId(id, forward=False)
+    def getPreviousId(self, id, onlyUnread=False):
+        return self.getNextId(id, forward=False, onlyUnread=onlyUnread)
     
     def getNumberOfUnreadItems(self):
         return self.db.execute("SELECT count(*) FROM feed WHERE read=0;").fetchone()[0]