Skip to content

Commit

Permalink
Add option to enable CDoc2 encryption
Browse files Browse the repository at this point in the history
CDOC-3

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma committed Nov 21, 2024
1 parent 4729b35 commit cbb1d25
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
3 changes: 2 additions & 1 deletion client/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ const Option<bool> Settings::CDOC2_DEFAULT { QStringLiteral("CDOC2-DEFAULT"), fa
const Option<bool> Settings::CDOC2_NOTIFICATION { QStringLiteral("CDOC2-NOTIFICATION"), false };
const Option<bool> Settings::CDOC2_USE_KEYSERVER { QStringLiteral("CDOC2-USE-KEYSERVER"), true };
const Option<QString, QString (*)()> 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<QString> Settings::CDOC2_GET { QStringLiteral("CDOC2-GET"), QStringLiteral(CDOC2_GET_URL) };
const Option<QByteArray> Settings::CDOC2_GET_CERT { QStringLiteral("CDOC2-GET-CERT") };
Expand Down
19 changes: 11 additions & 8 deletions client/dialogs/SettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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<int>(&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
Expand Down
4 changes: 2 additions & 2 deletions client/dialogs/SettingsDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -472,7 +472,7 @@ QRadioButton::indicator::checked {
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="chkCdoc2KeyServer">
<widget class="CheckBox" name="chkCdoc2KeyServer">
<property name="text">
<string notr="true">Use key server</string>
</property>
Expand Down

0 comments on commit cbb1d25

Please sign in to comment.