Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 47 additions & 36 deletions client/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ class MacMenuBar {};
#include <QtCore/QXmlStreamReader>
#include <QtGui/QDesktopServices>
#include <QtGui/QFileOpenEvent>
#include <QtGui/QFontDatabase>
#include <QtGui/QScreen>
#include <QtNetwork/QNetworkProxy>
#include <QtNetwork/QSslCertificate>
Expand Down Expand Up @@ -197,11 +198,14 @@ class DigidocConf final: public digidoc::XmlConfCurrent
if(static std::atomic_bool isShown(false); !isShown.exchange(true))
{
dispatchToMain([] {
WarningDialog::show(Application::tr(
"The renewal of Trust Service status List, used for digital signature validation, has failed. "
"Please check your internet connection and make sure you have the latest ID-software version "
"installed. An expired Trust Service List (TSL) will be used for signature validation. "
"<a href=\"https://www.id.ee/en/article/digidoc4-message-updating-the-list-of-trusted-certificates-was-unsuccessful/\">Additional information</a>"), QString());
WarningDialog::create()
->withTitle(Application::tr("The renewal of Trust Service status List has failed"))
->withText(Application::tr(
"Trust Service status List is used for digital signature validation. "
"Please check your internet connection and make sure you have the latest ID-software version "
"installed. An expired Trust Service List (TSL) will be used for signature validation. "
"<a href=\"https://www.id.ee/en/article/digidoc4-message-updating-the-list-of-trusted-certificates-was-unsuccessful/\">Additional information</a>"))
->open();
});
}
return true;
Expand Down Expand Up @@ -344,6 +348,8 @@ Application::Application( int &argc, char **argv )
connect(this, &Application::messageReceived, this, qOverload<const QString&>(&Application::parseArgs));
#endif

QFontDatabase::addApplicationFont(QStringLiteral(":/fonts/Roboto-Bold.ttf"));

