diff PreferencesDialog.py @ 111:c17a224bc251

make the keep interval for feeds configurable via the GUI. Fix saving the proxy settings
author Dirk Olmes <dirk@xanthippe.ping.de>
date Thu, 31 Mar 2011 03:15:39 +0200
parents 48d1d7bba548
children e830fa1cc7a2
line wrap: on
line diff
--- a/PreferencesDialog.py	Wed Mar 30 02:59:22 2011 +0200
+++ b/PreferencesDialog.py	Thu Mar 31 03:15:39 2011 +0200
@@ -13,22 +13,33 @@
         self.fillUi()
 
     def fillUi(self):
+        self.fillMaximized()
+        self.fillHideReadFeedEntries()
+        self.fillShowOnlyUnreadFeeds()
+        self.fillProxySettings()
+        self.fillDaysToKeepFeedEntries()
+
+    def fillMaximized(self):
         maximized = self.preferences.startMaximized()
         self.ui.startMaximized.setChecked(maximized)
 
+    def fillHideReadFeedEntries(self):
         hideRead = self.preferences.hideReadFeedEntries()
         self.ui.hideReadFeedEntries.setChecked(hideRead)
 
+    def fillShowOnlyUnreadFeeds(self):
         showOnlyUnreadFeeds = self.preferences.showOnlyUnreadFeeds()
         self.ui.showOnlyUnreadFeeds.setChecked(showOnlyUnreadFeeds)
 
-        self.fillProxySettings()
-
     def fillProxySettings(self):
         if self.preferences.isProxyConfigured():
             self.ui.proxyHost.setText(self.preferences.proxyHost())
             self.ui.proxyPort.setText(str(self.preferences.proxyPort()))
 
+    def fillDaysToKeepFeedEntries(self):
+        days = self.preferences.daysToKeepFeedEntries()
+        self.ui.daysToKeepFeedEntries.setText(str(days))
+
     def startMaximizedChanged(self, change):
         if change:
             self.preferences.setStartMaximized(True)
@@ -48,12 +59,22 @@
             self.preferences.setShowOnlyUnreadFeeds(False)
 
     def storeProxySettings(self):
-        proxyHost = str(self.ui.proxyHost.text())
+        proxyHost = self.ui.proxyHost.text()
+        if proxyHost.isEmpty():
+            proxyHost = None
         self.preferences.setProxyHost(proxyHost)
 
-        proxyPort = int(self.ui.proxyPort.text())
+        proxyPort = self.ui.proxyPort.text()
+        if proxyPort.isEmpty():
+            proxyPort = None
         self.preferences.setProxyPort(proxyPort)
 
+    def daysToKeepFeedEntriesFinishedEditing(self):
+        text = self.ui.daysToKeepFeedEntries.text()
+        if not text.isEmpty():
+            text = str(text)
+            self.preferences.setDaysToKeepFeedEntries(text)
+
     def accept(self):
         self.storeProxySettings()
         self.session.commit()