13 |
13 |
14 from .AdBlockNetwork import AdBlockNetwork |
14 from .AdBlockNetwork import AdBlockNetwork |
15 from .AdBlockPage import AdBlockPage |
15 from .AdBlockPage import AdBlockPage |
16 from .AdBlockSubscription import AdBlockSubscription |
16 from .AdBlockSubscription import AdBlockSubscription |
17 from .AdBlockDialog import AdBlockDialog |
17 from .AdBlockDialog import AdBlockDialog |
|
18 |
|
19 import Helpviewer.HelpWindow |
18 |
20 |
19 from Utilities.AutoSaver import AutoSaver |
21 from Utilities.AutoSaver import AutoSaver |
20 import Utilities |
22 import Utilities |
21 import Preferences |
23 import Preferences |
22 |
24 |
73 """ |
75 """ |
74 if self.isEnabled() == enabled: |
76 if self.isEnabled() == enabled: |
75 return |
77 return |
76 |
78 |
77 self.__enabled = enabled |
79 self.__enabled = enabled |
|
80 for mainWindow in Helpviewer.HelpWindow.HelpWindow.mainWindows(): |
|
81 mainWindow.adBlockIcon().setEnabled(enabled) |
78 if enabled: |
82 if enabled: |
79 self.__loadSubscriptions() |
83 self.__loadSubscriptions() |
80 self.rulesChanged.emit() |
84 self.rulesChanged.emit() |
81 |
85 |
82 def network(self): |
86 def network(self): |
219 """ |
223 """ |
220 if self.__subscriptionsLoaded: |
224 if self.__subscriptionsLoaded: |
221 return |
225 return |
222 |
226 |
223 defaultSubscriptionUrl = \ |
227 defaultSubscriptionUrl = \ |
224 "abp:subscribe?location=http://adblockplus.mozdev.org/easylist/easylist.txt&title=EasyList" |
228 "abp:subscribe?location=" \ |
|
229 "http://adblockplus.mozdev.org/easylist/easylist.txt&title=EasyList" |
225 defaultSubscriptions = [] |
230 defaultSubscriptions = [] |
226 defaultSubscriptions.append( |
231 defaultSubscriptions.append( |
227 bytes(self.__customSubscriptionUrl().toEncoded()).decode()) |
232 bytes(self.__customSubscriptionUrl().toEncoded()).decode()) |
228 defaultSubscriptions.append(defaultSubscriptionUrl) |
233 defaultSubscriptions.append(defaultSubscriptionUrl) |
229 |
234 |
248 self.__adBlockDialog = AdBlockDialog() |
253 self.__adBlockDialog = AdBlockDialog() |
249 |
254 |
250 self.__adBlockDialog.show() |
255 self.__adBlockDialog.show() |
251 return self.__adBlockDialog |
256 return self.__adBlockDialog |
252 |
257 |
|
258 def showRule(self): |
|
259 """ |
|
260 Public slot to show an AdBlock rule. |
|
261 """ |
|
262 act = self.sender() |
|
263 if act is not None: |
|
264 rule = act.data() |
|
265 if rule: |
|
266 self.showDialog().showRule(rule) |
|
267 |
253 def elementHidingRules(self): |
268 def elementHidingRules(self): |
254 """ |
269 """ |
255 Public method to get the element hiding rules. |
270 Public method to get the element hiding rules. |
256 |
271 |
257 @return element hiding rules (string) |
272 @return element hiding rules (string) |