WebBrowser/WebBrowserClearPrivateDataDialog.py

Sat, 31 Dec 2016 13:34:21 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 31 Dec 2016 13:34:21 +0100
changeset 5389
9b1c800daff3
parent 4819
cb0672f0fc15
child 6048
82ad8ec9548c
permissions
-rw-r--r--

Updated copyright for 2017.

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
5389
9b1c800daff3 Updated copyright for 2017.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4819
diff changeset
3 # Copyright (c) 2009 - 2017 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
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3057
diff changeset
10 from __future__ import unicode_literals
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
11
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3484
diff changeset
12 from PyQt5.QtWidgets import QDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
4741
f9e1adc69076 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
14 from .Ui_WebBrowserClearPrivateDataDialog import \
f9e1adc69076 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
15 Ui_WebBrowserClearPrivateDataDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
17
4741
f9e1adc69076 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
18 class WebBrowserClearPrivateDataDialog(QDialog,
f9e1adc69076 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
19 Ui_WebBrowserClearPrivateDataDialog):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 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
22 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
23 def __init__(self, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 @param parent reference to the parent widget (QWidget)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 """
4741
f9e1adc69076 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
29 super(WebBrowserClearPrivateDataDialog, self).__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 self.setupUi(self)
3366
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
31
6084bb3c3911 Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
32 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
33 self.resize(max(self.width(), msh.width()), msh.height())
0
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 def getData(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 Public method to get the data from the dialog.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
2999
28c75409a78f Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
39 @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
40 (browsing history, search history, favicons, disk cache, cookies,
4819
cb0672f0fc15 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4741
diff changeset
41 passwords, web databases, downloads, flash, zoom values, SSL
cb0672f0fc15 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4741
diff changeset
42 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
43 milliseconds (tuple of booleans and integer)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 """
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
45 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
46 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
47 # 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
48 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
49 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
50 # 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
51 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
52 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
53 # 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
54 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
55 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
56 # 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
57 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
58 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
59 # 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
60 historyPeriod = 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
61
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
62 return (self.historyCheckBox.isChecked(),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
63 self.searchCheckBox.isChecked(),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
64 self.iconsCheckBox.isChecked(),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
65 self.cacheCheckBox.isChecked(),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
66 self.cookiesCheckBox.isChecked(),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
67 self.passwordsCheckBox.isChecked(),
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
68 self.databasesCheckBox.isChecked(),
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
69 self.downloadsCheckBox.isChecked(),
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
70 self.flashCookiesCheckBox.isChecked(),
4612
c9982bcd00f8 Added capability to remember the zoom values for each site (incl. a dialog to manage these).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
71 self.zoomCheckBox.isChecked(),
4819
cb0672f0fc15 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4741
diff changeset
72 self.sslExceptionsCheckBox.isChecked(),
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
73 historyPeriod)

eric ide

mercurial