eric6/WebBrowser/FlashCookieManager/FlashCookieManagerDialog.py

Wed, 30 Dec 2020 11:00:44 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Dec 2020 11:00:44 +0100
branch
maintenance
changeset 7924
8a96736d465e
parent 7781
607a6098cb44
permissions
-rw-r--r--

Updated copyright for 2021.

4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7924
8a96736d465e Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7781
diff changeset
3 # Copyright (c) 2015 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to manage the flash cookies.
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 from PyQt5.QtCore import pyqtSlot, Qt, QPoint, QTimer
7268
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
11 from PyQt5.QtWidgets import (
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
12 QDialog, QTreeWidgetItem, QApplication, QMenu, QInputDialog, QLineEdit
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
13 )
4362
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
14
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
15 from E5Gui import E5MessageBox
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
16 from E5Gui.E5OverrideCursor import E5OverrideCursor
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 from .Ui_FlashCookieManagerDialog import Ui_FlashCookieManagerDialog
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 import Preferences
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 import UI.PixmapCache
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 class FlashCookieManagerDialog(QDialog, Ui_FlashCookieManagerDialog):
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 Class implementing a dialog to manage the flash cookies.
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 """
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 def __init__(self, manager, parent=None):
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 """
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 Constructor
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 @param manager reference to the Flash cookie manager object
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 @type FlashCookieManager
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 @param parent reference to the parent widget
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 @type QWidget
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 """
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 super(FlashCookieManagerDialog, self).__init__(parent)
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.setupUi(self)
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 self.setWindowFlags(Qt.Window)
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 self.cookiesList.setContextMenuPolicy(Qt.CustomContextMenu)
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.cookiesList.customContextMenuRequested.connect(
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 self.__cookiesListContextMenuRequested)
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.__manager = manager
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 @pyqtSlot()
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 def on_whiteList_itemSelectionChanged(self):
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 """
4362
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
50 Private slot handling the selection of items in the whitelist.
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 """
4362
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
52 enable = len(self.whiteList.selectedItems()) > 0
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
53 self.removeWhiteButton.setEnabled(enable)
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 @pyqtSlot()
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 def on_blackList_itemSelectionChanged(self):
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 """
4362
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
58 Private slot handling the selection of items in the blacklist.
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 """
4362
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
60 enable = len(self.blackList.selectedItems()) > 0
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
61 self.removeBlackButton.setEnabled(enable)
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 @pyqtSlot()
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 def on_removeWhiteButton_clicked(self):
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 """
4363
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
66 Private slot to remove a server from the whitelist.
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 """
4363
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
68 for itm in self.whiteList.selectedItems():
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
69 row = self.whiteList.row(itm)
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
70 self.whiteList.takeItem(row)
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
71 del itm
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 @pyqtSlot()
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 def on_addWhiteButton_clicked(self):
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 """
4363
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
76 Private slot to add a server to the whitelist.
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
77 """
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
78 origin, ok = QInputDialog.getText(
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
79 self,
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
80 self.tr("Add to whitelist"),
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
81 self.tr("Origin:"),
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
82 QLineEdit.Normal)
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
83 if ok and bool(origin):
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
84 self.__addWhitelist(origin)
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
85
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
86 def __addWhitelist(self, origin):
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
87 """
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
88 Private method to add a cookie origin to the whitelist.
4370
54dbb658f9e6 Corrected some code style issues and regenerated the source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4363
diff changeset
89
54dbb658f9e6 Corrected some code style issues and regenerated the source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4363
diff changeset
90 @param origin origin to be added to the list
54dbb658f9e6 Corrected some code style issues and regenerated the source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4363
diff changeset
91 @type str
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 """
4363
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
93 if not origin:
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
94 return
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
95
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
96 if len(self.blackList.findItems(origin, Qt.MatchFixedString)) > 0:
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
97 E5MessageBox.information(
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
98 self,
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
99 self.tr("Add to whitelist"),
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
100 self.tr("""The server '{0}' is already in the blacklist."""
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
101 """ Please remove it first.""").format(origin))
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
102 return
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
103
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
104 if len(self.whiteList.findItems(origin, Qt.MatchFixedString)) == 0:
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
105 self.whiteList.addItem(origin)
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 @pyqtSlot()
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 def on_removeBlackButton_clicked(self):
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 """
4363
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
110 Private slot to remove a server from the blacklist.
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 """
4363
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
112 for itm in self.blackList.selectedItems():
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
113 row = self.blackList.row(itm)
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
114 self.blackList.takeItem(row)
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
115 del itm
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 @pyqtSlot()
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 def on_addBlackButton_clicked(self):
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 """
4363
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
120 Private slot to add a server to the blacklist.
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
121 """
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
122 origin, ok = QInputDialog.getText(
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
123 self,
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
124 self.tr("Add to blacklist"),
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
125 self.tr("Origin:"),
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
126 QLineEdit.Normal)
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
127 if ok and bool(origin):
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
128 self.__addBlacklist(origin)
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
129
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
130 def __addBlacklist(self, origin):
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
131 """
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
132 Private method to add a cookie origin to the blacklist.
4370
54dbb658f9e6 Corrected some code style issues and regenerated the source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4363
diff changeset
133
54dbb658f9e6 Corrected some code style issues and regenerated the source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4363
diff changeset
134 @param origin origin to be added to the list
54dbb658f9e6 Corrected some code style issues and regenerated the source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4363
diff changeset
135 @type str
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 """
4363
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
137 if not origin:
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
138 return
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
139
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
140 if len(self.whiteList.findItems(origin, Qt.MatchFixedString)) > 0:
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
141 E5MessageBox.information(
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
142 self,
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
143 self.tr("Add to blacklist"),
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
144 self.tr("""The server '{0}' is already in the whitelist."""
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
145 """ Please remove it first.""").format(origin))
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
146 return
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
147
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
148 if len(self.blackList.findItems(origin, Qt.MatchFixedString)) == 0:
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
149 self.blackList.addItem(origin)
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 @pyqtSlot(str)
5605
1950fe1a32c4 Finished fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
152 def on_filterEdit_textChanged(self, filterStr):
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 """
4363
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
154 Private slot to filter the cookies list.
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
155
5605
1950fe1a32c4 Finished fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
156 @param filterStr filter text
4363
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
157 @type str
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 """
5605
1950fe1a32c4 Finished fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
159 if not filterStr:
4363
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
160 # show all in collapsed state
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
161 for index in range(self.cookiesList.topLevelItemCount()):
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
162 self.cookiesList.topLevelItem(index).setHidden(False)
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
163 self.cookiesList.topLevelItem(index).setExpanded(False)
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
164 else:
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
165 # show matching in expanded state
5605
1950fe1a32c4 Finished fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
166 filterStr = filterStr.lower()
4363
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
167 for index in range(self.cookiesList.topLevelItemCount()):
7268
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
168 txt = (
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
169 "." +
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
170 self.cookiesList.topLevelItem(index).text(0).lower()
a28338eaf694 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
171 )
4363
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
172 self.cookiesList.topLevelItem(index).setHidden(
5605
1950fe1a32c4 Finished fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
173 filterStr not in txt)
4363
c00061f670c7 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4362
diff changeset
174 self.cookiesList.topLevelItem(index).setExpanded(True)
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem)
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 def on_cookiesList_currentItemChanged(self, current, previous):
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 """
4362
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
179 Private slot handling a change of the current cookie item.
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
180
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
181 @param current reference to the current item
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
182 @type QTreeWidgetItem
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
183 @param previous reference to the previous item
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
184 @type QTreeWidgetItem
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 """
4362
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
186 if current is None:
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
187 self.removeButton.setEnabled(False)
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
188 return
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
189
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
190 cookie = current.data(0, Qt.UserRole)
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
191 if cookie is None:
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
192 self.nameLabel.setText(self.tr("<no flash cookie selected>"))
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
193 self.sizeLabel.setText(self.tr("<no flash cookie selected>"))
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
194 self.originLabel.setText(self.tr("<no flash cookie selected>"))
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
195 self.modifiedLabel.setText(self.tr("<no flash cookie selected>"))
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
196 self.contentsEdit.clear()
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
197 self.pathEdit.clear()
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
198 self.removeButton.setText(self.tr("Remove Cookie Group"))
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
199 else:
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
200 suffix = ""
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
201 if cookie.path.startswith(
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
202 self.__manager.flashPlayerDataPath() +
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
203 "/macromedia.com/support/flashplayer/sys"):
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
204 suffix = self.tr(" (settings)")
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
205 self.nameLabel.setText(
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
206 self.tr("{0}{1}", "name and suffix")
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
207 .format(cookie.name, suffix))
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
208 self.sizeLabel.setText(self.tr("{0} Byte").format(cookie.size))
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
209 self.originLabel.setText(cookie.origin)
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
210 self.modifiedLabel.setText(
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
211 cookie.lastModified.toString("yyyy-MM-dd hh:mm:ss"))
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
212 self.contentsEdit.setPlainText(cookie.contents)
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
213 self.pathEdit.setText(cookie.path)
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
214 self.removeButton.setText(self.tr("Remove Cookie"))
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
215 self.removeButton.setEnabled(True)
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 @pyqtSlot(QPoint)
4362
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
218 def __cookiesListContextMenuRequested(self, pos):
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
219 """
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
220 Private slot handling the cookies list context menu.
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
221
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
222 @param pos position to show the menu at
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
223 @type QPoint
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 """
4362
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
225 itm = self.cookiesList.itemAt(pos)
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
226 if itm is None:
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
227 return
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
228
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
229 menu = QMenu()
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
230 addBlacklistAct = menu.addAction(self.tr("Add to blacklist"))
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
231 addWhitelistAct = menu.addAction(self.tr("Add to whitelist"))
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
232
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
233 self.cookiesList.setCurrentItem(itm)
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
234
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
235 activatedAction = menu.exec(
4362
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
236 self.cookiesList.viewport().mapToGlobal(pos))
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
237 if itm.childCount() == 0:
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
238 origin = itm.data(0, Qt.UserRole).origin
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
239 else:
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
240 origin = itm.text(0)
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
241
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
242 if activatedAction == addBlacklistAct:
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
243 self.__addBlacklist(origin)
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
244 elif activatedAction == addWhitelistAct:
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
245 self.__addWhitelist(origin)
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 @pyqtSlot()
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 def on_reloadButton_clicked(self):
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 """
4362
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
250 Private slot handling a press of the reload button.
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 """
4362
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
252 self.refreshView(True)
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 @pyqtSlot()
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 def on_removeAllButton_clicked(self):
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 """
4362
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
257 Private slot to remove all cookies.
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 """
4362
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
259 ok = E5MessageBox.yesNo(
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
260 self,
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
261 self.tr("Remove All"),
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
262 self.tr("""Do you really want to delete all flash cookies on"""
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
263 """ your computer?"""))
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
264 if ok:
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
265 cookies = self.__manager.flashCookies()
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
266 for cookie in cookies:
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
267 self.__manager.removeCookie(cookie)
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
268
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
269 self.cookiesList.clear()
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
270 self.__manager.clearNewOrigins()
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
271 self.__manager.clearCache()
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 @pyqtSlot()
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 def on_removeButton_clicked(self):
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 """
4362
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
276 Private slot to remove one cookie or a cookie group.
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 """
4362
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
278 itm = self.cookiesList.currentItem()
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
279 if itm is None:
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
280 return
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
281
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
282 cookie = itm.data(0, Qt.UserRole)
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
283 if cookie is None:
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
284 # remove a whole cookie group
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
285 origin = itm.text(0)
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
286 cookieList = self.__manager.flashCookies()
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
287 for fcookie in cookieList:
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
288 if fcookie.origin == origin:
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
289 self.__manager.removeCookie(fcookie)
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
290
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
291 index = self.cookiesList.indexOfTopLevelItem(itm)
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
292 self.cookiesList.takeTopLevelItem(index)
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
293 else:
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
294 self.__manager.removeCookie(cookie)
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
295 parent = itm.parent()
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
296 index = parent.indexOfChild(itm)
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
297 parent.takeChild(index)
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
298
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
299 if parent.childCount() == 0:
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
300 # remove origin item as well
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
301 index = self.cookiesList.indexOfTopLevelItem(parent)
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
302 self.cookiesList.takeTopLevelItem(index)
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
303 del parent
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
304 del itm
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 def refreshView(self, forceReload=False):
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 """
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 Public method to refresh the dialog view.
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 @param forceReload flag indicating to reload the cookies
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311 @type bool
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312 """
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 blocked = self.filterEdit.blockSignals(True)
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 self.filterEdit.clear()
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 self.contentsEdit.clear()
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 self.filterEdit.blockSignals(blocked)
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 if forceReload:
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 self.__manager.clearCache()
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 self.__manager.clearNewOrigins()
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 QTimer.singleShot(0, self.__refreshCookiesList)
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 QTimer.singleShot(0, self.__refreshFilterLists)
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 def showPage(self, index):
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 """
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 Public method to display a given page.
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 @param index index of the page to be shown
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 @type int
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 """
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 self.cookiesTabWidget.setCurrentIndex(index)
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 @pyqtSlot()
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 def __refreshCookiesList(self):
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 """
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 Private slot to refresh the cookies list.
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 """
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
339 with E5OverrideCursor():
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
340 cookies = self.__manager.flashCookies()
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
341 self.cookiesList.clear()
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
342
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
343 counter = 0
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
344 originDict = {}
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
345 for cookie in cookies:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
346 cookieOrigin = cookie.origin
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
347 if cookieOrigin.startswith("."):
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
348 cookieOrigin = cookieOrigin[1:]
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
349
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
350 if cookieOrigin in originDict:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
351 itm = QTreeWidgetItem(originDict[cookieOrigin])
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
352 else:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
353 newParent = QTreeWidgetItem(self.cookiesList)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
354 newParent.setText(0, cookieOrigin)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
355 newParent.setIcon(0, UI.PixmapCache.getIcon("dirOpen"))
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
356 self.cookiesList.addTopLevelItem(newParent)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
357 originDict[cookieOrigin] = newParent
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
358
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
359 itm = QTreeWidgetItem(newParent)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
360
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
361 suffix = ""
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
362 if cookie.path.startswith(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
363 self.__manager.flashPlayerDataPath() +
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
364 "/macromedia.com/support/flashplayer/sys"):
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
365 suffix = self.tr(" (settings)")
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
366
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
367 if cookie.path + "/" + cookie.name in (
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
368 self.__manager.newCookiesList()
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
369 ):
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
370 suffix += self.tr(" [new]")
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
371 font = itm.font(0)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
372 font.setBold(True)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
373 itm.setFont(font)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
374 itm.parent().setExpanded(True)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
375
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
376 itm.setText(0, self.tr("{0}{1}", "name and suffix").format(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
377 cookie.name, suffix))
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
378 itm.setData(0, Qt.UserRole, cookie)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
379
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
380 counter += 1
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
381 if counter > 100:
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
382 QApplication.processEvents()
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
383 counter = 0
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384
7771
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
385 self.removeAllButton.setEnabled(
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
386 self.cookiesList.topLevelItemCount() > 0)
787a6b3f8c9f Optimized the use of Waiting Cursors by using a specialized context manager class.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7759
diff changeset
387 self.removeButton.setEnabled(False)
4361
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
388
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389 @pyqtSlot()
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390 def __refreshFilterLists(self):
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391 """
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392 Private slot to refresh the white and black lists.
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 """
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 self.whiteList.clear()
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
395 self.blackList.clear()
9eec3a532d59 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
396
4752
a3bcc42a82a9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4751
diff changeset
397 self.whiteList.addItems(
a3bcc42a82a9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4751
diff changeset
398 Preferences.getWebBrowser("FlashCookiesWhitelist"))
a3bcc42a82a9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4751
diff changeset
399 self.blackList.addItems(
a3bcc42a82a9 Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4751
diff changeset
400 Preferences.getWebBrowser("FlashCookiesBlacklist"))
4362
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
401
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
402 self.on_whiteList_itemSelectionChanged()
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
403 self.on_blackList_itemSelectionChanged()
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
404
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
405 def closeEvent(self, evt):
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
406 """
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
407 Protected method to handle the close event.
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
408
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
409 @param evt reference to the close event
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
410 @type QCloseEvent
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
411 """
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
412 self.__manager.clearNewOrigins()
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
413
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
414 whiteList = []
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
415 for row in range(self.whiteList.count()):
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
416 whiteList.append(self.whiteList.item(row).text())
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
417
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
418 blackList = []
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
419 for row in range(self.blackList.count()):
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
420 blackList.append(self.blackList.item(row).text())
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
421
4768
57da9217196b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4752
diff changeset
422 Preferences.setWebBrowser("FlashCookiesWhitelist", whiteList)
57da9217196b Continued porting the web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4752
diff changeset
423 Preferences.setWebBrowser("FlashCookiesBlacklist", blackList)
4362
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
424
1a171c85b275 Continued adding code for a Flash cookie manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4361
diff changeset
425 evt.accept()

eric ide

mercurial