# HG changeset patch # User Dirk Olmes # Date 1299478092 -3600 # Node ID d372b3ee7bd8fed0d30d78774aef5f4a915d17b3 # Parent 4f87be5399ff3db495073473bff354dc19c95419 add marking the entire current selection as read diff -r 4f87be5399ff -r d372b3ee7bd8 MainWindow.py --- a/MainWindow.py Sat Mar 05 03:40:35 2011 +0100 +++ b/MainWindow.py Mon Mar 07 07:08:12 2011 +0100 @@ -127,6 +127,21 @@ self.session.commit() self.ui.feedEntryList.doItemsLayout() + def markSelectedEntriesRead(self): + selectedIndexes = self.ui.feedEntryList.selectedIndexes() + for index in selectedIndexes: + # selectedIndexes returns one QModelIndex instance per row/column combo. + # We are only interested in the rows here so just operate on the first + # 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.toggleRead() + self.session.commit() + self.ui.feedEntryList.doItemsLayout() + def addFeed(self): addFeed = AddFeed(self.session) success = addFeed.exec_() diff -r 4f87be5399ff -r d372b3ee7bd8 Ui_MainWindow.ui --- a/Ui_MainWindow.ui Sat Mar 05 03:40:35 2011 +0100 +++ b/Ui_MainWindow.ui Mon Mar 07 07:08:12 2011 +0100 @@ -79,6 +79,7 @@ Feed + @@ -220,6 +221,14 @@ Delete + + + true + + + Mark selected read + + @@ -424,6 +433,22 @@ + + actionMarkSelectedEntriesRead + activated() + MainWindow + markSelectedEntriesRead() + + + -1 + -1 + + + 495 + 374 + + + addFeed() @@ -437,5 +462,6 @@ markSelectedFeedRead() deleteFeed() feedEntryDoubleClicked() + markSelectedEntriesRead()