8 """ |
8 """ |
9 |
9 |
10 |
10 |
11 from PyQt5.QtCore import pyqtSlot, Qt, QUrl, QDateTime |
11 from PyQt5.QtCore import pyqtSlot, Qt, QUrl, QDateTime |
12 from PyQt5.QtWidgets import ( |
12 from PyQt5.QtWidgets import ( |
13 QDialog, QDialogButtonBox, QAbstractButton, QApplication |
13 QDialog, QDialogButtonBox, QAbstractButton |
14 ) |
14 ) |
15 |
15 |
16 from E5Gui import E5MessageBox |
16 from E5Gui import E5MessageBox |
|
17 from E5Gui.E5OverrideCursor import E5OverrideCursor |
17 |
18 |
18 from .Ui_SafeBrowsingDialog import Ui_SafeBrowsingDialog |
19 from .Ui_SafeBrowsingDialog import Ui_SafeBrowsingDialog |
19 |
20 |
20 import UI.PixmapCache |
21 import UI.PixmapCache |
21 import Preferences |
22 import Preferences |
165 Private method to check, if it is safe to close the dialog. |
166 Private method to check, if it is safe to close the dialog. |
166 |
167 |
167 @return flag indicating safe to close |
168 @return flag indicating safe to close |
168 @rtype bool |
169 @rtype bool |
169 """ |
170 """ |
170 QApplication.restoreOverrideCursor() |
|
171 if self.__isModified(): |
171 if self.__isModified(): |
172 res = E5MessageBox.okToClearData( |
172 res = E5MessageBox.okToClearData( |
173 self, |
173 self, |
174 self.tr("Safe Browsing Management"), |
174 self.tr("Safe Browsing Management"), |
175 self.tr("""The dialog contains unsaved changes."""), |
175 self.tr("""The dialog contains unsaved changes."""), |
198 self, |
198 self, |
199 self.tr("Update Safe Browsing Cache"), |
199 self.tr("Update Safe Browsing Cache"), |
200 self.tr("""Updating the Safe Browsing cache might be a lengthy""" |
200 self.tr("""Updating the Safe Browsing cache might be a lengthy""" |
201 """ operation. Please be patient!""")) |
201 """ operation. Please be patient!""")) |
202 |
202 |
203 QApplication.setOverrideCursor(Qt.WaitCursor) |
203 with E5OverrideCursor(): |
204 ok, error = self.__manager.updateHashPrefixCache() |
204 ok, error = self.__manager.updateHashPrefixCache() |
205 self.__resetProgress() |
205 self.__resetProgress() |
206 QApplication.restoreOverrideCursor() |
|
207 if not ok: |
206 if not ok: |
208 if error: |
207 if error: |
209 E5MessageBox.critical( |
208 E5MessageBox.critical( |
210 self, |
209 self, |
211 self.tr("Update Safe Browsing Cache"), |
210 self.tr("Update Safe Browsing Cache"), |
227 self, |
226 self, |
228 self.tr("Clear Safe Browsing Cache"), |
227 self.tr("Clear Safe Browsing Cache"), |
229 self.tr("""Do you really want to clear the Safe Browsing cache?""" |
228 self.tr("""Do you really want to clear the Safe Browsing cache?""" |
230 """ Re-populating it might take some time.""")) |
229 """ Re-populating it might take some time.""")) |
231 if res: |
230 if res: |
232 QApplication.setOverrideCursor(Qt.WaitCursor) |
231 with E5OverrideCursor(): |
233 self.__manager.fullCacheCleanup() |
232 self.__manager.fullCacheCleanup() |
234 QApplication.restoreOverrideCursor() |
|
235 |
233 |
236 @pyqtSlot(str, int) |
234 @pyqtSlot(str, int) |
237 def __setProgressMessage(self, message, maximum): |
235 def __setProgressMessage(self, message, maximum): |
238 """ |
236 """ |
239 Private slot to set the progress message and the maximum value. |
237 Private slot to set the progress message and the maximum value. |