def __init__(self, cookie: QNetworkCookie = None, parent: QWidget = None) -> None: super().__init__(parent) self.setupUi(self) if cookie: self.m_nameLineEdit.setText(cookie.name().data().decode()) self.m_domainLineEdit.setText(cookie.domain()) self.m_valueLineEdit.setText(cookie.value().data().decode()) self.m_pathLineEdit.setText(cookie.path()) self.m_dateEdit.setDate(cookie.expirationDate().date()) self.m_isSecureComboBox.addItem( self.tr("yes") if cookie.isSecure() else self.tr("no")) self.m_isHttpOnlyComboBox.addItem( self.tr("yes") if cookie.isHttpOnly() else self.tr("no")) self.m_addButton.setVisible(False) self.m_cancelButton.setText(self.tr("Close")) else: self.m_nameLineEdit.setReadOnly(False) self.m_domainLineEdit.setReadOnly(False) self.m_valueLineEdit.setReadOnly(False) self.m_pathLineEdit.setReadOnly(False) self.m_dateEdit.setReadOnly(False) self.m_dateEdit.setDate( QDateTime.currentDateTime().addYears(1).date()) self.m_isSecureComboBox.addItem(self.tr("no")) self.m_isSecureComboBox.addItem(self.tr("yes")) self.m_isHttpOnlyComboBox.addItem(self.tr("no")) self.m_isHttpOnlyComboBox.addItem(self.tr("yes"))
def __init__(self, cookie: QNetworkCookie, parent: QWidget = None) -> None: super().__init__(parent) self.setupUi(self) self.setAutoFillBackground(True) self.m_nameLabel.setText(cookie.name().data().decode()) self.m_domainLabel.setText(cookie.domain()) self.m_viewButton.clicked.connect(self.viewClicked) self.m_deleteButton.clicked.connect(self.deleteClicked)