--- a/WebBrowser/SafeBrowsing/SafeBrowsingDialog.py Tue Apr 10 19:43:45 2018 +0200 +++ b/WebBrowser/SafeBrowsing/SafeBrowsingDialog.py Wed Apr 11 19:57:23 2018 +0200 @@ -53,6 +53,8 @@ "SafeBrowsingFilterPlatform") self.__automaticUpdate = Preferences.getWebBrowser( "SafeBrowsingAutoUpdate") + self.__useLookupApi = Preferences.getWebBrowser( + "SafeBrowsingUseLookupApi") self.buttonBox.setFocus() @@ -66,11 +68,9 @@ self.gsbGroupBox.setChecked(self.__enabled) self.gsbApiKeyEdit.setText(self.__apiKey) self.gsbFilterPlatformCheckBox.setChecked(self.__filterPlatform) - # TODO: add text to label to indicate Update API only self.gsbAutoUpdateCheckBox.setChecked(self.__automaticUpdate) - # TODO: add checkbox to enable the Lookup API + self.gsbLookupCheckBox.setChecked(self.__useLookupApi) - # TODO: enable the cache buttons group box only on Update API self.__updateCacheButtons() super(SafeBrowsingDialog, self).show() @@ -114,6 +114,7 @@ self.__apiKey = self.gsbApiKeyEdit.text() self.__filterPlatform = self.gsbFilterPlatformCheckBox.isChecked() self.__automaticUpdate = self.gsbAutoUpdateCheckBox.isChecked() + self.__useLookupApi = self.gsbLookupCheckBox.isChecked() Preferences.setWebBrowser("SafeBrowsingEnabled", self.__enabled) Preferences.setWebBrowser("SafeBrowsingApiKey", self.__apiKey) @@ -121,6 +122,8 @@ self.__filterPlatform) Preferences.setWebBrowser("SafeBrowsingAutoUpdate", self.__automaticUpdate) + Preferences.setWebBrowser("SafeBrowsingUseLookupApi", + self.__useLookupApi) self.__manager.configurationChanged() @@ -152,7 +155,9 @@ (self.__apiKey != self.gsbApiKeyEdit.text()) or (self.__filterPlatform != self.gsbFilterPlatformCheckBox.isChecked()) or - (self.__automaticUpdate != self.gsbAutoUpdateCheckBox.isChecked()) + (self.__automaticUpdate != + self.gsbAutoUpdateCheckBox.isChecked()) or + (self.__useLookupApi != self.gsbLookupCheckBox.isChecked()) ) def __okToClose(self): @@ -289,6 +294,7 @@ urlStr = self.urlEdit.text() url = QUrl.fromUserInput(urlStr) threatLists = self.__manager.lookupUrl(url) + # TODO: handle threatLists being None (indicating a lookup error) if threatLists: threatMessages = self.__manager.getThreatMessages(threatLists)