diff -r 2fed7bc4ad83 -r d8c45fe8a1b9 Helpviewer/HelpBrowserWV.py --- a/Helpviewer/HelpBrowserWV.py Thu Jul 26 18:38:15 2012 +0200 +++ b/Helpviewer/HelpBrowserWV.py Sat Jul 28 11:23:12 2012 +0200 @@ -45,6 +45,8 @@ from .WebPlugins.WebPluginFactory import WebPluginFactory +from .AdBlock.AdBlockPage import AdBlockedPageEntry + ########################################################################################## @@ -181,6 +183,9 @@ self.__sslConfiguration = None self.__proxy.finished.connect(self.__managerFinished) + + self.__adBlockedEntries = [] + self.loadStarted.connect(self.__loadStarted) def acceptNavigationRequest(self, frame, request, type_): """ @@ -361,6 +366,39 @@ return QWebPage.extension(self, extension, option, output) + def __loadStarted(self): + """ + Private method to handle the loadStarted signal. + """ + self.__adBlockedEntries = [] + + def addAdBlockRule(self, rule, url): + """ + Public slot to add an AdBlock rule to the page. + + @param rule AdBlock rule to add (AdBlockRule) + @param url URL that matched the rule (QUrl) + """ + entry = AdBlockedPageEntry(rule, url) + if entry not in self.__adBlockedEntries: + self.__adBlockedEntries.append(entry) + + def getAdBlockedPageEntries(self): + """ + Public method to get the list of AdBlock page entries. + + @return list of AdBlock page entries (list of AdBlockedPageEntry) + """ + return self.__adBlockedEntries + + def url(self): + """ + Public method to get the URL of the page. + + @return URL of the page (QUrl) + """ + return self.mainFrame().url() + def userAgent(self, resolveEmpty=False): """ Public method to get the global user agent setting. @@ -1671,7 +1709,7 @@ self.zoomOut() if ok: - self.mw.adblockManager().page().applyRulesToPage(self.page()) + self.mw.adblockManager().page().hideBlockedPageEntries(self.page()) self.mw.passwordManager().fill(self.page()) def isLoading(self):