WebBrowser/FlashCookieManager/FlashCookieManager.py

branch
QtWebEngine
changeset 4752
a3bcc42a82a9
parent 4751
f745a556fd6f
child 4913
e16573640cb8
equal deleted inserted replaced
4751:f745a556fd6f 4752:a3bcc42a82a9
52 self.__timer.timeout.connect(self.__autoRefresh) 52 self.__timer.timeout.connect(self.__autoRefresh)
53 53
54 # start the timer if needed 54 # start the timer if needed
55 self.__startStopTimer() 55 self.__startStopTimer()
56 56
57 if Preferences.getHelp("FlashCookiesDeleteOnStartExit"): 57 if Preferences.getWebBrowser("FlashCookiesDeleteOnStartExit"):
58 self.__loadFlashCookies() 58 self.__loadFlashCookies()
59 self.__removeAllButWhitelisted() 59 self.__removeAllButWhitelisted()
60 60
61 def shutdown(self): 61 def shutdown(self):
62 """ 62 """
63 Public method to perform shutdown actions. 63 Public method to perform shutdown actions.
64 """ 64 """
65 if self.__flashCookieManagerDialog is not None: 65 if self.__flashCookieManagerDialog is not None:
66 self.__flashCookieManagerDialog.close() 66 self.__flashCookieManagerDialog.close()
67 67
68 if Preferences.getHelp("FlashCookiesDeleteOnStartExit"): 68 if Preferences.getWebBrowser("FlashCookiesDeleteOnStartExit"):
69 self.__removeAllButWhitelisted() 69 self.__removeAllButWhitelisted()
70 70
71 def setFlashCookies(self, cookies): 71 def setFlashCookies(self, cookies):
72 """ 72 """
73 Public method to set the list of cached Flash cookies. 73 Public method to set the list of cached Flash cookies.
117 @param cookie Flash cookie to be tested 117 @param cookie Flash cookie to be tested
118 @type FlashCookie 118 @type FlashCookie
119 @return flag indicating a blacklisted cookie 119 @return flag indicating a blacklisted cookie
120 @rtype bool 120 @rtype bool
121 """ 121 """
122 return cookie.origin in Preferences.getHelp("FlashCookiesBlacklist") 122 return cookie.origin in \
123 Preferences.getWebBrowser("FlashCookiesBlacklist")
123 124
124 def __isWhitelisted(self, cookie): 125 def __isWhitelisted(self, cookie):
125 """ 126 """
126 Private method to check for a whitelisted cookie. 127 Private method to check for a whitelisted cookie.
127 128
128 @param cookie Flash cookie to be tested 129 @param cookie Flash cookie to be tested
129 @type FlashCookie 130 @type FlashCookie
130 @return flag indicating a whitelisted cookie 131 @return flag indicating a whitelisted cookie
131 @rtype bool 132 @rtype bool
132 """ 133 """
133 return cookie.origin in Preferences.getHelp("FlashCookiesWhitelist") 134 return cookie.origin in \
135 Preferences.getWebBrowser("FlashCookiesWhitelist")
134 136
135 def __removeAllButWhitelisted(self): 137 def __removeAllButWhitelisted(self):
136 """ 138 """
137 Private method to remove all non-whitelisted cookies. 139 Private method to remove all non-whitelisted cookies.
138 """ 140 """
167 Public method to get the Flash Player data path. 169 Public method to get the Flash Player data path.
168 170
169 @return Flash Player data path 171 @return Flash Player data path
170 @rtype str 172 @rtype str
171 """ 173 """
172 return Preferences.getHelp("FlashCookiesDataPath") 174 return Preferences.getWebBrowser("FlashCookiesDataPath")
173 175
174 def preferencesChanged(self): 176 def preferencesChanged(self):
175 """ 177 """
176 Public slot to handle a change of preferences. 178 Public slot to handle a change of preferences.
177 """ 179 """
216 break 218 break
217 219
218 if newCookie: 220 if newCookie:
219 newCookieList.append(cookie.path + "/" + cookie.name) 221 newCookieList.append(cookie.path + "/" + cookie.name)
220 222
221 if newCookieList and Preferences.getHelp("FlashCookieNotify"): 223 if newCookieList and Preferences.getWebBrowser("FlashCookieNotify"):
222 self.__newCookiesList.extend(newCookieList) 224 self.__newCookiesList.extend(newCookieList)
223 win = WebBrowser.WebBrowserWindow.WebBrowserWindow.mainWindow() 225 win = WebBrowser.WebBrowserWindow.WebBrowserWindow.mainWindow()
224 if win is None: 226 if win is None:
225 return 227 return
226 228
248 250
249 def __startStopTimer(self): 251 def __startStopTimer(self):
250 """ 252 """
251 Private slot to start or stop the auto refresh timer. 253 Private slot to start or stop the auto refresh timer.
252 """ 254 """
253 if Preferences.getHelp("FlashCookieAutoRefresh"): 255 if Preferences.getWebBrowser("FlashCookieAutoRefresh"):
254 if not self.__timer.isActive(): 256 if not self.__timer.isActive():
255 if not bool(self.__flashCookies): 257 if not bool(self.__flashCookies):
256 self.__loadFlashCookies() 258 self.__loadFlashCookies()
257 259
258 self.__timer.start() 260 self.__timer.start()

eric ide

mercurial