@@ -66,6 +66,7 @@ class MacMenuBar {};
6666#include < QtCore/QXmlStreamReader>
6767#include < QtGui/QDesktopServices>
6868#include < QtGui/QFileOpenEvent>
69+ #include < QtGui/QFontDatabase>
6970#include < QtGui/QScreen>
7071#include < QtNetwork/QNetworkProxy>
7172#include < QtNetwork/QSslCertificate>
@@ -197,11 +198,14 @@ class DigidocConf final: public digidoc::XmlConfCurrent
197198 if (static std::atomic_bool isShown (false ); !isShown.exchange (true ))
198199 {
199200 dispatchToMain ([] {
200- WarningDialog::show (Application::tr (
201- " The renewal of Trust Service status List, used for digital signature validation, has failed. "
202- " Please check your internet connection and make sure you have the latest ID-software version "
203- " installed. An expired Trust Service List (TSL) will be used for signature validation. "
204- " <a href=\" https://www.id.ee/en/article/digidoc4-message-updating-the-list-of-trusted-certificates-was-unsuccessful/\" >Additional information</a>" ), QString ());
201+ WarningDialog::create ()
202+ ->withTitle (Application::tr (" The renewal of Trust Service status List has failed" ))
203+ ->withText (Application::tr (
204+ " Trust Service status List is used for digital signature validation. "
205+ " Please check your internet connection and make sure you have the latest ID-software version "
206+ " installed. An expired Trust Service List (TSL) will be used for signature validation. "
207+ " <a href=\" https://www.id.ee/en/article/digidoc4-message-updating-the-list-of-trusted-certificates-was-unsuccessful/\" >Additional information</a>" ))
208+ ->open ();
205209 });
206210 }
207211 return true ;
@@ -344,6 +348,8 @@ Application::Application( int &argc, char **argv )
344348 connect (this , &Application::messageReceived, this , qOverload<const QString&>(&Application::parseArgs));
345349#endif
346350
351+ QFontDatabase::addApplicationFont (QStringLiteral (" :/fonts/Roboto-Bold.ttf" ));
352+
347353#ifdef CONFIG_URL
348354 d->conf = new Configuration (this );
349355 QMetaObject::invokeMethod (this , [this ] {
@@ -354,47 +360,48 @@ Application::Application( int &argc, char **argv )
354360 WarningDialog *dlg{};
355361 if (lessThanVersion (QLatin1String (" QDIGIDOC4-UNSUPPORTED" )))
356362 {
357- dlg = WarningDialog::show ( tr (
358- " This version of ID-software on your computer is unsupported. "
359- " DigiDoc4 Client cannot be used until you update ID-software. "
360- " Install new ID-software from <a href=\" https://www.id.ee/en/article/install-id-software/\" >www.id.ee</a>. "
361- " macOS users can download the latest ID-software version from the "
362- " <a href=\" https://itunes.apple.com/ee/developer/ria/id556524921?mt=12\" >Mac App Store</a>." ));
363+ dlg = WarningDialog::create ()
364+ -> withTitle ( tr ( " This version of ID-software on your computer is unsupported" ))
365+ -> withText ( tr ( " DigiDoc4 Client cannot be used until you update ID-software. "
366+ " Install new ID-software from <a href=\" https://www.id.ee/en/article/install-id-software/\" >www.id.ee</a>. "
367+ " macOS users can download the latest ID-software version from the "
368+ " <a href=\" https://itunes.apple.com/ee/developer/ria/id556524921?mt=12\" >Mac App Store</a>." ));
363369 connect (dlg, &WarningDialog::finished, this , &Application::quit);
364370 }
365371 else if (lessThanVersion (QLatin1String (" QDIGIDOC4-SUPPORTED" )))
366372 {
367- dlg = WarningDialog::show (tr (
368- " Your ID-software has expired. To download the latest software version, go to the "
369- " <a href=\" https://www.id.ee/en/article/install-id-software/\" >id.ee</a> website. "
370- " macOS users can download the latest ID-software version from the "
371- " <a href=\" https://itunes.apple.com/ee/developer/ria/id556524921?mt=12\" >Mac App Store</a>." ));
373+ dlg = WarningDialog::create ()
374+ ->withTitle (tr (" Your ID-software has expired" ))
375+ ->withText (tr (" To download the latest software version, go to the "
376+ " <a href=\" https://www.id.ee/en/article/install-id-software/\" >id.ee</a> website. "
377+ " macOS users can download the latest ID-software version from the "
378+ " <a href=\" https://itunes.apple.com/ee/developer/ria/id556524921?mt=12\" >Mac App Store</a>." ));
372379 }
373380 connect (d->conf , &Configuration::finished, this , [lessThanVersion](bool changed, const QString &){
374381 if (changed && lessThanVersion (QLatin1String (" QDIGIDOC4-LATEST" )))
375382 {
376- auto *dlg = new WarningDialog (tr (
377- " An ID-software update has been found. To download the update, go to the "
378- " <a href=\" https://www.id.ee/en/article/install-id-software/\" >id.ee</a> website. "
379- " macOS users can download the update from the "
380- " <a href=\" https://itunes.apple.com/ee/developer/ria/id556524921?mt=12\" >Mac App Store</a>." ), activeWindow ());
383+ auto *dlg = WarningDialog::create (activeWindow ())
384+ ->withTitle (tr (" An ID-software update has been found" ))
385+ ->withText (tr (" To download the update, go to the "
386+ " <a href=\" https://www.id.ee/en/article/install-id-software/\" >id.ee</a> website. "
387+ " macOS users can download the update from the "
388+ " <a href=\" https://itunes.apple.com/ee/developer/ria/id556524921?mt=12\" >Mac App Store</a>." ));
381389 new Overlay (dlg, activeWindow ());
382390 dlg->exec ();
383391 }
384392 });
385- #ifdef Q_OS_WIN
386393 if (dlg)
387394 {
388- dlg->addButton (tr (" Start downloading" ), 2 );
389- connect (dlg, &WarningDialog::finished, this , [](int result) {
390- if (result != 2 )
391- return ;
395+ #ifdef Q_OS_WIN
396+ dlg->addButton (tr (" Start downloading" ), QMessageBox::Ok);
397+ connect (dlg, &WarningDialog::accepted, this , [] {
392398 QString path = QApplication::applicationDirPath () + QLatin1String (" /id-updater.exe" );
393399 if (QFile::exists (path))
394400 QProcess::startDetached (path, {});
395401 });
396- }
397402#endif
403+ dlg->open ();
404+ }
398405 }, Qt::QueuedConnection);
399406#endif
400407
@@ -470,11 +477,11 @@ Application::Application( int &argc, char **argv )
470477#ifdef Q_OS_MAC
471478 if (!Settings::PLUGINS.isSet ())
472479 {
473- auto *dlg = new WarningDialog ( tr (
474- " In order to authenticate and sign in e-services with an ID-card you need to install the web browser components." ), mainWindow ());
475- dlg ->setCancelText (tr (" Ignore forever" ));
476- dlg ->addButton (tr (" Remind later" ), QMessageBox::Ignore);
477- dlg ->addButton (tr (" Install" ), QMessageBox::Open);
480+ auto *dlg = WarningDialog::create ()
481+ -> withText ( tr ( " In order to authenticate and sign in e-services with an ID-card you need to install the web browser components." ))
482+ ->setCancelText (tr (" Ignore forever" ))
483+ ->addButton (tr (" Remind later" ), QMessageBox::Ignore)
484+ ->addButton (tr (" Install" ), QMessageBox::Open);
478485 connect (dlg, &WarningDialog::finished, this , [](int result) {
479486 switch (result)
480487 {
@@ -809,11 +816,15 @@ bool Application::notify(QObject *object, QEvent *event)
809816 }
810817 catch (const std::bad_alloc &e)
811818 {
812- WarningDialog::show (tr (" Added file(s) exceeds the maximum size limit of the container(120MB)." ), QString::fromLocal8Bit (e.what ()));
819+ WarningDialog::create ()
820+ ->withTitle (DocumentModel::tr (" Failed to add file" ))
821+ ->withText (tr (" Added file(s) exceeds the maximum size limit of the container(120MB)." ))
822+ ->withDetails (QString::fromLocal8Bit (e.what ()))
823+ ->open ();
813824 }
814825 catch (...)
815826 {
816- WarningDialog::show ( tr (" Caught exception!" ));
827+ WarningDialog::create ()-> withTitle ( tr (" Caught exception!" ))-> open ( );
817828 }
818829
819830 return false ;
@@ -944,11 +955,11 @@ void Application::showClient(QStringList files, bool crypto, bool sign, bool new
944955 });
945956}
946957
947- void Application::showWarning ( const QString &msg , const digidoc::Exception &e )
958+ void Application::showWarning (const QString &title , const digidoc::Exception &e)
948959{
949960 digidoc::Exception::ExceptionCode code = digidoc::Exception::General;
950961 QStringList causes = DigiDoc::parseException (e, code);
951- WarningDialog::show (msg, causes.join (' \n ' ));
962+ WarningDialog::create ()-> withTitle (title)-> withDetails ( causes.join (' \n ' ))-> open ( );
952963}
953964
954965QSigner* Application::signer () const { return d->signer ; }
0 commit comments