7 Module implementing a dialog to select which private data to clear. |
7 Module implementing a dialog to select which private data to clear. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt6.QtWidgets import QDialog |
10 from PyQt6.QtWidgets import QDialog |
11 |
11 |
12 from .Ui_WebBrowserClearPrivateDataDialog import ( |
12 from .Ui_WebBrowserClearPrivateDataDialog import Ui_WebBrowserClearPrivateDataDialog |
13 Ui_WebBrowserClearPrivateDataDialog |
|
14 ) |
|
15 |
13 |
16 |
14 |
17 class WebBrowserClearPrivateDataDialog(QDialog, |
15 class WebBrowserClearPrivateDataDialog(QDialog, Ui_WebBrowserClearPrivateDataDialog): |
18 Ui_WebBrowserClearPrivateDataDialog): |
|
19 """ |
16 """ |
20 Class implementing a dialog to select which private data to clear. |
17 Class implementing a dialog to select which private data to clear. |
21 """ |
18 """ |
|
19 |
22 def __init__(self, parent=None): |
20 def __init__(self, parent=None): |
23 """ |
21 """ |
24 Constructor |
22 Constructor |
25 |
23 |
26 @param parent reference to the parent widget (QWidget) |
24 @param parent reference to the parent widget (QWidget) |
27 """ |
25 """ |
28 super().__init__(parent) |
26 super().__init__(parent) |
29 self.setupUi(self) |
27 self.setupUi(self) |
30 |
28 |
31 msh = self.minimumSizeHint() |
29 msh = self.minimumSizeHint() |
32 self.resize(max(self.width(), msh.width()), msh.height()) |
30 self.resize(max(self.width(), msh.width()), msh.height()) |
33 |
31 |
34 def getData(self): |
32 def getData(self): |
35 """ |
33 """ |
36 Public method to get the data from the dialog. |
34 Public method to get the data from the dialog. |
37 |
35 |
38 @return tuple with flags indicating which data to clear |
36 @return tuple with flags indicating which data to clear |
39 (browsing history, search history, favicons, disk cache, cookies, |
37 (browsing history, search history, favicons, disk cache, cookies, |
40 passwords, web databases, downloads, zoom values, SSL |
38 passwords, web databases, downloads, zoom values, SSL |
41 certificate error exceptions) and the selected history period in |
39 certificate error exceptions) and the selected history period in |
42 milliseconds (tuple of booleans and integer) |
40 milliseconds (tuple of booleans and integer) |
55 # last four weeks |
53 # last four weeks |
56 historyPeriod = 4 * 7 * 24 * 60 * 60 * 1000 |
54 historyPeriod = 4 * 7 * 24 * 60 * 60 * 1000 |
57 elif index == 4: |
55 elif index == 4: |
58 # clear all |
56 # clear all |
59 historyPeriod = 0 |
57 historyPeriod = 0 |
60 |
58 |
61 return (self.historyCheckBox.isChecked(), |
59 return ( |
62 self.searchCheckBox.isChecked(), |
60 self.historyCheckBox.isChecked(), |
63 self.iconsCheckBox.isChecked(), |
61 self.searchCheckBox.isChecked(), |
64 self.cacheCheckBox.isChecked(), |
62 self.iconsCheckBox.isChecked(), |
65 self.cookiesCheckBox.isChecked(), |
63 self.cacheCheckBox.isChecked(), |
66 self.passwordsCheckBox.isChecked(), |
64 self.cookiesCheckBox.isChecked(), |
67 self.databasesCheckBox.isChecked(), |
65 self.passwordsCheckBox.isChecked(), |
68 self.downloadsCheckBox.isChecked(), |
66 self.databasesCheckBox.isChecked(), |
69 self.zoomCheckBox.isChecked(), |
67 self.downloadsCheckBox.isChecked(), |
70 self.sslExceptionsCheckBox.isChecked(), |
68 self.zoomCheckBox.isChecked(), |
71 historyPeriod) |
69 self.sslExceptionsCheckBox.isChecked(), |
|
70 historyPeriod, |
|
71 ) |