Mercurial > hg > Feedworm
comparison MainWindow.py @ 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 | 8ec20377bcb0 |
comparison
equal
deleted
inserted
replaced
125:514e5d7dca98 | 126:089ee60b28fb |
---|---|
123 def markSelectedFeedRead(self): | 123 def markSelectedFeedRead(self): |
124 self.backend.markAllEntriesRead(self.selectedFeed) | 124 self.backend.markAllEntriesRead(self.selectedFeed) |
125 self.ui.feedEntryList.doItemsLayout() | 125 self.ui.feedEntryList.doItemsLayout() |
126 | 126 |
127 def markSelectedEntriesRead(self): | 127 def markSelectedEntriesRead(self): |
128 entriesToBeMarked = [] | |
128 selectedIndexes = self.ui.feedEntryList.selectedIndexes() | 129 selectedIndexes = self.ui.feedEntryList.selectedIndexes() |
129 for index in selectedIndexes: | 130 for index in selectedIndexes: |
130 # selectedIndexes returns one QModelIndex instance per row/column combo. | 131 # selectedIndexes returns one QModelIndex instance per row/column combo. |
131 # We are only interested in the rows here so just operate on the first | 132 # We are only interested in the rows here so just operate on the first |
132 # column | 133 # column |
133 if index.column() == 0: | 134 if index.column() == 0: |
134 row = index.row() | 135 row = index.row() |
135 # use selectedEntry here to ensure it has a valid state after all | 136 entriesToBeMarked.append(self.feedEntries[row]) |
136 # selected entries are marked read | 137 self.backend.markFeedEntriesAsRead(entriesToBeMarked) |
137 self.selectedEntry = self.feedEntries[row] | 138 self.selectedEntry = None |
138 self.selectedEntry.markRead() | |
139 self.session.commit() | |
140 self.ui.feedEntryList.doItemsLayout() | 139 self.ui.feedEntryList.doItemsLayout() |
141 | 140 |
142 def addFeed(self): | 141 def addFeed(self): |
143 addFeed = AddFeed(self.backend) | 142 addFeed = AddFeed(self.backend) |
144 success = addFeed.exec_() | 143 success = addFeed.exec_() |