changeset 103:063581d8594e

implement deleting a feed from the GUI
author Dirk Olmes <dirk@xanthippe.ping.de>
date Wed, 16 Feb 2011 06:57:06 +0100
parents 25fef7c29c5b
children 4f87be5399ff
files MainWindow.py Ui_MainWindow.ui
diffstat 2 files changed, 36 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MainWindow.py	Wed Feb 16 06:18:40 2011 +0100
+++ b/MainWindow.py	Wed Feb 16 06:57:06 2011 +0100
@@ -48,6 +48,7 @@
     def enableFeedRelatedWidgets(self):
         self.ui.actionFeedSettings.setEnabled(True)
         self.ui.actionMarkFeedRead.setEnabled(True)
+        self.ui.actionDeleteFeed.setEnabled(True)
 
     def setupFeedEntries(self):
         hideReadEntries = self.preferences.hideReadFeedEntries()
@@ -135,6 +136,15 @@
             self.session.commit()
             self.updateFeedList()
 
+    def deleteFeed(self):
+        try:
+            self.session.delete(self.selectedFeed)
+            self.session.commit()
+            self.updateFeedList()
+        except Exception as exception:
+            message = "Error while deleting feed: " + str(exception)
+            self._updateStatusBar(message)
+
     def showPreferences(self):
         preferences = PreferencesDialog(self.session)
         preferences.exec_()
--- a/Ui_MainWindow.ui	Wed Feb 16 06:18:40 2011 +0100
+++ b/Ui_MainWindow.ui	Wed Feb 16 06:57:06 2011 +0100
@@ -81,6 +81,7 @@
     <addaction name="actionAddFeed"/>
     <addaction name="actionMarkFeedRead"/>
     <addaction name="actionUpdate"/>
+    <addaction name="actionDeleteFeed"/>
     <addaction name="actionFeedSettings"/>
    </widget>
    <widget class="QMenu" name="menuArticle">
@@ -211,6 +212,14 @@
     <string>Ctrl+Shift+U</string>
    </property>
   </action>
+  <action name="actionDeleteFeed">
+   <property name="enabled">
+    <bool>false</bool>
+   </property>
+   <property name="text">
+    <string>Delete</string>
+   </property>
+  </action>
  </widget>
  <customwidgets>
   <customwidget>
@@ -383,6 +392,22 @@
     </hint>
    </hints>
   </connection>
+  <connection>
+   <sender>actionDeleteFeed</sender>
+   <signal>activated()</signal>
+   <receiver>MainWindow</receiver>
+   <slot>deleteFeed()</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>
@@ -394,5 +419,6 @@
   <slot>showPreferences()</slot>
   <slot>showFeedSettings()</slot>
   <slot>markSelectedFeedRead()</slot>
+  <slot>deleteFeed()</slot>
  </slots>
 </ui>