diff MainWindow.py @ 105:d372b3ee7bd8

add marking the entire current selection as read
author Dirk Olmes <dirk@xanthippe.ping.de>
date Mon, 07 Mar 2011 07:08:12 +0100
parents 4f87be5399ff
children 863599e84269
line wrap: on
line diff
--- 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_()