src/eric7/WebBrowser/WebBrowserClearPrivateDataDialog.py

Sat, 31 Dec 2022 16:23:21 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 31 Dec 2022 16:23:21 +0100
branch
eric7
changeset 9653
e67609152c5e
parent 9221
bf71ee032bb4
child 10436
f6881d10e995
permissions
-rw-r--r--

Updated copyright for 2023.

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
9653
e67609152c5e Updated copyright for 2023.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
3 # Copyright (c) 2009 - 2023 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
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 @param parent reference to the parent widget (QWidget)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
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
26 super().__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 self.setupUi(self)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
28
3366
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
29 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
30 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
31
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 def getData(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 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
35
2999
28c75409a78f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
36 @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
37 (browsing history, search history, favicons, disk cache, cookies,
8069
1176a936efa4 Web Browser: removed the Flash Cookie Manager because Flash is dead.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
38 passwords, web databases, downloads, zoom values, SSL
4819
cb0672f0fc15 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4741
diff changeset
39 certificate error exceptions) and the selected history period in
cb0672f0fc15 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4741
diff changeset
40 milliseconds (tuple of booleans and integer)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 """
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
42 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
43 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
44 # 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
45 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
46 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
47 # 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
48 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
49 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
50 # 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
51 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
52 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
53 # 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
54 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
55 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
56 # 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
57 historyPeriod = 0
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
58
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
59 return (
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
60 self.historyCheckBox.isChecked(),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
61 self.searchCheckBox.isChecked(),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
62 self.iconsCheckBox.isChecked(),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
63 self.cacheCheckBox.isChecked(),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
64 self.cookiesCheckBox.isChecked(),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
65 self.passwordsCheckBox.isChecked(),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
66 self.databasesCheckBox.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 )

eric ide

mercurial