eric6/Helpviewer/HelpClearPrivateDataDialog.py

branch
maintenance
changeset 6989
8b8cadf8d7e9
parent 6942
2602857055c5
equal deleted inserted replaced
6938:7926553b7509 6989:8b8cadf8d7e9
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2009 - 2019 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 __future__ import unicode_literals
11
12 from PyQt5.QtWidgets import QDialog
13
14 from .Ui_HelpClearPrivateDataDialog import Ui_HelpClearPrivateDataDialog
15
16
17 class HelpClearPrivateDataDialog(QDialog, Ui_HelpClearPrivateDataDialog):
18 """
19 Class implementing a dialog to select which private data to clear.
20 """
21 def __init__(self, parent=None):
22 """
23 Constructor
24
25 @param parent reference to the parent widget (QWidget)
26 """
27 super(HelpClearPrivateDataDialog, self).__init__(parent)
28 self.setupUi(self)
29
30 msh = self.minimumSizeHint()
31 self.resize(max(self.width(), msh.width()), msh.height())
32
33 def getData(self):
34 """
35 Public method to get the data from the dialog.
36
37 @return tuple with flags indicating which data to clear
38 (browsing history, search history, favicons, disk cache, cookies,
39 passwords, web databases, downloads, flash, zoom values) and the
40 selected history period in milliseconds (tuple of booleans and
41 integer)
42 """
43 index = self.historyCombo.currentIndex()
44 if index == 0:
45 # last hour
46 historyPeriod = 60 * 60 * 1000
47 elif index == 1:
48 # last day
49 historyPeriod = 24 * 60 * 60 * 1000
50 elif index == 2:
51 # last week
52 historyPeriod = 7 * 24 * 60 * 60 * 1000
53 elif index == 3:
54 # last four weeks
55 historyPeriod = 4 * 7 * 24 * 60 * 60 * 1000
56 elif index == 4:
57 # clear all
58 historyPeriod = 0
59
60 return (self.historyCheckBox.isChecked(),
61 self.searchCheckBox.isChecked(),
62 self.iconsCheckBox.isChecked(),
63 self.cacheCheckBox.isChecked(),
64 self.cookiesCheckBox.isChecked(),
65 self.passwordsCheckBox.isChecked(),
66 self.databasesCheckBox.isChecked(),
67 self.downloadsCheckBox.isChecked(),
68 self.flashCookiesCheckBox.isChecked(),
69 self.zoomCheckBox.isChecked(),
70 historyPeriod)

eric ide

mercurial