Sun, 10 Jul 2016 19:41:24 +0200
Started to rework the cookies dialog of the new web browser.
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
4631
5c1a96925da4
Updated copyright for 2016.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4021
diff
changeset
|
3 | # Copyright (c) 2009 - 2016 Detlev Offenbach <detlev@die-offenbachs.de> |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing a dialog to show all cookies. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
3145
a9de05d4a22f
# __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3057
diff
changeset
|
10 | from __future__ import unicode_literals |
2525
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2403
diff
changeset
|
11 | |
3656
441956d8fce5
Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3484
diff
changeset
|
12 | from PyQt5.QtCore import pyqtSlot, Qt, QDateTime, QByteArray, \ |
441956d8fce5
Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3484
diff
changeset
|
13 | QSortFilterProxyModel |
441956d8fce5
Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3484
diff
changeset
|
14 | from PyQt5.QtGui import QFont, QFontMetrics |
5029
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
15 | from PyQt5.QtWidgets import QDialog, QTreeWidgetItem |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | |
5029
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
17 | ##from .CookieModel import CookieModel |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
18 | ## |
12
1d8dd9706f46
First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7
diff
changeset
|
19 | from .Ui_CookiesDialog import Ui_CookiesDialog |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
21 | |
5029
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
22 | # TODO: Change dialog to use a QTreeWidget and show cookie data on bottom of dialog |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
23 | # TODO: Remove CookieModel, CookieDetailsDialog and related files |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | class CookiesDialog(QDialog, Ui_CookiesDialog): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | Class implementing a dialog to show all cookies. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | """ |
5029
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
28 | DomainRole = Qt.UserRole + 1 |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
29 | CookieRole = Qt.UserRole + 2 |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
30 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
31 | def __init__(self, cookieJar, parent=None): |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | Constructor |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | @param cookieJar reference to the cookie jar (CookieJar) |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | @param parent reference to the parent widget (QWidget) |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
37 | """ |
2525
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2403
diff
changeset
|
38 | super(CookiesDialog, self).__init__(parent) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | self.setupUi(self) |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
41 | self.addButton.setEnabled(False) |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
43 | self.__cookieJar = cookieJar |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
44 | |
5029
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
45 | self.__domainDict = {} |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
46 | ## self.__itemDict = {} # TODO: Maybe get rid of this |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
47 | |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
48 | for cookie in self.__cookieJar.cookies(): |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
49 | self.__addCookie(cookie) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
50 | |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
51 | def __cookieDomain(self, cookie): |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
52 | """ |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
53 | Private method to extract the cookie domain. |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
54 | |
5029
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
55 | @param cookie cookie to get the domain from |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
56 | @type QNetworkCookie |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
57 | @return domain of the cookie |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
58 | @rtype str |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
59 | """ |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
60 | domain = cookie.domain() |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
61 | if domain.startswith("."): |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
62 | domain = domain[1:] |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
63 | return domain |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
64 | |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
65 | def __addCookie(self, cookie): |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
66 | """ |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
67 | Private method to add a cookie to the tree. |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
68 | |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
69 | @param cookie reference to the cookie |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
70 | @type QNetworkCookie |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
71 | """ |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
72 | domain = self.__cookieDomain(cookie) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
73 | if domain in self.__domainDict: |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
74 | itm = QTreeWidgetItem(self.__domainDict[domain]) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
75 | else: |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
76 | newParent = QTreeWidgetItem(self.cookiesTree) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
77 | newParent.setText(0, domain) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
78 | newParent.setData(0, self.DomainRole, cookie.domain()) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
79 | self.__domainDict[domain] = newParent |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
80 | |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
81 | itm = QTreeWidgetItem(newParent) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
82 | |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
83 | itm.setText(0, cookie.domain()) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
84 | itm.setText(1, bytes(cookie.name()).decode()) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
85 | itm.setData(0, self.CookieRole, cookie) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
86 | |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
87 | ## self.__itemDict[itm] = cookie |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
88 | |
5029
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
89 | ## self.removeButton.clicked.connect(self.cookiesTable.removeSelected) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
90 | ## self.removeAllButton.clicked.connect(self.cookiesTable.removeAll) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
91 | ## |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
92 | ## self.cookiesTable.verticalHeader().hide() |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
93 | ## model = CookieModel(cookieJar, self) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
94 | ## self.__proxyModel = QSortFilterProxyModel(self) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
95 | ## self.__proxyModel.setSourceModel(model) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
96 | ## self.searchEdit.textChanged.connect( |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
97 | ## self.__proxyModel.setFilterFixedString) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
98 | ## self.cookiesTable.setModel(self.__proxyModel) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
99 | ## self.cookiesTable.doubleClicked.connect(self.__showCookieDetails) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
100 | ## self.cookiesTable.selectionModel().selectionChanged.connect( |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
101 | ## self.__tableSelectionChanged) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
102 | ## self.cookiesTable.model().modelReset.connect(self.__tableModelReset) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
103 | ## |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
104 | ## fm = QFontMetrics(QFont()) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
105 | ## height = fm.height() + fm.height() // 3 |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
106 | ## self.cookiesTable.verticalHeader().setDefaultSectionSize(height) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
107 | ## self.cookiesTable.verticalHeader().setMinimumSectionSize(-1) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
108 | ## for section in range(model.columnCount()): |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
109 | ## header = self.cookiesTable.horizontalHeader()\ |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
110 | ## .sectionSizeHint(section) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
111 | ## if section == 0: |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
112 | ## header = fm.width("averagebiglonghost.averagedomain.info") |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
113 | ## elif section == 1: |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
114 | ## header = fm.width("_session_id") |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
115 | ## elif section == 4: |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
116 | ## header = fm.width( |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
117 | ## QDateTime.currentDateTime().toString(Qt.LocalDate)) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
118 | ## buffer = fm.width("mm") |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
119 | ## header += buffer |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
120 | ## self.cookiesTable.horizontalHeader().resizeSection(section, header) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
121 | ## self.cookiesTable.horizontalHeader().setStretchLastSection(True) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
122 | ## self.cookiesTable.model().sort( |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
123 | ## self.cookiesTable.horizontalHeader().sortIndicatorSection(), |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
124 | ## Qt.AscendingOrder) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
125 | ## |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
126 | ## self.__detailsDialog = None |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
127 | ## |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
128 | ## def __showCookieDetails(self, index): |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
129 | ## """ |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
130 | ## Private slot to show a dialog with the cookie details. |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
131 | ## |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
132 | ## @param index index of the entry to show (QModelIndex) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
133 | ## """ |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
134 | ## if not index.isValid(): |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
135 | ## return |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
136 | ## |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
137 | ## cookiesTable = self.sender() |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
138 | ## if cookiesTable is None: |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
139 | ## return |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
140 | ## |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
141 | ## model = cookiesTable.model() |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
142 | ## row = index.row() |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
143 | ## |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
144 | ## domain = model.data(model.index(row, 0)) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
145 | ## name = model.data(model.index(row, 1)) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
146 | ## path = model.data(model.index(row, 2)) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
147 | ## secure = model.data(model.index(row, 3)) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
148 | ## expires = model.data(model.index(row, 4)).toString("yyyy-MM-dd hh:mm") |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
149 | ## data = model.data(model.index(row, 5)) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
150 | ## if data is None: |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
151 | ## value = "" |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
152 | ## else: |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
153 | ## value = bytes(QByteArray.fromPercentEncoding(data)).decode() |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
154 | ## |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
155 | ## if self.__detailsDialog is None: |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
156 | ## from .CookieDetailsDialog import CookieDetailsDialog |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
157 | ## self.__detailsDialog = CookieDetailsDialog(self) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
158 | ## self.__detailsDialog.setData(domain, name, path, secure, expires, |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
159 | ## value) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
160 | ## self.__detailsDialog.show() |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
161 | |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
162 | @pyqtSlot() |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
163 | def on_addButton_clicked(self): |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
164 | """ |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
165 | Private slot to add a new exception. |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
166 | """ |
5029
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
167 | # TODO: change this |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
168 | ## selection = self.cookiesTable.selectionModel().selectedRows() |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
169 | ## if len(selection) == 0: |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
170 | ## return |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
171 | ## |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
172 | ## from .CookiesExceptionsDialog import CookiesExceptionsDialog |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
173 | ## |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
174 | ## firstSelected = selection[0] |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
175 | ## domainSelection = firstSelected.sibling(firstSelected.row(), 0) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
176 | ## domain = self.__proxyModel.data(domainSelection, Qt.DisplayRole) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
177 | ## dlg = CookiesExceptionsDialog(self.__cookieJar, self) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
178 | ## dlg.setDomainName(domain) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
179 | ## dlg.exec_() |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
180 | ## |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
181 | ## def __tableSelectionChanged(self, selected, deselected): |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
182 | ## """ |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
183 | ## Private slot to handle a change of selected items. |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
184 | ## |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
185 | ## @param selected selected indexes (QItemSelection) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
186 | ## @param deselected deselected indexes (QItemSelection) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
187 | ## """ |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
188 | ## self.addButton.setEnabled(len(selected.indexes()) > 0) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
189 | ## |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
190 | ## def __tableModelReset(self): |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
191 | ## """ |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
192 | ## Private slot to handle a reset of the cookies table. |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
193 | ## """ |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
194 | ## self.addButton.setEnabled(False) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
195 | |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
196 | @pyqtSlot() |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
197 | def on_removeButton_clicked(self): |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
198 | """ |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
199 | Slot documentation goes here. |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
200 | """ |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
201 | # TODO: not implemented yet |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
202 | raise NotImplementedError |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
203 | |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
204 | @pyqtSlot() |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
205 | def on_removeAllButton_clicked(self): |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
206 | """ |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
207 | Slot documentation goes here. |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
208 | """ |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
209 | # TODO: not implemented yet |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
210 | raise NotImplementedError |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
211 | |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
212 | @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
213 | def on_cookiesTree_currentItemChanged(self, current, previous): |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
214 | """ |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
215 | Private slot to handle a change of the current item. |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
216 | |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
217 | @param current reference to the current item |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
218 | @type QTreeWidgetItem |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
219 | @param previous reference to the previous current item |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
220 | @type QTreeWidgetItem |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
221 | """ |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
222 | self.addButton.setEnabled(current is not None) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
223 | self.removeButton.setEnabled(current is not None) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
224 | |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
225 | if current is None: |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
226 | return |
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
227 | |
5029
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
228 | if not current.text(1): |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
229 | # it is a cookie domain entry |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
230 | self.domain.setText(self.tr("<no cookie selected>")) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
231 | self.name.setText(self.tr("<no cookie selected>")) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
232 | self.path.setText(self.tr("<no cookie selected>")) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
233 | self.secure.setText(self.tr("<no cookie selected>")) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
234 | self.expiration.setText(self.tr("<no cookie selected>")) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
235 | self.value.setText(self.tr("<no cookie selected>")) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
236 | |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
237 | self.removeButton.setText(self.tr("Remove Cookies")) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
238 | else: |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
239 | # it is a cookie entry |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
240 | cookie = current.data(0, self.CookieRole) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
241 | |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
242 | self.domain.setText(cookie.domain()) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
243 | self.name.setText(bytes(cookie.name()).decode()) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
244 | self.path.setText(cookie.path()) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
245 | if cookie.isSecure(): |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
246 | self.secure.setText(self.tr("Secure connections only")) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
247 | else: |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
248 | self.secure.setText(self.tr("All connections")) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
249 | if cookie.isSessionCookie(): |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
250 | self.expiration.setText(self.tr("Session Cookie")) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
251 | else: |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
252 | self.expiration.setText( |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
253 | cookie.expirationDate().toString("yyyy-MM-dd HH:mm:ss")) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
254 | self.value.setText( |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
255 | bytes(QByteArray.fromPercentEncoding(cookie.value())).decode()) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
256 | |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
257 | self.removeButton.setText(self.tr("Remove Cookie")) |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
258 | |
5029
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
259 | @pyqtSlot(str) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
260 | def on_searchEdit_textChanged(self, txt): |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
261 | """ |
5029
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
262 | Private slot to search and filter the cookie tree. |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
263 | |
5029
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
264 | @param txt text to search for |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
265 | @type str |
0
de9c2efb9d02
Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
266 | """ |
5029
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
267 | if not txt: |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
268 | for row in range(self.cookiesTree.topLevelItemCount()): |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
269 | self.cookiesTree.topLevelItem(row).setHidden(False) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
270 | else: |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
271 | for row in range(self.cookiesTree.topLevelItemCount()): |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
272 | text = self.cookiesTree.topLevelItem(row).text(0) |
1ce5e98ebc43
Started to rework the cookies dialog of the new web browser.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5028
diff
changeset
|
273 | self.cookiesTree.topLevelItem(row).setHidden(txt not in text) |