diff MainWindow.py @ 151:bca9341dc67f

move the selected feed into the backend - sqlalchemy backend works, couchdb backend currently broken
author Dirk Olmes <dirk@xanthippe.ping.de>
date Sat, 27 Aug 2011 07:07:50 +0200
parents babe14449162
children a1c0459e1eeb
line wrap: on
line diff
--- a/MainWindow.py	Sat Aug 27 06:43:28 2011 +0200
+++ b/MainWindow.py	Sat Aug 27 07:07:50 2011 +0200
@@ -25,8 +25,8 @@
         self.initFeedEntryList()
 
     def updateFeedList(self):
-        self.allFeeds = self.backend.getFeeds()
-        feedModel = DisplayModel(self, self.allFeeds, "title")
+        allFeeds = self.backend.getFeeds()
+        feedModel = DisplayModel(self, allFeeds, "title")
         self.ui.feedList.setModel(feedModel)
         self.ui.feedList.update()
 
@@ -39,7 +39,7 @@
         self.ui.feedEntryList.horizontalHeader().setStretchLastSection(True)
 
     def feedSelected(self, index):
-        self.selectedFeed = self.allFeeds[index.row()]
+        self.backend.selectFeed(index.row())
         self.enableFeedRelatedWidgets()
         self.setupFeedEntries()
 
@@ -49,8 +49,9 @@
         self.ui.actionDeleteFeed.setEnabled(True)
 
     def setupFeedEntries(self):
+        # TODO move the access to preferences into the backend
         hideReadEntries = self.preferences.hideReadFeedEntries()
-        self.feedEntries = self.backend.entriesForFeed(self.selectedFeed, hideReadEntries)
+        self.feedEntries = self.backend.entriesForSelectedFeed(hideReadEntries)
         self.initFeedDisplayModel()
 
     def initFeedDisplayModel(self):
@@ -120,7 +121,7 @@
         self.ui.feedEntryList.doItemsLayout()
 
     def markSelectedFeedRead(self):
-        self.backend.markAllEntriesRead(self.selectedFeed)
+        self.backend.markSelectedFeedAsRead()
         self.ui.feedEntryList.doItemsLayout()
 
     def markSelectedEntriesRead(self):
@@ -151,7 +152,7 @@
 
     def deleteFeed(self):
         try:
-            self.backend.deleteFeed(self.selectedFeed)
+            self.backend.deleteSelectedFeed()
             self.updateFeedList()
         except Exception as exception:
             message = "Error while deleting feed: " + str(exception)
@@ -162,7 +163,7 @@
         preferences.exec_()
 
     def showFeedSettings(self):
-        feedSettings = FeedSettings(self.selectedFeed, self.backend)
+        feedSettings = FeedSettings(self.backend)
         feedSettings.exec_()
 
     def _updateStatusBar(self, message):