from re import sub
class Controller(QtCore.QObject):
+ cachedList = None
def __init__(self, listing):
QtCore.QObject.__init__(self)
@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):
elif (setting == "fontSize" ):
config.setFontSize(value)
config.saveConfig()
+
+ @QtCore.Slot(str, str)
+ def openSettings(self):
+ bus = dbus.SessionBus()
+ settingService = bus.get_object('com.nokia.DuiControlPanel', '/')
+ setting = shareService.get_dbus_method('appletPage', 'com.nokia.DuiControlPanelIf')
+ setting("feedingitsync")
@QtCore.Slot(str, str)
def share(self, key, articleid):