Mercurial > hg > Feedworm
changeset 126:089ee60b28fb backend
mark feed entries as read in the backend
author | Dirk Olmes <dirk@xanthippe.ping.de> |
---|---|
date | Mon, 22 Aug 2011 14:04:42 +0200 |
parents | 514e5d7dca98 |
children | c923e4c57a81 |
files | MainWindow.py backend/sqlalchemy/SqlAlchemyBackend.py |
diffstat | 2 files changed, 9 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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):
--- 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()