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