Skip to content

Commit

Permalink
Remove option (open-eid#1188)
Browse files Browse the repository at this point in the history
IB-7719

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma authored May 31, 2023
1 parent eca150a commit 601f172
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 45 deletions.
24 changes: 12 additions & 12 deletions client/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")); });
Expand Down Expand Up @@ -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; }
Expand All @@ -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<digidoc::X509Cert> TSCerts() const final
Expand Down Expand Up @@ -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<QSslCertificate> list;
for(const auto &cert: Application::confValue(QLatin1String("CERT-BUNDLE")).toArray())
list.append(QSslCertificate(fromBase64(cert), QSsl::Der));
Expand Down Expand Up @@ -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<QWidget *>(object), QAccessible::StaticText);
return interface;
return new QAccessibleWidget(qobject_cast<QWidget *>(object), QAccessible::StaticText);
return {};
});


Expand All @@ -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 );
Expand Down Expand Up @@ -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 );
}
Expand Down Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion client/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class Application final: public Common
TSLUrl,
TSLCerts,
TSLCache,
TSLOnlineDigest
};

explicit Application( int &argc, char **argv );
Expand Down
37 changes: 15 additions & 22 deletions client/dialogs/SettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

#include <algorithm>

#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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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)
{
Expand Down Expand Up @@ -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();
Expand All @@ -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);
}
Expand All @@ -328,10 +325,6 @@ void SettingsDialog::initFunctionality()
connect(ui->langGroup, qOverload<QAbstractButton*>(&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) {
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 0 additions & 10 deletions client/dialogs/SettingsDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -371,16 +371,6 @@ QRadioButton::indicator::checked {
</item>
</layout>
</item>
<item>
<widget class="CheckBox" name="chkGeneralTslRefresh">
<property name="text">
<string>Online TSL digest check</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="CheckBox" name="chkShowPrintSummary">
<property name="text">
Expand Down

0 comments on commit 601f172

Please sign in to comment.