eric7/WebBrowser/WebBrowserClearPrivateDataDialog.py

branch
eric7
changeset 8312
800c432b34c8
parent 8218
7c09585bd960
child 8318
962bce857696
equal deleted inserted replaced
8311:4e8b98454baa 8312:800c432b34c8
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2009 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to select which private data to clear.
8 """
9
10 from PyQt5.QtWidgets import QDialog
11
12 from .Ui_WebBrowserClearPrivateDataDialog import (
13 Ui_WebBrowserClearPrivateDataDialog
14 )
15
16
17 class WebBrowserClearPrivateDataDialog(QDialog,
18 Ui_WebBrowserClearPrivateDataDialog):
19 """
20 Class implementing a dialog to select which private data to clear.
21 """
22 def __init__(self, parent=None):
23 """
24 Constructor
25
26 @param parent reference to the parent widget (QWidget)
27 """
28 super().__init__(parent)
29 self.setupUi(self)
30
31 msh = self.minimumSizeHint()
32 self.resize(max(self.width(), msh.width()), msh.height())
33
34 def getData(self):
35 """
36 Public method to get the data from the dialog.
37
38 @return tuple with flags indicating which data to clear
39 (browsing history, search history, favicons, disk cache, cookies,
40 passwords, web databases, downloads, zoom values, SSL
41 certificate error exceptions) and the selected history period in
42 milliseconds (tuple of booleans and integer)
43 """
44 index = self.historyCombo.currentIndex()
45 if index == 0:
46 # last hour
47 historyPeriod = 60 * 60 * 1000
48 elif index == 1:
49 # last day
50 historyPeriod = 24 * 60 * 60 * 1000
51 elif index == 2:
52 # last week
53 historyPeriod = 7 * 24 * 60 * 60 * 1000
54 elif index == 3:
55 # last four weeks
56 historyPeriod = 4 * 7 * 24 * 60 * 60 * 1000
57 elif index == 4:
58 # clear all
59 historyPeriod = 0
60
61 return (self.historyCheckBox.isChecked(),
62 self.searchCheckBox.isChecked(),
63 self.iconsCheckBox.isChecked(),
64 self.cacheCheckBox.isChecked(),
65 self.cookiesCheckBox.isChecked(),
66 self.passwordsCheckBox.isChecked(),
67 self.databasesCheckBox.isChecked(),
68 self.downloadsCheckBox.isChecked(),
69 self.zoomCheckBox.isChecked(),
70 self.sslExceptionsCheckBox.isChecked(),
71 historyPeriod)

eric ide

mercurial