Tue, 10 Dec 2024 15:46:34 +0100
Updated copyright for 2025.
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
11090
f5f5f5803935
Updated copyright for 2025.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10692
diff
changeset
|
3 | # Copyright (c) 2009 - 2025 Detlev Offenbach <detlev@die-offenbachs.de> |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing a dialog to select which private data to clear. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
8318
962bce857696
Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
10 | from PyQt6.QtWidgets import QDialog |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
11 | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
12 | from .Ui_WebBrowserClearPrivateDataDialog import Ui_WebBrowserClearPrivateDataDialog |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
14 | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
15 | class WebBrowserClearPrivateDataDialog(QDialog, Ui_WebBrowserClearPrivateDataDialog): |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
17 | Class implementing a dialog to select which private data to clear. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
19 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
20 | def __init__(self, parent=None): |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
23 | |
10436
f6881d10e995
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
24 | @param parent reference to the parent widget |
f6881d10e995
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
25 | @type QWidget |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8069
diff
changeset
|
27 | super().__init__(parent) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | self.setupUi(self) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
29 | |
3366
6084bb3c3911
Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
30 | msh = self.minimumSizeHint() |
6084bb3c3911
Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
31 | self.resize(max(self.width(), msh.width()), msh.height()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
32 | |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | def getData(self): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | Public method to get the data from the dialog. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
36 | |
2999
28c75409a78f
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
37 | @return tuple with flags indicating which data to clear |
28c75409a78f
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
38 | (browsing history, search history, favicons, disk cache, cookies, |
10692
9becf9ca115c
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
39 | passwords, downloads, zoom values, SSL certificate error exceptions) and |
9becf9ca115c
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
40 | the selected history period in milliseconds |
9becf9ca115c
Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
41 | @rtype tuple of (bool, bool, bool, bool, bool, bool, bool, bool, bool, int) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | """ |
1853
01812b281a1e
Extended the "Clear Private Data" dialog of the web browser to clear flash cookies and to select a browsing history period to clear.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
43 | index = self.historyCombo.currentIndex() |
01812b281a1e
Extended the "Clear Private Data" dialog of the web browser to clear flash cookies and to select a browsing history period to clear.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
44 | if index == 0: |
01812b281a1e
Extended the "Clear Private Data" dialog of the web browser to clear flash cookies and to select a browsing history period to clear.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
45 | # last hour |
01812b281a1e
Extended the "Clear Private Data" dialog of the web browser to clear flash cookies and to select a browsing history period to clear.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
46 | historyPeriod = 60 * 60 * 1000 |
01812b281a1e
Extended the "Clear Private Data" dialog of the web browser to clear flash cookies and to select a browsing history period to clear.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
47 | elif index == 1: |
01812b281a1e
Extended the "Clear Private Data" dialog of the web browser to clear flash cookies and to select a browsing history period to clear.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
48 | # last day |
01812b281a1e
Extended the "Clear Private Data" dialog of the web browser to clear flash cookies and to select a browsing history period to clear.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
49 | historyPeriod = 24 * 60 * 60 * 1000 |
01812b281a1e
Extended the "Clear Private Data" dialog of the web browser to clear flash cookies and to select a browsing history period to clear.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
50 | elif index == 2: |
01812b281a1e
Extended the "Clear Private Data" dialog of the web browser to clear flash cookies and to select a browsing history period to clear.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
51 | # last week |
01812b281a1e
Extended the "Clear Private Data" dialog of the web browser to clear flash cookies and to select a browsing history period to clear.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
52 | historyPeriod = 7 * 24 * 60 * 60 * 1000 |
01812b281a1e
Extended the "Clear Private Data" dialog of the web browser to clear flash cookies and to select a browsing history period to clear.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
53 | elif index == 3: |
01812b281a1e
Extended the "Clear Private Data" dialog of the web browser to clear flash cookies and to select a browsing history period to clear.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
54 | # last four weeks |
01812b281a1e
Extended the "Clear Private Data" dialog of the web browser to clear flash cookies and to select a browsing history period to clear.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
55 | historyPeriod = 4 * 7 * 24 * 60 * 60 * 1000 |
01812b281a1e
Extended the "Clear Private Data" dialog of the web browser to clear flash cookies and to select a browsing history period to clear.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
56 | elif index == 4: |
01812b281a1e
Extended the "Clear Private Data" dialog of the web browser to clear flash cookies and to select a browsing history period to clear.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
57 | # clear all |
01812b281a1e
Extended the "Clear Private Data" dialog of the web browser to clear flash cookies and to select a browsing history period to clear.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1509
diff
changeset
|
58 | historyPeriod = 0 |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
59 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
60 | return ( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
61 | self.historyCheckBox.isChecked(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
62 | self.searchCheckBox.isChecked(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
63 | self.iconsCheckBox.isChecked(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
64 | self.cacheCheckBox.isChecked(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
65 | self.cookiesCheckBox.isChecked(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
66 | self.passwordsCheckBox.isChecked(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
67 | self.downloadsCheckBox.isChecked(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
68 | self.zoomCheckBox.isChecked(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
69 | self.sslExceptionsCheckBox.isChecked(), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
70 | historyPeriod, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
71 | ) |