Fixed an issue adding a custom AdBlock rule.

Sat, 19 Mar 2016 18:12:26 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 19 Mar 2016 18:12:26 +0100
changeset 4878
8701872bb336
parent 4876
686e69aecdb5
child 4883
ae0ee88c9d62

Fixed an issue adding a custom AdBlock rule.

Helpviewer/AdBlock/AdBlockTreeWidget.py file | annotate | diff | comparison | revisions
--- a/Helpviewer/AdBlock/AdBlockTreeWidget.py	Sat Mar 19 17:30:05 2016 +0100
+++ b/Helpviewer/AdBlock/AdBlockTreeWidget.py	Sat Mar 19 18:12:26 2016 +0100
@@ -116,28 +116,17 @@
             return
         
         if not filter:
-            filter = QInputDialog.getText(
+            filter, ok = QInputDialog.getText(
                 self,
                 self.tr("Add Custom Rule"),
                 self.tr("Write your rule here:"),
                 QLineEdit.Normal)
-            if filter == "":
+            if not ok or filter == "":
                 return
         
         from .AdBlockRule import AdBlockRule
         rule = AdBlockRule(filter, self.__subscription)
-        offset = self.__subscription.addRule(rule)
-        
-        item = QTreeWidgetItem()
-        item.setText(0, filter)
-        item.setData(0, Qt.UserRole, offset)
-        item.setFlags(item.flags() | Qt.ItemIsEditable)
-        
-        self.__itemChangingBlock = True
-        self.__topItem.addChild(item)
-        self.__itemChangingBlock = False
-        
-        self.__adjustItemFeatures(item, rule)
+        self.__subscription.addRule(rule)
     
     def removeRule(self):
         """

eric ide

mercurial