Fixed an issue remembering the enabled state of AdBlock subscriptions.

Sat, 04 Aug 2012 13:46:18 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 04 Aug 2012 13:46:18 +0200
changeset 1971
a68d78702c98
parent 1970
02cf3bac079b
child 1972
5341662d6cfb
child 1974
6753821a479e

Fixed an issue remembering the enabled state of AdBlock subscriptions.

Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Source/eric5.Helpviewer.AdBlock.AdBlockSubscription.html file | annotate | diff | comparison | revisions
Helpviewer/AdBlock/AdBlockManager.py file | annotate | diff | comparison | revisions
Helpviewer/AdBlock/AdBlockSubscription.py file | annotate | diff | comparison | revisions
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Source/eric5.Helpviewer.AdBlock.AdBlockSubscription.html	Sat Aug 04 13:30:04 2012 +0200
+++ b/Documentation/Source/eric5.Helpviewer.AdBlock.AdBlockSubscription.html	Sat Aug 04 13:46:18 2012 +0200
@@ -49,6 +49,9 @@
 <dt>changed()</dt>
 <dd>
 emitted after the subscription has changed
+</dd><dt>enabledChanged(bool)</dt>
+<dd>
+emitted after the enabled state was changed
 </dd><dt>rulesChanged()</dt>
 <dd>
 emitted after the subscription's rules have changed
--- a/Helpviewer/AdBlock/AdBlockManager.py	Sat Aug 04 13:30:04 2012 +0200
+++ b/Helpviewer/AdBlock/AdBlockManager.py	Sat Aug 04 13:46:18 2012 +0200
@@ -223,6 +223,7 @@
         
         subscription.rulesChanged.connect(self.rulesChanged)
         subscription.changed.connect(self.rulesChanged)
+        subscription.enabledChanged.connect(self.rulesChanged)
         
         self.rulesChanged.emit()
     
@@ -284,7 +285,8 @@
             else:
                 subscriptions.append(self.__customSubscriptionUrlString)
         else:
-            subscriptions = [self.__defaultSubscriptionUrlString, self.__customSubscriptionUrlString]
+            subscriptions = [self.__defaultSubscriptionUrlString,
+                self.__customSubscriptionUrlString]
         for subscription in subscriptions:
             url = QUrl.fromEncoded(subscription.encode())
             adBlockSubscription = AdBlockSubscription(url,
@@ -293,6 +295,7 @@
                 subscription.startswith(self.__defaultSubscriptionUrlString))
             adBlockSubscription.rulesChanged.connect(self.rulesChanged)
             adBlockSubscription.changed.connect(self.rulesChanged)
+            adBlockSubscription.enabledChanged.connect(self.rulesChanged)
             self.__subscriptions.append(adBlockSubscription)
         
         self.__subscriptionsLoaded = True
--- a/Helpviewer/AdBlock/AdBlockSubscription.py	Sat Aug 04 13:30:04 2012 +0200
+++ b/Helpviewer/AdBlock/AdBlockSubscription.py	Sat Aug 04 13:46:18 2012 +0200
@@ -30,9 +30,11 @@
     
     @signal changed() emitted after the subscription has changed
     @signal rulesChanged() emitted after the subscription's rules have changed
+    @signal enabledChanged(bool) emitted after the enabled state was changed
     """
     changed = pyqtSignal()
     rulesChanged = pyqtSignal()
+    enabledChanged = pyqtSignal(bool)
     
     def __init__(self, url, custom, parent=None, default=False):
         """
@@ -99,10 +101,6 @@
         lastUpdateByteArray = url.encodedQueryItemValue("lastUpdate")
         lastUpdateString = QUrl.fromPercentEncoding(lastUpdateByteArray)
         self.__lastUpdate = QDateTime.fromString(lastUpdateString, Qt.ISODate)
-##        if lastUpdateString:
-##            self.__lastUpdate = QDateTime.fromString(lastUpdateString, Qt.ISODate)
-##        else:
-##            self.__lastUpdate = QDateTime.currentDateTime()
         
         self.__loadRules()
     
@@ -148,6 +146,7 @@
             return
         
         self.__enabled = enabled
+        self.enabledChanged.emit(enabled)
     
     def title(self):
         """

eric ide

mercurial