334 @pyqtSlot() |
335 @pyqtSlot() |
335 def __refreshCookiesList(self): |
336 def __refreshCookiesList(self): |
336 """ |
337 """ |
337 Private slot to refresh the cookies list. |
338 Private slot to refresh the cookies list. |
338 """ |
339 """ |
339 QApplication.setOverrideCursor(Qt.WaitCursor) |
340 with E5OverrideCursor(): |
340 |
341 cookies = self.__manager.flashCookies() |
341 cookies = self.__manager.flashCookies() |
342 self.cookiesList.clear() |
342 self.cookiesList.clear() |
|
343 |
|
344 counter = 0 |
|
345 originDict = {} |
|
346 for cookie in cookies: |
|
347 cookieOrigin = cookie.origin |
|
348 if cookieOrigin.startswith("."): |
|
349 cookieOrigin = cookieOrigin[1:] |
|
350 |
343 |
351 if cookieOrigin in originDict: |
344 counter = 0 |
352 itm = QTreeWidgetItem(originDict[cookieOrigin]) |
345 originDict = {} |
353 else: |
346 for cookie in cookies: |
354 newParent = QTreeWidgetItem(self.cookiesList) |
347 cookieOrigin = cookie.origin |
355 newParent.setText(0, cookieOrigin) |
348 if cookieOrigin.startswith("."): |
356 newParent.setIcon(0, UI.PixmapCache.getIcon("dirOpen")) |
349 cookieOrigin = cookieOrigin[1:] |
357 self.cookiesList.addTopLevelItem(newParent) |
|
358 originDict[cookieOrigin] = newParent |
|
359 |
350 |
360 itm = QTreeWidgetItem(newParent) |
351 if cookieOrigin in originDict: |
|
352 itm = QTreeWidgetItem(originDict[cookieOrigin]) |
|
353 else: |
|
354 newParent = QTreeWidgetItem(self.cookiesList) |
|
355 newParent.setText(0, cookieOrigin) |
|
356 newParent.setIcon(0, UI.PixmapCache.getIcon("dirOpen")) |
|
357 self.cookiesList.addTopLevelItem(newParent) |
|
358 originDict[cookieOrigin] = newParent |
|
359 |
|
360 itm = QTreeWidgetItem(newParent) |
|
361 |
|
362 suffix = "" |
|
363 if cookie.path.startswith( |
|
364 self.__manager.flashPlayerDataPath() + |
|
365 "/macromedia.com/support/flashplayer/sys"): |
|
366 suffix = self.tr(" (settings)") |
|
367 |
|
368 if cookie.path + "/" + cookie.name in ( |
|
369 self.__manager.newCookiesList() |
|
370 ): |
|
371 suffix += self.tr(" [new]") |
|
372 font = itm.font(0) |
|
373 font.setBold(True) |
|
374 itm.setFont(font) |
|
375 itm.parent().setExpanded(True) |
|
376 |
|
377 itm.setText(0, self.tr("{0}{1}", "name and suffix").format( |
|
378 cookie.name, suffix)) |
|
379 itm.setData(0, Qt.UserRole, cookie) |
|
380 |
|
381 counter += 1 |
|
382 if counter > 100: |
|
383 QApplication.processEvents() |
|
384 counter = 0 |
361 |
385 |
362 suffix = "" |
386 self.removeAllButton.setEnabled( |
363 if cookie.path.startswith( |
387 self.cookiesList.topLevelItemCount() > 0) |
364 self.__manager.flashPlayerDataPath() + |
388 self.removeButton.setEnabled(False) |
365 "/macromedia.com/support/flashplayer/sys"): |
|
366 suffix = self.tr(" (settings)") |
|
367 |
|
368 if cookie.path + "/" + cookie.name in ( |
|
369 self.__manager.newCookiesList() |
|
370 ): |
|
371 suffix += self.tr(" [new]") |
|
372 font = itm.font(0) |
|
373 font.setBold(True) |
|
374 itm.setFont(font) |
|
375 itm.parent().setExpanded(True) |
|
376 |
|
377 itm.setText(0, self.tr("{0}{1}", "name and suffix").format( |
|
378 cookie.name, suffix)) |
|
379 itm.setData(0, Qt.UserRole, cookie) |
|
380 |
|
381 counter += 1 |
|
382 if counter > 100: |
|
383 QApplication.processEvents() |
|
384 counter = 0 |
|
385 |
|
386 self.removeAllButton.setEnabled( |
|
387 self.cookiesList.topLevelItemCount() > 0) |
|
388 self.removeButton.setEnabled(False) |
|
389 |
|
390 QApplication.restoreOverrideCursor() |
|
391 |
389 |
392 @pyqtSlot() |
390 @pyqtSlot() |
393 def __refreshFilterLists(self): |
391 def __refreshFilterLists(self): |
394 """ |
392 """ |
395 Private slot to refresh the white and black lists. |
393 Private slot to refresh the white and black lists. |