# HG changeset patch # User Dirk Olmes # Date 1314014682 -7200 # Node ID 089ee60b28fba4932b3421e5e38ae9bfd7120f6f # Parent 514e5d7dca981c8c5388ca1473b02e26a5f0f774 mark feed entries as read in the backend diff -r 514e5d7dca98 -r 089ee60b28fb MainWindow.py --- a/MainWindow.py Mon Aug 22 11:22:45 2011 +0200 +++ b/MainWindow.py Mon Aug 22 14:04:42 2011 +0200 @@ -125,6 +125,7 @@ self.ui.feedEntryList.doItemsLayout() def markSelectedEntriesRead(self): + entriesToBeMarked = [] selectedIndexes = self.ui.feedEntryList.selectedIndexes() for index in selectedIndexes: # selectedIndexes returns one QModelIndex instance per row/column combo. @@ -132,11 +133,9 @@ # column if index.column() == 0: row = index.row() - # use selectedEntry here to ensure it has a valid state after all - # selected entries are marked read - self.selectedEntry = self.feedEntries[row] - self.selectedEntry.markRead() - self.session.commit() + entriesToBeMarked.append(self.feedEntries[row]) + self.backend.markFeedEntriesAsRead(entriesToBeMarked) + self.selectedEntry = None self.ui.feedEntryList.doItemsLayout() def addFeed(self): diff -r 514e5d7dca98 -r 089ee60b28fb backend/sqlalchemy/SqlAlchemyBackend.py --- a/backend/sqlalchemy/SqlAlchemyBackend.py Mon Aug 22 11:22:45 2011 +0200 +++ b/backend/sqlalchemy/SqlAlchemyBackend.py Mon Aug 22 14:04:42 2011 +0200 @@ -56,6 +56,11 @@ self.session.delete(feed) self.session.commit() + def markFeedEntriesAsRead(self, entries): + for entry in entries: + entry.markRead() + self.session.commit() + def dispose(self): # save all uncommitted state, just in case self.session.commit()