38 |
38 |
39 self.cookiesTable.verticalHeader().hide() |
39 self.cookiesTable.verticalHeader().hide() |
40 model = CookieModel(cookieJar, self) |
40 model = CookieModel(cookieJar, self) |
41 self.__proxyModel = QSortFilterProxyModel(self) |
41 self.__proxyModel = QSortFilterProxyModel(self) |
42 self.__proxyModel.setSourceModel(model) |
42 self.__proxyModel.setSourceModel(model) |
43 self.searchEdit.textChanged.connect(self.__proxyModel.setFilterFixedString) |
43 self.searchEdit.textChanged.connect( |
|
44 self.__proxyModel.setFilterFixedString) |
44 self.cookiesTable.setModel(self.__proxyModel) |
45 self.cookiesTable.setModel(self.__proxyModel) |
45 self.cookiesTable.doubleClicked.connect(self.__showCookieDetails) |
46 self.cookiesTable.doubleClicked.connect(self.__showCookieDetails) |
46 self.cookiesTable.selectionModel().selectionChanged.connect( |
47 self.cookiesTable.selectionModel().selectionChanged.connect( |
47 self.__tableSelectionChanged) |
48 self.__tableSelectionChanged) |
48 self.cookiesTable.model().modelReset.connect(self.__tableModelReset) |
49 self.cookiesTable.model().modelReset.connect(self.__tableModelReset) |
50 fm = QFontMetrics(QFont()) |
51 fm = QFontMetrics(QFont()) |
51 height = fm.height() + fm.height() // 3 |
52 height = fm.height() + fm.height() // 3 |
52 self.cookiesTable.verticalHeader().setDefaultSectionSize(height) |
53 self.cookiesTable.verticalHeader().setDefaultSectionSize(height) |
53 self.cookiesTable.verticalHeader().setMinimumSectionSize(-1) |
54 self.cookiesTable.verticalHeader().setMinimumSectionSize(-1) |
54 for section in range(model.columnCount()): |
55 for section in range(model.columnCount()): |
55 header = self.cookiesTable.horizontalHeader().sectionSizeHint(section) |
56 header = self.cookiesTable.horizontalHeader()\ |
|
57 .sectionSizeHint(section) |
56 if section == 0: |
58 if section == 0: |
57 header = fm.width("averagebiglonghost.averagedomain.info") |
59 header = fm.width("averagebiglonghost.averagedomain.info") |
58 elif section == 1: |
60 elif section == 1: |
59 header = fm.width("_session_id") |
61 header = fm.width("_session_id") |
60 elif section == 4: |
62 elif section == 4: |
61 header = fm.width(QDateTime.currentDateTime().toString(Qt.LocalDate)) |
63 header = fm.width( |
|
64 QDateTime.currentDateTime().toString(Qt.LocalDate)) |
62 buffer = fm.width("mm") |
65 buffer = fm.width("mm") |
63 header += buffer |
66 header += buffer |
64 self.cookiesTable.horizontalHeader().resizeSection(section, header) |
67 self.cookiesTable.horizontalHeader().resizeSection(section, header) |
65 self.cookiesTable.horizontalHeader().setStretchLastSection(True) |
68 self.cookiesTable.horizontalHeader().setStretchLastSection(True) |
66 self.cookiesTable.model().sort( |
69 self.cookiesTable.model().sort( |
89 name = model.data(model.index(row, 1)) |
92 name = model.data(model.index(row, 1)) |
90 path = model.data(model.index(row, 2)) |
93 path = model.data(model.index(row, 2)) |
91 secure = model.data(model.index(row, 3)) |
94 secure = model.data(model.index(row, 3)) |
92 expires = model.data(model.index(row, 4)).toString("yyyy-MM-dd hh:mm") |
95 expires = model.data(model.index(row, 4)).toString("yyyy-MM-dd hh:mm") |
93 value = bytes( |
96 value = bytes( |
94 QByteArray.fromPercentEncoding(model.data(model.index(row, 5)))).decode() |
97 QByteArray.fromPercentEncoding( |
|
98 model.data(model.index(row, 5)))).decode() |
95 |
99 |
96 if self.__detailsDialog is None: |
100 if self.__detailsDialog is None: |
97 from .CookieDetailsDialog import CookieDetailsDialog |
101 from .CookieDetailsDialog import CookieDetailsDialog |
98 self.__detailsDialog = CookieDetailsDialog(self) |
102 self.__detailsDialog = CookieDetailsDialog(self) |
99 self.__detailsDialog.setData(domain, name, path, secure, expires, value) |
103 self.__detailsDialog.setData(domain, name, path, secure, expires, |
|
104 value) |
100 self.__detailsDialog.show() |
105 self.__detailsDialog.show() |
101 |
106 |
102 @pyqtSlot() |
107 @pyqtSlot() |
103 def on_addButton_clicked(self): |
108 def on_addButton_clicked(self): |
104 """ |
109 """ |