Fixed an issue adding a custom AdBlock rule. 6_1_x

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

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 19 Mar 2016 18:12:26 +0100
branch
6_1_x
changeset 4879
8e5ff8d71328
parent 4877
2ef641412a63
child 4882
742af9854449

Fixed an issue adding a custom AdBlock rule.
(grafted from 8701872bb336b66c30dae7203d75a1e355e8f6aa)

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