Helpviewer/HelpClearPrivateDataDialog.py

Sun, 08 Dec 2013 12:26:22 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 08 Dec 2013 12:26:22 +0100
branch
5_3_x
changeset 3133
95f357148982
parent 2302
f29e9405c851
child 2525
8b507a9a2d40
child 2999
28c75409a78f
child 3163
9f50365a0870
permissions
-rw-r--r--

Prepared new stable release.

# -*- coding: utf-8 -*-

# Copyright (c) 2009 - 2013 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing a dialog to select which private data to clear.
"""

from PyQt4.QtGui import QDialog

from .Ui_HelpClearPrivateDataDialog import Ui_HelpClearPrivateDataDialog


class HelpClearPrivateDataDialog(QDialog, Ui_HelpClearPrivateDataDialog):
    """
    Class implementing a dialog to select which private data to clear.
    """
    def __init__(self, parent=None):
        """
        Constructor
        
        @param parent reference to the parent widget (QWidget)
        """
        super().__init__(parent)
        self.setupUi(self)
    
    def getData(self):
        """
        Public method to get the data from the dialog.
        
        @return tuple with flags indicating which data to clear (browsing history,
            search history, favicons, disk cache, cookies, passwords, web
            databases, downloads, flash) and the selected history period in milliseconds
            (tuple of booleans and integer)
        """
        index = self.historyCombo.currentIndex()
        if index == 0:
            # last hour
            historyPeriod = 60 * 60 * 1000
        elif index == 1:
            # last day
            historyPeriod = 24 * 60 * 60 * 1000
        elif index == 2:
            # last week
            historyPeriod = 7 * 24 * 60 * 60 * 1000
        elif index == 3:
            # last four weeks
            historyPeriod = 4 * 7 * 24 * 60 * 60 * 1000
        elif index == 4:
            # clear all
            historyPeriod = 0
        
        return (self.historyCheckBox.isChecked(),
                self.searchCheckBox.isChecked(),
                self.iconsCheckBox.isChecked(),
                self.cacheCheckBox.isChecked(),
                self.cookiesCheckBox.isChecked(),
                self.passwordsCheckBox.isChecked(),
                self.databasesCheckBox.isChecked(),
                self.downloadsCheckBox.isChecked(),
                self.flashCookiesCheckBox.isChecked(),
                historyPeriod)

eric ide

mercurial