1
0
mirror of https://github.com/altlinux/admc.git synced 2025-02-09 01:57:26 +03:00

add constants for cert strategy strings

This commit is contained in:
Dmitry Degtyarev 2021-09-21 15:41:31 +04:00
parent abe94f7391
commit 7474e183fd
3 changed files with 19 additions and 9 deletions

View File

@ -28,6 +28,10 @@
#include <QPushButton>
const QString CERT_STRATEGY_NEVER = "never";
const QString CERT_STRATEGY_HARD = "hard";
const QString CERT_STRATEGY_DEMAND = "demand";
const QString CERT_STRATEGY_ALLOW = "allow";
const QString CERT_STRATEGY_TRY = "try";
ConnectionOptionsDialog::ConnectionOptionsDialog(QWidget *parent)
: QDialog(parent) {
@ -36,10 +40,10 @@ ConnectionOptionsDialog::ConnectionOptionsDialog(QWidget *parent)
const QList<QString> require_cert_list = {
CERT_STRATEGY_NEVER,
"hard",
"demand",
"allow",
"try",
CERT_STRATEGY_HARD,
CERT_STRATEGY_DEMAND,
CERT_STRATEGY_ALLOW,
CERT_STRATEGY_TRY,
};
for (const QString &string : require_cert_list) {
ui->cert_combo->addItem(string);

View File

@ -27,6 +27,12 @@
#include <QDialog>
extern const QString CERT_STRATEGY_NEVER;
extern const QString CERT_STRATEGY_HARD;
extern const QString CERT_STRATEGY_DEMAND;
extern const QString CERT_STRATEGY_ALLOW;
extern const QString CERT_STRATEGY_TRY;
namespace Ui {
class ConnectionOptionsDialog;
}

View File

@ -371,11 +371,11 @@ void MainWindow::load_connection_options() {
const QString cert_strategy_string = settings_get_variant(SETTING_cert_strategy).toString();
const QHash<QString, CertStrategy> cert_strategy_map = {
{"never", CertStrategy_Never},
{"hard", CertStrategy_Hard},
{"demand", CertStrategy_Demand},
{"allow", CertStrategy_Allow},
{"try", CertStrategy_Try},
{CERT_STRATEGY_NEVER, CertStrategy_Never},
{CERT_STRATEGY_HARD, CertStrategy_Hard},
{CERT_STRATEGY_DEMAND, CertStrategy_Demand},
{CERT_STRATEGY_ALLOW, CertStrategy_Allow},
{CERT_STRATEGY_TRY, CertStrategy_Try},
};
const CertStrategy cert_strategy = cert_strategy_map.value(cert_strategy_string, CertStrategy_Never);
AdInterface::set_cert_strategy(cert_strategy);