5 |
5 |
6 """ |
6 """ |
7 Module implementing the AdBlock configuration dialog. |
7 Module implementing the AdBlock configuration dialog. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt4.QtCore import QUrl |
10 from PyQt4.QtCore import pyqtSlot, QUrl |
11 from PyQt4.QtGui import QDialog, QMenu, QToolButton, QApplication, QDesktopServices |
11 from PyQt4.QtGui import QDialog, QMenu, QToolButton, QApplication, QDesktopServices |
12 |
12 |
13 from E5Gui.E5TreeSortFilterProxyModel import E5TreeSortFilterProxyModel |
13 from E5Gui.E5TreeSortFilterProxyModel import E5TreeSortFilterProxyModel |
14 |
14 |
15 import Helpviewer.HelpWindow |
15 import Helpviewer.HelpWindow |
33 super().__init__(parent) |
34 super().__init__(parent) |
34 self.setupUi(self) |
35 self.setupUi(self) |
35 |
36 |
36 self.clearButton.setIcon(UI.PixmapCache.getIcon("clearLeft.png")) |
37 self.clearButton.setIcon(UI.PixmapCache.getIcon("clearLeft.png")) |
37 self.iconLabel.setPixmap(UI.PixmapCache.getPixmap("adBlockPlus48.png")) |
38 self.iconLabel.setPixmap(UI.PixmapCache.getPixmap("adBlockPlus48.png")) |
|
39 |
|
40 self.updateSpinBox.setValue(Preferences.getHelp("AdBlockUpdatePeriod")) |
38 |
41 |
39 self.__adBlockModel = AdBlockModel(self) |
42 self.__adBlockModel = AdBlockModel(self) |
40 self.__proxyModel = E5TreeSortFilterProxyModel(self) |
43 self.__proxyModel = E5TreeSortFilterProxyModel(self) |
41 self.__proxyModel.setSourceModel(self.__adBlockModel) |
44 self.__proxyModel.setSourceModel(self.__adBlockModel) |
42 self.subscriptionsTree.setModel(self.__proxyModel) |
45 self.subscriptionsTree.setModel(self.__proxyModel) |
153 if idx.parent().isValid(): |
156 if idx.parent().isValid(): |
154 idx = idx.parent() |
157 idx = idx.parent() |
155 subscription = self.__adBlockModel.subscription(idx) |
158 subscription = self.__adBlockModel.subscription(idx) |
156 manager = Helpviewer.HelpWindow.HelpWindow.adblockManager() |
159 manager = Helpviewer.HelpWindow.HelpWindow.adblockManager() |
157 manager.removeSubscription(subscription) |
160 manager.removeSubscription(subscription) |
|
161 |
|
162 @pyqtSlot(int) |
|
163 def on_updateSpinBox_valueChanged(self, value): |
|
164 """ |
|
165 Private slot to handle changes of the update period. |
|
166 |
|
167 @param value update period (integer) |
|
168 """ |
|
169 if value != Preferences.getHelp("AdBlockUpdatePeriod"): |
|
170 Preferences.setHelp("AdBlockUpdatePeriod", value) |
|
171 |
|
172 manager = Helpviewer.HelpWindow.HelpWindow.adblockManager() |
|
173 for subscription in manager.subscriptions(): |
|
174 subscription.checkForUpdate() |