From 1cf149f6b3cec84090ddcfb524219780d0330510 Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Fri, 4 Aug 2023 10:31:06 +0300 Subject: [PATCH] Add option to enable CDoc2 encryption CDOC-3 Signed-off-by: Raul Metsma --- client/Settings.cpp | 3 ++- client/dialogs/SettingsDialog.cpp | 19 +++++++++++-------- client/dialogs/SettingsDialog.ui | 4 ++-- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/client/Settings.cpp b/client/Settings.cpp index 3a95ff9bb..24ca80f6b 100644 --- a/client/Settings.cpp +++ b/client/Settings.cpp @@ -30,7 +30,8 @@ const Option Settings::CDOC2_DEFAULT { QStringLiteral("CDOC2-DEFAULT"), fa const Option Settings::CDOC2_NOTIFICATION { QStringLiteral("CDOC2-NOTIFICATION"), false }; const Option Settings::CDOC2_USE_KEYSERVER { QStringLiteral("CDOC2-USE-KEYSERVER"), true }; const Option Settings::CDOC2_DEFAULT_KEYSERVER { QStringLiteral("CDOC2-DEFAULT-KEYSERVER"), [] { - return Application::confValue(QLatin1String("CDOC2-DEFAULT-KEYSERVER")).toString(QStringLiteral("ria-test")); + return Application::confValue(QLatin1String("CDOC2-DEFAULT-KEYSERVER")) + .toString(QStringLiteral("00000000-0000-0000-0000-000000000000")); }}; const Option Settings::CDOC2_GET { QStringLiteral("CDOC2-GET"), QStringLiteral(CDOC2_GET_URL) }; const Option Settings::CDOC2_GET_CERT { QStringLiteral("CDOC2-GET-CERT") }; diff --git a/client/dialogs/SettingsDialog.cpp b/client/dialogs/SettingsDialog.cpp index 5d2125452..87c62c3e7 100644 --- a/client/dialogs/SettingsDialog.cpp +++ b/client/dialogs/SettingsDialog.cpp @@ -356,13 +356,17 @@ void SettingsDialog::initFunctionality() Settings::DEFAULT_DIR = text; }); #endif - ui->wgtCDoc2->hide(); -#if 0 ui->chkCdoc2KeyServer->setChecked(Settings::CDOC2_USE_KEYSERVER); - ui->cmbCdoc2Name->setEnabled(ui->chkCdoc2KeyServer->isChecked()); - connect(ui->chkCdoc2KeyServer, &QCheckBox::toggled, this, [this](bool checked) { - Settings::CDOC2_USE_KEYSERVER = checked; + auto setCDoc2KeyServerEnabled = [this](bool checked) { ui->cmbCdoc2Name->setEnabled(checked); + ui->txtCdoc2UUID->setEnabled(checked); + ui->txtCdoc2Fetch->setEnabled(checked); + ui->txtCdoc2Post->setEnabled(checked); + }; + setCDoc2KeyServerEnabled(ui->chkCdoc2KeyServer->isChecked()); + connect(ui->chkCdoc2KeyServer, &QCheckBox::toggled, this, [this, setCDoc2KeyServerEnabled](bool checked) { + Settings::CDOC2_USE_KEYSERVER = checked; + setCDoc2KeyServerEnabled(checked); }); #ifdef CONFIG_URL QJsonObject list = Application::confValue(QLatin1String("CDOC2-CONF")).toObject(); @@ -376,20 +380,19 @@ void SettingsDialog::initFunctionality() ui->cmbCdoc2Name->addItem(i.value().toObject().value(QLatin1String("NAME")).toString(), i.key()); if(Settings::CDOC2_GET.isSet() || Settings::CDOC2_POST.isSet()) ui->cmbCdoc2Name->addItem(QStringLiteral("Custom"), QStringLiteral("custom")); + QString cdoc2Service = Settings::CDOC2_DEFAULT_KEYSERVER; + ui->cmbCdoc2Name->setCurrentIndex(ui->cmbCdoc2Name->findData(cdoc2Service)); connect(ui->cmbCdoc2Name, qOverload(&QComboBox::currentIndexChanged), this, [this, setCDoc2Values] (int index) { QString key = ui->cmbCdoc2Name->itemData(index).toString(); Settings::CDOC2_DEFAULT_KEYSERVER = key; setCDoc2Values(key); }); - QString cdoc2Service = Settings::CDOC2_DEFAULT_KEYSERVER; - ui->cmbCdoc2Name->setCurrentIndex(ui->cmbCdoc2Name->findData(cdoc2Service)); setCDoc2Values(cdoc2Service); #else ui->cmbCdoc2Name->addItem(QStringLiteral("Default")); ui->txtCdoc2UUID->setText(QStringLiteral("default")); ui->txtCdoc2Fetch->setText(QStringLiteral(CDOC2_GET_URL)); ui->txtCdoc2Post->setText(QStringLiteral(CDOC2_POST_URL)); -#endif #endif // pageProxy diff --git a/client/dialogs/SettingsDialog.ui b/client/dialogs/SettingsDialog.ui index 89b90bb97..eb3cde8bf 100644 --- a/client/dialogs/SettingsDialog.ui +++ b/client/dialogs/SettingsDialog.ui @@ -262,7 +262,7 @@ QCheckBox, QRadioButton { min-height: 31px; spacing: 5px; } -QCheckBox:disabled, QRadioButton:disabled { +QCheckBox::disabled, QRadioButton::disabled, QLineEdit::disabled, QComboBox::disabled { color: #727679; } QCheckBox::indicator, QRadioButton::indicator { @@ -472,7 +472,7 @@ QRadioButton::indicator::checked { - + Use key server