90 @pyqtSlot(str) |
92 @pyqtSlot(str) |
91 def on_filterEdit_textChanged(self, p0): |
93 def on_filterEdit_textChanged(self, p0): |
92 """ |
94 """ |
93 Slot documentation goes here. |
95 Slot documentation goes here. |
94 """ |
96 """ |
|
97 return |
95 # TODO: not implemented yet |
98 # TODO: not implemented yet |
96 raise NotImplementedError |
99 raise NotImplementedError |
97 |
100 |
98 @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem) |
101 @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem) |
99 def on_cookiesList_currentItemChanged(self, current, previous): |
102 def on_cookiesList_currentItemChanged(self, current, previous): |
100 """ |
103 """ |
101 Slot documentation goes here. |
104 Private slot handling a change of the current cookie item. |
102 """ |
105 |
103 # TODO: not implemented yet |
106 @param current reference to the current item |
104 raise NotImplementedError |
107 @type QTreeWidgetItem |
105 |
108 @param previous reference to the previous item |
106 @pyqtSlot() |
109 @type QTreeWidgetItem |
107 def on_cookiesList_itemSelectionChanged(self): |
110 """ |
108 """ |
111 if current is None: |
109 Slot documentation goes here. |
112 self.removeButton.setEnabled(False) |
110 """ |
113 return |
111 # TODO: not implemented yet |
114 |
112 raise NotImplementedError |
115 cookie = current.data(0, Qt.UserRole) |
|
116 if cookie is None: |
|
117 self.nameLabel.setText(self.tr("<no flash cookie selected>")) |
|
118 self.sizeLabel.setText(self.tr("<no flash cookie selected>")) |
|
119 self.originLabel.setText(self.tr("<no flash cookie selected>")) |
|
120 self.modifiedLabel.setText(self.tr("<no flash cookie selected>")) |
|
121 self.contentsEdit.clear() |
|
122 self.pathEdit.clear() |
|
123 self.removeButton.setText(self.tr("Remove Cookie Group")) |
|
124 else: |
|
125 suffix = "" |
|
126 if cookie.path.startswith( |
|
127 self.__manager.flashPlayerDataPath() + |
|
128 "/macromedia.com/support/flashplayer/sys"): |
|
129 suffix = self.tr(" (settings)") |
|
130 self.nameLabel.setText( |
|
131 self.tr("{0}{1}", "name and suffix") |
|
132 .format(cookie.name, suffix)) |
|
133 self.sizeLabel.setText(self.tr("{0} Byte").format(cookie.size)) |
|
134 self.originLabel.setText(cookie.origin) |
|
135 self.modifiedLabel.setText( |
|
136 cookie.lastModified.toString("yyyy-MM-dd hh:mm:ss")) |
|
137 self.contentsEdit.setPlainText(cookie.contents) |
|
138 self.pathEdit.setText(cookie.path) |
|
139 self.removeButton.setText(self.tr("Remove Cookie")) |
|
140 self.removeButton.setEnabled(True) |
113 |
141 |
114 @pyqtSlot(QPoint) |
142 @pyqtSlot(QPoint) |
115 def __cookiesListContextMenuRequested(self, point): |
143 def __cookiesListContextMenuRequested(self, pos): |
116 """ |
144 """ |
117 Slot documentation goes here. |
145 Private slot handling the cookies list context menu. |
118 """ |
146 |
119 # TODO: not implemented yet |
147 @param pos position to show the menu at |
120 raise NotImplementedError |
148 @type QPoint |
|
149 """ |
|
150 itm = self.cookiesList.itemAt(pos) |
|
151 if itm is None: |
|
152 return |
|
153 |
|
154 menu = QMenu() |
|
155 addBlacklistAct = menu.addAction(self.tr("Add to blacklist")) |
|
156 addWhitelistAct = menu.addAction(self.tr("Add to whitelist")) |
|
157 |
|
158 self.cookiesList.setCurrentItem(itm) |
|
159 |
|
160 activatedAction = menu.exec_( |
|
161 self.cookiesList.viewport().mapToGlobal(pos)) |
|
162 if itm.childCount() == 0: |
|
163 origin = itm.data(0, Qt.UserRole).origin |
|
164 else: |
|
165 origin = itm.text(0) |
|
166 |
|
167 if activatedAction == addBlacklistAct: |
|
168 self.__addBlacklist(origin) |
|
169 elif activatedAction == addWhitelistAct: |
|
170 self.__addWhitelist(origin) |
121 |
171 |
122 @pyqtSlot() |
172 @pyqtSlot() |
123 def on_reloadButton_clicked(self): |
173 def on_reloadButton_clicked(self): |
124 """ |
174 """ |
125 Slot documentation goes here. |
175 Private slot handling a press of the reload button. |
126 """ |
176 """ |
127 # TODO: not implemented yet |
177 self.refreshView(True) |
128 raise NotImplementedError |
|
129 |
178 |
130 @pyqtSlot() |
179 @pyqtSlot() |
131 def on_removeAllButton_clicked(self): |
180 def on_removeAllButton_clicked(self): |
132 """ |
181 """ |
133 Slot documentation goes here. |
182 Private slot to remove all cookies. |
134 """ |
183 """ |
135 # TODO: not implemented yet |
184 ok = E5MessageBox.yesNo( |
136 raise NotImplementedError |
185 self, |
|
186 self.tr("Remove All"), |
|
187 self.tr("""Do you really want to delete all flash cookies on""" |
|
188 """ your computer?""")) |
|
189 if ok: |
|
190 cookies = self.__manager.flashCookies() |
|
191 for cookie in cookies: |
|
192 self.__manager.removeCookie(cookie) |
|
193 |
|
194 self.cookiesList.clear() |
|
195 self.__manager.clearNewOrigins() |
|
196 self.__manager.clearCache() |
137 |
197 |
138 @pyqtSlot() |
198 @pyqtSlot() |
139 def on_removeButton_clicked(self): |
199 def on_removeButton_clicked(self): |
140 """ |
200 """ |
141 Slot documentation goes here. |
201 Private slot to remove one cookie or a cookie group. |
142 """ |
202 """ |
143 # TODO: not implemented yet |
203 itm = self.cookiesList.currentItem() |
144 raise NotImplementedError |
204 if itm is None: |
|
205 return |
|
206 |
|
207 cookie = itm.data(0, Qt.UserRole) |
|
208 if cookie is None: |
|
209 # remove a whole cookie group |
|
210 origin = itm.text(0) |
|
211 cookieList = self.__manager.flashCookies() |
|
212 for fcookie in cookieList: |
|
213 if fcookie.origin == origin: |
|
214 self.__manager.removeCookie(fcookie) |
|
215 |
|
216 index = self.cookiesList.indexOfTopLevelItem(itm) |
|
217 self.cookiesList.takeTopLevelItem(index) |
|
218 else: |
|
219 self.__manager.removeCookie(cookie) |
|
220 parent = itm.parent() |
|
221 index = parent.indexOfChild(itm) |
|
222 parent.takeChild(index) |
|
223 |
|
224 if parent.childCount() == 0: |
|
225 # remove origin item as well |
|
226 index = self.cookiesList.indexOfTopLevelItem(parent) |
|
227 self.cookiesList.takeTopLevelItem(index) |
|
228 del parent |
|
229 del itm |
145 |
230 |
146 def refreshView(self, forceReload=False): |
231 def refreshView(self, forceReload=False): |
147 """ |
232 """ |
148 Public method to refresh the dialog view. |
233 Public method to refresh the dialog view. |
149 |
234 |