changeset 56:c82f5538733c

add a menu item to mark all entries in a feed as read
author Dirk Olmes <dirk@xanthippe.ping.de>
date Fri, 23 Jul 2010 04:06:10 +0200
parents 0f9b3e57cff0
children 254d5b89a6ca
files Feed.py MainWindow.py Ui_MainWindow.ui
diffstat 3 files changed, 69 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Feed.py	Tue May 18 03:17:06 2010 +0200
+++ b/Feed.py	Fri Jul 23 04:06:10 2010 +0200
@@ -29,3 +29,7 @@
     def incrementNextUpdateDate(self):
         delta = timedelta(minutes=self.update_interval)
         self.next_update = datetime.now() + delta
+
+    def toggleRead(self):
+        for entry in self.entries:
+            entry.toggleRead()
\ No newline at end of file
--- a/MainWindow.py	Tue May 18 03:17:06 2010 +0200
+++ b/MainWindow.py	Fri Jul 23 04:06:10 2010 +0200
@@ -35,6 +35,7 @@
         self.selectedFeed = self.allFeeds[index.row()]
 
         self.ui.actionFeedSettings.setEnabled(True)
+        self.ui.actionMarkFeedRead.setEnabled(True)
         
         self.sortedEntries = self.selectedFeed.entriesSortedByUpdateDate()
         model = DisplayModel(self, self.sortedEntries, FeedEntry.userPresentableString)
@@ -67,6 +68,11 @@
         self.selectedEntry.toggleRead()
         self.session.commit()
         self.ui.feedList.update()
+        
+    def toggleReadOnSelectedFeed(self):
+        self.selectedFeed.toggleRead()
+        self.session.commit()
+        self.ui.feedEntryList.update()
     
     def addFeed(self):
         addFeed = AddFeed(self.session)
--- a/Ui_MainWindow.ui	Tue May 18 03:17:06 2010 +0200
+++ b/Ui_MainWindow.ui	Fri Jul 23 04:06:10 2010 +0200
@@ -63,6 +63,8 @@
      <string>Feed</string>
     </property>
     <addaction name="actionAddFeed"/>
+    <addaction name="actionMarkFeedRead"/>
+    <addaction name="actionUpdate"/>
     <addaction name="actionFeedSettings"/>
    </widget>
    <widget class="QMenu" name="menuArticle">
@@ -80,6 +82,7 @@
     <property name="title">
      <string>Feedworm</string>
     </property>
+    <addaction name="actionUpdateAllFeeds"/>
     <addaction name="actionPreferences"/>
     <addaction name="separator"/>
     <addaction name="actionQuit"/>
@@ -153,6 +156,45 @@
     <string>Settings ...</string>
    </property>
   </action>
+  <action name="actionMarkFeedRead">
+   <property name="enabled">
+    <bool>false</bool>
+   </property>
+   <property name="text">
+    <string>Mark all read</string>
+   </property>
+   <property name="toolTip">
+    <string>Mark all articles in current feed as read</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+M</string>
+   </property>
+  </action>
+  <action name="actionUpdate">
+   <property name="enabled">
+    <bool>false</bool>
+   </property>
+   <property name="text">
+    <string>Update</string>
+   </property>
+   <property name="toolTip">
+    <string>Update selected feed</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+U</string>
+   </property>
+  </action>
+  <action name="actionUpdateAllFeeds">
+   <property name="enabled">
+    <bool>false</bool>
+   </property>
+   <property name="text">
+    <string>Update feeds</string>
+   </property>
+   <property name="shortcut">
+    <string>Ctrl+Shift+U</string>
+   </property>
+  </action>
  </widget>
  <customwidgets>
   <customwidget>
@@ -309,6 +351,22 @@
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>actionMarkFeedRead</sender>
+   <signal>activated()</signal>
+   <receiver>MainWindow</receiver>
+   <slot>toggleReadOnSelectedFeed()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>-1</x>
+     <y>-1</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>495</x>
+     <y>374</y>
+    </hint>
+   </hints>
+  </connection>
  </connections>
  <slots>
   <slot>addFeed()</slot>
@@ -319,5 +377,6 @@
   <slot>openLinkFromSelectedEntry()</slot>
   <slot>showPreferences()</slot>
   <slot>showFeedSettings()</slot>
+  <slot>toggleReadOnSelectedFeed()</slot>
  </slots>
 </ui>