Skip to content

Commit cbb1d25

Browse files
committed
Add option to enable CDoc2 encryption
CDOC-3 Signed-off-by: Raul Metsma <raul@metsma.ee>
1 parent 4729b35 commit cbb1d25

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

client/Settings.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ const Option<bool> Settings::CDOC2_DEFAULT { QStringLiteral("CDOC2-DEFAULT"), fa
3030
const Option<bool> Settings::CDOC2_NOTIFICATION { QStringLiteral("CDOC2-NOTIFICATION"), false };
3131
const Option<bool> Settings::CDOC2_USE_KEYSERVER { QStringLiteral("CDOC2-USE-KEYSERVER"), true };
3232
const Option<QString, QString (*)()> Settings::CDOC2_DEFAULT_KEYSERVER { QStringLiteral("CDOC2-DEFAULT-KEYSERVER"), [] {
33-
return Application::confValue(QLatin1String("CDOC2-DEFAULT-KEYSERVER")).toString(QStringLiteral("ria-test"));
33+
return Application::confValue(QLatin1String("CDOC2-DEFAULT-KEYSERVER"))
34+
.toString(QStringLiteral("00000000-0000-0000-0000-000000000000"));
3435
}};
3536
const Option<QString> Settings::CDOC2_GET { QStringLiteral("CDOC2-GET"), QStringLiteral(CDOC2_GET_URL) };
3637
const Option<QByteArray> Settings::CDOC2_GET_CERT { QStringLiteral("CDOC2-GET-CERT") };

client/dialogs/SettingsDialog.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -356,13 +356,17 @@ void SettingsDialog::initFunctionality()
356356
Settings::DEFAULT_DIR = text;
357357
});
358358
#endif
359-
ui->wgtCDoc2->hide();
360-
#if 0
361359
ui->chkCdoc2KeyServer->setChecked(Settings::CDOC2_USE_KEYSERVER);
362-
ui->cmbCdoc2Name->setEnabled(ui->chkCdoc2KeyServer->isChecked());
363-
connect(ui->chkCdoc2KeyServer, &QCheckBox::toggled, this, [this](bool checked) {
364-
Settings::CDOC2_USE_KEYSERVER = checked;
360+
auto setCDoc2KeyServerEnabled = [this](bool checked) {
365361
ui->cmbCdoc2Name->setEnabled(checked);
362+
ui->txtCdoc2UUID->setEnabled(checked);
363+
ui->txtCdoc2Fetch->setEnabled(checked);
364+
ui->txtCdoc2Post->setEnabled(checked);
365+
};
366+
setCDoc2KeyServerEnabled(ui->chkCdoc2KeyServer->isChecked());
367+
connect(ui->chkCdoc2KeyServer, &QCheckBox::toggled, this, [this, setCDoc2KeyServerEnabled](bool checked) {
368+
Settings::CDOC2_USE_KEYSERVER = checked;
369+
setCDoc2KeyServerEnabled(checked);
366370
});
367371
#ifdef CONFIG_URL
368372
QJsonObject list = Application::confValue(QLatin1String("CDOC2-CONF")).toObject();
@@ -376,20 +380,19 @@ void SettingsDialog::initFunctionality()
376380
ui->cmbCdoc2Name->addItem(i.value().toObject().value(QLatin1String("NAME")).toString(), i.key());
377381
if(Settings::CDOC2_GET.isSet() || Settings::CDOC2_POST.isSet())
378382
ui->cmbCdoc2Name->addItem(QStringLiteral("Custom"), QStringLiteral("custom"));
383+
QString cdoc2Service = Settings::CDOC2_DEFAULT_KEYSERVER;
384+
ui->cmbCdoc2Name->setCurrentIndex(ui->cmbCdoc2Name->findData(cdoc2Service));
379385
connect(ui->cmbCdoc2Name, qOverload<int>(&QComboBox::currentIndexChanged), this, [this, setCDoc2Values] (int index) {
380386
QString key = ui->cmbCdoc2Name->itemData(index).toString();
381387
Settings::CDOC2_DEFAULT_KEYSERVER = key;
382388
setCDoc2Values(key);
383389
});
384-
QString cdoc2Service = Settings::CDOC2_DEFAULT_KEYSERVER;
385-
ui->cmbCdoc2Name->setCurrentIndex(ui->cmbCdoc2Name->findData(cdoc2Service));
386390
setCDoc2Values(cdoc2Service);
387391
#else
388392
ui->cmbCdoc2Name->addItem(QStringLiteral("Default"));
389393
ui->txtCdoc2UUID->setText(QStringLiteral("default"));
390394
ui->txtCdoc2Fetch->setText(QStringLiteral(CDOC2_GET_URL));
391395
ui->txtCdoc2Post->setText(QStringLiteral(CDOC2_POST_URL));
392-
#endif
393396
#endif
394397

395398
// pageProxy

client/dialogs/SettingsDialog.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ QCheckBox, QRadioButton {
262262
min-height: 31px;
263263
spacing: 5px;
264264
}
265-
QCheckBox:disabled, QRadioButton:disabled {
265+
QCheckBox::disabled, QRadioButton::disabled, QLineEdit::disabled, QComboBox::disabled {
266266
color: #727679;
267267
}
268268
QCheckBox::indicator, QRadioButton::indicator {
@@ -472,7 +472,7 @@ QRadioButton::indicator::checked {
472472
</widget>
473473
</item>
474474
<item row="1" column="0" colspan="2">
475-
<widget class="QCheckBox" name="chkCdoc2KeyServer">
475+
<widget class="CheckBox" name="chkCdoc2KeyServer">
476476
<property name="text">
477477
<string notr="true">Use key server</string>
478478
</property>

0 commit comments

Comments
 (0)