19 from .AdBlockModel import AdBlockModel |
19 from .AdBlockModel import AdBlockModel |
20 from .AdBlockRule import AdBlockRule |
20 from .AdBlockRule import AdBlockRule |
21 |
21 |
22 import UI.PixmapCache |
22 import UI.PixmapCache |
23 |
23 |
|
24 |
24 class AdBlockDialog(QDialog, Ui_AdBlockDialog): |
25 class AdBlockDialog(QDialog, Ui_AdBlockDialog): |
25 """ |
26 """ |
26 Class implementing the AdBlock configuration dialog. |
27 Class implementing the AdBlock configuration dialog. |
27 """ |
28 """ |
28 def __init__(self, parent = None): |
29 def __init__(self, parent=None): |
29 """ |
30 """ |
30 Constructor |
31 Constructor |
31 """ |
32 """ |
32 QDialog.__init__(self, parent) |
33 QDialog.__init__(self, parent) |
33 self.setupUi(self) |
34 self.setupUi(self) |
78 menu = self.actionButton.menu() |
79 menu = self.actionButton.menu() |
79 menu.clear() |
80 menu.clear() |
80 |
81 |
81 menu.addAction(self.trUtf8("Add Custom Rule"), self.addCustomRule) |
82 menu.addAction(self.trUtf8("Add Custom Rule"), self.addCustomRule) |
82 |
83 |
83 menu.addAction(self.trUtf8("Learn more about writing rules..."), |
84 menu.addAction(self.trUtf8("Learn more about writing rules..."), |
84 self.__learnAboutWritingFilters) |
85 self.__learnAboutWritingFilters) |
85 |
86 |
86 menu.addSeparator() |
87 menu.addSeparator() |
87 |
88 |
88 idx = self.__proxyModel.mapToSource(self.subscriptionsTree.currentIndex()) |
89 idx = self.__proxyModel.mapToSource(self.subscriptionsTree.currentIndex()) |
89 |
90 |
90 act = menu.addAction(self.trUtf8("Update Subscription"), |
91 act = menu.addAction(self.trUtf8("Update Subscription"), |
91 self.__updateSubscription) |
92 self.__updateSubscription) |
92 act.setEnabled(idx.isValid()) |
93 act.setEnabled(idx.isValid()) |
93 |
94 |
94 menu.addAction(self.trUtf8("Browse Subscriptions..."), self.__browseSubscriptions) |
95 menu.addAction(self.trUtf8("Browse Subscriptions..."), self.__browseSubscriptions) |
95 |
96 |
96 menu.addSeparator() |
97 menu.addSeparator() |
97 |
98 |
98 act = menu.addAction(self.trUtf8("Remove Subscription"), |
99 act = menu.addAction(self.trUtf8("Remove Subscription"), |
99 self.__removeSubscription) |
100 self.__removeSubscription) |
100 act.setEnabled(idx.isValid()) |
101 act.setEnabled(idx.isValid()) |
101 |
102 |
102 def addCustomRule(self, rule = ""): |
103 def addCustomRule(self, rule=""): |
103 """ |
104 """ |
104 Public slot to add a custom AdBlock rule. |
105 Public slot to add a custom AdBlock rule. |
105 |
106 |
106 @param rule string defining the rule to be added (string) |
107 @param rule string defining the rule to be added (string) |
107 """ |
108 """ |