|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>eric6.WebBrowser.AdBlock.AdBlockSubscription</title> |
|
4 <meta charset="UTF-8"> |
|
5 <style> |
|
6 body { |
|
7 background: #EDECE6; |
|
8 margin: 0em 1em 10em 1em; |
|
9 color: black; |
|
10 } |
|
11 |
|
12 h1 { color: white; background: #85774A; } |
|
13 h2 { color: white; background: #85774A; } |
|
14 h3 { color: white; background: #9D936E; } |
|
15 h4 { color: white; background: #9D936E; } |
|
16 |
|
17 a { color: #BA6D36; } |
|
18 |
|
19 </style> |
|
20 </head> |
|
21 <body><a NAME="top" ID="top"></a> |
|
22 <h1>eric6.WebBrowser.AdBlock.AdBlockSubscription</h1> |
|
23 <p> |
|
24 Module implementing the AdBlock subscription class. |
|
25 </p> |
|
26 <h3>Global Attributes</h3> |
|
27 <table> |
|
28 <tr><td>None</td></tr> |
|
29 </table> |
|
30 <h3>Classes</h3> |
|
31 <table> |
|
32 <tr> |
|
33 <td><a href="#AdBlockSubscription">AdBlockSubscription</a></td> |
|
34 <td>Class implementing the AdBlock subscription.</td> |
|
35 </tr> |
|
36 </table> |
|
37 <h3>Functions</h3> |
|
38 <table> |
|
39 <tr><td>None</td></tr> |
|
40 </table> |
|
41 <hr /><hr /> |
|
42 <a NAME="AdBlockSubscription" ID="AdBlockSubscription"></a> |
|
43 <h2>AdBlockSubscription</h2> |
|
44 <p> |
|
45 Class implementing the AdBlock subscription. |
|
46 </p><h3>Signals</h3> |
|
47 <dl> |
|
48 <dt>changed()</dt> |
|
49 <dd> |
|
50 emitted after the subscription has changed |
|
51 </dd><dt>enabledChanged(bool)</dt> |
|
52 <dd> |
|
53 emitted after the enabled state was changed |
|
54 </dd><dt>rulesChanged()</dt> |
|
55 <dd> |
|
56 emitted after the subscription's rules have changed |
|
57 </dd><dt>rulesEnabledChanged()</dt> |
|
58 <dd> |
|
59 emitted after a rule enabled state was |
|
60 changed |
|
61 </dd> |
|
62 </dl> |
|
63 <h3>Derived from</h3> |
|
64 QObject |
|
65 <h3>Class Attributes</h3> |
|
66 <table> |
|
67 <tr><td>None</td></tr> |
|
68 </table> |
|
69 <h3>Class Methods</h3> |
|
70 <table> |
|
71 <tr><td>None</td></tr> |
|
72 </table> |
|
73 <h3>Methods</h3> |
|
74 <table> |
|
75 <tr> |
|
76 <td><a href="#AdBlockSubscription.__init__">AdBlockSubscription</a></td> |
|
77 <td>Constructor</td> |
|
78 </tr><tr> |
|
79 <td><a href="#AdBlockSubscription.__loadRules">__loadRules</a></td> |
|
80 <td>Private method to load the rules of the subscription.</td> |
|
81 </tr><tr> |
|
82 <td><a href="#AdBlockSubscription.__parseUrl">__parseUrl</a></td> |
|
83 <td>Private method to parse the AdBlock URL for the subscription.</td> |
|
84 </tr><tr> |
|
85 <td><a href="#AdBlockSubscription.__rulesDownloaded">__rulesDownloaded</a></td> |
|
86 <td>Private slot to deal with the downloaded rules.</td> |
|
87 </tr><tr> |
|
88 <td><a href="#AdBlockSubscription.__validateCheckSum">__validateCheckSum</a></td> |
|
89 <td>Private method to check the subscription file's checksum.</td> |
|
90 </tr><tr> |
|
91 <td><a href="#AdBlockSubscription.addRule">addRule</a></td> |
|
92 <td>Public method to add a rule.</td> |
|
93 </tr><tr> |
|
94 <td><a href="#AdBlockSubscription.allRules">allRules</a></td> |
|
95 <td>Public method to get the list of rules.</td> |
|
96 </tr><tr> |
|
97 <td><a href="#AdBlockSubscription.canBeRemoved">canBeRemoved</a></td> |
|
98 <td>Public method to check, if the subscription can be removed.</td> |
|
99 </tr><tr> |
|
100 <td><a href="#AdBlockSubscription.canEditRules">canEditRules</a></td> |
|
101 <td>Public method to check, if rules can be edited.</td> |
|
102 </tr><tr> |
|
103 <td><a href="#AdBlockSubscription.checkForUpdate">checkForUpdate</a></td> |
|
104 <td>Public method to check for an update.</td> |
|
105 </tr><tr> |
|
106 <td><a href="#AdBlockSubscription.isEnabled">isEnabled</a></td> |
|
107 <td>Public method to check, if the subscription is enabled.</td> |
|
108 </tr><tr> |
|
109 <td><a href="#AdBlockSubscription.lastUpdate">lastUpdate</a></td> |
|
110 <td>Public method to get the date and time of the last update.</td> |
|
111 </tr><tr> |
|
112 <td><a href="#AdBlockSubscription.location">location</a></td> |
|
113 <td>Public method to get the subscription location.</td> |
|
114 </tr><tr> |
|
115 <td><a href="#AdBlockSubscription.removeRule">removeRule</a></td> |
|
116 <td>Public method to remove a rule given the offset.</td> |
|
117 </tr><tr> |
|
118 <td><a href="#AdBlockSubscription.replaceRule">replaceRule</a></td> |
|
119 <td>Public method to replace a rule given the offset.</td> |
|
120 </tr><tr> |
|
121 <td><a href="#AdBlockSubscription.requiresLocation">requiresLocation</a></td> |
|
122 <td>Public method to get the location of a required subscription.</td> |
|
123 </tr><tr> |
|
124 <td><a href="#AdBlockSubscription.rule">rule</a></td> |
|
125 <td>Public method to get a specific rule.</td> |
|
126 </tr><tr> |
|
127 <td><a href="#AdBlockSubscription.rulesFileName">rulesFileName</a></td> |
|
128 <td>Public method to get the name of the rules file.</td> |
|
129 </tr><tr> |
|
130 <td><a href="#AdBlockSubscription.saveRules">saveRules</a></td> |
|
131 <td>Public method to save the subscription rules.</td> |
|
132 </tr><tr> |
|
133 <td><a href="#AdBlockSubscription.setEnabled">setEnabled</a></td> |
|
134 <td>Public method to set the enabled status.</td> |
|
135 </tr><tr> |
|
136 <td><a href="#AdBlockSubscription.setLocation">setLocation</a></td> |
|
137 <td>Public method to set the subscription location.</td> |
|
138 </tr><tr> |
|
139 <td><a href="#AdBlockSubscription.setRuleEnabled">setRuleEnabled</a></td> |
|
140 <td>Public method to enable a specific rule.</td> |
|
141 </tr><tr> |
|
142 <td><a href="#AdBlockSubscription.setTitle">setTitle</a></td> |
|
143 <td>Public method to set the subscription title.</td> |
|
144 </tr><tr> |
|
145 <td><a href="#AdBlockSubscription.title">title</a></td> |
|
146 <td>Public method to get the subscription title.</td> |
|
147 </tr><tr> |
|
148 <td><a href="#AdBlockSubscription.updateNow">updateNow</a></td> |
|
149 <td>Public method to update the subscription immediately.</td> |
|
150 </tr><tr> |
|
151 <td><a href="#AdBlockSubscription.url">url</a></td> |
|
152 <td>Public method to generate the URL for this subscription.</td> |
|
153 </tr> |
|
154 </table> |
|
155 <h3>Static Methods</h3> |
|
156 <table> |
|
157 <tr><td>None</td></tr> |
|
158 </table> |
|
159 <a NAME="AdBlockSubscription.__init__" ID="AdBlockSubscription.__init__"></a> |
|
160 <h4>AdBlockSubscription (Constructor)</h4> |
|
161 <b>AdBlockSubscription</b>(<i>url, custom, parent=None, default=False</i>) |
|
162 <p> |
|
163 Constructor |
|
164 </p><dl> |
|
165 <dt><i>url</i></dt> |
|
166 <dd> |
|
167 AdBlock URL for the subscription (QUrl) |
|
168 </dd><dt><i>custom</i></dt> |
|
169 <dd> |
|
170 flag indicating a custom subscription (boolean) |
|
171 </dd><dt><i>parent</i></dt> |
|
172 <dd> |
|
173 reference to the parent object (QObject) |
|
174 </dd><dt><i>default</i></dt> |
|
175 <dd> |
|
176 flag indicating a default subscription (boolean) |
|
177 </dd> |
|
178 </dl><a NAME="AdBlockSubscription.__loadRules" ID="AdBlockSubscription.__loadRules"></a> |
|
179 <h4>AdBlockSubscription.__loadRules</h4> |
|
180 <b>__loadRules</b>(<i></i>) |
|
181 <p> |
|
182 Private method to load the rules of the subscription. |
|
183 </p><a NAME="AdBlockSubscription.__parseUrl" ID="AdBlockSubscription.__parseUrl"></a> |
|
184 <h4>AdBlockSubscription.__parseUrl</h4> |
|
185 <b>__parseUrl</b>(<i>url</i>) |
|
186 <p> |
|
187 Private method to parse the AdBlock URL for the subscription. |
|
188 </p><dl> |
|
189 <dt><i>url</i> (QUrl)</dt> |
|
190 <dd> |
|
191 AdBlock URL for the subscription |
|
192 </dd> |
|
193 </dl><a NAME="AdBlockSubscription.__rulesDownloaded" ID="AdBlockSubscription.__rulesDownloaded"></a> |
|
194 <h4>AdBlockSubscription.__rulesDownloaded</h4> |
|
195 <b>__rulesDownloaded</b>(<i>reply</i>) |
|
196 <p> |
|
197 Private slot to deal with the downloaded rules. |
|
198 </p><dl> |
|
199 <dt><i>reply</i> (QNetworkReply)</dt> |
|
200 <dd> |
|
201 reference to the network reply |
|
202 </dd> |
|
203 </dl><a NAME="AdBlockSubscription.__validateCheckSum" ID="AdBlockSubscription.__validateCheckSum"></a> |
|
204 <h4>AdBlockSubscription.__validateCheckSum</h4> |
|
205 <b>__validateCheckSum</b>(<i>fileName</i>) |
|
206 <p> |
|
207 Private method to check the subscription file's checksum. |
|
208 </p><dl> |
|
209 <dt><i>fileName</i> (str)</dt> |
|
210 <dd> |
|
211 name of the file containing the subscription |
|
212 </dd> |
|
213 </dl><dl> |
|
214 <dt>Returns:</dt> |
|
215 <dd> |
|
216 flag indicating a valid file. A file is considered |
|
217 valid, if the checksum is OK, the file does not contain a |
|
218 checksum (i.e. cannot be checked) or we are using the limited |
|
219 EasyList (because we fiddled with the original). |
|
220 </dd> |
|
221 </dl><dl> |
|
222 <dt>Return Type:</dt> |
|
223 <dd> |
|
224 bool |
|
225 </dd> |
|
226 </dl><a NAME="AdBlockSubscription.addRule" ID="AdBlockSubscription.addRule"></a> |
|
227 <h4>AdBlockSubscription.addRule</h4> |
|
228 <b>addRule</b>(<i>rule</i>) |
|
229 <p> |
|
230 Public method to add a rule. |
|
231 </p><dl> |
|
232 <dt><i>rule</i> (AdBlockRule)</dt> |
|
233 <dd> |
|
234 reference to the rule to add |
|
235 </dd> |
|
236 </dl><dl> |
|
237 <dt>Returns:</dt> |
|
238 <dd> |
|
239 offset of the rule |
|
240 </dd> |
|
241 </dl><dl> |
|
242 <dt>Return Type:</dt> |
|
243 <dd> |
|
244 int |
|
245 </dd> |
|
246 </dl><a NAME="AdBlockSubscription.allRules" ID="AdBlockSubscription.allRules"></a> |
|
247 <h4>AdBlockSubscription.allRules</h4> |
|
248 <b>allRules</b>(<i></i>) |
|
249 <p> |
|
250 Public method to get the list of rules. |
|
251 </p><dl> |
|
252 <dt>Returns:</dt> |
|
253 <dd> |
|
254 list of rules |
|
255 </dd> |
|
256 </dl><dl> |
|
257 <dt>Return Type:</dt> |
|
258 <dd> |
|
259 list of AdBlockRule |
|
260 </dd> |
|
261 </dl><a NAME="AdBlockSubscription.canBeRemoved" ID="AdBlockSubscription.canBeRemoved"></a> |
|
262 <h4>AdBlockSubscription.canBeRemoved</h4> |
|
263 <b>canBeRemoved</b>(<i></i>) |
|
264 <p> |
|
265 Public method to check, if the subscription can be removed. |
|
266 </p><dl> |
|
267 <dt>Returns:</dt> |
|
268 <dd> |
|
269 flag indicating removal is allowed |
|
270 </dd> |
|
271 </dl><dl> |
|
272 <dt>Return Type:</dt> |
|
273 <dd> |
|
274 bool |
|
275 </dd> |
|
276 </dl><a NAME="AdBlockSubscription.canEditRules" ID="AdBlockSubscription.canEditRules"></a> |
|
277 <h4>AdBlockSubscription.canEditRules</h4> |
|
278 <b>canEditRules</b>(<i></i>) |
|
279 <p> |
|
280 Public method to check, if rules can be edited. |
|
281 </p><dl> |
|
282 <dt>Returns:</dt> |
|
283 <dd> |
|
284 flag indicating rules may be edited |
|
285 </dd> |
|
286 </dl><dl> |
|
287 <dt>Return Type:</dt> |
|
288 <dd> |
|
289 bool |
|
290 </dd> |
|
291 </dl><a NAME="AdBlockSubscription.checkForUpdate" ID="AdBlockSubscription.checkForUpdate"></a> |
|
292 <h4>AdBlockSubscription.checkForUpdate</h4> |
|
293 <b>checkForUpdate</b>(<i></i>) |
|
294 <p> |
|
295 Public method to check for an update. |
|
296 </p><a NAME="AdBlockSubscription.isEnabled" ID="AdBlockSubscription.isEnabled"></a> |
|
297 <h4>AdBlockSubscription.isEnabled</h4> |
|
298 <b>isEnabled</b>(<i></i>) |
|
299 <p> |
|
300 Public method to check, if the subscription is enabled. |
|
301 </p><dl> |
|
302 <dt>Returns:</dt> |
|
303 <dd> |
|
304 flag indicating the enabled status |
|
305 </dd> |
|
306 </dl><dl> |
|
307 <dt>Return Type:</dt> |
|
308 <dd> |
|
309 bool |
|
310 </dd> |
|
311 </dl><a NAME="AdBlockSubscription.lastUpdate" ID="AdBlockSubscription.lastUpdate"></a> |
|
312 <h4>AdBlockSubscription.lastUpdate</h4> |
|
313 <b>lastUpdate</b>(<i></i>) |
|
314 <p> |
|
315 Public method to get the date and time of the last update. |
|
316 </p><dl> |
|
317 <dt>Returns:</dt> |
|
318 <dd> |
|
319 date and time of the last update |
|
320 </dd> |
|
321 </dl><dl> |
|
322 <dt>Return Type:</dt> |
|
323 <dd> |
|
324 QDateTime |
|
325 </dd> |
|
326 </dl><a NAME="AdBlockSubscription.location" ID="AdBlockSubscription.location"></a> |
|
327 <h4>AdBlockSubscription.location</h4> |
|
328 <b>location</b>(<i></i>) |
|
329 <p> |
|
330 Public method to get the subscription location. |
|
331 </p><dl> |
|
332 <dt>Returns:</dt> |
|
333 <dd> |
|
334 URL of the subscription location |
|
335 </dd> |
|
336 </dl><dl> |
|
337 <dt>Return Type:</dt> |
|
338 <dd> |
|
339 QUrl |
|
340 </dd> |
|
341 </dl><a NAME="AdBlockSubscription.removeRule" ID="AdBlockSubscription.removeRule"></a> |
|
342 <h4>AdBlockSubscription.removeRule</h4> |
|
343 <b>removeRule</b>(<i>offset</i>) |
|
344 <p> |
|
345 Public method to remove a rule given the offset. |
|
346 </p><dl> |
|
347 <dt><i>offset</i> (int)</dt> |
|
348 <dd> |
|
349 offset of the rule to remove |
|
350 </dd> |
|
351 </dl><a NAME="AdBlockSubscription.replaceRule" ID="AdBlockSubscription.replaceRule"></a> |
|
352 <h4>AdBlockSubscription.replaceRule</h4> |
|
353 <b>replaceRule</b>(<i>rule, offset</i>) |
|
354 <p> |
|
355 Public method to replace a rule given the offset. |
|
356 </p><dl> |
|
357 <dt><i>rule</i> (AdBlockRule)</dt> |
|
358 <dd> |
|
359 reference to the rule to set |
|
360 </dd><dt><i>offset</i> (int)</dt> |
|
361 <dd> |
|
362 offset of the rule to remove |
|
363 </dd> |
|
364 </dl><dl> |
|
365 <dt>Returns:</dt> |
|
366 <dd> |
|
367 requested rule |
|
368 </dd> |
|
369 </dl><dl> |
|
370 <dt>Return Type:</dt> |
|
371 <dd> |
|
372 AdBlockRule |
|
373 </dd> |
|
374 </dl><a NAME="AdBlockSubscription.requiresLocation" ID="AdBlockSubscription.requiresLocation"></a> |
|
375 <h4>AdBlockSubscription.requiresLocation</h4> |
|
376 <b>requiresLocation</b>(<i></i>) |
|
377 <p> |
|
378 Public method to get the location of a required subscription. |
|
379 </p><dl> |
|
380 <dt>Returns:</dt> |
|
381 <dd> |
|
382 location of a required subscription |
|
383 </dd> |
|
384 </dl><dl> |
|
385 <dt>Return Type:</dt> |
|
386 <dd> |
|
387 str |
|
388 </dd> |
|
389 </dl><a NAME="AdBlockSubscription.rule" ID="AdBlockSubscription.rule"></a> |
|
390 <h4>AdBlockSubscription.rule</h4> |
|
391 <b>rule</b>(<i>offset</i>) |
|
392 <p> |
|
393 Public method to get a specific rule. |
|
394 </p><dl> |
|
395 <dt><i>offset</i> (int)</dt> |
|
396 <dd> |
|
397 offset of the rule |
|
398 </dd> |
|
399 </dl><dl> |
|
400 <dt>Returns:</dt> |
|
401 <dd> |
|
402 requested rule |
|
403 </dd> |
|
404 </dl><dl> |
|
405 <dt>Return Type:</dt> |
|
406 <dd> |
|
407 AdBlockRule |
|
408 </dd> |
|
409 </dl><a NAME="AdBlockSubscription.rulesFileName" ID="AdBlockSubscription.rulesFileName"></a> |
|
410 <h4>AdBlockSubscription.rulesFileName</h4> |
|
411 <b>rulesFileName</b>(<i></i>) |
|
412 <p> |
|
413 Public method to get the name of the rules file. |
|
414 </p><dl> |
|
415 <dt>Returns:</dt> |
|
416 <dd> |
|
417 name of the rules file |
|
418 </dd> |
|
419 </dl><dl> |
|
420 <dt>Return Type:</dt> |
|
421 <dd> |
|
422 str |
|
423 </dd> |
|
424 </dl><a NAME="AdBlockSubscription.saveRules" ID="AdBlockSubscription.saveRules"></a> |
|
425 <h4>AdBlockSubscription.saveRules</h4> |
|
426 <b>saveRules</b>(<i></i>) |
|
427 <p> |
|
428 Public method to save the subscription rules. |
|
429 </p><a NAME="AdBlockSubscription.setEnabled" ID="AdBlockSubscription.setEnabled"></a> |
|
430 <h4>AdBlockSubscription.setEnabled</h4> |
|
431 <b>setEnabled</b>(<i>enabled</i>) |
|
432 <p> |
|
433 Public method to set the enabled status. |
|
434 </p><dl> |
|
435 <dt><i>enabled</i> (bool)</dt> |
|
436 <dd> |
|
437 flag indicating the enabled status |
|
438 </dd> |
|
439 </dl><a NAME="AdBlockSubscription.setLocation" ID="AdBlockSubscription.setLocation"></a> |
|
440 <h4>AdBlockSubscription.setLocation</h4> |
|
441 <b>setLocation</b>(<i>url</i>) |
|
442 <p> |
|
443 Public method to set the subscription location. |
|
444 </p><dl> |
|
445 <dt><i>url</i> (QUrl)</dt> |
|
446 <dd> |
|
447 URL of the subscription location |
|
448 </dd> |
|
449 </dl><a NAME="AdBlockSubscription.setRuleEnabled" ID="AdBlockSubscription.setRuleEnabled"></a> |
|
450 <h4>AdBlockSubscription.setRuleEnabled</h4> |
|
451 <b>setRuleEnabled</b>(<i>offset, enabled</i>) |
|
452 <p> |
|
453 Public method to enable a specific rule. |
|
454 </p><dl> |
|
455 <dt><i>offset</i> (int)</dt> |
|
456 <dd> |
|
457 offset of the rule |
|
458 </dd><dt><i>enabled</i> (bool)</dt> |
|
459 <dd> |
|
460 new enabled state |
|
461 </dd> |
|
462 </dl><dl> |
|
463 <dt>Returns:</dt> |
|
464 <dd> |
|
465 reference to the changed rule |
|
466 </dd> |
|
467 </dl><dl> |
|
468 <dt>Return Type:</dt> |
|
469 <dd> |
|
470 AdBlockRule |
|
471 </dd> |
|
472 </dl><a NAME="AdBlockSubscription.setTitle" ID="AdBlockSubscription.setTitle"></a> |
|
473 <h4>AdBlockSubscription.setTitle</h4> |
|
474 <b>setTitle</b>(<i>title</i>) |
|
475 <p> |
|
476 Public method to set the subscription title. |
|
477 </p><dl> |
|
478 <dt><i>title</i> (str)</dt> |
|
479 <dd> |
|
480 subscription title |
|
481 </dd> |
|
482 </dl><a NAME="AdBlockSubscription.title" ID="AdBlockSubscription.title"></a> |
|
483 <h4>AdBlockSubscription.title</h4> |
|
484 <b>title</b>(<i></i>) |
|
485 <p> |
|
486 Public method to get the subscription title. |
|
487 </p><dl> |
|
488 <dt>Returns:</dt> |
|
489 <dd> |
|
490 subscription title |
|
491 </dd> |
|
492 </dl><dl> |
|
493 <dt>Return Type:</dt> |
|
494 <dd> |
|
495 string |
|
496 </dd> |
|
497 </dl><a NAME="AdBlockSubscription.updateNow" ID="AdBlockSubscription.updateNow"></a> |
|
498 <h4>AdBlockSubscription.updateNow</h4> |
|
499 <b>updateNow</b>(<i></i>) |
|
500 <p> |
|
501 Public method to update the subscription immediately. |
|
502 </p><a NAME="AdBlockSubscription.url" ID="AdBlockSubscription.url"></a> |
|
503 <h4>AdBlockSubscription.url</h4> |
|
504 <b>url</b>(<i></i>) |
|
505 <p> |
|
506 Public method to generate the URL for this subscription. |
|
507 </p><dl> |
|
508 <dt>Returns:</dt> |
|
509 <dd> |
|
510 AdBlock URL for the subscription |
|
511 </dd> |
|
512 </dl><dl> |
|
513 <dt>Return Type:</dt> |
|
514 <dd> |
|
515 QUrl |
|
516 </dd> |
|
517 </dl> |
|
518 <div align="right"><a href="#top">Up</a></div> |
|
519 <hr /> |
|
520 </body></html> |