From 07bc3475f893430a59f91f65ea50d87ba21b5854 Mon Sep 17 00:00:00 2001 From: "Felix (xq) Queißner" Date: Sat, 20 Jun 2020 00:17:05 +0200 Subject: Patches by @tomasino, starts to implement the auto-enable/host filter feature for client certificates. --- src/certificatemanagementdialog.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/certificatemanagementdialog.cpp') diff --git a/src/certificatemanagementdialog.cpp b/src/certificatemanagementdialog.cpp index a14a9a4..9b8b095 100644 --- a/src/certificatemanagementdialog.cpp +++ b/src/certificatemanagementdialog.cpp @@ -53,6 +53,10 @@ void CertificateManagementDialog::on_certificates_selected(QModelIndex const& in ); this->ui->cert_notes->setPlainText(cert.user_notes); + this->ui->cert_host_filter->setText(cert.host_filter); + this->ui->cert_auto_enable->setEnabled(not cert.host_filter.isEmpty()); + this->ui->cert_auto_enable->setChecked(cert.auto_enable); + this->ui->delete_cert_button->setEnabled(true); } else @@ -63,6 +67,8 @@ void CertificateManagementDialog::on_certificates_selected(QModelIndex const& in this->ui->cert_expiration_date->setDateTime(QDateTime { }); this->ui->cert_livetime->setText(""); this->ui->cert_fingerprint->setPlainText(""); + this->ui->cert_host_filter->setText(""); + this->ui->cert_auto_enable->setChecked(false); if(auto group_name = global_identities.group(index); not group_name.isEmpty()) { this->ui->delete_cert_button->setEnabled(global_identities.canDeleteGroup(group_name)); @@ -150,3 +156,21 @@ void CertificateManagementDialog::on_create_cert_button_clicked() dialog.groupName(), id); } + +void CertificateManagementDialog::on_cert_host_filter_textChanged(const QString &host_filter) +{ + if(this->selected_identity != nullptr) { + this->ui->cert_auto_enable->setEnabled(not host_filter.isEmpty()); + this->selected_identity->host_filter = host_filter; + } else { + this->ui->cert_auto_enable->setEnabled(false); + } + +} + +void CertificateManagementDialog::on_cert_auto_enable_clicked(bool checked) +{ + if(this->selected_identity != nullptr) { + this->selected_identity->auto_enable = checked; + } +} -- cgit v1.2.3