From 601f1723d1660d7ae3a5ad4c2f043f34532e9eda Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Wed, 31 May 2023 07:51:09 +0300 Subject: [PATCH] Remove option (#1188) IB-7719 Signed-off-by: Raul Metsma --- client/Application.cpp | 24 ++++++++++---------- client/Application.h | 1 - client/dialogs/SettingsDialog.cpp | 37 +++++++++++++------------------ client/dialogs/SettingsDialog.ui | 10 --------- 4 files changed, 27 insertions(+), 45 deletions(-) diff --git a/client/Application.cpp b/client/Application.cpp index 43665da75..3edecf66a 100644 --- a/client/Application.cpp +++ b/client/Application.cpp @@ -91,7 +91,9 @@ class DigidocConf final: public digidoc::XmlConfCurrent DigidocConf() { Settings::LIBDIGIDOCPP_DEBUG = false; - +#ifndef Q_OS_DARWIN + setTSLOnlineDigest(true); +#endif #ifdef CONFIG_URL reload(); QTimer::singleShot(0, qApp->conf(), [] { qApp->conf()->checkVersion(QStringLiteral("QDIGIDOC4")); }); @@ -142,8 +144,6 @@ class DigidocConf final: public digidoc::XmlConfCurrent { return Settings::PROXY_TUNNEL_SSL.value(digidoc::XmlConfCurrent::proxyTunnelSSL()); } std::string TSLCache() const final { return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation).toStdString(); } - bool TSLOnlineDigest() const final - { return Settings::TSL_ONLINE_DIGEST.value(digidoc::XmlConfCurrent::TSLOnlineDigest()); } void setProxyHost( const std::string &host ) final { Settings::PROXY_HOST = host; } @@ -155,8 +155,6 @@ class DigidocConf final: public digidoc::XmlConfCurrent { Settings::PROXY_PASS = pass; } void setProxyTunnelSSL( bool enable ) final { Settings::PROXY_TUNNEL_SSL.setValue(enable, digidoc::XmlConfCurrent::proxyTunnelSSL()); } - void setTSLOnlineDigest( bool enable ) final - { Settings::TSL_ONLINE_DIGEST.setValue(enable, digidoc::XmlConfCurrent::TSLOnlineDigest()); } #endif std::vector TSCerts() const final @@ -227,7 +225,6 @@ class DigidocConf final: public digidoc::XmlConfCurrent { if(Settings::TSA_URL == Application::confValue(Settings::TSA_URL.KEY).toString()) Settings::TSA_URL.clear(); // Cleanup user conf if it is default url - Settings::SETTINGS_MIGRATED.clear(); QList list; for(const auto &cert: Application::confValue(QLatin1String("CERT-BUNDLE")).toArray()) list.append(QSslCertificate(fromBase64(cert), QSsl::Der)); @@ -344,11 +341,10 @@ Application::Application( int &argc, char **argv ) QDesktopServices::setUrlHandler(QStringLiteral("browse"), this, "browse"); QDesktopServices::setUrlHandler(QStringLiteral("mailto"), this, "mailTo"); - QAccessible::installFactory([](const QString &classname, QObject *object) { - QAccessibleInterface *interface = nullptr; + QAccessible::installFactory([](const QString &classname, QObject *object) -> QAccessibleInterface* { if (classname == QLatin1String("QSvgWidget") && object && object->isWidgetType()) - interface = new QAccessibleWidget(qobject_cast(object), QAccessible::StaticText); - return interface; + return new QAccessibleWidget(qobject_cast(object), QAccessible::StaticText); + return {}; }); @@ -357,6 +353,12 @@ Application::Application( int &argc, char **argv ) installTranslator( &d->qtTranslator ); loadTranslation( Common::language() ); + // Clear obsolete registriy settings + Settings::SETTINGS_MIGRATED.clear(); +#ifdef Q_OS_DARWIN + Settings::TSL_ONLINE_DIGEST.clear(); +#endif + // Actions d->closeAction = new QAction( tr("Close Window"), this ); d->closeAction->setShortcut( Qt::CTRL + Qt::Key_W ); @@ -588,7 +590,6 @@ QVariant Application::confValue( ConfParameter parameter, const QVariant &value } return QVariant::fromValue(list); } - case TSLOnlineDigest: return i->TSLOnlineDigest(); } return r.isEmpty() ? value.toString() : QString::fromUtf8( r ); } @@ -858,7 +859,6 @@ void Application::setConfValue( ConfParameter parameter, const QVariant &value ) case ProxyUser: i->setProxyUser( v.isEmpty()? std::string() : v.constData() ); break; case ProxyPass: i->setProxyPass( v.isEmpty()? std::string() : v.constData() ); break; case ProxySSL: i->setProxyTunnelSSL( value.toBool() ); break; - case TSLOnlineDigest: i->setTSLOnlineDigest( value.toBool() ); break; case TSAUrl: i->setTSUrl(v.isEmpty()? std::string() : v.constData()); break; case SiVaUrl: i->setVerifyServiceUri(v.isEmpty()? std::string() : v.constData()); break; case TSLCerts: diff --git a/client/Application.h b/client/Application.h index e66e3dbc6..4d918d155 100644 --- a/client/Application.h +++ b/client/Application.h @@ -50,7 +50,6 @@ class Application final: public Common TSLUrl, TSLCerts, TSLCache, - TSLOnlineDigest }; explicit Application( int &argc, char **argv ); diff --git a/client/dialogs/SettingsDialog.cpp b/client/dialogs/SettingsDialog.cpp index 01c0daf78..eb756c18a 100644 --- a/client/dialogs/SettingsDialog.cpp +++ b/client/dialogs/SettingsDialog.cpp @@ -54,7 +54,7 @@ #include -#define qdigidoc4log QStringLiteral("%1/%2.log").arg(QDir::tempPath(), qApp->applicationName()) +#define qdigidoc4log QStringLiteral("%1/%2.log").arg(QDir::tempPath(), QApplication::applicationName()) SettingsDialog::SettingsDialog(int page, QWidget *parent) : QDialog(parent) @@ -101,8 +101,6 @@ SettingsDialog::SettingsDialog(int page, QWidget *parent) ui->btGeneralChooseDirectory->setFont(regularFont); ui->txtGeneralDirectory->setFont(regularFont); - ui->chkGeneralTslRefresh->setFont(regularFont); - ui->chkShowPrintSummary->setFont(regularFont); ui->chkRoleAddressInfo->setFont(regularFont); ui->chkLibdigidocppDebug->setFont(regularFont); @@ -188,7 +186,7 @@ SettingsDialog::SettingsDialog(int page, QWidget *parent) } WarningDialog::show(this, tr("DigiDoc4 Client configuration update was successful.")); #ifdef Q_OS_WIN - QString path = qApp->applicationDirPath() + QStringLiteral("/id-updater.exe"); + QString path = QApplication::applicationDirPath() + QLatin1String("/id-updater.exe"); if (QFile::exists(path)) QProcess::startDetached(path, {}); #endif @@ -211,7 +209,7 @@ SettingsDialog::SettingsDialog(int page, QWidget *parent) #ifdef CONFIG_URL qApp->conf()->update(true); #endif - QString cache = qApp->confValue(Application::TSLCache).toString(); + QString cache = Application::confValue(Application::TSLCache).toString(); const QStringList tsllist = QDir(QStringLiteral(":/TSL/")).entryList(); for(const QString &file: tsllist) { @@ -288,11 +286,10 @@ void SettingsDialog::checkConnection() { QApplication::setOverrideCursor( Qt::WaitCursor ); saveProxy(); - CheckConnection connection; - if(!connection.check(QStringLiteral("https://id.eesti.ee/config.json"))) + if(CheckConnection connection; !connection.check(QStringLiteral("https://id.eesti.ee/config.json"))) { Application::restoreOverrideCursor(); - FadeInNotification* notification = new FadeInNotification(this, + auto *notification = new FadeInNotification(this, ria::qdigidoc4::colors::MOJO, ria::qdigidoc4::colors::MARZIPAN, 0, 120); QString error; QString details = connection.errorDetails(); @@ -305,7 +302,7 @@ void SettingsDialog::checkConnection() else { Application::restoreOverrideCursor(); - FadeInNotification* notification = new FadeInNotification(this, + auto *notification = new FadeInNotification(this, ria::qdigidoc4::colors::WHITE, ria::qdigidoc4::colors::MANTIS, 0, 120); notification->start(tr("The connection to certificate status service is successful!"), 750, 3000, 1200); } @@ -328,10 +325,6 @@ void SettingsDialog::initFunctionality() connect(ui->langGroup, qOverload(&QButtonGroup::buttonClicked), this, [this](QAbstractButton *button){ retranslate(button->property("lang").toString()); }); - ui->chkGeneralTslRefresh->setChecked(qApp->confValue(Application::TSLOnlineDigest).toBool()); - connect(ui->chkGeneralTslRefresh, &QCheckBox::toggled, [](bool checked) { - qApp->setConfValue(Application::TSLOnlineDigest, checked); - }); ui->chkShowPrintSummary->setChecked(Settings::SHOW_PRINT_SUMMARY); connect(ui->chkShowPrintSummary, &QCheckBox::toggled, this, &SettingsDialog::togglePrinting); connect(ui->chkShowPrintSummary, &QCheckBox::toggled, this, [](bool checked) { @@ -396,11 +389,11 @@ void SettingsDialog::initFunctionality() }); ui->rdTimeStampCustom->setChecked(Settings::TSA_URL_CUSTOM); ui->wgtTSACert->setVisible(ui->rdTimeStampCustom->isChecked()); - ui->txtTimeStamp->setPlaceholderText(qApp->confValue(Settings::TSA_URL.KEY).toString()); - QString TSA_URL = Settings::TSA_URL.value(qApp->confValue(Application::TSAUrl)); + ui->txtTimeStamp->setPlaceholderText(Application::confValue(Settings::TSA_URL.KEY).toString()); + QString TSA_URL = Settings::TSA_URL.value(Application::confValue(Application::TSAUrl)); ui->txtTimeStamp->setText(ui->txtTimeStamp->placeholderText() == TSA_URL ? QString() : TSA_URL); connect(ui->txtTimeStamp, &QLineEdit::textChanged, this, [this](const QString &url) { - qApp->setConfValue(Application::TSAUrl, url); + Application::setConfValue(Application::TSAUrl, url); if(url.isEmpty()) { Settings::TSA_CERT.clear(); @@ -444,11 +437,11 @@ void SettingsDialog::initFunctionality() }); ui->rdSiVaCustom->setChecked(Settings::SIVA_URL_CUSTOM); ui->wgtSiVaCert->setVisible(ui->rdSiVaCustom->isChecked()); - ui->txtSiVa->setPlaceholderText(qApp->confValue(Settings::SIVA_URL.KEY).toString()); - QString SIVA_URL = Settings::SIVA_URL.value(qApp->confValue(Application::SiVaUrl)); + ui->txtSiVa->setPlaceholderText(Application::confValue(Settings::SIVA_URL.KEY).toString()); + QString SIVA_URL = Settings::SIVA_URL.value(Application::confValue(Application::SiVaUrl)); ui->txtSiVa->setText(ui->txtSiVa->placeholderText() == SIVA_URL ? QString() : SIVA_URL); connect(ui->txtSiVa, &QLineEdit::textChanged, this, [this](const QString &url) { - qApp->setConfValue(Application::SiVaUrl, url); + Application::setConfValue(Application::SiVaUrl, url); if(url.isEmpty()) { Settings::SIVA_CERT.clear(); @@ -491,7 +484,7 @@ void SettingsDialog::initFunctionality() connect(dlg, &WarningDialog::finished, qApp, [](int result) { if(result == 1) { qApp->setProperty("restart", true); - qApp->quit(); + QApplication::quit(); } }); #endif @@ -560,7 +553,7 @@ void SettingsDialog::updateProxy() void SettingsDialog::updateVersion() { ui->txtNavVersion->setText(tr("%1 version %2, released %3") - .arg(tr("DigiDoc4 Client"), qApp->applicationVersion(), QStringLiteral(BUILD_DATE))); + .arg(tr("DigiDoc4 Client"), QApplication::applicationVersion(), QStringLiteral(BUILD_DATE))); } void SettingsDialog::saveProxy() @@ -662,7 +655,7 @@ void SettingsDialog::saveFile(const QString &name, const QString &path) void SettingsDialog::saveFile(const QString &name, const QByteArray &content) { QString filename = FileDialog::getSaveFileName(this, tr("Save as"), QStringLiteral( "%1/%2_%3_%4") - .arg(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), qApp->applicationName(), qApp->applicationVersion(), name), + .arg(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), QApplication::applicationName(), QApplication::applicationVersion(), name), tr("Text files (*.txt)") ); if( filename.isEmpty() ) return; diff --git a/client/dialogs/SettingsDialog.ui b/client/dialogs/SettingsDialog.ui index e915df19d..0735a4030 100644 --- a/client/dialogs/SettingsDialog.ui +++ b/client/dialogs/SettingsDialog.ui @@ -371,16 +371,6 @@ QRadioButton::indicator::checked { - - - - Online TSL digest check - - - true - - -