comparison PreferencesDialog.py @ 158:e8bb107a74e1

all preferences are stored in a single JSON document in the couchdb backend. PreferencesDialog converts QString to a proper Python datatybe before sending it to the backend.
author dirk
date Mon, 29 Aug 2011 02:33:51 +0200
parents e830fa1cc7a2
children 2c91b5653878
comparison
equal deleted inserted replaced
157:7dd9ae9556fd 158:e8bb107a74e1
31 self.ui.showOnlyUnreadFeeds.setChecked(showOnlyUnreadFeeds) 31 self.ui.showOnlyUnreadFeeds.setChecked(showOnlyUnreadFeeds)
32 32
33 def fillProxySettings(self): 33 def fillProxySettings(self):
34 if self.preferences.isProxyConfigured(): 34 if self.preferences.isProxyConfigured():
35 self.ui.proxyHost.setText(self.preferences.proxyHost()) 35 self.ui.proxyHost.setText(self.preferences.proxyHost())
36 self.ui.proxyPort.setText(str(self.preferences.proxyPort())) 36 port = self.preferences.proxyPort()
37 if port is not None:
38 self.ui.proxyPort.setText(str(port))
37 39
38 def fillDaysToKeepFeedEntries(self): 40 def fillDaysToKeepFeedEntries(self):
39 days = self.preferences.daysToKeepFeedEntries() 41 days = self.preferences.daysToKeepFeedEntries()
40 self.ui.daysToKeepFeedEntries.setText(str(days)) 42 self.ui.daysToKeepFeedEntries.setText(str(days))
41 43
58 self.preferences.setShowOnlyUnreadFeeds(False) 60 self.preferences.setShowOnlyUnreadFeeds(False)
59 61
60 def storeProxySettings(self): 62 def storeProxySettings(self):
61 proxyHost = self.ui.proxyHost.text() 63 proxyHost = self.ui.proxyHost.text()
62 if proxyHost.isEmpty(): 64 if proxyHost.isEmpty():
63 proxyHost = None 65 self.preferences.setProxyHost(None)
64 self.preferences.setProxyHost(proxyHost) 66 else:
67 self.preferences.setProxyHost(str(proxyHost))
65 68
66 proxyPort = self.ui.proxyPort.text() 69 proxyPort = self.ui.proxyPort.text()
67 if proxyPort.isEmpty(): 70 if proxyPort.isEmpty():
68 proxyPort = None 71 self.preferences.setProxyPort(None)
69 self.preferences.setProxyPort(proxyPort) 72 else:
73 self.preferences.setProxyPort(int(proxyPort))
70 74
71 def daysToKeepFeedEntriesFinishedEditing(self): 75 def daysToKeepFeedEntriesFinishedEditing(self):
72 text = self.ui.daysToKeepFeedEntries.text() 76 text = self.ui.daysToKeepFeedEntries.text()
73 if not text.isEmpty(): 77 if not text.isEmpty():
74 text = str(text) 78 text = str(text)