comparison backend/couchdb/Preferences.py @ 194:2c91b5653878

enable/disable using the proxy via a preference setting
author dirk
date Fri, 07 Oct 2011 07:00:44 +0200
parents 214addba1f93
children bb3c851b18b1
comparison
equal deleted inserted replaced
193:c345a26febc2 194:2c91b5653878
5 HIDE_READ_FEED_ENTRIES = "hideReadFeedEntries" 5 HIDE_READ_FEED_ENTRIES = "hideReadFeedEntries"
6 PROXY_HOST = "proxyHost" 6 PROXY_HOST = "proxyHost"
7 PROXY_PORT = "proxyPort" 7 PROXY_PORT = "proxyPort"
8 SHOW_ONLY_UNREAD_FEEDS = "showOnlyUnreadFeeds" 8 SHOW_ONLY_UNREAD_FEEDS = "showOnlyUnreadFeeds"
9 START_MAXIMIZED = "startMaximized" 9 START_MAXIMIZED = "startMaximized"
10 USE_PROXY = "useProxy"
10 11
11 class Preferences(object): 12 class Preferences(object):
12 def __init__(self, database): 13 def __init__(self, database):
13 self.database = database 14 self.database = database
14 self._initDocument() 15 self._initDocument()
37 def isProxyConfigured(self): 38 def isProxyConfigured(self):
38 return self.proxyHost() is not None 39 return self.proxyHost() is not None
39 40
40 def proxyHost(self): 41 def proxyHost(self):
41 return self._documentValue(PROXY_HOST) 42 return self._documentValue(PROXY_HOST)
43
44 def useProxy(self):
45 return self._documentValue(USE_PROXY, True)
46
47 def setUseProxy(self, value):
48 self._setDocumentValue(USE_PROXY, value)
42 49
43 def setProxyHost(self, hostname): 50 def setProxyHost(self, hostname):
44 if hostname is None: 51 if hostname is None:
45 if PROXY_HOST in self.document.keys(): 52 if PROXY_HOST in self.document.keys():
46 del self.document[PROXY_HOST] 53 del self.document[PROXY_HOST]