#ifdef CONFIG_URL
d->conf = new Configuration(this);
QMetaObject::invokeMethod(this, [this] {
Expand All @@ -354,47 +360,48 @@ Application::Application( int &argc, char **argv )
WarningDialog *dlg{};
if(lessThanVersion(QLatin1String("QDIGIDOC4-UNSUPPORTED")))
{
dlg = WarningDialog::show(tr(
"This version of ID-software on your computer is unsupported. "
"DigiDoc4 Client cannot be used until you update ID-software. "
"Install new ID-software from <a href=\"https://www.id.ee/en/article/install-id-software/\">www.id.ee</a>. "
"macOS users can download the latest ID-software version from the "
"<a href=\"https://itunes.apple.com/ee/developer/ria/id556524921?mt=12\">Mac App Store</a>."));
dlg = WarningDialog::create()
->withTitle(tr("This version of ID-software on your computer is unsupported"))
->withText(tr("DigiDoc4 Client cannot be used until you update ID-software. "
"Install new ID-software from <a href=\"https://www.id.ee/en/article/install-id-software/\">www.id.ee</a>. "
"macOS users can download the latest ID-software version from the "
"<a href=\"https://itunes.apple.com/ee/developer/ria/id556524921?mt=12\">Mac App Store</a>."));
connect(dlg, &WarningDialog::finished, this, &Application::quit);
}
else if(lessThanVersion(QLatin1String("QDIGIDOC4-SUPPORTED")))
{
dlg = WarningDialog::show(tr(
"Your ID-software has expired. To download the latest software version, go to the "
"<a href=\"https://www.id.ee/en/article/install-id-software/\">id.ee</a> website. "
"macOS users can download the latest ID-software version from the "
"<a href=\"https://itunes.apple.com/ee/developer/ria/id556524921?mt=12\">Mac App Store</a>."));
dlg = WarningDialog::create()
->withTitle(tr("Your ID-software has expired"))
->withText(tr("To download the latest software version, go to the "
"<a href=\"https://www.id.ee/en/article/install-id-software/\">id.ee</a> website. "
"macOS users can download the latest ID-software version from the "
"<a href=\"https://itunes.apple.com/ee/developer/ria/id556524921?mt=12\">Mac App Store</a>."));
}
connect(d->conf, &Configuration::finished, this, [lessThanVersion](bool changed, const QString &){
if(changed && lessThanVersion(QLatin1String("QDIGIDOC4-LATEST")))
{
auto *dlg = new WarningDialog(tr(
"An ID-software update has been found. To download the update, go to the "
"<a href=\"https://www.id.ee/en/article/install-id-software/\">id.ee</a> website. "
"macOS users can download the update from the "
"<a href=\"https://itunes.apple.com/ee/developer/ria/id556524921?mt=12\">Mac App Store</a>."), activeWindow());
auto *dlg = WarningDialog::create(activeWindow())
->withTitle(tr("An ID-software update has been found"))
->withText(tr("To download the update, go to the "
"<a href=\"https://www.id.ee/en/article/install-id-software/\">id.ee</a> website. "
"macOS users can download the update from the "
"<a href=\"https://itunes.apple.com/ee/developer/ria/id556524921?mt=12\">Mac App Store</a>."));
new Overlay(dlg, activeWindow());
dlg->exec();
}
});
#ifdef Q_OS_WIN
if(dlg)
{
dlg->addButton(tr("Start downloading"), 2);
connect(dlg, &WarningDialog::finished, this, [](int result) {
if(result != 2)
return;
#ifdef Q_OS_WIN
dlg->addButton(tr("Start downloading"), QMessageBox::Ok);
connect(dlg, &WarningDialog::accepted, this, [] {
QString path = QApplication::applicationDirPath() + QLatin1String("/id-updater.exe");
if (QFile::exists(path))
QProcess::startDetached(path, {});
});
}
#endif
dlg->open();
}
}, Qt::QueuedConnection);
#endif

Expand Down Expand Up @@ -470,11 +477,11 @@ Application::Application( int &argc, char **argv )
#ifdef Q_OS_MAC
if(!Settings::PLUGINS.isSet())
{
auto *dlg = new WarningDialog(tr(
"In order to authenticate and sign in e-services with an ID-card you need to install the web browser components."), mainWindow());
dlg->setCancelText(tr("Ignore forever"));
dlg->addButton(tr("Remind later"), QMessageBox::Ignore);
dlg->addButton(tr("Install"), QMessageBox::Open);
auto *dlg = WarningDialog::create()
->withText(tr("In order to authenticate and sign in e-services with an ID-card you need to install the web browser components."))
->setCancelText(tr("Ignore forever"))
->addButton(tr("Remind later"), QMessageBox::Ignore)
->addButton(tr("Install"), QMessageBox::Open);
connect(dlg, &WarningDialog::finished, this, [](int result) {
switch(result)
{
Expand Down Expand Up @@ -809,11 +816,15 @@ bool Application::notify(QObject *object, QEvent *event)
}
catch(const std::bad_alloc &e)
{
WarningDialog::show(tr("Added file(s) exceeds the maximum size limit of the container(120MB)."), QString::fromLocal8Bit(e.what()));
WarningDialog::create()
->withTitle(DocumentModel::tr("Failed to add file"))
->withText(tr("Added file(s) exceeds the maximum size limit of the container(120MB)."))
->withDetails(QString::fromLocal8Bit(e.what()))
->open();
}
catch(...)
{
WarningDialog::show(tr("Caught exception!"));
WarningDialog::create()->withTitle(tr("Caught exception!"))->open();
}

return false;
Expand Down Expand Up @@ -944,11 +955,11 @@ void Application::showClient(QStringList files, bool crypto, bool sign, bool new
});
}

void Application::showWarning( const QString &msg, const digidoc::Exception &e )
void Application::showWarning(const QString &title, const digidoc::Exception &e)
{
digidoc::Exception::ExceptionCode code = digidoc::Exception::General;
QStringList causes = DigiDoc::parseException(e, code);
WarningDialog::show(msg, causes.join('\n'));
WarningDialog::create()->withTitle(title)->withDetails(causes.join('\n'))->open();
}

QSigner* Application::signer() const { return d->signer; }
Expand Down
2 changes: 1 addition & 1 deletion client/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private Q_SLOTS:
static void msgHandler(QtMsgType type, const QMessageLogContext &ctx, const QString &msg);
static void parseArgs(const QString &msg = {});
static void parseArgs(QStringList args);
static void showWarning(const QString &msg, const digidoc::Exception &e);
static void showWarning(const QString &title, const digidoc::Exception &e);
#if defined(Q_OS_MAC)
static void initMacEvents();
static void deinitMacEvents();
Expand Down
6 changes: 3 additions & 3 deletions client/CDoc1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@
#include "QCryptoBackend.h"
#include "QSigner.h"
#include "Utils.h"
#include "dialogs/FileDialog.h"

#include <QtCore/QBuffer>
#include <QtCore/QDebug>
#include <QtCore/QDir>
#include <QtCore/QTemporaryFile>
#include <QtCore/QXmlStreamWriter>
#include <QtNetwork/QSslKey>
Expand Down Expand Up @@ -68,7 +68,7 @@ const QHash<QString, QCryptographicHash::Algorithm> CDoc1::SHA_MTH{
CDoc1::CDoc1(const QString &path)
: QFile(path)
{
setLastError(CryptoDoc::tr("An error occurred while opening the document."));
setLastError(CryptoDoc::tr("An error occurred while opening the document"));
if(!open(QFile::ReadOnly))
return;
readXML(this, [this](QXmlStreamReader &xml) {
Expand Down Expand Up @@ -195,7 +195,7 @@ bool CDoc1::decryptPayload(const QByteArray &key)
return setLastError(CryptoDoc::tr("Error parsing document"));
data = Crypto::cipher(ENC_MTH[method], key, data, false);
if(data.isEmpty())
return setLastError(CryptoDoc::tr("Failed to decrypt document"));
return setLastError(QCoreApplication::translate("QSigner", "Failed to decrypt document"));

// remove ANSIX923 padding
if(data.size() > 0 && method == AES128CBC_MTH)
Expand Down
Loading
Loading