diff --git a/client/Application.cpp b/client/Application.cpp index 14dd6aee5..c0fcd28ff 100644 --- a/client/Application.cpp +++ b/client/Application.cpp @@ -28,7 +28,6 @@ #include "QSmartCard.h" #include "DigiDoc.h" #include "Settings.h" -#include "Styles.h" #ifdef Q_OS_MAC #include "MacMenuBar.h" #else @@ -66,6 +65,7 @@ class MacMenuBar {}; #include #include #include +#include #include #include #include @@ -197,11 +197,12 @@ class DigidocConf final: public digidoc::XmlConfCurrent if(static std::atomic_bool isShown(false); !isShown.exchange(true)) { dispatchToMain([] { - WarningDialog::show(Application::tr( + WarningDialog::create()->withText(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. " - "Additional information"), QString()); + "Additional information")) + ->open(); }); } return true; @@ -312,10 +313,6 @@ Application::Application( int &argc, char **argv ) setWindowIcon(QIcon(QStringLiteral(":/images/Icon.svg"))); if(QFile::exists(QStringLiteral("%1/%2.log").arg(QDir::tempPath(), applicationName()))) qInstallMessageHandler(msgHandler); - QPalette p = palette(); - p.setBrush(QPalette::Link, QBrush("#2F70B6")); - p.setBrush(QPalette::LinkVisited, QBrush("#2F70B6")); - setPalette(p); #if defined(Q_OS_WIN) AllowSetForegroundWindow( ASFW_ANY ); @@ -328,10 +325,6 @@ Application::Application( int &argc, char **argv ) setLibraryPaths({ applicationDirPath() + "/../PlugIns" }); #endif #endif - setStyleSheet(QStringLiteral( - "QDialogButtonBox { dialogbuttonbox-buttons-have-icons: 0; }\n")); - - QNetworkProxyFactory::setUseSystemConfiguration(true); QStringList args = arguments(); args.removeFirst(); @@ -344,6 +337,19 @@ Application::Application( int &argc, char **argv ) connect(this, &Application::messageReceived, this, qOverload(&Application::parseArgs)); #endif + QPalette p = palette(); + p.setBrush(QPalette::Link, QBrush("#2F70B6")); + p.setBrush(QPalette::LinkVisited, QBrush("#2F70B6")); + setPalette(p); + setStyleSheet(QStringLiteral( + "QDialogButtonBox { dialogbuttonbox-buttons-have-icons: 0; }\n")); + QNetworkProxyFactory::setUseSystemConfiguration(true); + QFontDatabase::addApplicationFont(QStringLiteral(":/fonts/Roboto-Bold.ttf")); + QFontDatabase::addApplicationFont(QStringLiteral(":/fonts/Roboto-Regular.ttf")); + QFont f(QStringLiteral("Roboto, Helvetica")); + f.setPixelSize(14); + QToolTip::setFont(f); + #ifdef CONFIG_URL d->conf = new Configuration(this); QMetaObject::invokeMethod(this, [this] { @@ -354,7 +360,7 @@ Application::Application( int &argc, char **argv ) WarningDialog *dlg{}; if(lessThanVersion(QLatin1String("QDIGIDOC4-UNSUPPORTED"))) { - dlg = WarningDialog::show(tr( + dlg = WarningDialog::create()->withText(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 www.id.ee. " @@ -364,7 +370,7 @@ Application::Application( int &argc, char **argv ) } else if(lessThanVersion(QLatin1String("QDIGIDOC4-SUPPORTED"))) { - dlg = WarningDialog::show(tr( + dlg = WarningDialog::create()->withText(tr( "Your ID-software has expired. To download the latest software version, go to the " "id.ee website. " "macOS users can download the latest ID-software version from the " @@ -373,11 +379,11 @@ Application::Application( int &argc, char **argv ) connect(d->conf, &Configuration::finished, this, [lessThanVersion](bool changed, const QString &){ if(changed && lessThanVersion(QLatin1String("QDIGIDOC4-LATEST"))) { - auto *dlg = new WarningDialog(tr( + auto *dlg = WarningDialog::create(activeWindow())->withText(tr( "An ID-software update has been found. To download the update, go to the " "id.ee website. " "macOS users can download the update from the " - "Mac App Store."), activeWindow()); + "Mac App Store.")); new Overlay(dlg, activeWindow()); dlg->exec(); } @@ -385,14 +391,13 @@ Application::Application( int &argc, char **argv ) #ifdef Q_OS_WIN if(dlg) { - dlg->addButton(tr("Start downloading"), 2); - connect(dlg, &WarningDialog::finished, this, [](int result) { - if(result != 2) - return; + 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, {}); }); + dlg->open(); } #endif }, Qt::QueuedConnection); @@ -401,7 +406,6 @@ Application::Application( int &argc, char **argv ) qRegisterMetaType("TokenData"); qRegisterMetaType("QSmartCardData"); qRegisterMetaType("QEventLoop*"); - QToolTip::setFont(Styles::font(Styles::Regular, 14)); QDesktopServices::setUrlHandler(QStringLiteral("browse"), this, "browse"); QDesktopServices::setUrlHandler(QStringLiteral("mailto"), this, "mailTo"); QAccessible::installFactory([](const QString &classname, QObject *object) -> QAccessibleInterface* { @@ -470,8 +474,8 @@ 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()); + 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.")); dlg->setCancelText(tr("Ignore forever")); dlg->addButton(tr("Remind later"), QMessageBox::Ignore); dlg->addButton(tr("Install"), QMessageBox::Open); @@ -809,11 +813,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; @@ -944,11 +952,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; } diff --git a/client/Application.h b/client/Application.h index 1bc595707..c458af40a 100644 --- a/client/Application.h +++ b/client/Application.h @@ -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(); diff --git a/client/CDoc1.cpp b/client/CDoc1.cpp index 338797151..af7b22b7b 100644 --- a/client/CDoc1.cpp +++ b/client/CDoc1.cpp @@ -24,10 +24,10 @@ #include "QCryptoBackend.h" #include "QSigner.h" #include "Utils.h" -#include "dialogs/FileDialog.h" #include #include +#include #include #include #include @@ -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) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 1a14a7f05..22cf438cd 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -33,7 +33,6 @@ add_executable(${PROJECT_NAME} WIN32 MACOSX_BUNDLE ${PROJECT_NAME}.rc ${WIDGETS} images/images.qrc - fonts/fonts.qrc mac/Info.plist.cmake common_enums.h main.cpp @@ -65,7 +64,6 @@ add_executable(${PROJECT_NAME} WIN32 MACOSX_BUNDLE LdapSearch.cpp LdapSearch.h MainWindow.cpp - MainWindow_MyEID.cpp MainWindow.h MainWindow.ui PrintSheet.cpp @@ -86,8 +84,6 @@ add_executable(${PROJECT_NAME} WIN32 MACOSX_BUNDLE Settings.h SslCertificate.cpp SslCertificate.h - Styles.cpp - Styles.h TokenData.cpp TokenData.h Utils.h @@ -105,6 +101,10 @@ qt_add_translations(${PROJECT_NAME} TS_FILES LUPDATE_OPTIONS -locations none ) qt_add_resources(${PROJECT_NAME} tsl BASE ${TSL_DIR} PREFIX /TSL FILES ${TSL_LIST}) +qt_add_resources(${PROJECT_NAME} fonts BASE fonts PREFIX /fonts FILES + fonts/Roboto-Bold.ttf + fonts/Roboto-Regular.ttf +) target_link_libraries(${PROJECT_NAME} qdigidoccommon diff --git a/client/CryptoDoc.cpp b/client/CryptoDoc.cpp index 3da60461d..9ea0b162f 100644 --- a/client/CryptoDoc.cpp +++ b/client/CryptoDoc.cpp @@ -49,7 +49,7 @@ class CryptoDoc::Private final: public QThread { Q_OBJECT public: - bool isEncryptedWarning() const; + bool isEncryptedWarning(const QString &title) const; void run() final; inline void waitForFinished() { @@ -67,12 +67,12 @@ class CryptoDoc::Private final: public QThread QStringList tempFiles; }; -bool CryptoDoc::Private::isEncryptedWarning() const +bool CryptoDoc::Private::isEncryptedWarning(const QString &title) const { if( fileName.isEmpty() ) - WarningDialog::show(CryptoDoc::tr("Container is not open")); + WarningDialog::create()->withTitle(title)->withText(CryptoDoc::tr("Container is not open"))->open(); if(isEncrypted) - WarningDialog::show(CryptoDoc::tr("Container is encrypted")); + WarningDialog::create()->withTitle(title)->withText(CryptoDoc::tr("Container is encrypted"))->open(); return fileName.isEmpty() || isEncrypted; } @@ -96,28 +96,20 @@ CDocumentModel::CDocumentModel(CryptoDoc::Private *doc) bool CDocumentModel::addFile(const QString &file, const QString &mime) { - if( d->isEncryptedWarning() ) + if(d->isEncryptedWarning(DocumentModel::tr("Failed to add file"))) return false; QFileInfo info(file); - if(info.size() == 0) - { - WarningDialog::show(DocumentModel::tr("Cannot add empty file to the container.")); + if(!addFileCheck(d->fileName, info)) return false; - } - if(d->cdoc->version() == 1 && info.size() > 120*1024*1024) - { - WarningDialog::show(tr("Added file(s) exceeds the maximum size limit of the container (∼120MB). " - "Read more about it")); - return false; - } - QString fileName(info.fileName()); - if(std::any_of(d->cdoc->files.cbegin(), d->cdoc->files.cend(), - [&fileName](const auto &containerFile) { return containerFile.name == fileName; })) + if(d->cdoc->version() == 1 && info.size() > 120*1024*1024) { - WarningDialog::show(DocumentModel::tr("Cannot add the file to the envelope. File '%1' is already in container.") - .arg(FileDialog::normalized(fileName))); + WarningDialog::create() + ->withTitle(DocumentModel::tr("Failed to add file")) + ->withText(tr("Added file(s) exceeds the maximum size limit of the container (∼120MB). " + "Read more about it")) + ->open(); return false; } @@ -148,7 +140,10 @@ QString CDocumentModel::copy(int row, const QString &dst) const file.data->seek(0); if(QFile f(dst); f.open(QFile::WriteOnly) && copyIODevice(file.data.get(), &f) == file.size) return dst; - WarningDialog::show(tr("Failed to save file '%1'").arg(dst)); + WarningDialog::create() + ->withTitle(FileDialog::tr("Failed to save file")) + ->withText(dst) + ->open(); return {}; } @@ -186,17 +181,19 @@ void CDocumentModel::open(int row) bool CDocumentModel::removeRow(int row) { - if(d->isEncryptedWarning()) + if(d->isEncryptedWarning(DocumentModel::tr("Failed remove document from container"))) return false; if(d->cdoc->files.empty() || row >= d->cdoc->files.size()) { - WarningDialog::show(DocumentModel::tr("Internal error")); + WarningDialog::create() + ->withTitle(DocumentModel::tr("Failed remove document from container")) + ->withText(DocumentModel::tr("Internal error")) + ->open(); return false; } d->cdoc->files.erase(d->cdoc->files.cbegin() + row); - emit removed(row); return true; } @@ -319,11 +316,14 @@ CryptoDoc::~CryptoDoc() { clear(); delete d; } bool CryptoDoc::addKey( const CKey &key ) { - if(d->isEncryptedWarning()) + if(d->isEncryptedWarning(tr("Failed to add key"))) return false; if(d->cdoc->keys.contains(key)) { - WarningDialog::show(tr("Key already exists")); + WarningDialog::create() + ->withTitle(tr("Failed to add key")) + ->withText(tr("Key already exists")) + ->open(); return false; } d->cdoc->keys.append(key); @@ -361,7 +361,10 @@ bool CryptoDoc::decrypt() { if( d->fileName.isEmpty() ) { - WarningDialog::show(tr("Container is not open")); + WarningDialog::create() + ->withTitle(QSigner::tr("Failed to decrypt document")) + ->withText(tr("Container is not open")) + ->open(); return false; } if(!d->isEncrypted) @@ -370,15 +373,20 @@ bool CryptoDoc::decrypt() CKey key = d->cdoc->canDecrypt(qApp->signer()->tokenauth().cert()); if(key.key.isEmpty()) { - WarningDialog::show(tr("You do not have the key to decrypt this document")); + WarningDialog::create() + ->withTitle(QSigner::tr("Failed to decrypt document")) + ->withText(tr("You do not have the key to decrypt this document")) + ->open(); return false; } if(d->cdoc->version() == 2 && !key.transaction_id.isEmpty() && !Settings::CDOC2_NOTIFICATION.isSet()) { - auto *dlg = new WarningDialog(tr("You must enter your PIN code twice in order to decrypt the CDOC2 container. " - "The first PIN entry is required for authentication to the key server referenced in the CDOC2 container. " - "Second PIN entry is required to decrypt the CDOC2 container."), Application::mainWindow()); + auto *dlg = WarningDialog::create() + ->withTitle(QSigner::tr("Failed to decrypt document")) + ->withText(tr("You must enter your PIN code twice in order to decrypt the CDOC2 container. " + "The first PIN entry is required for authentication to the key server referenced in the CDOC2 container. " + "Second PIN entry is required to decrypt the CDOC2 container.")); dlg->setCancelText(WarningDialog::Cancel); dlg->addButton(WarningDialog::OK, QMessageBox::Ok); dlg->addButton(tr("Don't show again"), QMessageBox::Ignore); @@ -398,15 +406,25 @@ bool CryptoDoc::decrypt() #endif if(d->key.isEmpty()) { - WarningDialog::show(tr("Failed to decrypt document. Please check your internet connection and network settings."), d->cdoc->lastError); + WarningDialog::create() + ->withTitle(QSigner::tr("Failed to decrypt document")) + ->withText(tr("Please check your internet connection and network settings.")) + ->withDetails(d->cdoc->lastError) + ->open(); return false; } d->waitForFinished(); if(d->isEncrypted) - WarningDialog::show(tr("Error parsing document")); + WarningDialog::create() + ->withTitle(QSigner::tr("Failed to decrypt document")) + ->withText(tr("Error parsing document")) + ->open(); if(!d->cdoc->lastError.isEmpty()) - WarningDialog::show(d->cdoc->lastError); + WarningDialog::create() + ->withTitle(QSigner::tr("Failed to decrypt document")) + ->withDetails(d->cdoc->lastError) + ->open(); return !d->isEncrypted; } @@ -419,14 +437,20 @@ bool CryptoDoc::encrypt( const QString &filename ) d->fileName = filename; if( d->fileName.isEmpty() ) { - WarningDialog::show(tr("Container is not open")); + WarningDialog::create() + ->withTitle(tr("Failed to encrypt document")) + ->withText(tr("Container is not open")) + ->open(); return false; } if(d->isEncrypted) return true; if(d->cdoc->keys.isEmpty()) { - WarningDialog::show(tr("No keys specified")); + WarningDialog::create() + ->withTitle(tr("Failed to encrypt document")) + ->withText(tr("No keys specified")) + ->open(); return false; } @@ -434,7 +458,11 @@ bool CryptoDoc::encrypt( const QString &filename ) if(d->isEncrypted) open(d->fileName); else - WarningDialog::show(tr("Failed to encrypt document. Please check your internet connection and network settings."), d->cdoc->lastError); + WarningDialog::create() + ->withTitle(tr("Failed to encrypt document")) + ->withText(tr("Please check your internet connection and network settings.")) + ->withDetails(d->cdoc->lastError) + ->open(); return d->isEncrypted; } @@ -462,7 +490,10 @@ bool CryptoDoc::open( const QString &file ) d->isEncrypted = bool(d->cdoc); if(!d->isEncrypted || d->cdoc->keys.isEmpty()) { - WarningDialog::show(tr("Failed to open document"), d->cdoc->lastError); + WarningDialog::create() + ->withTitle(tr("Failed to open document")) + ->withDetails(d->cdoc->lastError) + ->open(); return false; } Application::addRecent( file ); @@ -471,7 +502,7 @@ bool CryptoDoc::open( const QString &file ) void CryptoDoc::removeKey( int id ) { - if(!d->isEncryptedWarning()) + if(!d->isEncryptedWarning(tr("Failed to remove key"))) d->cdoc->keys.removeAt(id); } diff --git a/client/DigiDoc.cpp b/client/DigiDoc.cpp index 4020f327f..46bbe43d7 100644 --- a/client/DigiDoc.cpp +++ b/client/DigiDoc.cpp @@ -22,9 +22,7 @@ #include "Application.h" #include "CheckConnection.h" #include "Common.h" -#include "QPCSC.h" #include "QSigner.h" -#include "SslCertificate.h" #include "TokenData.h" #include "Utils.h" #include "dialogs/FileDialog.h" @@ -56,15 +54,19 @@ struct ServiceConfirmation final: public ContainerOpenCB bool validateOnline() const final { if(!CheckConnection().check()) return dispatchToMain([this] { - WarningDialog::show(parent, DigiDoc::tr("Connecting to SiVa server failed! Please check your internet connection and network settings.")); + WarningDialog::create(parent) + ->withTitle(DigiDoc::tr("Connecting to SiVa server failed!")) + ->withText(DigiDoc::tr("Please check your internet connection and network settings.")) + ->open(); return false; }); return dispatchToMain([this] { - auto *dlg = new WarningDialog(DigiDoc::tr("This type of signed document will be transmitted to the " + auto *dlg = WarningDialog::create(parent)->withText(DigiDoc::tr( + "This type of signed document will be transmitted to the " "Digital Signature Validation Service SiVa to verify the validity of the digital signature. " "Read more information about transmitted data to Digital Signature Validation service from " "here.
" - "Do you want to continue?"), parent); + "Do you want to continue?")); dlg->setCancelText(WarningDialog::Cancel); dlg->addButton(WarningDialog::YES, QMessageBox::Yes); return dlg->exec() == QMessageBox::Yes; @@ -289,26 +291,17 @@ SDocumentModel::SDocumentModel(DigiDoc *container) bool SDocumentModel::addFile(const QString &file, const QString &mime) { QFileInfo info(file); - if(info.size() == 0) - { - WarningDialog::show(DocumentModel::tr("Cannot add empty file to the container.")); + if(!addFileCheck(doc->fileName(), info)) return false; - } QString fileName(info.fileName()); if(fileName == QStringLiteral("mimetype")) { - WarningDialog::show(DocumentModel::tr("Cannot add file with name 'mimetype' to the envelope.")); + WarningDialog::create() + ->withTitle(DocumentModel::tr("Failed to add file")) + ->withText(DocumentModel::tr("Cannot add file with name 'mimetype' to the envelope.")) + ->open(); return false; } - for(int row = 0; row < rowCount(); row++) - { - if(fileName == from(doc->b->dataFiles().at(size_t(row))->fileName())) - { - WarningDialog::show(DocumentModel::tr("Cannot add the file to the envelope. File '%1' is already in container.") - .arg(FileDialog::normalized(fileName))); - return false; - } - } if(doc->addFile(file, mime)) { emit added(FileDialog::normalized(fileName)); @@ -372,10 +365,9 @@ bool SDocumentModel::removeRow(int row) { doc->b->removeDataFile(unsigned(row)); doc->modified = true; - emit removed(row); return true; } - catch( const Exception &e ) { DigiDoc::setLastError(tr("Failed remove document from container"), e); } + catch( const Exception &e ) { DigiDoc::setLastError(DocumentModel::tr("Failed remove document from container"), e); } return false; } @@ -407,7 +399,7 @@ DigiDoc::~DigiDoc() { clear(); } bool DigiDoc::addFile(const QString &file, const QString &mime) { - if(isError(!b->signatures().empty(), tr("Cannot add files to signed container"))) + if(isError(!b->signatures().empty(), DocumentModel::tr("Failed to add file"), tr("Cannot add files to signed container"))) return false; try { b->addDataFile( to(file), to(mime)); @@ -450,12 +442,12 @@ DocumentModel* DigiDoc::documentModel() const QString DigiDoc::fileName() const { return m_fileName; } -bool DigiDoc::isError(bool failure, const QString &msg) const +bool DigiDoc::isError(bool failure, const QString &title, const QString &text) const { if(!b) - WarningDialog::show(tr("Container is not open")); + WarningDialog::create()->withTitle(title)->withText(tr("Container is not open"))->open(); else if(failure) - WarningDialog::show(msg); + WarningDialog::create()->withTitle(title)->withText(text)->open(); return !b || failure; } @@ -553,11 +545,9 @@ bool DigiDoc::open( const QString &file ) switch(e.code()) { case Exception::NetworkError: - setLastError(tr("Connecting to SiVa server failed! Please check your internet connection."), e); - break; case Exception::HostNotFound: case Exception::InvalidUrl: - setLastError(tr("Connecting to SiVa server failed! Please check your internet connection and network settings."), e); + setLastError(tr("Connecting to SiVa server failed!"), e); break; default: if(e.msg().find("Online validation disabled") == std::string::npos) @@ -598,7 +588,7 @@ QStringList DigiDoc::parseException(const Exception &e, Exception::ExceptionCode void DigiDoc::removeSignature( unsigned int num ) { - if(isError(num >= b->signatures().size(), tr("Missing signature"))) + if(isError(num >= b->signatures().size(), tr("Failed remove signature from container"), tr("Missing signature"))) return; try { modified = waitFor([&] { @@ -639,47 +629,51 @@ bool DigiDoc::saveAs(const QString &filename) return false; } -void DigiDoc::setLastError( const QString &msg, const Exception &e ) +void DigiDoc::setLastError(const QString &title, const Exception &e) { + auto *dlg = WarningDialog::create()->withTitle(title); Exception::ExceptionCode code = Exception::General; QStringList causes = parseException(e, code); switch( code ) { case Exception::CertificateRevoked: - WarningDialog::show(tr("Certificate status revoked"), causes.join('\n')); break; + dlg->withText(tr("Certificate status revoked")); break; case Exception::CertificateUnknown: - WarningDialog::show(tr("Certificate status unknown"), causes.join('\n')); break; + dlg->withText(tr("Certificate status unknown")); break; case Exception::OCSPTimeSlot: - WarningDialog::show(tr("Please check your computer time. Additional information"), causes.join('\n')); break; + dlg->withText(tr("Please check your computer time. Additional information")); break; case Exception::OCSPRequestUnauthorized: - WarningDialog::show(tr("You have not granted IP-based access. " - "Check your validity confirmation service access settings."), causes.join('\n')); break; + dlg->withText(tr("You have not granted IP-based access. " + "Check your validity confirmation service access settings.")); break; case Exception::TSForbidden: - WarningDialog::show(tr("Failed to sign container. " - "Check your Time-Stamping service access settings."), causes.join('\n')); break; + dlg->withText(tr("Check your Time-Stamping service access settings.")); break; case Exception::TSTooManyRequests: - WarningDialog::show(tr("The limit for digital signatures per month has been reached for this IP address. " - "Additional information"), causes.join('\n')); break; + dlg->withText(tr("The limit for digital signatures per month has been reached for this IP address. " + "Additional information")); break; case Exception::PINCanceled: - break; + dlg->deleteLater(); + return; case Exception::PINFailed: - WarningDialog::show(tr("PIN Login failed"), causes.join('\n')); break; + dlg->withText(tr("PIN Login failed")); break; case Exception::PINIncorrect: - WarningDialog::show(tr("PIN Incorrect"), causes.join('\n')); break; + dlg->withText(tr("PIN Incorrect")); break; case Exception::PINLocked: - WarningDialog::show(tr("PIN Locked. Unblock to reuse PIN."), causes.join('\n')); break; - case Exception::NetworkError: // use passed message for these thre exceptions + dlg->withText(tr("PIN Locked. Unblock to reuse PIN.")); break; + case Exception::NetworkError: + dlg->withText(tr("Please check your internet connection.")); break; case Exception::HostNotFound: case Exception::InvalidUrl: + dlg->withText(tr("Please check your internet connection and network settings.")); break; default: - WarningDialog::show(msg, causes.join('\n')); break; + break; } + dlg->withDetails(causes.join('\n'))->open(); } bool DigiDoc::sign(const QString &city, const QString &state, const QString &zip, const QString &country, const QString &role, Signer *signer) { - if(isError(b->dataFiles().empty(), tr("Cannot add signature to empty container"))) + if(isError(b->dataFiles().empty(), tr("Failed to sign container"), tr("Cannot add signature to empty container"))) return false; try @@ -709,15 +703,20 @@ bool DigiDoc::sign(const QString &city, const QString &state, const QString &zip switch(code) { case Exception::PINIncorrect: - (new WarningDialog(tr("PIN Incorrect"), Application::mainWindow()))->exec(); + WarningDialog::create() + ->withTitle(tr("Failed to sign container")) + ->withText(tr("PIN Incorrect")) + ->exec(); return sign(city, state, zip, country, role, signer); - case Exception::NetworkError: - case Exception::HostNotFound: - WarningDialog::show(tr("Failed to sign container. Please check the access to signing services and network settings."), causes.join('\n')); break; case Exception::InvalidUrl: - WarningDialog::show(tr("Failed to sign container. Signing service URL is incorrect."), causes.join('\n')); break; + WarningDialog::create() + ->withTitle(tr("Failed to sign container")) + ->withText(tr("Signing service URL is incorrect.")) + ->withDetails(causes.join('\n')) + ->open(); + break; default: - setLastError(tr("Failed to sign container."), e); break; + setLastError(tr("Failed to sign container"), e); break; } } return false; diff --git a/client/DigiDoc.h b/client/DigiDoc.h index 429cd1793..fca8ac1e1 100644 --- a/client/DigiDoc.h +++ b/client/DigiDoc.h @@ -148,8 +148,8 @@ class DigiDoc: public QObject digidoc::Exception::ExceptionCode &code); private: - bool isError(bool failure, const QString &msg = {}) const; - static void setLastError( const QString &msg, const digidoc::Exception &e ); + bool isError(bool failure, const QString &title, const QString &text) const; + static void setLastError(const QString &title, const digidoc::Exception &e); std::unique_ptr b; std::unique_ptr parentContainer; diff --git a/client/DocumentModel.cpp b/client/DocumentModel.cpp index 0920c0815..07faccb44 100644 --- a/client/DocumentModel.cpp +++ b/client/DocumentModel.cpp @@ -27,6 +27,43 @@ #include #include +bool DocumentModel::addFileCheck(const QString &container, QFileInfo file) +{ + // Check that container is not dropped into itself + if(QFileInfo(container) == file) + { + auto *dlg = WarningDialog::create() + ->withTitle(tr("Cannot add container to same container")) + ->withText(FileDialog::normalized(container)); + dlg->setCancelText(WarningDialog::Cancel); + dlg->open(); + return false; + } + + if(file.size() == 0) + { + WarningDialog::create() + ->withTitle(tr("Cannot add empty file to the container.")) + ->withText(FileDialog::normalized(file.absoluteFilePath())) + ->open(); + return false; + } + QString fileName = file.fileName(); + for(int row = 0; row < rowCount(); row++) + { + if(fileName == data(row)) + { + WarningDialog::create() + ->withTitle(tr("File is already in container.")) + ->withText(FileDialog::normalized(fileName)) + ->open(); + return false; + } + } + + return true; +} + void DocumentModel::addTempFiles(const QStringList &files) { for(const QString &file: files) @@ -59,7 +96,9 @@ bool DocumentModel::verifyFile(const QString &f) QJsonArray allowedExts = Application::confValue(QLatin1String("ALLOWED-EXTENSIONS")).toArray(defaultArray); if(allowedExts.contains(QJsonValue(QFileInfo(f).suffix().toLower()))) return true; - auto *dlg = new WarningDialog(tr("A file with this extension cannot be opened in the DigiDoc4 Client. Download the file to view it.")); + auto *dlg = WarningDialog::create() + ->withTitle(tr("Failed to open file")) + ->withText(tr("A file with this extension cannot be opened in the DigiDoc4 Client. Download the file to view it.")); dlg->setCancelText(WarningDialog::OK); dlg->open(); return false; diff --git a/client/DocumentModel.h b/client/DocumentModel.h index 1b20916ac..192b9ed21 100644 --- a/client/DocumentModel.h +++ b/client/DocumentModel.h @@ -20,6 +20,8 @@ #include +class QFileInfo; + class DocumentModel: public QObject { Q_OBJECT @@ -40,8 +42,8 @@ class DocumentModel: public QObject signals: void added(const QString &file); - void removed(int row); protected: + bool addFileCheck(const QString &container, QFileInfo file); static bool verifyFile(const QString &f); }; diff --git a/client/LdapSearch.h b/client/LdapSearch.h index d52ee1b0c..e8a0d336d 100644 --- a/client/LdapSearch.h +++ b/client/LdapSearch.h @@ -34,7 +34,7 @@ class LdapSearch final: public QObject Q_SIGNALS: void searchResult(const QList &result, int resultCount, const QVariantMap &userData); - void error( const QString &msg, const QString &details ); + void error(const QString &title, const QString &details); private: bool init(); diff --git a/client/MainWindow.cpp b/client/MainWindow.cpp index 1a1b83866..127d792f6 100644 --- a/client/MainWindow.cpp +++ b/client/MainWindow.cpp @@ -104,7 +104,6 @@ MainWindow::MainWindow( QWidget *parent ) connect(ui->cryptoIntroButton, &QPushButton::clicked, this, [this] { openContainer(false); }); connect(ui->signContainerPage, &ContainerPage::action, this, &MainWindow::onSignAction); connect(ui->signContainerPage, &ContainerPage::addFiles, this, [this](const QStringList &files) { openFiles(files, true); } ); - connect(ui->signContainerPage, &ContainerPage::fileRemoved, this, &MainWindow::removeSignatureFile); connect(ui->signContainerPage, &ContainerPage::removed, this, &MainWindow::removeSignature); connect(ui->signContainerPage, &ContainerPage::warning, this, [this](WarningText warningText) { ui->warnings->showWarning(std::move(warningText)); @@ -113,7 +112,6 @@ MainWindow::MainWindow( QWidget *parent ) connect(ui->cryptoContainerPage, &ContainerPage::action, this, &MainWindow::onCryptoAction); connect(ui->cryptoContainerPage, &ContainerPage::addFiles, this, [this](const QStringList &files) { openFiles(files, true); } ); - connect(ui->cryptoContainerPage, &ContainerPage::fileRemoved, this, &MainWindow::removeCryptoFile); connect(ui->cryptoContainerPage, &ContainerPage::warning, this, [this](WarningText warningText) { ui->warnings->showWarning(std::move(warningText)); ui->crypto->warningIcon(true); @@ -165,6 +163,12 @@ void MainWindow::changeEvent(QEvent* event) QWidget::changeEvent(event); } +void MainWindow::changePinClicked(QSmartCardData::PinType type, QSmartCard::PinAction action) +{ + if(qApp->signer()->smartcard()->pinChange(type, action, ui->topBar)) + updateMyEid(qApp->signer()->smartcard()->data()); +} + void MainWindow::closeEvent(QCloseEvent * /*event*/) { cryptoDoc.reset(); @@ -189,16 +193,6 @@ ContainerState MainWindow::currentState() return ContainerState::Uninitialized; } -bool MainWindow::decrypt() -{ - if(!cryptoDoc) - return false; - - WaitDialogHolder waitDialog(this, tr("Decrypting")); - - return cryptoDoc->decrypt(); -} - void MainWindow::dragEnterEvent(QDragEnterEvent *event) { if(!event->source() && !dropEventFiles(event).isEmpty()) @@ -251,8 +245,9 @@ bool MainWindow::encrypt() while (!FileDialog::fileIsWritable(cryptoDoc->fileName())) { - auto *dlg = new WarningDialog(tr("Cannot alter container %1. Save different location?") - .arg(FileDialog::normalized(cryptoDoc->fileName())), this); + auto *dlg = WarningDialog::create(this) + ->withTitle(CryptoDoc::tr("Failed to encrypt document")) + ->withText(tr("Cannot alter container %1. Save different location?").arg(FileDialog::normalized(cryptoDoc->fileName()))); dlg->addButton(WarningDialog::YES, QMessageBox::Yes); if(dlg->exec() != QMessageBox::Yes) return false; @@ -281,7 +276,7 @@ void MainWindow::navigateToPage( Pages page, const QStringList &files, bool crea if(page == SignDetails) { navigate = false; - std::unique_ptr signatureContainer(new DigiDoc(this)); + auto signatureContainer = std::make_unique(this); if(create) { QString filename = FileDialog::createNewFileName(files[0], true, this); @@ -307,7 +302,6 @@ void MainWindow::navigateToPage( Pages page, const QStringList &files, bool crea { navigate = false; auto cryptoContainer = std::make_unique(this); - if(create) { QString filename = FileDialog::createNewFileName(files[0], false, this); @@ -361,7 +355,10 @@ void MainWindow::onSignAction(int action, const QString &idCode, const QString & case ClearSignatureWarning: ui->signature->warningIcon(false); ui->warnings->closeWarnings(SignDetails); - ui->warnings->closeWarning(EmptyFileWarning); + break; + case ContainerClose: + digiDoc.reset(); + selectPage(Pages::SignIntro); break; case ContainerCancel: resetDigiDoc({}); @@ -411,6 +408,7 @@ void MainWindow::onCryptoAction(int action, const QString &/*id*/, const QString { switch(action) { + case ContainerClose: case ContainerCancel: cryptoDoc.reset(); selectPage(Pages::CryptoIntro); @@ -421,12 +419,17 @@ void MainWindow::onCryptoAction(int action, const QString &/*id*/, const QString break; case DecryptContainer: case DecryptToken: - if(decrypt()) + { + if(!cryptoDoc) + break; + WaitDialogHolder waitDialog(this, tr("Decrypting")); + if(cryptoDoc->decrypt()) { ui->cryptoContainerPage->transition(cryptoDoc.get(), qApp->signer()->tokenauth().cert()); FadeInNotification::success(ui->topBar, tr("Decryption succeeded!")); } break; + } case EncryptContainer: if(encrypt()) { @@ -486,24 +489,18 @@ void MainWindow::openFiles(const QStringList &files, bool addFile, bool forceCre if(addFile) { page = (state == ContainerState::UnencryptedContainer) ? CryptoDetails : SignDetails; - if(validateFiles(page == CryptoDetails ? cryptoDoc->fileName() : digiDoc->fileName(), content)) - { - if(page != CryptoDetails && digiDoc->isPDF() && !wrap(digiDoc->fileName(), true)) - return; - DocumentModel* model = (current == CryptoDetails) ? - cryptoDoc->documentModel() : digiDoc->documentModel(); - for(const auto &file: content) - model->addFile(file); - selectPage(page); + if(page != CryptoDetails && digiDoc->isPDF() && !wrap(digiDoc->fileName(), true)) return; - } - } - else - { - // If browsed (double-clicked in Explorer/Finder, clicked on bdoc/cdoc in opened container) - // or recently opened file is opened, then new container should be created. - page = (state == ContainerState::UnencryptedContainer) ? SignDetails : CryptoDetails; + DocumentModel* model = (current == CryptoDetails) ? + cryptoDoc->documentModel() : digiDoc->documentModel(); + for(const auto &file: content) + model->addFile(file); + selectPage(page); + return; } + // If browsed (double-clicked in Explorer/Finder, clicked on bdoc/cdoc in opened container) + // or recently opened file is opened, then new container should be created. + page = (state == ContainerState::UnencryptedContainer) ? SignDetails : CryptoDetails; break; default: if(addFile) @@ -547,23 +544,20 @@ void MainWindow::resetDigiDoc(std::unique_ptr &&doc) { if(digiDoc && digiDoc->isModified()) { - QString warning, cancelTxt, saveTxt; + auto *dlg = WarningDialog::create(this); + QString saveTxt; if(digiDoc->state() == UnsignedContainer) { - warning = tr("You've added file(s) to container, but these are not signed yet. Keep the unsigned container or remove it?"); - cancelTxt = WarningDialog::buttonLabel(WarningDialog::Remove); - saveTxt = tr("Keep"); + dlg->withText(tr("You've added file(s) to container, but these are not signed yet. Keep the unsigned container or remove it?")); + dlg->setCancelText(WarningDialog::Remove); + dlg->addButton(tr("Keep"), QMessageBox::Save); } else { - warning = tr("You've changed the open container but have not saved any changes. Save the changes or close without saving?"); - cancelTxt = tr("Do not save"); - saveTxt = tr("Save"); + dlg->withText(tr("You've changed the open container but have not saved any changes. Save the changes or close without saving?")); + dlg->setCancelText(tr("Do not save")); + dlg->addButton(tr("Save"), QMessageBox::Save); } - - auto *dlg = new WarningDialog(warning, this); - dlg->setCancelText(cancelTxt); - dlg->addButton(saveTxt, QMessageBox::Save); if(dlg->exec() == QMessageBox::Save) save(); } @@ -578,7 +572,9 @@ bool MainWindow::save() QString target = digiDoc->fileName(); while(!FileDialog::fileIsWritable(target)) { - auto *dlg = new WarningDialog(tr("Cannot alter container %1. Save different location?").arg(target), this); + auto *dlg = WarningDialog::create(this) + ->withTitle(tr("Cannot alter container")) + ->withText(tr("Cannot alter container %1. Save different location?").arg(FileDialog::normalized(target))); dlg->addButton(WarningDialog::YES, QMessageBox::Yes); if(dlg->exec() != QMessageBox::Yes) return false; @@ -668,52 +664,6 @@ void MainWindow::sign(F &&sign) adjustDrops(); } -void MainWindow::removeCryptoFile(int index) -{ - if(!cryptoDoc) - return; - - if(removeFile(cryptoDoc->documentModel(), index)) - { - if(QFile::exists(cryptoDoc->fileName())) - QFile::remove(cryptoDoc->fileName()); - cryptoDoc.reset(); - selectPage(Pages::CryptoIntro); - } -} - -bool MainWindow::removeFile(DocumentModel *model, int index) -{ - auto count = model->rowCount(); - if(count != 1) - { - model->removeRow(index); - } - else - { - auto *dlg = new WarningDialog(tr("You are about to delete the last file in the container, it is removed along with the container."), this); - dlg->setCancelText(WarningDialog::Cancel); - dlg->resetCancelStyle(false); - dlg->addButton(WarningDialog::Remove, QMessageBox::Ok, true); - if (dlg->exec() == QMessageBox::Ok) { - window()->setWindowFilePath({}); - window()->setWindowTitle(tr("DigiDoc4 Client")); - return true; - } - } - - for(auto i = 0; i < model->rowCount(); ++i) { - if(model->fileSize(i) > 0) - continue; - ui->warnings->closeWarning(EmptyFileWarning); - if(digiDoc) - ui->signContainerPage->transition(digiDoc.get()); - break; - } - - return false; -} - void MainWindow::removeSignature(int index) { if(!digiDoc) @@ -725,41 +675,13 @@ void MainWindow::removeSignature(int index) adjustDrops(); } -void MainWindow::removeSignatureFile(int index) -{ - if(!digiDoc) - return; - - if(removeFile(digiDoc->documentModel(), index)) - { - if(QFile::exists(digiDoc->fileName())) - QFile::remove(digiDoc->fileName()); - digiDoc.reset(); - selectPage(Pages::SignIntro); - } -} - -bool MainWindow::validateFiles(const QString &container, const QStringList &files) -{ - // Check that container is not dropped into itself - QFileInfo containerInfo(container); - if(std::none_of(files.cbegin(), files.cend(), - [containerInfo] (const QString &file) { return containerInfo == QFileInfo(file); })) - return true; - auto *dlg = new WarningDialog(tr("Cannot add container to same container\n%1") - .arg(FileDialog::normalized(container)), this); - dlg->setCancelText(WarningDialog::Cancel); - dlg->open(); - return false; -} - bool MainWindow::wrap(const QString& wrappedFile, bool pdf) { QString filename = FileDialog::createNewFileName(wrappedFile, true, this); if(filename.isNull()) return false; - std::unique_ptr signatureContainer(new DigiDoc(this)); + auto signatureContainer = std::make_unique(this); signatureContainer->create(filename); // If pdf, add whole file to signature container; otherwise content only @@ -779,15 +701,103 @@ bool MainWindow::wrap(const QString& wrappedFile, bool pdf) bool MainWindow::wrapContainer(bool signing) { - QString msg = signing ? - tr("Files can not be added to the signed container. The system will create a new container which shall contain the signed document and the files you wish to add.") : - tr("Files can not be added to the cryptocontainer. The system will create a new container which shall contain the cypto-document and the files you wish to add."); - auto *dlg = new WarningDialog(msg, this); + auto *dlg = WarningDialog::create(this) + ->withTitle(signing ? tr("Files can not be added to the signed container") : tr("Files can not be added to the cryptocontainer")) + ->withText(signing ? + tr("The system will create a new container which shall contain the signed document and the files you wish to add.") : + tr("The system will create a new container which shall contain the cypto-document and the files you wish to add.")); dlg->setCancelText(WarningDialog::Cancel); dlg->addButton(tr("Continue"), QMessageBox::Ok); return dlg->exec() == QMessageBox::Ok; } + +void MainWindow::updateMyEID(const TokenData &t) +{ + ui->warnings->closeWarnings(MyEid); + SslCertificate cert(t.cert()); + auto type = cert.type(); + ui->infoStack->setHidden(type == SslCertificate::UnknownType); + ui->accordion->setHidden(type == SslCertificate::UnknownType); + ui->noReaderInfo->setVisible(type == SslCertificate::UnknownType); + + auto setText = [this](const char *text) { + ui->noReaderInfoText->setProperty("currenttext", text); + ui->noReaderInfoText->setText(tr(text)); + }; + if(!t.isNull()) + { + setText(QT_TR_NOOP("The card in the card reader is not an Estonian ID-card")); + if(ui->cardInfo->token().card() != t.card()) + ui->accordion->clear(); + if(type & SslCertificate::TempelType) + { + ui->infoStack->update(cert); + ui->accordion->updateInfo(cert); + } + } + else + { + ui->infoStack->clearData(); + ui->accordion->clear(); + ui->myEid->invalidIcon(false); + ui->myEid->warningIcon(false); + setText(QT_TR_NOOP("Connect the card reader to your computer and insert your ID card into the reader")); + } +} + +void MainWindow::updateMyEid(const QSmartCardData &data) +{ + ui->infoStack->update(data); + ui->accordion->updateInfo(data); + ui->myEid->warningIcon(false); + ui->myEid->invalidIcon(false); + ui->warnings->closeWarnings(MyEid); + if(data.isNull()) + return; + bool pin1Blocked = data.retryCount(QSmartCardData::Pin1Type) == 0; + bool pin2Blocked = data.retryCount(QSmartCardData::Pin2Type) == 0; + bool pin2Locked = data.pinLocked(QSmartCardData::Pin2Type); + ui->myEid->warningIcon( + pin1Blocked || + pin2Blocked || pin2Locked || + data.retryCount(QSmartCardData::PukType) == 0); + ui->signContainerPage->cardChanged(data.signCert(), pin2Blocked || pin2Locked); + ui->cryptoContainerPage->cardChanged(data.authCert(), pin1Blocked); + + if(pin1Blocked) + ui->warnings->showWarning({WarningType::UnblockPin1Warning, 0, + [this]{ changePinClicked(QSmartCardData::Pin1Type, QSmartCard::UnblockWithPuk); }}); + + if(pin2Locked && pin2Blocked) + ui->warnings->showWarning({WarningType::ActivatePin2WithPUKWarning, 0, + [this]{ changePinClicked(QSmartCardData::Pin2Type, QSmartCard::ActivateWithPuk); }}); + else if(pin2Blocked) + ui->warnings->showWarning({WarningType::UnblockPin2Warning, 0, + [this]{ changePinClicked(QSmartCardData::Pin2Type, QSmartCard::UnblockWithPuk); }}); + else if(pin2Locked) + ui->warnings->showWarning({WarningType::ActivatePin2Warning, 0, + [this]{ changePinClicked(QSmartCardData::Pin2Type, QSmartCard::ActivateWithPin); }}); + + const qint64 DAY = 24 * 60 * 60; + qint64 expiresIn = 106 * DAY; + for(const QSslCertificate &cert: {data.authCert(), data.signCert()}) + { + if(!cert.isNull()) + expiresIn = std::min(expiresIn, QDateTime::currentDateTime().secsTo(cert.expiryDate().toLocalTime())); + } + if(expiresIn <= 0) + { + ui->myEid->invalidIcon(true); + ui->warnings->showWarning({WarningType::CertExpiredError}); + } + else if(expiresIn <= 105 * DAY) + { + ui->myEid->warningIcon(true); + ui->warnings->showWarning({WarningType::CertExpiryWarning}); + } +} + void MainWindow::updateSelector() { TokenData selected; diff --git a/client/MainWindow.h b/client/MainWindow.h index 1ff103ea4..b956faf76 100644 --- a/client/MainWindow.h +++ b/client/MainWindow.h @@ -62,7 +62,6 @@ class MainWindow final : public QWidget void changePinClicked(QSmartCardData::PinType type, QSmartCard::PinAction action); void convertToCDoc(); ria::qdigidoc4::ContainerState currentState(); - bool decrypt(); bool encrypt(); void loadPicture(); void navigateToPage( ria::qdigidoc4::Pages page, const QStringList &files = QStringList(), bool create = true ); @@ -71,14 +70,10 @@ class MainWindow final : public QWidget void openContainer(bool signature); void pageSelected(int page, bool checked = true); void resetDigiDoc(std::unique_ptr &&doc); - void removeCryptoFile(int index); - bool removeFile(DocumentModel *model, int index); void removeSignature(int index); - void removeSignatureFile(int index); bool save(); template void sign(F &&sign); - bool validateFiles(const QString &container, const QStringList &files); void updateSelector(); void updateMyEID(const TokenData &t); void updateMyEid(const QSmartCardData &data); diff --git a/client/MainWindow_MyEID.cpp b/client/MainWindow_MyEID.cpp deleted file mode 100644 index a7af5cd9c..000000000 --- a/client/MainWindow_MyEID.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* - * QDigiDoc4 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#include "MainWindow.h" -#include "ui_MainWindow.h" - -#include "Application.h" -#include "QSigner.h" -#include "SslCertificate.h" -#include "widgets/WarningItem.h" -#include "widgets/WarningList.h" - -#include -#include - -using namespace ria::qdigidoc4; - -void MainWindow::changePinClicked(QSmartCardData::PinType type, QSmartCard::PinAction action) -{ - if(qApp->signer()->smartcard()->pinChange(type, action, ui->topBar)) - updateMyEid(qApp->signer()->smartcard()->data()); -} - -void MainWindow::updateMyEID(const TokenData &t) -{ - ui->warnings->clearMyEIDWarnings(); - SslCertificate cert(t.cert()); - auto type = cert.type(); - ui->infoStack->setHidden(type == SslCertificate::UnknownType); - ui->accordion->setHidden(type == SslCertificate::UnknownType); - ui->noReaderInfo->setVisible(type == SslCertificate::UnknownType); - - auto setText = [this](const char *text) { - ui->noReaderInfoText->setProperty("currenttext", text); - ui->noReaderInfoText->setText(tr(text)); - }; - if(!t.isNull()) - { - setText(QT_TR_NOOP("The card in the card reader is not an Estonian ID-card")); - if(ui->cardInfo->token().card() != t.card()) - ui->accordion->clear(); - if(type & SslCertificate::TempelType) - { - ui->infoStack->update(cert); - ui->accordion->updateInfo(cert); - } - } - else - { - ui->infoStack->clearData(); - ui->accordion->clear(); - ui->myEid->invalidIcon(false); - ui->myEid->warningIcon(false); - setText(QT_TR_NOOP("Connect the card reader to your computer and insert your ID card into the reader")); - } -} - -void MainWindow::updateMyEid(const QSmartCardData &data) -{ - ui->infoStack->update(data); - ui->accordion->updateInfo(data); - ui->myEid->warningIcon(false); - ui->myEid->invalidIcon(false); - ui->warnings->clearMyEIDWarnings(); - if(data.isNull()) - return; - bool pin1Blocked = data.retryCount(QSmartCardData::Pin1Type) == 0; - bool pin2Blocked = data.retryCount(QSmartCardData::Pin2Type) == 0; - bool pin2Locked = data.pinLocked(QSmartCardData::Pin2Type); - ui->myEid->warningIcon( - pin1Blocked || - pin2Blocked || pin2Locked || - data.retryCount(QSmartCardData::PukType) == 0); - ui->signContainerPage->cardChanged(data.signCert(), pin2Blocked || pin2Locked); - ui->cryptoContainerPage->cardChanged(data.authCert(), pin1Blocked); - - if(pin1Blocked) - ui->warnings->showWarning({WarningType::UnblockPin1Warning, 0, - [this]{ changePinClicked(QSmartCardData::Pin1Type, QSmartCard::UnblockWithPuk); }}); - - if(pin2Locked && pin2Blocked) - ui->warnings->showWarning({WarningType::ActivatePin2WithPUKWarning, 0, - [this]{ changePinClicked(QSmartCardData::Pin2Type, QSmartCard::ActivateWithPuk); }}); - else if(pin2Blocked) - ui->warnings->showWarning({WarningType::UnblockPin2Warning, 0, - [this]{ changePinClicked(QSmartCardData::Pin2Type, QSmartCard::UnblockWithPuk); }}); - else if(pin2Locked) - ui->warnings->showWarning({WarningType::ActivatePin2Warning, 0, - [this]{ changePinClicked(QSmartCardData::Pin2Type, QSmartCard::ActivateWithPin); }}); - - const qint64 DAY = 24 * 60 * 60; - qint64 expiresIn = 106 * DAY; - for(const QSslCertificate &cert: {data.authCert(), data.signCert()}) - { - if(!cert.isNull()) - expiresIn = std::min(expiresIn, QDateTime::currentDateTime().secsTo(cert.expiryDate().toLocalTime())); - } - if(expiresIn <= 0) - { - ui->myEid->invalidIcon(true); - ui->warnings->showWarning({WarningType::CertExpiredError}); - } - else if(expiresIn <= 105 * DAY) - { - ui->myEid->warningIcon(true); - ui->warnings->showWarning({WarningType::CertExpiryWarning}); - } -} diff --git a/client/QSigner.cpp b/client/QSigner.cpp index a7b57e000..16a88fe31 100644 --- a/client/QSigner.cpp +++ b/client/QSigner.cpp @@ -121,8 +121,11 @@ QSigner::QSigner(QObject *parent) EC_KEY_METHOD_set_sign(d->ecmethod, sign, sign_setup, Private::ecdsa_do_sign); d->smartcard = new QSmartCard(parent); - connect(this, &QSigner::error, this, [](const QString &msg) { - WarningDialog::show(msg); + connect(this, &QSigner::error, this, [](const QString &title, const QString &msg) { + WarningDialog::create() + ->withTitle(title) + ->withText(msg) + ->open(); }); connect(this, &QSigner::signDataChanged, this, [this](const TokenData &token) { std::string method; @@ -172,13 +175,13 @@ QByteArray QSigner::decrypt(std::function &&func) { if(!d->lock.tryLockForWrite(10 * 1000)) { - Q_EMIT error( tr("Signing/decrypting is already in progress another window.") ); + Q_EMIT error(tr("Failed to decrypt document"), tr("Signing/decrypting is already in progress another window.")); return {}; } if( d->auth.cert().isNull() ) { - Q_EMIT error( tr("Authentication certificate is not selected.") ); + Q_EMIT error(tr("Failed to decrypt document"), tr("Authentication certificate is not selected.")); d->lock.unlock(); return {}; } @@ -188,10 +191,10 @@ QByteArray QSigner::decrypt(std::function &&func) case QCryptoBackend::PinOK: break; case QCryptoBackend::PinCanceled: return {}; case QCryptoBackend::PinLocked: - Q_EMIT error(QCryptoBackend::errorString(status)); + Q_EMIT error(tr("Failed to decrypt document"), QCryptoBackend::errorString(status)); return {}; default: - Q_EMIT error(tr("Failed to login token") + ' ' + QCryptoBackend::errorString(status)); + Q_EMIT error(tr("Failed to decrypt document"), tr("Failed to login token") + ' ' + QCryptoBackend::errorString(status)); return {}; } QByteArray result = waitFor(func, d->backend); @@ -200,7 +203,7 @@ QByteArray QSigner::decrypt(std::function &&func) return {}; if(result.isEmpty()) - Q_EMIT error( tr("Failed to decrypt document") ); + Q_EMIT error(tr("Failed to decrypt document"), {}); return result; } @@ -228,14 +231,17 @@ QSslKey QSigner::key() const return key; } -quint8 QSigner::login(const TokenData &cert) const +quint8 QSigner::login(const TokenData &token) const { - switch(auto status = d->backend->login(cert)) + switch(auto status = d->backend->login(token)) { case QCryptoBackend::PinOK: return status; case QCryptoBackend::PinIncorrect: - (new WarningDialog(QCryptoBackend::errorString(status), Application::mainWindow()))->exec(); - return login(cert); + WarningDialog::create() + ->withTitle(SslCertificate(token.cert()).keyUsage().contains(SslCertificate::NonRepudiation) ? tr("Failed to sign document") : tr("Failed to decrypt document")) + ->withText(QCryptoBackend::errorString(status)) + ->exec(); + return login(token); default: d->lock.unlock(); // QSmartCard should also know that PIN is blocked. @@ -290,7 +296,7 @@ void QSigner::run() auto *pkcs11 = qobject_cast(d->backend); if(pkcs11 && !pkcs11->reload()) { - Q_EMIT error(tr("Failed to load PKCS#11 module")); + Q_EMIT error(tr("Failed to load PKCS#11 module"), {}); return; } diff --git a/client/QSigner.h b/client/QSigner.h index 1e03d3979..5468b99bf 100644 --- a/client/QSigner.h +++ b/client/QSigner.h @@ -55,10 +55,10 @@ class QSigner final: public QThread, public digidoc::Signer void cacheChanged(); void authDataChanged( const TokenData &token ); void signDataChanged( const TokenData &token ); - void error( const QString &msg ); + void error(const QString &title, const QString &text); private: - quint8 login(const TokenData &cert) const; + quint8 login(const TokenData &token) const; static QCryptographicHash::Algorithm methodToNID(const std::string &method); void run() final; diff --git a/client/Styles.cpp b/client/Styles.cpp deleted file mode 100644 index c04f41dff..000000000 --- a/client/Styles.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* - * QDigiDoc4 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#include "Styles.h" - -#include -#include -#include -#include -#include -#include - -#ifndef Q_OS_MAC -// https://forum.qt.io/topic/26663/different-os-s-different-font-sizes/3 -// http://doc.qt.io/qt-5/scalability.html -#define FONT_SIZE_DECREASE_SMALL 3 -#define FONT_SIZE_DECREASE_LARGE 4 -#define FONT_DECREASE_CUTOFF 12 -#define MIN_FONT_SIZE 2 - -struct FontSample { - int fontSize; - const char *sample; - int width; -}; - -const FontSample condensedSamples[] = { - { 9, "LAADI", 30 }, // Estimated - { 11, "DOKUMENT", 51 }, - { 12, "MUUDA", 36 }, - { 14, "KATKESTA", 59 }, - { 16, "Lugejas on ID kaart", 120 }, - { 20, "MARI MAASIKAS MUSTIKAS", 227 }, - { 24, "MINU eID", 88 }, -}; - -const FontSample regularSamples[] = { - { 11, "Dokumendi haldamiseks sisesta kaart lugejasse", 233 }, - { 12, "Ver. 4.0.0.1", 57 }, - { 13, "Dokument2.pdf", 80 }, // Estimated - { 14, "Dokument2.pdf", 96 }, - { 15, "MARI MAASIKAS", 110 }, // Estimated - { 16, "MARI MAASIKAS", 124 }, - { 18, "Isikutuvastamise sertifikaat", 221 }, - { 20, "Allkirjastamiseks või kontrollimiseks lohista fail siia…", 470 }, - { 22, "Krüpteerimine õnnestus!", 236 }, - { 24, "MUUDA", 72 }, -}; -#endif - -class FontDatabase -{ -public: - FontDatabase() - { -#ifndef Q_OS_MAC - // See http://doc.qt.io/qt-5/highdpi.html - // and http://doc.qt.io/qt-5/scalability.html - for(const auto &sample : condensedSamples) - condensedMapping[sample.fontSize] = calcFontSize(sample, condensed); - for(const auto &sample : regularSamples) - regularMapping[sample.fontSize] = calcFontSize(sample, regular); -#endif - } - QString fontName( Styles::Font font ) - { - switch( font ) - { - case Styles::Condensed: return condensed; - default: return regular; - } - } - QFont font(Styles::Font font, int size) - { -#ifdef Q_OS_MAC - return {fontName(font), size}; -#else - int adjusted = 0; - const QMap mapping = font == Styles::Condensed ? condensedMapping : regularMapping; - - if (mapping.find(size) != mapping.cend()) - adjusted = mapping[size]; - else - adjusted = size - (size > FONT_DECREASE_CUTOFF ? FONT_SIZE_DECREASE_LARGE : FONT_SIZE_DECREASE_SMALL); - return {fontName(font), adjusted}; -#endif - } - -private: -#ifndef Q_OS_MAC - int calcFontSize(const FontSample &sample, const QString &font) - { - int fontSize = sample.fontSize; - int prevWidth = 0; - int width = 0; - - for(; fontSize >= MIN_FONT_SIZE; fontSize--) - { - width = QFontMetrics(QFont(font, fontSize)).boundingRect(sample.sample).width(); - if (width <= sample.width) - break; - prevWidth = width; - } - - if(prevWidth) - { - if(abs(width - sample.width) > abs(prevWidth - sample.width)) - fontSize++; - } - return fontSize; - }; -#endif - - QString condensed = QFontDatabase::applicationFontFamilies( - QFontDatabase::addApplicationFont(QStringLiteral(":/fonts/RobotoCondensed-Regular.ttf"))).at(0); - QString regular = QFontDatabase::applicationFontFamilies( - QFontDatabase::addApplicationFont(QStringLiteral(":/fonts/Roboto-Regular.ttf"))).at(0); -#ifndef Q_OS_MAC - QMap condensedMapping; - QMap regularMapping; -#endif -}; - -QFont Styles::font( Styles::Font font, int size ) -{ - static FontDatabase fontDatabase; - return fontDatabase.font( font, size ); -} - -QFont Styles::font( Styles::Font font, int size, QFont::Weight weight ) -{ - QFont f = Styles::font( font, size ); - f.setWeight( weight ); - return f; -} diff --git a/client/Styles.h b/client/Styles.h deleted file mode 100644 index 0f68483a7..000000000 --- a/client/Styles.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * QDigiDoc4 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#pragma once - -#include - -class Styles -{ -public: - enum Font { - Condensed, - Regular - }; - - static QFont font( Font font, int size ); - static QFont font( Font font, int size, QFont::Weight weight ); - -private: - Styles() = delete; -}; diff --git a/client/common_enums.h b/client/common_enums.h index 0d02eee69..81e99cf34 100644 --- a/client/common_enums.h +++ b/client/common_enums.h @@ -36,6 +36,7 @@ enum ContainerState : unsigned char { }; enum Actions : unsigned char { + ContainerClose, ContainerCancel, ContainerConvert, ContainerEncrypt, diff --git a/client/dialogs/AddRecipients.cpp b/client/dialogs/AddRecipients.cpp index 69f910383..fc1e4fa05 100644 --- a/client/dialogs/AddRecipients.cpp +++ b/client/dialogs/AddRecipients.cpp @@ -116,7 +116,7 @@ void AddRecipients::addRecipientFromFile() QFile f( file ); if( !f.open( QIODevice::ReadOnly ) ) { - WarningDialog::show(this, tr("Failed to read certificate")); + WarningDialog::create(this)->withTitle(tr("Failed to read certificate"))->open(); return; } @@ -128,12 +128,12 @@ void AddRecipients::addRecipientFromFile() } if( cert.isNull() ) { - WarningDialog::show(this, tr("Failed to read certificate")); + WarningDialog::create(this)->withTitle(tr("Failed to read certificate"))->open(); } else if( !SslCertificate( cert ).keyUsage().contains( SslCertificate::KeyEncipherment ) && !SslCertificate( cert ).keyUsage().contains( SslCertificate::KeyAgreement ) ) { - WarningDialog::show(this, tr("This certificate cannot be used for encryption")); + WarningDialog::create(this)->withTitle(tr("This certificate cannot be used for encryption"))->open(); } else addRecipient(cert); @@ -184,12 +184,13 @@ void AddRecipients::addRecipientToRightPane(Item *item, bool update) { if(Settings::CDOC2_DEFAULT && Settings::CDOC2_USE_KEYSERVER) { - WarningDialog::show(this, tr("Failed to add certificate. An expired certificate cannot be used for encryption.")); + WarningDialog::create(this)->withText(tr("Failed to add certificate. An expired certificate cannot be used for encryption."))->open(); return; } - auto *dlg = new WarningDialog(tr("Are you sure that you want use certificate for encrypting, which expired on %1?
" + auto *dlg = WarningDialog::create(this)->withText(tr( + "Are you sure that you want use certificate for encrypting, which expired on %1?
" "When decrypter has updated certificates then decrypting is impossible.") - .arg(expiryDate.toString(QStringLiteral("dd.MM.yyyy hh:mm:ss"))), this); + .arg(expiryDate.toString(QStringLiteral("dd.MM.yyyy hh:mm:ss")))); dlg->setCancelText(WarningDialog::NO); dlg->addButton(WarningDialog::YES, QMessageBox::Yes); if(dlg->exec() != QMessageBox::Yes) @@ -202,7 +203,8 @@ void AddRecipients::addRecipientToRightPane(Item *item, bool update) errors.removeAll(QSslError(QSslError::CertificateExpired, key.cert)); if(!errors.isEmpty()) { - auto *dlg = new WarningDialog(tr("Recipient’s certification chain contains certificates that are not trusted. Continue with encryption?"), this); + auto *dlg = WarningDialog::create(this) + ->withText(tr("Recipient’s certification chain contains certificates that are not trusted. Continue with encryption?")); dlg->setCancelText(WarningDialog::NO); dlg->addButton(WarningDialog::YES, QMessageBox::Yes); if(dlg->exec() != QMessageBox::Yes) @@ -291,14 +293,14 @@ void AddRecipients::search(const QString &term, bool select, const QString &type else { QApplication::restoreOverrideCursor(); - WarningDialog::show(this, tr("Personal code is not valid!")); + WarningDialog::create(this)->withTitle(tr("Personal code is not valid!"))->open(); } } -void AddRecipients::showError( const QString &msg, const QString &details ) +void AddRecipients::showError(const QString &title, const QString &details) { QApplication::restoreOverrideCursor(); - WarningDialog::show(this, msg, details); + WarningDialog::create(this)->withTitle(title)->withDetails(details)->open(); } void AddRecipients::showResult(const QList &result, int resultCount, const QVariantMap &userData) @@ -317,12 +319,14 @@ void AddRecipients::showResult(const QList &result, int resultC } } if(resultCount >= 50) - showError(tr("The name you were looking for gave too many results, please refine your search.")); + WarningDialog::create(this) + ->withText(tr("The name you were looking for gave too many results, please refine your search.")) + ->open(); else if(--multiSearch <= 0 && ui->leftPane->items.isEmpty()) - { - showError(tr("Person or company does not own a valid certificate.
" - "It is necessary to have a valid certificate for encryption.
" - "Read more about it.")); - } + WarningDialog::create(this) + ->withText(tr("Person or company does not own a valid certificate.
" + "It is necessary to have a valid certificate for encryption.
" + "Read more about it.")) + ->open(); QApplication::restoreOverrideCursor(); } diff --git a/client/dialogs/AddRecipients.h b/client/dialogs/AddRecipients.h index a9bc5fece..4998f5174 100644 --- a/client/dialogs/AddRecipients.h +++ b/client/dialogs/AddRecipients.h @@ -51,7 +51,7 @@ class AddRecipients final : public QDialog void addRecipientToRightPane(Item *item, bool update = true); void search(const QString &term, bool select = false, const QString &type = {}); - void showError(const QString &msg, const QString &details = {}); + void showError(const QString &title, const QString &details); void showResult(const QList &result, int resultCount, const QVariantMap &userData); static AddressItem* itemListValue(ItemList *list, const CKey &cert); diff --git a/client/dialogs/CertificateDetails.cpp b/client/dialogs/CertificateDetails.cpp index ea7d91f0f..f679e3ae7 100644 --- a/client/dialogs/CertificateDetails.cpp +++ b/client/dialogs/CertificateDetails.cpp @@ -75,7 +75,7 @@ CertificateDetails::CertificateDetails(const SslCertificate &cert, QWidget *pare if(QFile f(file); f.open(QIODevice::WriteOnly)) f.write(cert.toPem()); else - WarningDialog::show(this, tr("Failed to save file")); + WarningDialog::create(this)->withTitle(QCoreApplication::translate("FileDialog", "Failed to save file"))->open(); }); connect(ui.close, &QPushButton::clicked, this, &CertificateDetails::accept); connect( this, &CertificateDetails::finished, this, &CertificateDetails::close ); diff --git a/client/dialogs/FileDialog.cpp b/client/dialogs/FileDialog.cpp index 41955855e..23eb07763 100644 --- a/client/dialogs/FileDialog.cpp +++ b/client/dialogs/FileDialog.cpp @@ -247,7 +247,10 @@ QString FileDialog::getExistingDirectory( QWidget *parent, const QString &captio if( !QFileInfo( res ).isWritable() ) #endif { - WarningDialog::show(parent, tr( "You don't have sufficient privileges to write this file into folder %1" ).arg( res )); + WarningDialog::create(parent) + ->withTitle(tr("Failed to save files")) + ->withText(tr("You don't have sufficient privileges to write this file into folder %1").arg(res)) + ->open(); return {}; } @@ -259,10 +262,10 @@ QString FileDialog::getSaveFileName(QWidget *parent, const QString &caption, con if(filename.endsWith(QLatin1String(".adoc"), Qt::CaseInsensitive)) filter = tr("Documents (%1)").arg(QLatin1String("*.adoc")); else if(filename.endsWith(QLatin1String(".asice"), Qt::CaseInsensitive) || - filename.endsWith(QLatin1String(".sce"), Qt::CaseInsensitive)) + filename.endsWith(QLatin1String(".sce"), Qt::CaseInsensitive)) filter = tr("Documents (%1)").arg(QLatin1String("*.asice *.sce")); else if(filename.endsWith(QLatin1String(".asics"), Qt::CaseInsensitive) || - filename.endsWith(QLatin1String(".scs"), Qt::CaseInsensitive)) + filename.endsWith(QLatin1String(".scs"), Qt::CaseInsensitive)) filter = tr("Documents (%1)").arg(QLatin1String("*.asics *.scs")); else if(filename.endsWith(QLatin1String(".bdoc"), Qt::CaseInsensitive)) filter = tr("Documents (%1)").arg(QLatin1String("*.bdoc")); @@ -277,17 +280,16 @@ QString FileDialog::getSaveFileName(QWidget *parent, const QString &caption, con else if(filename.endsWith(QLatin1String(".pdf"), Qt::CaseInsensitive)) filter = tr("Documents (%1)").arg(QLatin1String("*.pdf")); QString file; - while( true ) + while(!(file = QFileDialog::getSaveFileName(parent, caption, normalized(filename), filter)).isEmpty()) { - file = QFileDialog::getSaveFileName(parent, caption, normalized(filename), filter); - if( !file.isEmpty() && !fileIsWritable( file ) ) - { - WarningDialog::show(parent, tr( "You don't have sufficient privileges to write this file into folder %1" ).arg( file )); - } - else - break; + if(fileIsWritable(file)) + return result(file); + WarningDialog::create(parent) + ->withTitle(tr("Failed to save file")) + ->withText(tr("You don't have sufficient privileges to write this file into folder %1").arg(file)) + ->exec(); } - return result( file ); + return file; } QString FileDialog::normalized(const QString &data) @@ -310,8 +312,6 @@ QString FileDialog::result( const QString &str ) #ifndef Q_OS_MACOS if(!str.isEmpty()) Settings::LAST_PATH = QFileInfo(str).absolutePath(); -#else - Settings::LAST_PATH.clear(); #endif return str; } diff --git a/client/dialogs/FirstRun.cpp b/client/dialogs/FirstRun.cpp index 09ac50725..7631f80c2 100644 --- a/client/dialogs/FirstRun.cpp +++ b/client/dialogs/FirstRun.cpp @@ -21,7 +21,6 @@ #include "ui_FirstRun.h" #include "Settings.h" -#include "Styles.h" #include #include @@ -40,19 +39,7 @@ FirstRun::FirstRun(QWidget *parent) if(parent) move(parent->geometry().center() - geometry().center()); - auto buttonFont = Styles::font(Styles::Condensed, 14); - auto dmLabelFont = Styles::font(Styles::Regular, 18); - auto regular12 = Styles::font(Styles::Regular, 12); - auto regular14 = Styles::font(Styles::Regular, 14); - auto titleFont = Styles::font(Styles::Regular, 20, QFont::DemiBold); - // Page 1: language - ui->title->setFont(Styles::font(Styles::Regular, 20, QFont::Bold)); - ui->welcome->setFont(titleFont); - ui->intro->setFont(regular14); - ui->langLabel->setFont(regular12); - - ui->lang->setFont(regular14); ui->lang->addItem(QStringLiteral("Eesti keel")); ui->lang->addItem(QStringLiteral("English")); ui->lang->addItem(QString::fromUtf8("Русский язык")); //QStringLiteral breaks windows text @@ -74,64 +61,20 @@ FirstRun::FirstRun(QWidget *parent) ui->retranslateUi(this); loadImages(); }); - ui->continueBtn->setFont(buttonFont); ui->coatOfArms->load(QStringLiteral(":/images/Logo_Suur.svg")); ui->leaves->load(QStringLiteral(":/images/vapilehed.svg")); ui->structureFunds->load(QStringLiteral(":/images/Struktuurifondid.svg")); - - // Page 2: intro - ui->introTitle->setFont(titleFont); - ui->introLabelSign->setFont(dmLabelFont); - ui->introLabelCrypto->setFont(dmLabelFont); - ui->introLabelEid->setFont(dmLabelFont); - ui->introIntroSign->setFont(regular14); - ui->introIntroCrypto->setFont(regular14); - ui->introIntroEid->setFont(regular14); - ui->introSkip->setFont(regular12); - ui->introViewSigning->setFont(buttonFont); - ui->introViewEncryption->setFont(buttonFont); - ui->introViewEid->setFont(buttonFont); ui->signWidget->load(QStringLiteral(":/images/icon_Allkiri_hover.svg")); ui->cryptoWidget->load(QStringLiteral(":/images/icon_Krypto_hover.svg")); ui->eidWidget->load(QStringLiteral(":/images/icon_Minu_eID_hover.svg")); - - // Page 3: Signing - ui->signTitle->setFont(titleFont); - ui->signLabel1->setFont(dmLabelFont); - ui->signLabel2->setFont(dmLabelFont); - ui->signLabel3->setFont(dmLabelFont); - ui->signText1->setFont(regular14); - ui->signText2->setFont(regular14); - ui->signText3->setFont(regular14); - ui->signSkip->setFont(regular12); - ui->signNext->setFont(buttonFont); ui->signOne->load(QStringLiteral(":/images/intro_one.svg")); ui->signTwo->load(QStringLiteral(":/images/intro_two.svg")); ui->signThree->load(QStringLiteral(":/images/intro_three.svg")); - - // Page 4: Crypto - ui->cryptoTitle->setFont(titleFont); - ui->cryptoLabel1->setFont(dmLabelFont); - ui->cryptoLabel2->setFont(dmLabelFont); - ui->cryptoLabel3->setFont(dmLabelFont); - ui->cryptoText1->setFont(regular14); - ui->cryptoText2->setFont(regular14); - ui->cryptoText3->setFont(regular14); - ui->cryptoSkip->setFont(regular12); - ui->cryptoNext->setFont(buttonFont); ui->cryptoOne->load(QStringLiteral(":/images/intro_one.svg")); ui->cryptoTwo->load(QStringLiteral(":/images/intro_two.svg")); ui->cryptoThree->load(QStringLiteral(":/images/intro_three.svg")); - // Page 5: My eID - ui->eidTitle->setFont(titleFont); - ui->eidLabel1->setFont(dmLabelFont); - ui->eidLabel3->setFont(dmLabelFont); - ui->eidText1->setFont(regular14); - ui->eidText3->setFont(regular14); - ui->eidEnter->setFont(buttonFont); - connect(ui->buttonGroup, QOverload::of(&QButtonGroup::buttonClicked), this, [this](QAbstractButton *b){ if(b == ui->continueBtn) ui->stack->setCurrentIndex(Intro); diff --git a/client/dialogs/FirstRun.ui b/client/dialogs/FirstRun.ui index 42becf9eb..0960e201a 100644 --- a/client/dialogs/FirstRun.ui +++ b/client/dialogs/FirstRun.ui @@ -37,10 +37,13 @@ height: 10px; background-color: #B9D9EB; } QPushButton { -border-radius: 2px; -border: none; +padding: 9px 12px; +border-radius: 4px; color: #ffffff; -background-color: #006EB5; +background-color: #2F70B6; +font-family: Roboto, Helvetica; +font-size: 12px; +font-weight: 700; } QPushButton:pressed { background-color: #41B6E6; @@ -52,22 +55,35 @@ QPushButton:disabled { background-color: #BEDBED; } #introSkip, #signSkip, #cryptoSkip { -border-radius: 2px; -border: none; -color: #006EB5; background-color: none; +color: #2F70B6; } -#introSkip:pressed, #signSkip:pressed, #cryptoSkip:pressed { -color: #FFFFFF; -background-color: #006EB5; +#introSkip:hover, #signSkip:hover, #cryptoSkip:hover { +background-color: #EAF1F8; } -#introSkip:hover:!pressed, #signSkip:hover:!pressed, #cryptoSkip:hover:!pressed { -border: 1px solid #006EB5; -color: #006EB5; +#introSkip:pressed, #signSkip:pressed, #cryptoSkip:pressed { +background-color: #BFD3E8; } #introSkip:disabled, #signSkip:disabled, #cryptoSkip:disabled { color: #727679; background-color: #BEDBED; +} +QLabel { +font-family: Roboto, Helvetica; +font-size: 14px; +color: #353739; +} +#title, #welcome, #introTitle, #signTitle, #cryptoTitle, #eidTitle { +font-size: 20px; +font-weight: 700; +color: #041E42; +} +#introLabelSign, #introLabelCrypto, #introLabelEid, +#signLabel1, #signLabel2, #signLabel3, +#cryptoLabel1, #cryptoLabel2, #cryptoLabel3, +#eidLabel1, #eidLabel3 { +font-size: 18px; +color: #041E42; } @@ -177,29 +193,14 @@ QComboBox::down-arrow:on { 412 458 200 - 34 + 30 - - - 200 - 34 - - - - - 200 - 34 - - PointingHandCursor - - Continue - - CONTINUE + Continue buttonGroup @@ -214,9 +215,6 @@ QComboBox::down-arrow:on { 343 - - border: none; - @@ -227,9 +225,6 @@ QComboBox::down-arrow:on { 144 - - border: none; - @@ -240,17 +235,11 @@ QComboBox::down-arrow:on { 20 - - - Roboto - 22 - - Qt::TabFocus - DIGIDOC + DigiDoc Qt::AlignCenter @@ -265,20 +254,9 @@ QComboBox::down-arrow:on { 24 - - - Roboto - 20 - - Qt::TabFocus - - border: none; -text-align: center; -color: #041E42; - Welcome to the Estonian eID application DigiDoc! @@ -295,20 +273,11 @@ color: #041E42; 40 - - - Roboto - 14 - - Qt::TabFocus - color: #353739; -line-height: 16px; -text-align: center; -border: none; + line-height: 16px; DigiDoc is created for managing Estonian eIDs and is the official digital signing and encryption application. @@ -324,22 +293,11 @@ border: none; 262 - 394 + 392 500 - 14 + 16 - - - Roboto - 12 - - - - border: none; -color: #353739; -text-align: center; - Vali suhtluskeel / Выберите язык / Select language: @@ -363,8 +321,7 @@ text-align: center; - #introPage { background: qradialgradient(cx:0.5, cy:0.5, radius: 1, fx:0.5, fy:1, stop:0 white, stop:0.59 white, stop:1 #B9D9EB) } -QWidget { border: none; } + #introPage { background: qradialgradient(cx:0.5, cy:0.5, radius: 1, fx:0.5, fy:1, stop:0 white, stop:0.59 white, stop:1 #B9D9EB) } @@ -384,18 +341,9 @@ QWidget { border: none; } - - - Roboto - 20 - - Qt::TabFocus - - color: #041E42; - The DigiDoc application allows you to: @@ -454,18 +402,9 @@ QWidget { border: none; } - - - Roboto - 18 - - Qt::TabFocus - - color: #041E42; - Sign documents @@ -476,18 +415,9 @@ QWidget { border: none; } - - - Roboto - 18 - - Qt::TabFocus - - color: #041E42; - Encrypt documents @@ -498,18 +428,9 @@ QWidget { border: none; } - - - Roboto - 18 - - Qt::TabFocus - - color: #041E42; - Manage your eID-s @@ -520,18 +441,9 @@ QWidget { border: none; } - - - Roboto - 14 - - Qt::TabFocus - - color: #353739; - DigiDoc Client can be used to sign digitally with ID-card, mobile-ID and Smart-ID, check the validity of digital signatures and open and save documents inside the signature container. @@ -545,18 +457,9 @@ QWidget { border: none; } - - - Roboto - 14 - - Qt::TabFocus - - color: #353739; - DigiDoc Client can also be used to encrypt data and decrypt the previously encrypted data. For encryption the program uses the authentication certificate of the ID-card. @@ -570,18 +473,9 @@ QWidget { border: none; } - - - Roboto - 14 - - Qt::TabFocus - - color: #353739; - Manage your ID-card’s PIN/PUK codes and check personal data. @@ -595,26 +489,11 @@ QWidget { border: none; } - - - 0 - 34 - - - - - 16777215 - 34 - - PointingHandCursor - - View introduction - - VIEW INTRODUCTION + View introduction buttonGroup @@ -623,26 +502,11 @@ QWidget { border: none; } - - - 0 - 34 - - - - - 16777215 - 34 - - PointingHandCursor - - View introduction - - VIEW INTRODUCTION + View introduction buttonGroup @@ -651,26 +515,11 @@ QWidget { border: none; } - - - 0 - 34 - - - - - 16777215 - 34 - - PointingHandCursor - - View introduction - - VIEW INTRODUCTION + View introduction buttonGroup @@ -679,18 +528,6 @@ QWidget { border: none; } - - - 0 - 25 - - - - - 16777215 - 25 - - PointingHandCursor @@ -733,18 +570,9 @@ QWidget { border: none; } 24 - - - Roboto - 20 - - Qt::TabFocus - - color: #041E42; - How to sign document digitally? @@ -818,29 +646,14 @@ border-radius: 3px; 363 500 298 - 34 + 30 - - - 298 - 34 - - - - - 298 - 34 - - PointingHandCursor - - View next intro - - VIEW NEXT INTRO + View next intro buttonGroup @@ -850,23 +663,11 @@ border-radius: 3px; 363 - 540 + 535 298 - 25 + 30 - - - 298 - 25 - - - - - 298 - 25 - - PointingHandCursor @@ -973,18 +774,9 @@ border-radius: 3px; 21 - - - Roboto - 18 - - Qt::TabFocus - - color: #041E42; - Select file @@ -998,18 +790,9 @@ border-radius: 3px; 21 - - - Roboto - 18 - - Qt::TabFocus - - color: #041E42; - Choose the signing method @@ -1023,18 +806,9 @@ border-radius: 3px; 150 - - - Roboto - 14 - - Qt::TabFocus - - color: #353739; - To sign the file, drag it from your computer to the DigiDoc application or click the "... or load a file from disk" button. You can drag or select multiple files at a time. @@ -1054,18 +828,9 @@ border-radius: 3px; 110 - - - Roboto - 14 - - Qt::TabFocus - - color: #353739; - Once the files have been selected, check them and choose whether you want to sign with ID-card, mobile-ID or Smart-ID. You can also save the container without signing. @@ -1085,18 +850,9 @@ border-radius: 3px; 21 - - - Roboto - 18 - - Qt::TabFocus - - color: #041E42; - Enter PIN2 @@ -1110,18 +866,9 @@ border-radius: 3px; 150 - - - Roboto - 14 - - Qt::TabFocus - - color: #353739; - By entering the PIN2 code, you will have signed the document with digital signature that by law is equal to the signature signed by hand. @@ -1233,18 +980,9 @@ border-radius: 3px; 21 - - - Roboto - 18 - - Qt::TabFocus - - color: #041E42; - Select file @@ -1258,18 +996,9 @@ border-radius: 3px; 21 - - - Roboto - 18 - - Qt::TabFocus - - color: #041E42; - Add recipients @@ -1283,18 +1012,9 @@ border-radius: 3px; 160 - - - Roboto - 14 - - Qt::TabFocus - - color: #353739; - A recipient must be selected in order to encrypt data. Drag the file to be encrypted from your computer to the DigiDoc application or select a file from the disk. You can drag or select multiple files at a time. @@ -1314,18 +1034,9 @@ border-radius: 3px; 110 - - - Roboto - 14 - - Qt::TabFocus - - color: #353739; - Select people who can open the container. @@ -1345,18 +1056,9 @@ border-radius: 3px; 21 - - - Roboto - 18 - - Qt::TabFocus - - color: #041E42; - Encrypt @@ -1370,18 +1072,9 @@ border-radius: 3px; 140 - - - Roboto - 14 - - Qt::TabFocus - - color: #353739; - Click the "Encrypt" button and the file is now encrypted. You now have the option to open the location of the container or forward the file by e-mail. @@ -1396,23 +1089,11 @@ border-radius: 3px; 363 - 540 + 535 298 - 25 + 30 - - - 298 - 25 - - - - - 298 - 25 - - PointingHandCursor @@ -1429,29 +1110,14 @@ border-radius: 3px; 363 500 298 - 34 + 30 - - - 298 - 34 - - - - - 298 - 34 - - PointingHandCursor - - View next intro - - VIEW NEXT INTRO + View next intro buttonGroup @@ -1466,18 +1132,9 @@ border-radius: 3px; 24 - - - Roboto - 20 - - Qt::TabFocus - - color: #041E42; - How to encrypt documents? @@ -1616,18 +1273,9 @@ border-radius: 3px; 21 - - - Roboto - 18 - - Qt::TabFocus - - color: #041E42; - Manage PIN and PUK codes @@ -1641,18 +1289,9 @@ border-radius: 3px; 21 - - - Roboto - 18 - - Qt::TabFocus - - color: #041E42; - Check personal data @@ -1666,18 +1305,9 @@ border-radius: 3px; 150 - - - Roboto - 14 - - Qt::TabFocus - - color: #353739; - Under "My eID", you will find the option to modify your PIN1, PIN2 and PUK, and the details of the certificates. Here you can also unlock the PUK code of your blocked PIN. @@ -1697,18 +1327,9 @@ border-radius: 3px; 140 - - - Roboto - 14 - - Qt::TabFocus - - color: #353739; - "My eID" also provides a good overview of the status and contact information of the ID card inserted in the card reader. @@ -1725,29 +1346,14 @@ border-radius: 3px; 363 500 298 - 34 + 30 - - - 298 - 34 - - - - - 298 - 34 - - PointingHandCursor - - Enter the application - - ENTER THE APPLICATION + Enter the application buttonGroup @@ -1762,18 +1368,9 @@ border-radius: 3px; 24 - - - Roboto - 20 - - Qt::TabFocus - - color: #041E42; - How to manage your electronic identities? diff --git a/client/dialogs/KeyDialog.ui b/client/dialogs/KeyDialog.ui index 095698d5b..d2cb48cd9 100644 --- a/client/dialogs/KeyDialog.ui +++ b/client/dialogs/KeyDialog.ui @@ -135,13 +135,6 @@ background-color: #82A9D3; - - - Roboto - -1 - true - - PointingHandCursor diff --git a/client/dialogs/MobileProgress.cpp b/client/dialogs/MobileProgress.cpp index 0bfa1fe5a..7ea2b915e 100644 --- a/client/dialogs/MobileProgress.cpp +++ b/client/dialogs/MobileProgress.cpp @@ -98,14 +98,16 @@ background-color: #007aff; d->req.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); d->manager = CheckConnection::setupNAM(d->req); d->manager->setParent(d); - QObject::connect(d->manager, &QNetworkAccessManager::finished, d, [=](QNetworkReply *reply) { + QObject::connect(d->manager, &QNetworkAccessManager::finished, d, [=, this](QNetworkReply *reply) { QScopedPointer scope(reply); - auto returnError = [=](const QString &err, const QString &details = {}) { + auto returnError = [=, this](const QString &err, const QString &details = {}) { qCWarning(MIDLog) << err; d->statusTimer->stop(); d->hide(); - auto *dlg = WarningDialog::show(d->parentWidget(), err, details); + auto *dlg = WarningDialog::create(d->parentWidget())->withText(err)->withDetails(details) + ->withTitle(QCoreApplication::translate("DigiDoc", "Failed to sign container")); QObject::connect(dlg, &WarningDialog::finished, &d->l, &QEventLoop::exit); + dlg->open(); }; switch(reply->error()) @@ -224,7 +226,10 @@ bool MobileProgress::init(const QString &ssid, const QString &cell) { if(!d->UUID.isEmpty() && QUuid(d->UUID).isNull()) { - WarningDialog::show(d->parentWidget(), tr("Failed to send request. Check your %1 service access settings.").arg(tr("mobile-ID"))); + WarningDialog::create(d->parentWidget()) + ->withText(tr("Failed to send request. Check your %1 service access settings.").arg(tr("mobile-ID"))) + ->withTitle(QCoreApplication::translate("DigiDoc", "Failed to sign container")) + ->open(); return false; } d->ssid = ssid; diff --git a/client/dialogs/SettingsDialog.cpp b/client/dialogs/SettingsDialog.cpp index 1ea71bf38..eaf227ffa 100644 --- a/client/dialogs/SettingsDialog.cpp +++ b/client/dialogs/SettingsDialog.cpp @@ -300,11 +300,14 @@ SettingsDialog::SettingsDialog(int page, QWidget *parent) if(QFile f(qdigidoc4log); f.open(QFile::WriteOnly|QFile::Truncate)) f.write({}); #ifdef Q_OS_MACOS - WarningDialog::show(this, tr("Restart DigiDoc4 Client to activate logging. Read more " - "here.")); + WarningDialog::create(this) + ->withTitle(tr("Restart DigiDoc4 Client to activate logging.")) + ->withText(tr("Read more here.")) + ->open(); #else - auto *dlg = WarningDialog::show(this, tr("Restart DigiDoc4 Client to activate logging. Read more " - "here. Restart now?")); + auto *dlg = WarningDialog::create(this) + ->withTitle(tr("Restart DigiDoc4 Client to activate logging.")) + ->withText(tr("Read more here. Restart now?")); dlg->setCancelText(WarningDialog::NO); dlg->addButton(WarningDialog::YES, QMessageBox::Yes); connect(dlg, &WarningDialog::finished, qApp, [](int result) { @@ -313,6 +316,7 @@ SettingsDialog::SettingsDialog(int page, QWidget *parent) QApplication::quit(); } }); + dlg->open(); #endif }); @@ -332,11 +336,16 @@ SettingsDialog::SettingsDialog(int page, QWidget *parent) #ifdef CONFIG_URL connect(qApp->conf(), &Configuration::finished, this, [this](bool /*update*/, const QString &error){ if(!error.isEmpty()) { - WarningDialog::show(this, tr("Checking updates has failed.") + "
" + tr("Please try again."), error); + WarningDialog::create(this) + ->withTitle(tr("Checking updates has failed.")) + ->withText(tr("Please try again.")) + ->withDetails(error) + ->open(); return; } - auto *dlg = WarningDialog::show(this, tr("DigiDoc4 Client configuration update was successful.")); + auto *dlg = WarningDialog::create(this)->withTitle(tr("DigiDoc4 Client configuration update was successful.")); new Overlay(dlg); + dlg->open(); #ifdef Q_OS_WIN QString path = QApplication::applicationDirPath() + QLatin1String("/id-updater.exe"); if (QFile::exists(path)) @@ -386,7 +395,7 @@ SettingsDialog::SettingsDialog(int page, QWidget *parent) cert.issuerInfo(QSslCertificate::Organization).contains(u"Zetes Estonia OÜ"_s, Qt::CaseInsensitive)) CertDeleteCertificateFromStore(CertDuplicateCertificateContext(c)); } - WarningDialog::show(this, tr("Redundant certificates have been successfully removed.")); + WarningDialog::create(this)->withTitle(tr("Redundant certificates have been successfully removed."))->open(); }); #endif @@ -597,7 +606,7 @@ void SettingsDialog::saveFile(const QString &name, const QByteArray &content) if( filename.isEmpty() ) return; if(QFile f(filename); !f.open(QIODevice::WriteOnly|QIODevice::Text) || !f.write(content)) - WarningDialog::show(this, tr("Failed write to file!")); + WarningDialog::create(this)->withText(tr("Failed write to file!"))->open(); } diff --git a/client/dialogs/SmartIDProgress.cpp b/client/dialogs/SmartIDProgress.cpp index c0e7dd2e1..97afb60fd 100644 --- a/client/dialogs/SmartIDProgress.cpp +++ b/client/dialogs/SmartIDProgress.cpp @@ -110,16 +110,18 @@ background-color: #007aff; d->req.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); d->manager = CheckConnection::setupNAM(d->req); d->manager->setParent(d); - QNetworkAccessManager::connect(d->manager, &QNetworkAccessManager::finished, d, [&](QNetworkReply *reply){ + QNetworkAccessManager::connect(d->manager, &QNetworkAccessManager::finished, d, [&, this](QNetworkReply *reply){ QScopedPointer scope(reply); - auto returnError = [=](const QString &err, const QString &details = {}) { + auto returnError = [=, this](const QString &err, const QString &details = {}) { qCWarning(SIDLog) << err; d->statusTimer->stop(); delete d->timer; d->timer = nullptr; d->hide(); - auto *dlg = WarningDialog::show(d->parentWidget(), err, details); + auto *dlg = WarningDialog::create(d->parentWidget())->withText(err)->withDetails(details) + ->withTitle(QCoreApplication::translate("DigiDoc", "Failed to sign container")); QObject::connect(dlg, &WarningDialog::finished, &d->l, &QEventLoop::exit); + dlg->open(); }; switch(reply->error()) @@ -127,7 +129,7 @@ background-color: #007aff; case QNetworkReply::NoError: break; case QNetworkReply::ContentNotFoundError: - return returnError(tr("Failed to sign container. Your Smart-ID transaction has expired or user account not found.")); + return returnError(tr("Your Smart-ID transaction has expired or user account not found.")); case QNetworkReply::ConnectionRefusedError: return returnError(tr("%1 service has encountered technical errors. Please try again later.").arg(tr("Smart-ID"))); case QNetworkReply::SslHandshakeFailedError: @@ -144,7 +146,7 @@ background-color: #007aff; switch (httpStatusCode) { case 403: - return returnError(tr("Failed to sign container. Check your %1 service access settings. " + return returnError(tr("Check your %1 service access settings. " "Additional information").arg(tr("Smart-ID"))); case 409: return returnError(tr("Failed to send request. The number of unsuccesful request from this IP address has been exceeded. Please try again later.")); @@ -185,9 +187,9 @@ background-color: #007aff; endResult == QLatin1String("USER_REFUSED_CONFIRMATIONMESSAGE_WITH_VC_CHOICE")) returnError(tr("User denied or cancelled")); else if(endResult == QLatin1String("TIMEOUT")) - returnError(tr("Failed to sign container. Your Smart-ID transaction has expired or user account not found.")); + returnError(tr("Your Smart-ID transaction has expired or user account not found.")); else if(endResult == QLatin1String("REQUIRED_INTERACTION_NOT_SUPPORTED_BY_APP")) - returnError(tr("Failed to sign container. You need to update your Smart-ID application to sign documents in DigiDoc4 Client.")); + returnError(tr("You need to update your Smart-ID application to sign documents in DigiDoc4 Client.")); else if(endResult == QLatin1String("WRONG_VC")) returnError(tr("Error: an incorrect control code was chosen")); else if(endResult == QLatin1String("DOCUMENT_UNUSABLE")) @@ -238,7 +240,10 @@ bool SmartIDProgress::init(const QString &country, const QString &idCode, const { if(!d->UUID.isEmpty() && QUuid(d->UUID).isNull()) { - WarningDialog::show(d->parentWidget(), tr("Failed to send request. Check your %1 service access settings.").arg(tr("Smart-ID"))); + WarningDialog::create(d->parentWidget()) + ->withText(tr("Failed to send request. Check your %1 service access settings.").arg(tr("Smart-ID"))) + ->withTitle(QCoreApplication::translate("DigiDoc", "Failed to sign container")) + ->open(); return false; } QFileInfo info(fileName); diff --git a/client/dialogs/WaitDialog.cpp b/client/dialogs/WaitDialog.cpp index b8423e280..e7801544f 100644 --- a/client/dialogs/WaitDialog.cpp +++ b/client/dialogs/WaitDialog.cpp @@ -17,37 +17,46 @@ * */ - #include "WaitDialog.h" -#include "WaitDialog_p.h" #include "ui_WaitDialog.h" -#include "Application.h" -#include "Styles.h" #include "effects/Overlay.h" +#include + +class WaitDialog : public QDialog +{ + Q_OBJECT + +public: + explicit WaitDialog(QWidget *parent = nullptr); + + void setText(const QString &text); + + static WaitDialog* create(QWidget *parent); + static void destroy(); + static WaitDialog* instance(); + + static WaitDialog *waitDialog; + Ui::WaitDialog ui; + QTimer timer; +}; + WaitDialog* WaitDialog::waitDialog = nullptr; WaitDialog::WaitDialog(QWidget *parent) : QDialog(parent) - , ui(new Ui::WaitDialog) { new Overlay(this); setWindowFlags(Qt::Dialog|Qt::FramelessWindowHint); - ui->setupUi(this); - ui->movie->load(QStringLiteral(":/images/wait.svg")); - ui->label->setFont(Styles::font(Styles::Condensed, 24)); - ui->label->setFocusPolicy(Qt::TabFocus); + ui.setupUi(this); + ui.movie->load(QStringLiteral(":/images/wait.svg")); + ui.label->setFocusPolicy(Qt::TabFocus); move(parent->geometry().center() - geometry().center()); timer.setSingleShot(true); connect(&timer, &QTimer::timeout, this, &WaitDialog::show); } -WaitDialog::~WaitDialog() -{ - delete ui; -} - WaitDialog* WaitDialog::create(QWidget *parent) { if(!waitDialog) @@ -68,7 +77,7 @@ WaitDialog* WaitDialog::instance() void WaitDialog::setText(const QString &text) { - ui->label->setText(text); + ui.label->setText(text); } @@ -104,3 +113,5 @@ WaitDialogHider::~WaitDialogHider() if(WaitDialog *d = WaitDialog::instance()) d->show(); } + +#include "WaitDialog.moc" diff --git a/client/dialogs/WaitDialog.ui b/client/dialogs/WaitDialog.ui index 30ffcf060..2ff404037 100644 --- a/client/dialogs/WaitDialog.ui +++ b/client/dialogs/WaitDialog.ui @@ -37,13 +37,11 @@ 33 - - - 24 - - - color: #041E42; border: none; + color: #003168; +font-family: Roboto, Helvetica; +font-size: 20px; +font-weight: 700; Decrypting diff --git a/client/dialogs/WaitDialog_p.h b/client/dialogs/WaitDialog_p.h deleted file mode 100644 index f11b740ab..000000000 --- a/client/dialogs/WaitDialog_p.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * QDigiDoc4 - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#pragma once - -#include -#include - -namespace Ui { -class WaitDialog; -} - -class WaitDialog : public QDialog -{ - Q_OBJECT - -public: - explicit WaitDialog(QWidget *parent = nullptr); - ~WaitDialog(); - - void setText(const QString &text); - - static WaitDialog* create(QWidget *parent); - static void destroy(); - static WaitDialog* instance(); - - Ui::WaitDialog *ui; - static WaitDialog *waitDialog; - QTimer timer; -}; diff --git a/client/dialogs/WarningDialog.cpp b/client/dialogs/WarningDialog.cpp index 587819c66..f15005702 100644 --- a/client/dialogs/WarningDialog.cpp +++ b/client/dialogs/WarningDialog.cpp @@ -25,7 +25,7 @@ #include #include -WarningDialog::WarningDialog(const QString &text, const QString &details, QWidget *parent) +WarningDialog::WarningDialog(QWidget *parent) : QDialog(parent) , ui(new Ui::WarningDialog) { @@ -37,22 +37,17 @@ WarningDialog::WarningDialog(const QString &text, const QString &details, QWidge #endif ui->buttonBox->layout()->setSpacing(40); - ui->text->setText(text); - ui->details->setText(details); + ui->title->hide(); + ui->text->hide(); ui->details->hide(); - ui->showDetails->setHidden(details.isEmpty()); + ui->showDetails->hide(); connect(ui->showDetails, &AccordionTitle::toggled, ui->details, &QLabel::setVisible); cancel = ui->buttonBox->button(QDialogButtonBox::Close); cancel->setCursor(Qt::PointingHandCursor); connect(cancel, &QPushButton::clicked, this, &QDialog::reject); resetCancelStyle(true); - } -WarningDialog::WarningDialog(const QString &text, QWidget *parent) - : WarningDialog(text, {}, parent) -{} - WarningDialog::~WarningDialog() { delete ui; @@ -148,14 +143,28 @@ void WarningDialog::setCancelText(const QString &label) ui->buttonBox->addButton(cancel, QDialogButtonBox::RejectRole); } -WarningDialog* WarningDialog::show(const QString &text, const QString &details) +WarningDialog* WarningDialog::create(QWidget *parent) +{ + return new WarningDialog(parent ? parent : Application::mainWindow()); +} + +WarningDialog* WarningDialog::withText(const QString &text) +{ + ui->text->setText(text); + ui->text->setHidden(text.isEmpty()); + return this; +} +WarningDialog* WarningDialog::withTitle(const QString &title) { - return show(Application::mainWindow(), text, details); + ui->title->setText(title); + ui->title->setHidden(title.isEmpty()); + return this; } -WarningDialog* WarningDialog::show(QWidget *parent, const QString &text, const QString &details) +WarningDialog* WarningDialog::withDetails(const QString &details) { - auto *dlg = new WarningDialog(text, details, parent); - dlg->open(); - return dlg; + ui->details->setText(details); + ui->details->hide(); + ui->showDetails->setHidden(details.isEmpty()); + return this; } diff --git a/client/dialogs/WarningDialog.h b/client/dialogs/WarningDialog.h index 977733fa3..21b4469a5 100644 --- a/client/dialogs/WarningDialog.h +++ b/client/dialogs/WarningDialog.h @@ -39,8 +39,6 @@ class WarningDialog final: public QDialog YES, Remove, }; - explicit WarningDialog(const QString &text, const QString &details, QWidget *parent = nullptr); - explicit WarningDialog(const QString &text, QWidget *parent = nullptr); ~WarningDialog() final; void addButton(ButtonText label, int ret, bool red = false); @@ -48,12 +46,18 @@ class WarningDialog final: public QDialog void setCancelText(ButtonText label); void setCancelText(const QString& label); void resetCancelStyle(bool warning); - static WarningDialog *show(const QString &text, const QString &details = {}); - static WarningDialog *show(QWidget *parent, const QString &text, const QString &details = {}); - static QString buttonLabel(ButtonText label); + static WarningDialog *create(QWidget *parent = {}); + + WarningDialog *withTitle(const QString &text); + WarningDialog *withText(const QString &text); + WarningDialog *withDetails(const QString &details); private: + explicit WarningDialog(QWidget *parent = nullptr); + + static QString buttonLabel(ButtonText label); + Ui::WarningDialog *ui; WaitDialogHider hider; QPushButton *cancel; diff --git a/client/dialogs/WarningDialog.ui b/client/dialogs/WarningDialog.ui index fe144fe92..e6a7ea465 100644 --- a/client/dialogs/WarningDialog.ui +++ b/client/dialogs/WarningDialog.ui @@ -7,18 +7,24 @@ 0 0 568 - 247 + 288 - #WarningDialog > QLabel { + #WarningDialog { +border-radius: 4px; +background-color: #FFFFFF; +} +#WarningDialog > QLabel { color: #07142A; font-family: Roboto, Helvetica; font-size: 14px; } -#WarningDialog { -border-radius: 4px; -background-color: #FFFFFF; +#WarningDialog > #title { +color: #003168; +font-family: Roboto, Helvetica; +font-size: 20px; +font-weight: 700; } QPushButton { background-color: #2F70B6; @@ -26,6 +32,7 @@ border: 1px solid #2F70B6; border-radius: 4px; padding: 12px 12px; color: #ffffff; +font-family: Roboto, Helvetica; font-size: 14px; font-weight: 700; } @@ -75,6 +82,13 @@ border-color: #E1C1C6; 24 + + + + Qt::AlignCenter + + + @@ -83,30 +97,12 @@ border-color: #E1C1C6; 30 - - - Roboto - -1 - - IBeamCursor - - QLabel { -margin: 10px 15px 0px 15px; -border: none; -} - - - TextLabel - Qt::RichText - - Qt::AlignCenter - true @@ -151,7 +147,6 @@ border: none; QLabel { margin: 0px 15px 0px 15px; -border: none; } diff --git a/client/fonts/fonts.qrc b/client/fonts/fonts.qrc deleted file mode 100644 index 11af7e54f..000000000 --- a/client/fonts/fonts.qrc +++ /dev/null @@ -1,8 +0,0 @@ - - - Roboto-Bold.ttf - Roboto-Regular.ttf - RobotoCondensed-Bold.ttf - RobotoCondensed-Regular.ttf - - diff --git a/client/translations/en.ts b/client/translations/en.ts index fce61f2ef..6134b7154 100644 --- a/client/translations/en.ts +++ b/client/translations/en.ts @@ -218,10 +218,6 @@ CDocumentModel - - Failed to save file '%1' - Failed to save file '%1' - Added file(s) exceeds the maximum size limit of the container (∼120MB). <a href='https://www.id.ee/en/article/encrypting-large-120-mb-files/'>Read more about it</a> Added file(s) exceeds the maximum size limit of the container (∼120MB). <a href='https://www.id.ee/en/article/encrypting-large-120-mb-files/'>Read more about it</a> @@ -360,10 +356,6 @@ Save certificate Save certificate - - Failed to save file - Failed to save file - Close Close @@ -461,6 +453,10 @@ In order to view Validity Confirmation Sheet there has to be at least one printer installed! In order to view Validity Confirmation Sheet there has to be at least one printer installed! + + You are about to delete the last file in the container, it is removed along with the container. + You are about to delete the last file in the container, it is removed along with the container. + Change Change @@ -545,8 +541,20 @@ Digi-ID - Failed to decrypt document - Failed to decrypt document + Failed to add key + Failed to add key + + + Please check your internet connection and network settings. + Please check your internet connection and network settings. + + + Failed to encrypt document + Failed to encrypt document + + + Failed to remove key + Failed to remove key Failed to open document @@ -560,14 +568,6 @@ You must enter your PIN code twice in order to decrypt the CDOC2 container. The first PIN entry is required for authentication to the key server referenced in the CDOC2 container. Second PIN entry is required to decrypt the CDOC2 container. You must enter your PIN code twice in order to decrypt the CDOC2 container. The first PIN entry is required for authentication to the key server referenced in the CDOC2 container. Second PIN entry is required to decrypt the CDOC2 container. - - Failed to encrypt document. Please check your internet connection and network settings. - Failed to encrypt document. Please check your internet connection and network settings. - - - Failed to decrypt document. Please check your internet connection and network settings. - Failed to decrypt document. Please check your internet connection and network settings. - Don't show again Don't show again @@ -694,6 +694,10 @@ Cannot add files to signed container Cannot add files to signed container + + Please check your internet connection. + Please check your internet connection. + Cannot add signature to empty container Cannot add signature to empty container @@ -710,6 +714,14 @@ PIN Login failed PIN Login failed + + Connecting to SiVa server failed! + Connecting to SiVa server failed! + + + Please check your internet connection and network settings. + Please check your internet connection and network settings. + Certificate status revoked Certificate status revoked @@ -718,10 +730,18 @@ Certificate status unknown Certificate status unknown + + Check your Time-Stamping service access settings. + Check your Time-Stamping service access settings. + PIN Locked. Unblock to reuse PIN. PIN Locked. Unblock to reuse PIN. + + Signing service URL is incorrect. + Signing service URL is incorrect. + An error occurred while opening the document. An error occurred while opening the document. @@ -738,10 +758,6 @@ Failed to save container Failed to save container - - Failed to sign container. Check your Time-Stamping service access settings. - Failed to sign container. Check your Time-Stamping service access settings. - You have not granted IP-based access. Check your validity confirmation service access settings. You have not granted IP-based access. Check your validity confirmation service access settings. @@ -758,44 +774,40 @@ The timestamp added to the signature must be taken before validity confirmation. The timestamp added to the signature must be taken before validity confirmation. - - Connecting to SiVa server failed! Please check your internet connection. - Connecting to SiVa server failed! Please check your internet connection. - - - Failed to sign container. - Failed to sign container. - This type of signed document will be transmitted to the Digital Signature Validation Service SiVa to verify the validity of the digital signature. Read more information about transmitted data to Digital Signature Validation service from <a href="https://www.id.ee/en/article/data-protection-conditions-for-the-id-software-of-the-national-information-system-authority/">here</a>.<br />Do you want to continue? This type of signed document will be transmitted to the Digital Signature Validation Service SiVa to verify the validity of the digital signature. Read more information about transmitted data to Digital Signature Validation service from <a href="https://www.id.ee/en/article/data-protection-conditions-for-the-id-software-of-the-national-information-system-authority/">here</a>.<br />Do you want to continue? - Connecting to SiVa server failed! Please check your internet connection and network settings. - Connecting to SiVa server failed! Please check your internet connection and network settings. + Opening + Opening - Failed to sign container. Please check the access to signing services and network settings. - Failed to sign container. Please check the access to signing services and network settings. + Failed to sign container + Failed to sign container + + + DocumentModel - Failed to sign container. Signing service URL is incorrect. - Failed to sign container. Signing service URL is incorrect. + Cannot add container to same container + Cannot add container to same container - Opening - Opening + File is already in container. + File is already in container. + + + Failed to open file + Failed to open file - - - DocumentModel A file with this extension cannot be opened in the DigiDoc4 Client. Download the file to view it. A file with this extension cannot be opened in the DigiDoc4 Client. Download the file to view it. - Cannot add the file to the envelope. File '%1' is already in container. - Cannot add the file to the envelope. File '%1' is already in container. + Failed remove document from container + Failed remove document from container Internal error @@ -809,6 +821,10 @@ Cannot add empty file to the container. Cannot add empty file to the container. + + Failed to add file + Failed to add file + FileDialog @@ -832,6 +848,10 @@ Create %1 Create %1 + + Failed to save files + Failed to save files + Documents (%1) Documents (%1) @@ -844,6 +864,10 @@ Move file Move file + + Failed to save file + Failed to save file + FileItem @@ -1366,27 +1390,13 @@ ID-Card Converted to crypto container! - You are about to delete the last file in the container, it is removed along with the container. - You are about to delete the last file in the container, it is removed along with the container. + Cannot alter container + Cannot alter container Removing signature Removing signature - - Files can not be added to the signed container. The system will create a new container which shall contain the signed document and the files you wish to add. - Files can not be added to the signed container. The system will create a new container which shall contain the signed document and the files you wish to add. - - - Files can not be added to the cryptocontainer. The system will create a new container which shall contain the cypto-document and the files you wish to add. - Files can not be added to the cryptocontainer. The system will create a new container which shall contain the cypto-document and the files you wish to add. - - - Cannot add container to same container -%1 - Cannot add container to same container -%1 - Connect the card reader to your computer and insert your ID card into the reader Connect the card reader to your computer and insert your ID-card into the reader @@ -1460,6 +1470,22 @@ ID-Card Save Save + + Files can not be added to the signed container + Files can not be added to the signed container + + + Files can not be added to the cryptocontainer + Files can not be added to the cryptocontainer + + + The system will create a new container which shall contain the signed document and the files you wish to add. + The system will create a new container which shall contain the signed document and the files you wish to add. + + + The system will create a new container which shall contain the cypto-document and the files you wish to add. + The system will create a new container which shall contain the cypto-document and the files you wish to add. + Continue Continue @@ -1582,10 +1608,22 @@ ID-Card mobile-ID mobile-ID + + Your Smart-ID transaction has expired or user account not found. + Your Smart-ID transaction has expired or user account not found. + Smart-ID Smart-ID + + Check your %1 service access settings. <a href="https://www.id.ee/en/article/for-organisations-that-sign-large-quantities-of-documents-using-digidoc4-client/">Additional information</a> + Check your %1 service access settings. <a href="https://www.id.ee/en/article/for-organisations-that-sign-large-quantities-of-documents-using-digidoc4-client/">Additional information</a> + + + You need to update your Smart-ID application to sign documents in DigiDoc4 Client. + You need to update your Smart-ID application to sign documents in DigiDoc4 Client. + Service result: Service result: @@ -1594,10 +1632,6 @@ ID-Card Make sure control code matches with one in phone screen and enter Smart-ID PIN2-code. Make sure control code matches with one in phone screen and enter Smart-ID PIN2-code. - - Failed to sign container. Check your %1 service access settings. <a href="https://www.id.ee/en/article/for-organisations-that-sign-large-quantities-of-documents-using-digidoc4-client/">Additional information</a> - Failed to sign container. Check your %1 service access settings. <a href="https://www.id.ee/en/article/for-organisations-that-sign-large-quantities-of-documents-using-digidoc4-client/">Additional information</a> - Your Smart-ID certificate level must be qualified to sign documents in DigiDoc4 Client. Your Smart-ID certificate level must be qualified to sign documents in DigiDoc4 Client. @@ -1662,14 +1696,6 @@ ID-Card Failed to send request. The number of unsuccesful request from this IP address has been exceeded. Please try again later. Failed to send request. The number of unsuccesful request from this IP address has been exceeded. Please try again later. - - Failed to sign container. Your Smart-ID transaction has expired or user account not found. - Failed to sign container. Your Smart-ID transaction has expired or user account not found. - - - Failed to sign container. You need to update your Smart-ID application to sign documents in DigiDoc4 Client. - Failed to sign container. You need to update your Smart-ID application to sign documents in DigiDoc4 Client. - Failed to send request. A valid session is associated with this personal code. It is not possible to start a new signing before the current session expires. Please try again later. Failed to send request. A valid session is associated with this personal code. It is not possible to start a new signing before the current session expires. Please try again later. @@ -2149,13 +2175,6 @@ ID-Card Cancel - - SDocumentModel - - Failed remove document from container - Failed remove document from container - - SettingsDialog @@ -2218,6 +2237,18 @@ ID-Card Checking updates has failed. Checking updates has failed. + + Restart DigiDoc4 Client to activate logging. + Restart DigiDoc4 Client to activate logging. + + + Read more <a href="https://www.id.ee/en/article/log-file-generation-in-digidoc4-client/">here</a>. + Read more <a href="https://www.id.ee/en/article/log-file-generation-in-digidoc4-client/">here</a>. + + + Read more <a href="https://www.id.ee/en/article/log-file-generation-in-digidoc4-client/">here</a>. Restart now? + Read more <a href="https://www.id.ee/en/article/log-file-generation-in-digidoc4-client/">here</a>. Restart now? + Please try again. Please try again. @@ -2331,14 +2362,6 @@ Additional licenses and components Save log Save log - - Restart DigiDoc4 Client to activate logging. Read more <a href="https://www.id.ee/en/article/log-file-generation-in-digidoc4-client/">here</a>. Restart now? - Restart DigiDoc4 Client to activate logging. Read more <a href="https://www.id.ee/en/article/log-file-generation-in-digidoc4-client/">here</a>. Restart now? - - - Restart DigiDoc4 Client to activate logging. Read more <a href="https://www.id.ee/en/article/log-file-generation-in-digidoc4-client/">here</a>. - Restart DigiDoc4 Client to activate logging. Read more <a href="https://www.id.ee/en/article/log-file-generation-in-digidoc4-client/">here</a>. - The project is supported by the European Regional Development Fund The project is supported by the European Regional Development Fund @@ -2772,18 +2795,6 @@ Additional licenses and components PUK code is blocked because the PUK code has been entered 3 times incorrectly.<br/>You can not unblock the PUK code yourself.<br/>As long as the PUK code is blocked, all eID options can be used, except PUK-code.<br/> PUK code is blocked because the PUK code has been entered 3 times incorrectly.<br/>You can not unblock the PUK code yourself.<br/>As long as the PUK code is blocked, all eID options can be used, except PUK-code.<br/> - - Certificate status is unknown. A valid certificate is required for electronic use. - Certificate status is unknown. A valid certificate is required for electronic use. - - - Your ID-card signing certificate status is unknown. You need valid certificates to use your ID-card electronically. - Your ID-card signing certificate status is unknown. You need valid certificates to use your ID-card electronically. - - - Your ID-card authentication certificate status is unknown. You need valid certificates to use your ID-card electronically. - Your ID-card authentication certificate status is unknown. You need valid certificates to use your ID-card electronically. - Please visit the service center to obtain new codes.<br/><a href="https://www.politsei.ee/en/instructions/applying-for-an-id-card-for-an-adult/reminders-for-id-card-holders/">Additional information</a>. Please visit the service center to obtain new codes.<br/><a href="https://www.politsei.ee/en/instructions/applying-for-an-id-card-for-an-adult/reminders-for-id-card-holders/">Additional information</a>. @@ -2837,52 +2848,76 @@ Additional licenses and components Certificate for Encryption - PIN%1 has been blocked because PIN%1 code has been entered incorrectly 3 times. - PIN%1 has been blocked because PIN%1 code has been entered incorrectly 3 times. + Certificate is valid + Certificate is valid - Unblock to reuse PIN%1. - Unblock to reuse PIN%1. + Your ID-card signing certificate is valid + Your ID-card signing certificate is valid - Check certificate status - Check certificate status + Your ID-card authentication certificate is valid + Your ID-card authentication certificate is valid - Your ID-card authentication certificate is valid. - Your ID-card authentication certificate is valid. + Certificate is not valid + Certificate is not valid - Your ID-card signing certificate is valid. - Your ID-card signing certificate is valid. + A valid certificate is required for electronic use. + A valid certificate is required for electronic use. - Your ID-card signing certificate is not valid. You need valid certificates to use your ID-card electronically. - Your ID-card signing certificate is not valid. You need valid certificates to use your ID-card electronically. + Your ID-card signing certificate is not valid + Your ID-card signing certificate is not valid - Your ID-card authentication certificate is not valid. You need valid certificates to use your ID-card electronically. - Your ID-card authentication certificate is not valid. You need valid certificates to use your ID-card electronically. + You need valid certificates to use your ID-card electronically. + You need valid certificates to use your ID-card electronically. - Read more <a href="https://www.id.ee/en/article/validity-of-id-card-certificates/">here</a>. - Read more <a href="https://www.id.ee/en/article/validity-of-id-card-certificates/">here</a>. + Your ID-card authentication certificate is not valid + Your ID-card authentication certificate is not valid - Certificate is valid. - Certificate is valid. + Certificate status is unknown + Certificate status unknown - Certificate is not valid. A valid certificate is required for electronic use. - Certificate is not valid. A valid certificate is required for electronic use. + Your ID-card signing certificate status is unknown + Your ID-card signing certificate status is unknown - PIN%1 can not be used because the certificate has expired. - PIN%1 can not be used because the certificate has expired. + Your ID-card authentication certificate status is unknown + Your ID-card authentication certificate status is unknown - Certificate status check failed. Please check your internet connection. - Certificate status check failed. Please check your internet connection. + Certificate status check failed + Certificate status check failed + + + Please check your internet connection. + Please check your internet connection. + + + PIN%1 has been blocked because PIN%1 code has been entered incorrectly 3 times. + PIN%1 has been blocked because PIN%1 code has been entered incorrectly 3 times. + + + Unblock to reuse PIN%1. + Unblock to reuse PIN%1. + + + Check certificate status + Check certificate status + + + Read more <a href="https://www.id.ee/en/article/validity-of-id-card-certificates/">here</a>. + Read more <a href="https://www.id.ee/en/article/validity-of-id-card-certificates/">here</a>. + + + PIN%1 can not be used because the certificate has expired. + PIN%1 can not be used because the certificate has expired. diff --git a/client/translations/et.ts b/client/translations/et.ts index 36f1e50c2..6da7d21bb 100644 --- a/client/translations/et.ts +++ b/client/translations/et.ts @@ -218,10 +218,6 @@ CDocumentModel - - Failed to save file '%1' - Faili '%1' salvestamine ebaõnnestus - Added file(s) exceeds the maximum size limit of the container (∼120MB). <a href='https://www.id.ee/en/article/encrypting-large-120-mb-files/'>Read more about it</a> Lisatud fail(id) ületab turvaümbriku maksimaalset suurust (~120MB). <a href='https://www.id.ee/artikkel/suuremahuliste-120-mb-failide-krupteerimine/'>Loe täpsemalt siit</a> @@ -360,10 +356,6 @@ Save certificate Salvesta sertifikaat - - Failed to save file - Faili salvestamine ebaõnnestus - Close Sulge @@ -461,6 +453,10 @@ In order to view Validity Confirmation Sheet there has to be at least one printer installed! Digitaalallkirjade kinnituslehe kuvamiseks peab olema arvutis vähemalt üks printer seadistatud! + + You are about to delete the last file in the container, it is removed along with the container. + Oled kustutamas viimast faili ümbrikus, koos sellega eemaldatakse ka ümbrik. + Change Muuda @@ -545,8 +541,20 @@ Digi-ID - Failed to decrypt document - Dokumendi dekrüpteerimine ebaõnnestus + Failed to add key + Võtme lisamine ebaõnnestus + + + Please check your internet connection and network settings. + Palun kontrolli internetiühendust ja võrgu sätteid. + + + Failed to encrypt document + Dokumendi krüpteerimine ebaõnnestus + + + Failed to remove key + Võtme eemaldamine ebaõnnestus Failed to open document @@ -560,14 +568,6 @@ You must enter your PIN code twice in order to decrypt the CDOC2 container. The first PIN entry is required for authentication to the key server referenced in the CDOC2 container. Second PIN entry is required to decrypt the CDOC2 container. CDOC2 ümbriku dekrüpteerimiseks tuleb sisestada PIN-koodi kaks korda. Esimene PIN-koodi sisestamine on vajalik autentimiseks CDOC2 ümbrikus viidatud võtmeedastusserverisse. Teine PIN-koodi sisestamine on vajalik CDOC2 ümbriku dekrüpteerimiseks. - - Failed to encrypt document. Please check your internet connection and network settings. - Dokumendi krüpteerimine ebaõnnestus. Palun kontrolli internetiühendust ja võrgu sätteid. - - - Failed to decrypt document. Please check your internet connection and network settings. - Dokumendi dekrüpteerimine ebaõnnestus. Palun kontrolli internetiühendust ja võrgu sätteid. - Don't show again Ära rohkem näita @@ -694,6 +694,10 @@ Cannot add files to signed container Allkirjastatud ümbrikule ei saa lisada faile + + Please check your internet connection. + Palun kontrolli internetiühendust. + Cannot add signature to empty container Tühjale ümbrikule ei saa lisada allkirja @@ -710,6 +714,14 @@ PIN Login failed PIN-koodi valideerimine ebaõnnestus + + Connecting to SiVa server failed! + Viga SiVa serveriga ühenduse saamisel! + + + Please check your internet connection and network settings. + Palun kontrolli internetiühendust ja võrgu sätteid. + Certificate status revoked Sertifikaat on kehtetu @@ -718,10 +730,18 @@ Certificate status unknown Sertifikaadi staatus on teadmata + + Check your Time-Stamping service access settings. + Kontrolli ajatempliteenuse ligipääsu seadeid. + PIN Locked. Unblock to reuse PIN. PIN on lukus. Tühista blokeering, et PIN-i taas kasutada. + + Signing service URL is incorrect. + Allkirjastamise teenuse URL ei ole korrektne. + An error occurred while opening the document. Ümbriku avamisel tekkis viga. @@ -738,10 +758,6 @@ Failed to save container Ümbriku salvestamine ebaõnnestus - - Failed to sign container. Check your Time-Stamping service access settings. - Ümbriku allkirjastamine ebaõnnestus. Kontrolli ajatempliteenuse ligipääsu seadeid. - You have not granted IP-based access. Check your validity confirmation service access settings. Puudub IP-põhine ligipääs. Kontrolli kehtivuskinnitusteenuse ligipääsu seadeid. @@ -758,44 +774,40 @@ The timestamp added to the signature must be taken before validity confirmation. Allkirjale lisatud ajatempel peab olema varasem kehtivuskinnitusest. - - Connecting to SiVa server failed! Please check your internet connection. - Viga SiVa serveriga ühenduse saamisel! Palun kontrolli internetiühendust. - - - Failed to sign container. - Ümbriku allkirjastamine ebaõnnestus. - This type of signed document will be transmitted to the Digital Signature Validation Service SiVa to verify the validity of the digital signature. Read more information about transmitted data to Digital Signature Validation service from <a href="https://www.id.ee/en/article/data-protection-conditions-for-the-id-software-of-the-national-information-system-authority/">here</a>.<br />Do you want to continue? Seda tüüpi allkirjastatud dokument edastatakse digitaalallkirjade kehtivuse kontrollimiseks valideerimisteenusele SiVa. Digitaalallkirjade kehtivuse kontrollimisel edastatud andmete kohta loe lähemalt <a href="https://www.id.ee/artikkel/riigi-infosusteemi-ameti-id-tarkvara-andmekaitsetingimused/">siit</a>.<br />Kas soovid jätkata? - Connecting to SiVa server failed! Please check your internet connection and network settings. - Viga SiVa serveriga ühenduse saamisel! Palun kontrolli internetiühendust ja võrgu sätteid. + Opening + Avamine - Failed to sign container. Please check the access to signing services and network settings. - Ümbriku allkirjastamine ebaõnnestus. Palun kontrolli allkirjastamiseks vajalike teenuste ligipääsu ja võrgu sätteid. + Failed to sign container + Ümbriku allkirjastamine ebaõnnestus + + + DocumentModel - Failed to sign container. Signing service URL is incorrect. - Ümbriku allkirjastamine ebaõnnestus. Allkirjastamise teenuse URL ei ole korrektne. + Cannot add container to same container + Ümbriku lisamine samasse ümbrikusse ebaõnnestus1 - Opening - Avamine + File is already in container. + + + + Failed to open file + Faili avamine ebaõnnestus - - - DocumentModel A file with this extension cannot be opened in the DigiDoc4 Client. Download the file to view it. Sellise laiendiga faili ei ole võimalik avada DigiDoc4 kliendis. Faili vaatamiseks laadi see alla. - Cannot add the file to the envelope. File '%1' is already in container. - Faili lisamine ümbrikusse ebaõnnestus. Lisatud '%1' on juba ümbrikus olemas. + Failed remove document from container + Faili eemaldamine ümbrikust ebaõnnestus Internal error @@ -809,6 +821,10 @@ Cannot add empty file to the container. Tühja faili ei saa lisada ümbrikusse. + + Failed to add file + Faili lisamine ebaõnnestus + FileDialog @@ -832,6 +848,10 @@ Create %1 Loo %1 + + Failed to save files + Failide salvestamine ebaõnnestus + Documents (%1) Dokumendid (%1) @@ -844,6 +864,10 @@ Move file Liiguta fail + + Failed to save file + Faili salvestamine ebaõnnestus + FileItem @@ -1366,27 +1390,13 @@ ID-kaardiga Konverteeritud turvaümbrikuks! - You are about to delete the last file in the container, it is removed along with the container. - Oled kustutamas viimast faili ümbrikus, koos sellega eemaldatakse ka ümbrik. + Cannot alter container + Ümbriku salvestamine ebaõnnestus Removing signature Allkirja eemaldamine - - Files can not be added to the signed container. The system will create a new container which shall contain the signed document and the files you wish to add. - Allkirjastatud ümbrikusse ei saa faile lisada. Süsteem loob uue ümbriku, kuhu lisatakse allkirjastatud dokument ja Sinu valitud failid. - - - Files can not be added to the cryptocontainer. The system will create a new container which shall contain the cypto-document and the files you wish to add. - Krüpto-ümbrikusse ei saa faile lisada. Süsteem loob uue ümbriku, kuhu lisatakse krüpteeritud dokument ja Sinu valitud failid. - - - Cannot add container to same container -%1 - Ümbriku lisamine samasse ümbrikusse ebaõnnestus -%1 - Connect the card reader to your computer and insert your ID card into the reader Ühenda kaardilugeja arvutiga ja sisesta ID-kaart lugejasse @@ -1460,6 +1470,22 @@ ID-kaardiga Save Salvesta + + Files can not be added to the signed container + Allkirjastatud ümbrikusse ei saa faile lisada + + + Files can not be added to the cryptocontainer + Krüpto-ümbrikusse ei saa faile lisada + + + The system will create a new container which shall contain the signed document and the files you wish to add. + Süsteem loob uue ümbriku, kuhu lisatakse allkirjastatud dokument ja Sinu valitud failid. + + + The system will create a new container which shall contain the cypto-document and the files you wish to add. + Süsteem loob uue ümbriku, kuhu lisatakse krüpteeritud dokument ja Sinu valitud failid. + Continue Edasi @@ -1582,10 +1608,22 @@ ID-kaardiga mobile-ID mobiil-ID + + Your Smart-ID transaction has expired or user account not found. + Sinu Smart-ID toiming aegus või kontot ei leitud. + Smart-ID Smart-ID + + Check your %1 service access settings. <a href="https://www.id.ee/en/article/for-organisations-that-sign-large-quantities-of-documents-using-digidoc4-client/">Additional information</a> + Kontrolli %1 teenuse ligipääsu seadeid. <a href="https://www.id.ee/artikkel/asutustele-kus-allkirjastatakse-digidoc4-kliendi-kaudu-suuremates-kogustes-dokumente/">Loe täpsemalt siit</a> + + + You need to update your Smart-ID application to sign documents in DigiDoc4 Client. + DigiDoc4 kliendis allkirjastamiseks pead Smart-ID rakendust uuendama. + Service result: Teenuse vastus/tulemus: @@ -1594,10 +1632,6 @@ ID-kaardiga Make sure control code matches with one in phone screen and enter Smart-ID PIN2-code. Veendu kontrollkoodi õigsuses ja sisesta nutiseadmes Smart-ID PIN2-kood. - - Failed to sign container. Check your %1 service access settings. <a href="https://www.id.ee/en/article/for-organisations-that-sign-large-quantities-of-documents-using-digidoc4-client/">Additional information</a> - Ümbriku allkirjastamine ebaõnnestus. Kontrolli %1 teenuse ligipääsu seadeid. <a href="https://www.id.ee/artikkel/asutustele-kus-allkirjastatakse-digidoc4-kliendi-kaudu-suuremates-kogustes-dokumente/">Loe täpsemalt siit</a> - Your Smart-ID certificate level must be qualified to sign documents in DigiDoc4 Client. DigiDoc4 kliendis allkirjastamiseks peab sinu Smart-ID vastama tasemele kõrge. @@ -1662,14 +1696,6 @@ ID-kaardiga Failed to send request. %1 service has encountered technical errors. Please try again later. Päringu saatmine ebaõnnestus. %1 teenuses esinevad tehnilised tõrked. Palun proovige mõne aja pärast uuesti. - - Failed to sign container. Your Smart-ID transaction has expired or user account not found. - Ümbriku allkirjastamine ebaõnnestus. Sinu Smart-ID toiming aegus või kontot ei leitud. - - - Failed to sign container. You need to update your Smart-ID application to sign documents in DigiDoc4 Client. - Ümbriku allkirjastamine ebaõnnestus. DigiDoc4 kliendis allkirjastamiseks pead Smart-ID rakendust uuendama. - Failed to send request. A valid session is associated with this personal code. It is not possible to start a new signing before the current session expires. Please try again later. Päringu saatmine ebaõnnestus. Selle isikukoodiga on seotud kehtiv sessioon. Enne kehtiva sessiooni aegumist ei ole võimalik uut allkirjastamist alustada. Palun proovige mõne aja pärast uuesti. @@ -2149,13 +2175,6 @@ ID-kaardiga Katkesta - - SDocumentModel - - Failed remove document from container - Faili eemaldamine ümbrikust ebaõnnestus - - SettingsDialog @@ -2218,6 +2237,18 @@ ID-kaardiga Checking updates has failed. Värskenduste kontrollimine on ebaõnnestunud. + + Restart DigiDoc4 Client to activate logging. + Logimise aktiveerimiseks taaskäivita DigiDoc4 klient. + + + Read more <a href="https://www.id.ee/en/article/log-file-generation-in-digidoc4-client/">here</a>. + Loe täpsemalt <a href="https://www.id.ee/artikkel/logifaili-genereerimine-digidoc4-kliendis/">siit</a>. + + + Read more <a href="https://www.id.ee/en/article/log-file-generation-in-digidoc4-client/">here</a>. Restart now? + Loe täpsemalt <a href="https://www.id.ee/artikkel/logifaili-genereerimine-digidoc4-kliendis/">siit</a>. Taaskäivita rakendus? + Please try again. Palun proovi uuesti. @@ -2331,14 +2362,6 @@ Täiendavad litsentsid ja komponendid Save log Salvesta logifail - - Restart DigiDoc4 Client to activate logging. Read more <a href="https://www.id.ee/en/article/log-file-generation-in-digidoc4-client/">here</a>. Restart now? - Logimise aktiveerimiseks taaskäivita DigiDoc4 klient. Loe täpsemalt <a href="https://www.id.ee/artikkel/logifaili-genereerimine-digidoc4-kliendis/">siit</a>. Taaskäivita rakendus? - - - Restart DigiDoc4 Client to activate logging. Read more <a href="https://www.id.ee/en/article/log-file-generation-in-digidoc4-client/">here</a>. - Logimise aktiveerimiseks taaskäivita DigiDoc4 klient. Loe täpsemalt <a href="https://www.id.ee/artikkel/logifaili-genereerimine-digidoc4-kliendis/">siit</a>. - The project is supported by the European Regional Development Fund Projekti on toetatud Euroopa Liidu Regionaalarengu Fondist @@ -2772,18 +2795,6 @@ Täiendavad litsentsid ja komponendid PUK code is blocked because the PUK code has been entered 3 times incorrectly.<br/>You can not unblock the PUK code yourself.<br/>As long as the PUK code is blocked, all eID options can be used, except PUK-code.<br/> PUK-kood on blokeeritud, kuna PUK-koodi on sisestatud 3 korda valesti.<br/>PUK-koodi ei saa ise lahti blokeerida.<br/>Kuigi PUK-kood on blokeeritud, saab kõiki eID võimalusi kasutada, välja arvatud PUK-koodi vajavaid.<br/> - - Certificate status is unknown. A valid certificate is required for electronic use. - Sertifikaadi staatus on teadmata. Elektrooniliseks kasutamiseks on vaja kehtivat sertifikaati. - - - Your ID-card signing certificate status is unknown. You need valid certificates to use your ID-card electronically. - Sinu ID-kaardi allkirjastamise sertifikaadi staatus on teadmata. Elektrooniliseks kasutamiseks on vaja kehtivat sertifikaati. - - - Your ID-card authentication certificate status is unknown. You need valid certificates to use your ID-card electronically. - Sinu ID-kaardi isikutuvastamise sertifikaadi staatus on teadmata. Elektrooniliseks kasutamiseks on vaja kehtivat sertifikaati. - Please visit the service center to obtain new codes.<br/><a href="https://www.politsei.ee/en/instructions/applying-for-an-id-card-for-an-adult/reminders-for-id-card-holders/">Additional information</a>. Uue PUK-koodi saamiseks külasta klienditeeninduspunkti, kust saad koodiümbriku uute koodidega.<br/><a href="https://www.politsei.ee/et/juhend/id-kaardi-taotlemine-taeiskasvanule/id-kaardi-kasutaja-meelespea/">Lisainfo</a>. @@ -2824,6 +2835,58 @@ Täiendavad litsentsid ja komponendid PUK code PUK-kood + + Certificate is valid + Sertifikaat kehtib + + + Your ID-card signing certificate is valid + Sinu ID-kaardi allkirjastamise sertifikaat kehtib + + + Your ID-card authentication certificate is valid + Sinu ID-kaardi isikutuvastamise sertifikaat kehtib + + + Certificate is not valid + Sertifikaat ei kehti + + + A valid certificate is required for electronic use. + Elektrooniliseks kasutamiseks on vaja kehtivat sertifikaati. + + + Your ID-card signing certificate is not valid + Sinu ID-kaardi allkirjastamise sertifikaat ei kehti + + + You need valid certificates to use your ID-card electronically. + ID-kaardi elektrooniliseks kasutamiseks on vaja kehtivaid sertifikaate. + + + Your ID-card authentication certificate is not valid + Sinu ID-kaardi isikutuvastamise sertifikaat ei kehti + + + Certificate status is unknown + Sertifikaadi staatus on teadmata + + + Your ID-card signing certificate status is unknown + Sinu ID-kaardi allkirjastamise sertifikaat staatus on teadmata + + + Your ID-card authentication certificate status is unknown + Sinu ID-kaardi isikutuvastamise sertifikaadi staatus on teadmata + + + Certificate status check failed + Sertifikaadi staatuse kontrollimine ebaõnnestus + + + Please check your internet connection. + Palun kontrolli internetiühendust. + The PUK code is located in your envelope PUK-kood asub Sinu koodiümbrikus @@ -2852,38 +2915,10 @@ Täiendavad litsentsid ja komponendid Check certificate status Kontrolli sertifikaadi staatust - - Your ID-card authentication certificate is valid. - Sinu ID-kaardi isikutuvastamise sertifikaat kehtib. - - - Your ID-card signing certificate is valid. - Sinu ID-kaardi allkirjastamise sertifikaat kehtib. - - - Your ID-card signing certificate is not valid. You need valid certificates to use your ID-card electronically. - Sinu ID-kaardi allkirjastamise sertifikaat ei kehti. ID-kaardi elektrooniliseks kasutamiseks on vaja kehtivaid sertifikaate. - - - Your ID-card authentication certificate is not valid. You need valid certificates to use your ID-card electronically. - Sinu ID-kaardi isikutuvastamise sertifikaat ei kehti. ID-kaardi elektrooniliseks kasutamiseks on vaja kehtivaid sertifikaate. - Read more <a href="https://www.id.ee/en/article/validity-of-id-card-certificates/">here</a>. Loe rohkem <a href="https://www.id.ee/artikkel/id-kaardi-sertifikaatide-kehtivus/">siit</a>. - - Certificate is valid. - Sertifikaat kehtib. - - - Certificate is not valid. A valid certificate is required for electronic use. - Sertifikaat ei kehti. Elektrooniliseks kasutamiseks on vaja kehtivat sertifikaati. - - - Certificate status check failed. Please check your internet connection. - Sertifikaadi staatuse kontrollimine ebaõnnestus. Palun kontrolli internetiühendust. - WarningDialog diff --git a/client/translations/ru.ts b/client/translations/ru.ts index 0a25e33aa..8414dff82 100644 --- a/client/translations/ru.ts +++ b/client/translations/ru.ts @@ -218,10 +218,6 @@ CDocumentModel - - Failed to save file '%1' - Неудачное сохранение файла '%1' - Added file(s) exceeds the maximum size limit of the container (∼120MB). <a href='https://www.id.ee/en/article/encrypting-large-120-mb-files/'>Read more about it</a> Добаленные файл/ы превышают максимальный размер контейнера. <a href='https://www.id.ee/ru/artikkel/kriptovanie-fajlov-s-bolshim-obemom-120-mb/'>Точнее можно прочитать</a> @@ -360,10 +356,6 @@ Save certificate Сохранить сертификат - - Failed to save file - Не удалось сохранить файл - Close Закрыть @@ -461,6 +453,10 @@ In order to view Validity Confirmation Sheet there has to be at least one printer installed! Для отображения листа подтверждения действительности цифровой подписи на компьютере должен быть установлен как минимум один принтер! + + You are about to delete the last file in the container, it is removed along with the container. + Вы собираетесь удалить последний файл в контейнере, он удаляется вместе с контейнером. + Change Поменять @@ -545,8 +541,20 @@ Digi-ID - Failed to decrypt document - Не удалось расшифровать документ + Failed to add key + + + + Please check your internet connection and network settings. + Пожалуйста, проверьте подключение к Интернету и настройки сети. + + + Failed to encrypt document + Не удалось зашифровать документ + + + Failed to remove key + Failed to open document @@ -560,14 +568,6 @@ You must enter your PIN code twice in order to decrypt the CDOC2 container. The first PIN entry is required for authentication to the key server referenced in the CDOC2 container. Second PIN entry is required to decrypt the CDOC2 container. PIN-код необходимо ввести дважды, чтобы расшифровать конверт CDOC2. Первый ввод PIN-кода требуется для аутентификации на сервере передачи ключей, указанном в конверте CDOC2. Для расшифровки конверта CDOC2 требуется второй ввод PIN-кода. - - Failed to encrypt document. Please check your internet connection and network settings. - Не удалось зашифровать документ. Пожалуйста, проверьте подключение к Интернету и настройки сети. - - - Failed to decrypt document. Please check your internet connection and network settings. - Не удалось расшифровать документ. Пожалуйста, проверьте подключение к Интернету и настройки сети. - Don't show again Больше не показывать @@ -698,6 +698,14 @@ Missing signature Подпись отсутствует + + Check your Time-Stamping service access settings. + Проверьте настройки доступа к меткам времени. + + + Please check your internet connection. + Пожалуйста проверьте подключение к интернету. + Cannot add signature to empty container Нельзя добавить подпись в пустой контейнер @@ -726,6 +734,14 @@ An error occurred while opening the document. Во время открытия конверта возникла ошибка. + + Connecting to SiVa server failed! + Ошибка при подключении с SiVa сервером! + + + Please check your internet connection and network settings. + Пожалуйста, проверьте подключение к Интернету и настройки сети. + Failed add file to container Не удается добавить файл в контейнер @@ -739,8 +755,8 @@ Не удается сохранить контейнер - Failed to sign container. Check your Time-Stamping service access settings. - Не удалось подписать контейнер. Проверьте настройки доступа к меткам времени. + Signing service URL is incorrect. + Службы URL-адрес подписи неверены. You have not granted IP-based access. Check your validity confirmation service access settings. @@ -758,44 +774,40 @@ The timestamp added to the signature must be taken before validity confirmation. Добавленная к подписи метка времени должна быть более ранней по времени, чем подтверждение действительности. - - Connecting to SiVa server failed! Please check your internet connection. - Ошибка при подключении с SiVa сервером! Пожалуйста проверьте подключение к интернету. - - - Failed to sign container. - Не удалось подписать контейнер. - This type of signed document will be transmitted to the Digital Signature Validation Service SiVa to verify the validity of the digital signature. Read more information about transmitted data to Digital Signature Validation service from <a href="https://www.id.ee/en/article/data-protection-conditions-for-the-id-software-of-the-national-information-system-authority/">here</a>.<br />Do you want to continue? Данный тип подписанного документа передается в службу валидации SiVa для проверки действительности цифровых подписей. Подробнее о данных, переданных для проверки действительности электронно-цифровых подписей, можно прочитать <a href="https://www.id.ee/ru/artikkel/usloviya-zashhity-dannyh-programmnogo-obespecheniya-id-karty-departamenta-gosudarstvennoj-infosistemy/">здесь</a>.<br />Желаете продолжить? - Connecting to SiVa server failed! Please check your internet connection and network settings. - Ошибка при подключении с SiVa сервером! Пожалуйста проверьте интернет соединение и настройки сети. + Opening + Открывается - Failed to sign container. Please check the access to signing services and network settings. - Не удалось подписать контейнер. Пожалуйста, проверьте настройки доступа и сеть для служб подписи. + Failed to sign container + Не удалось подписать контейнер + + + DocumentModel - Failed to sign container. Signing service URL is incorrect. - Не удалось подписать контейнер. Службы URL-адрес подписи неверены. + Cannot add container to same container + Невозможно добавить контейнер в тот же контейнер - Opening - Открывается + File is already in container. + + + + Failed to open file + - - - DocumentModel A file with this extension cannot be opened in the DigiDoc4 Client. Download the file to view it. Файл с таким расширением не может быть открыт в клиенте DigiDoc4. Загрузите файл, чтобы просмотреть его. - Cannot add the file to the envelope. File '%1' is already in container. - Невозможно добавить файл в контейнер. Файл '%1' уже в контейнере. + Failed remove document from container + Не удается удалить файл из контейнера Internal error @@ -809,6 +821,10 @@ Cannot add empty file to the container. Пустой файл нельзя добавить в контейнер. + + Failed to add file + + FileDialog @@ -832,6 +848,10 @@ Create %1 Создайте %1 + + Failed to save files + + Documents (%1) Документы (%1) @@ -844,6 +864,10 @@ Move file Переместить файл + + Failed to save file + Не удалось сохранить файл + FileItem @@ -1366,27 +1390,13 @@ ID-картой Переделан в контейнер для зашифровывания! - You are about to delete the last file in the container, it is removed along with the container. - Вы собираетесь удалить последний файл в контейнере, он удаляется вместе с контейнером. + Cannot alter container + Сохранение контейнера не удалось Removing signature Удаление подписи - - Files can not be added to the signed container. The system will create a new container which shall contain the signed document and the files you wish to add. - Файлы не могут быть добавлены в подписанный контейнер. Система создаст новый контейнер, в который будет добавлен подписанный документ и выбранные вами файлы. - - - Files can not be added to the cryptocontainer. The system will create a new container which shall contain the cypto-document and the files you wish to add. - Файлы не могут быть добавлены в криптоконтейнер. Система создаст новый контейнер, в который будет добавлен зашифрованный документ и выбранные вами файлы. - - - Cannot add container to same container -%1 - Невозможно добавить контейнер в тот же контейнер -%1 - Connect the card reader to your computer and insert your ID card into the reader Подключите устройство чтения карт к компьютеру и вставьте ID-карту в устройство чтения @@ -1460,6 +1470,22 @@ ID-картой Save Сохранить + + Files can not be added to the signed container + Файлы не могут быть добавлены в подписанный контейнер + + + Files can not be added to the cryptocontainer + Файлы не могут быть добавлены в криптоконтейнер + + + The system will create a new container which shall contain the signed document and the files you wish to add. + Система создаст новый контейнер, в который будет добавлен подписанный документ и выбранные вами файлы. + + + The system will create a new container which shall contain the cypto-document and the files you wish to add. + Система создаст новый контейнер, в который будет добавлен зашифрованный документ и выбранные вами файлы. + Continue Продолжить @@ -1582,10 +1608,22 @@ ID-картой mobile-ID mobiil-ID + + Your Smart-ID transaction has expired or user account not found. + Срок действия вашей операции Smart-ID истек или учетная запись не найдена. + Smart-ID Smart-ID + + Check your %1 service access settings. <a href="https://www.id.ee/en/article/for-organisations-that-sign-large-quantities-of-documents-using-digidoc4-client/">Additional information</a> + Проверьте настройки доступа услуги %1 <a href="https://www.id.ee/ru/artikkel/dlya-uchrezhdenij-v-kotoryh-v-bolshom-obeme-podpisyvayutsya-dokumenty-s-pomoshhyu-digidoc4-klienta/">Дополнительная информация</a> + + + You need to update your Smart-ID application to sign documents in DigiDoc4 Client. + Для подписания с помощью Smart-ID в программе DigiDoc4 клиент нужно обновить приложение Smart-ID. + Service result: Ответ/результат услуги: @@ -1594,10 +1632,6 @@ ID-картой Make sure control code matches with one in phone screen and enter Smart-ID PIN2-code. Убедитесь в правильности контрольного кодa и введите PIN2-код для Smart-ID. - - Failed to sign container. Check your %1 service access settings. <a href="https://www.id.ee/en/article/for-organisations-that-sign-large-quantities-of-documents-using-digidoc4-client/">Additional information</a> - Не удалось подписать контейнер. Проверьте настройки доступа услуги %1 <a href="https://www.id.ee/ru/artikkel/dlya-uchrezhdenij-v-kotoryh-v-bolshom-obeme-podpisyvayutsya-dokumenty-s-pomoshhyu-digidoc4-klienta/">Дополнительная информация</a> - Your Smart-ID certificate level must be qualified to sign documents in DigiDoc4 Client. Для подписания в DigiDoc4 клиенте Ваш Smart-ID должен соответствовать более высокому уровню. @@ -1662,14 +1696,6 @@ ID-картой Failed to send request. The number of unsuccesful request from this IP address has been exceeded. Please try again later. Не удалось отправить запрос. Превышено количество неудачных запросов с этого IP-адреса. Пожалуйста, попробуйте позже. - - Failed to sign container. Your Smart-ID transaction has expired or user account not found. - Не удалось подписать контейнер. Срок действия вашей операции Smart-ID истек или учетная запись не найдена. - - - Failed to sign container. You need to update your Smart-ID application to sign documents in DigiDoc4 Client. - Не удалось подписать контейнер. Для подписания с помощью Smart-ID в программе DigiDoc4 клиент нужно обновить приложение Smart-ID. - Failed to send request. A valid session is associated with this personal code. It is not possible to start a new signing before the current session expires. Please try again later. Не удалось отправить запрос. С данным персональным номером связана действующая сессия. До истечения действующей сессии невозможно начать новое подписание. Пожалуйста, попробуйте позже. @@ -2150,13 +2176,6 @@ ID-картой Отмена - - SDocumentModel - - Failed remove document from container - Не удается удалить файл из контейнера - - SettingsDialog @@ -2219,6 +2238,18 @@ ID-картой Checking updates has failed. Ошибка проверки обновлений. + + Restart DigiDoc4 Client to activate logging. + Перезапустите клиент DigiDoc4, чтобы активировать ведение журнала. + + + Read more <a href="https://www.id.ee/en/article/log-file-generation-in-digidoc4-client/">here</a>. + Подробнее читайте <a href="https://www.id.ee/ru/artikkel/generirovanie-log-fajla-v-kliente-digidoc4/">здесь</a>. + + + Read more <a href="https://www.id.ee/en/article/log-file-generation-in-digidoc4-client/">here</a>. Restart now? + Подробнее читайте <a href="https://www.id.ee/ru/artikkel/generirovanie-log-fajla-v-kliente-digidoc4/">здесь</a>. Перезапустить приложение? + Please try again. Пожалуйста, попробуйте еще раз. @@ -2332,14 +2363,6 @@ Additional licenses and components Save log Сохранить лог-файл - - Restart DigiDoc4 Client to activate logging. Read more <a href="https://www.id.ee/en/article/log-file-generation-in-digidoc4-client/">here</a>. Restart now? - Перезапустите клиент DigiDoc4, чтобы активировать ведение журнала. Подробнее читайте <a href="https://www.id.ee/ru/artikkel/generirovanie-log-fajla-v-kliente-digidoc4/">здесь</a>. Перезапустить приложение? - - - Restart DigiDoc4 Client to activate logging. Read more <a href="https://www.id.ee/en/article/log-file-generation-in-digidoc4-client/">here</a>. - Перезапустите клиент DigiDoc4, чтобы активировать ведение журнала. Подробнее читайте <a href="https://www.id.ee/ru/artikkel/generirovanie-log-fajla-v-kliente-digidoc4/">здесь</a>. - The project is supported by the European Regional Development Fund Проект поддерживается Европейским фондом регионального развития @@ -2773,18 +2796,6 @@ Additional licenses and components PUK code is blocked because the PUK code has been entered 3 times incorrectly.<br/>You can not unblock the PUK code yourself.<br/>As long as the PUK code is blocked, all eID options can be used, except PUK-code.<br/> PUK заблокирован, потому что PUK введен неверно 3 раза.<br/>PUK невозможно разблокировать самому.<br/>Пока PUK-код заблокирован, можно использовать все возможности eID, кроме тех которые требуют PUK.<br/> - - Certificate status is unknown. A valid certificate is required for electronic use. - Статус сертификата неизвестен. Для электронного использования требуется действующий сертификат. - - - Your ID-card signing certificate status is unknown. You need valid certificates to use your ID-card electronically. - Статус сертификата подписи вашей ID-карты неизвестен. Для электронного использования вашей ID-карты необходимы действующие сертификаты. - - - Your ID-card authentication certificate status is unknown. You need valid certificates to use your ID-card electronically. - Статус сертификата идентификации вашей ID-карты неизвестен. Для электронного использования вашей ID-карты необходимы действующие сертификаты. - Please visit the service center to obtain new codes.<br/><a href="https://www.politsei.ee/en/instructions/applying-for-an-id-card-for-an-adult/reminders-for-id-card-holders/">Additional information</a>. Для получения нового PUK-кода для своей ID-карты, посетите центр обслуживания, где вы сможете получить конверт с кодами.<br/><a href="https://www.politsei.ee/ru/instruktsii/hodataystvo-o-vydache-id-karty-vzroslomu/pamyatka-dlya-polzovatelya-id-karti/">Дополнительная информация</a>. @@ -2807,7 +2818,7 @@ Additional licenses and components PIN%1 code must be changed in order to authenticate - Чтобы аутентифицироваться, необходимо изменить PIN%1. + Чтобы аутентифицироваться, необходимо изменить PIN%1 PIN%1 code must be changed in order to sign @@ -2838,52 +2849,76 @@ Additional licenses and components Сертификат шифрования - PIN%1 has been blocked because PIN%1 code has been entered incorrectly 3 times. - PIN%1 заблокирован, потому что PIN%1-код был введен неверно 3 раза. + Certificate is valid + Сертификат действителен - Unblock to reuse PIN%1. - Разблокируйте его для повторного использования PIN%1. + Your ID-card signing certificate is valid + Сертификат подписи в вашей ID-карте действителен - Check certificate status - Проверить статус сертификата + Your ID-card authentication certificate is valid + Сертификат идентификации личности в вашей ID-карте действителен + + + Certificate is not valid + Сертификат недействителен - Your ID-card authentication certificate is valid. - Сертификат идентификации личности в вашей ID-карте действителен. + A valid certificate is required for electronic use. + Для электронного использования необходим действующий сертификат. - Your ID-card signing certificate is valid. - Сертификат подписи в вашей ID-карте действителен. + Your ID-card signing certificate is not valid + Сертификат подписи вашей ID-карты недействителен - Your ID-card signing certificate is not valid. You need valid certificates to use your ID-card electronically. - Сертификат подписи вашей ID-карты недействителен. Для электронного использования ID-карты требуются действующие сертификаты. + You need valid certificates to use your ID-card electronically. + Для электронного использования ID-карты требуются действующие сертификаты. - Your ID-card authentication certificate is not valid. You need valid certificates to use your ID-card electronically. - Сертификат идентификации личности в вашей ID-карте недействителен. Для электронного использования ID-карты требуются действующие сертификаты. + Your ID-card authentication certificate is not valid + Сертификат идентификации личности в вашей ID-карте недействителен - Read more <a href="https://www.id.ee/en/article/validity-of-id-card-certificates/">here</a>. - Подробнее читайте <a href="https://www.id.ee/ru/artikkel/dejstvitelnost-sertifikatov-id-karty/">здесь</a>. + Certificate status is unknown + Статус сертификата неизвестен - Certificate is valid. - Сертификат действителен. + Your ID-card signing certificate status is unknown + Статус сертификата подписи вашей ID-карты неизвестен - Certificate is not valid. A valid certificate is required for electronic use. - Сертификат недействителен. Для электронного использования необходим действующий сертификат. + Your ID-card authentication certificate status is unknown + Статус сертификата идентификации вашей ID-карты неизвестен - PIN%1 can not be used because the certificate has expired. - PIN%1 не может быть использован, так как срок действия сертификата истек. + Certificate status check failed + Проверка статуса сертификата не удалась + + + Please check your internet connection. + Пожалуйста проверьте подключение к интернету. - Certificate status check failed. Please check your internet connection. - Проверка статуса сертификата не удалась. Пожалуйста проверьте подключение к интернету. + PIN%1 has been blocked because PIN%1 code has been entered incorrectly 3 times. + PIN%1 заблокирован, потому что PIN%1-код был введен неверно 3 раза. + + + Unblock to reuse PIN%1. + Разблокируйте его для повторного использования PIN%1. + + + Check certificate status + Проверить статус сертификата + + + Read more <a href="https://www.id.ee/en/article/validity-of-id-card-certificates/">here</a>. + Подробнее читайте <a href="https://www.id.ee/ru/artikkel/dejstvitelnost-sertifikatov-id-karty/">здесь</a>. + + + PIN%1 can not be used because the certificate has expired. + PIN%1 не может быть использован, так как срок действия сертификата истек. diff --git a/client/widgets/CardWidget.ui b/client/widgets/CardWidget.ui index 76108c8dc..e5589b724 100644 --- a/client/widgets/CardWidget.ui +++ b/client/widgets/CardWidget.ui @@ -24,6 +24,7 @@ font-weight: 400; } #cardName { color: #003168; +font-family: Roboto, Helvetica; font-size: 16px; font-weight: 700; } diff --git a/client/widgets/ContainerPage.cpp b/client/widgets/ContainerPage.cpp index bb1e37cd5..9509d1705 100644 --- a/client/widgets/ContainerPage.cpp +++ b/client/widgets/ContainerPage.cpp @@ -68,7 +68,6 @@ ContainerPage::ContainerPage(QWidget *parent) connectCode(ui->convert, Actions::ContainerConvert); connectCode(ui->save, Actions::ContainerSave); connect(ui->leftPane, &FileList::addFiles, this, &ContainerPage::addFiles); - connect(ui->leftPane, &ItemList::removed, this, &ContainerPage::fileRemoved); connect(ui->leftPane, &ItemList::addItem, this, [this](int code) { emit action(code); }); connect(ui->rightPane, &ItemList::addItem, this, [this](int code) { emit action(code); }); connect(ui->rightPane, &ItemList::removed, this, &ContainerPage::removed); @@ -177,7 +176,7 @@ void ContainerPage::handleAction(int type) return signatureItem->isSelfSigned(code); })) { - auto *dlg = new WarningDialog(tr("The document has already been signed by you."), this); + auto *dlg = WarningDialog::create(this)->withTitle(tr("The document has already been signed by you.")); dlg->addButton(tr("Continue signing"), QMessageBox::Ok); if(dlg->exec() != QMessageBox::Ok) return; @@ -196,6 +195,27 @@ void ContainerPage::changeEvent(QEvent* event) QWidget::changeEvent(event); } +template +void ContainerPage::deleteConfirm(C *c, int index) +{ + if(c->documentModel()->rowCount() > 1) + { + ui->leftPane->removeItem(index); + return; + } + auto *dlg = WarningDialog::create(this)->withText(tr("You are about to delete the last file in the container, it is removed along with the container.")); + dlg->setCancelText(WarningDialog::Cancel); + dlg->resetCancelStyle(false); + dlg->addButton(WarningDialog::Remove, QMessageBox::Ok, true); + if (dlg->exec() != QMessageBox::Ok) + return; + window()->setWindowFilePath({}); + window()->setWindowTitle(tr("DigiDoc4 Client")); + if(QFile::exists(c->fileName())) + QFile::remove(c->fileName()); + emit action(ContainerClose); +} + void ContainerPage::setHeader(const QString &file) { fileName = QDir::toNativeSeparators (file); @@ -216,7 +236,7 @@ void ContainerPage::showMainAction(const QList &actions) bool isSignMobile = !isSignCard && (actions.contains(SignatureMobile) || actions.contains(SignatureSmartID)); bool isEncrypt = actions.contains(EncryptContainer) && !ui->rightPane->findChildren().isEmpty(); bool isDecrypt = !isBlocked && (actions.contains(DecryptContainer) || actions.contains(DecryptToken)); - mainAction->setButtonEnabled(isSupported && !hasEmptyFile && + mainAction->setButtonEnabled(isSupported && (isEncrypt || isDecrypt || isSignMobile || (isSignCard && !isBlocked && !isExpired))); ui->mainActionSpacer->changeSize(198, 20, QSizePolicy::Fixed); ui->navigationArea->layout()->invalidate(); @@ -224,7 +244,7 @@ void ContainerPage::showMainAction(const QList &actions) void ContainerPage::showSigningButton() { - if (!isSupported || hasEmptyFile) + if (!isSupported) { if(mainAction) mainAction->hide(); @@ -241,6 +261,10 @@ void ContainerPage::showSigningButton() void ContainerPage::transition(CryptoDoc *container, const QSslCertificate &cert) { + disconnect(ui->leftPane, &ItemList::removed, container, nullptr); + connect(ui->leftPane, &ItemList::removed, container, [this, container](int index) { + deleteConfirm(container, index); + }); disconnect(ui->rightPane, &ItemList::add, container, nullptr); connect(ui->rightPane, &ItemList::add, container, [this, container] { AddRecipients dlg(ui->rightPane, this); @@ -256,8 +280,8 @@ void ContainerPage::transition(CryptoDoc *container, const QSslCertificate &cert } showMainAction({ EncryptContainer }); }); - disconnect(this, &ContainerPage::removed, container, nullptr); - connect(this, &ContainerPage::removed, container, [this, container](int index) { + disconnect(ui->rightPane, &ItemList::removed, container, nullptr); + connect(ui->rightPane, &ItemList::removed, container, [this, container](int index) { container->removeKey(index); ui->rightPane->removeItem(index); showMainAction({ EncryptContainer }); @@ -292,7 +316,7 @@ void ContainerPage::transition(CryptoDoc *container, const QSslCertificate &cert bool hasUnsupported = false; for(CKey &key: container->keys()) { - hasUnsupported = std::max(hasUnsupported, key.unsupported); + hasUnsupported = hasUnsupported || key.unsupported; ui->rightPane->addWidget(new AddressItem(std::move(key), AddressItem::Icon, ui->rightPane)); } if(hasUnsupported) @@ -303,6 +327,10 @@ void ContainerPage::transition(CryptoDoc *container, const QSslCertificate &cert void ContainerPage::transition(DigiDoc* container) { + disconnect(ui->leftPane, &ItemList::removed, container, nullptr); + connect(ui->leftPane, &ItemList::removed, container, [this, container](int index) { + deleteConfirm(container, index); + }); disconnect(this, &ContainerPage::certChanged, container, nullptr); connect(this, &ContainerPage::certChanged, container, [this](const SslCertificate &) { showSigningButton(); @@ -312,8 +340,9 @@ void ContainerPage::transition(DigiDoc* container) #ifdef Q_OS_WIN if( QPrinterInfo::availablePrinterNames().isEmpty() ) { - WarningDialog::show(this, - tr("In order to view Validity Confirmation Sheet there has to be at least one printer installed!")); + WarningDialog::create(this) + ->withText(tr("In order to view Validity Confirmation Sheet there has to be at least one printer installed!")) + ->open(); return; } #endif @@ -378,17 +407,18 @@ void ContainerPage::transition(DigiDoc* container) if(container->isCades()) emit warning({UnsupportedAsicCadesWarning}); - hasEmptyFile = false; - for (auto i = 0; i < container->documentModel()->rowCount(); i++) + isSupported = container->isSupported() || container->isPDF(); + + for (auto i = 0, count = container->documentModel()->rowCount(); i < count; i++) { if(container->documentModel()->fileSize(i) == 0) { emit warning({EmptyFileWarning}); - hasEmptyFile = true; + isSupported = false; + break; } } - isSupported = container->isSupported() || container->isPDF(); showSigningButton(); ui->leftPane->setModel(container->documentModel()); diff --git a/client/widgets/ContainerPage.h b/client/widgets/ContainerPage.h index b88be81ea..b75a1663e 100644 --- a/client/widgets/ContainerPage.h +++ b/client/widgets/ContainerPage.h @@ -55,13 +55,14 @@ class ContainerPage final : public QWidget void action(int code, const QString &idCode = {}, const QString &info2 = {}); void addFiles(const QStringList &files); void certChanged(const SslCertificate &cert); - void fileRemoved(int row); void removed(int row); void warning(const WarningText &warningText); private: void changeEvent(QEvent* event) final; void clear(int code); + template + void deleteConfirm(C *c, int index); void elideFileName(); bool eventFilter(QObject *o, QEvent *e) final; void showMainAction(const QList &actions); @@ -79,7 +80,6 @@ class ContainerPage final : public QWidget const char *cancelText = QT_TR_NOOP("Cancel"); const char *convertText = QT_TR_NOOP("Encrypt"); bool isSupported = false; - bool hasEmptyFile = false; bool isSeal = false; bool isExpired = false; bool isBlocked = false; diff --git a/client/widgets/FileList.cpp b/client/widgets/FileList.cpp index fdfed6367..7f0eb981a 100644 --- a/client/widgets/FileList.cpp +++ b/client/widgets/FileList.cpp @@ -117,8 +117,9 @@ void FileList::open(FileItem *item) const void FileList::removeItem(int row) { + if(!documentModel->removeRow(row)) + return; ItemList::removeItem(row); - updateDownload(); } @@ -154,13 +155,15 @@ void FileList::saveAll() QString dest = dir + QDir::separator() + FileDialog::safeName(documentModel->data(i)); if( QFile::exists( dest ) ) { - if( b == QMessageBox::YesToAll ) + if(b == QMessageBox::YesToAll) { - QFile::remove( dest ); - documentModel->save( i, dest ); - continue; + QFile::remove( dest ); + documentModel->save( i, dest ); + continue; } - auto *dlg = new WarningDialog(tr("%1 already exists.
Do you want replace it?").arg( dest ), this); + auto *dlg = WarningDialog::create(this) + ->withTitle(FileDialog::tr("Failed to save files")) + ->withText(tr("%1 already exists.
Do you want replace it?").arg(dest)); dlg->setCancelText(WarningDialog::Cancel); dlg->addButton(WarningDialog::YES, QMessageBox::Yes); dlg->addButton(WarningDialog::NO, QMessageBox::No); @@ -168,18 +171,19 @@ void FileList::saveAll() dlg->addButton(tr("Replace all"), QMessageBox::YesToAll); b = dlg->exec(); - if(b == QDialog::Rejected) - break; - if(b == QMessageBox::No) - continue; - if(b == QMessageBox::Save) + switch(b) { - dest = FileDialog::getSaveFileName(this, FileDialog::tr("Save file"), dest); - if( dest.isEmpty() ) + case QDialog::Rejected: + return; + case QMessageBox::No: + continue; + case QMessageBox::Save: + if(dest = FileDialog::getSaveFileName(this, FileDialog::tr("Save file"), dest); dest.isEmpty()) continue; + break; + default: + QFile::remove(dest); } - else - QFile::remove( dest ); } documentModel->save( i, dest ); } @@ -203,9 +207,8 @@ void FileList::setModel(DocumentModel *documentModel) { this->documentModel = documentModel; disconnect(documentModel, &DocumentModel::added, nullptr, nullptr); - disconnect(documentModel, &DocumentModel::removed, nullptr, nullptr); connect(documentModel, &DocumentModel::added, this, &FileList::addFile); - connect(documentModel, &DocumentModel::removed, this, &FileList::removeItem); + auto count = documentModel->rowCount(); for(int i = 0; i < count; i++) addFile(documentModel->data(i)); diff --git a/client/widgets/MainAction.cpp b/client/widgets/MainAction.cpp index 0305411c9..403a788bd 100644 --- a/client/widgets/MainAction.cpp +++ b/client/widgets/MainAction.cpp @@ -20,7 +20,6 @@ #include "MainAction.h" #include "ui_MainAction.h" #include "Settings.h" -#include "Styles.h" #include #include @@ -40,7 +39,6 @@ MainAction::MainAction(QWidget *parent) , ui(new Private) { ui->setupUi(this); - ui->mainAction->setFont(Styles::font(Styles::Condensed, 16)); ui->otherCards->hide(); ui->otherCards->installEventFilter(this); parent->installEventFilter(this); @@ -52,9 +50,10 @@ MainAction::MainAction(QWidget *parent) if (ui->actions.value(0) == Actions::SignatureSmartID) Settings::MOBILEID_ORDER = false; }); - connect(ui->mainAction, &QPushButton::clicked, this, [&]{ emit action(ui->actions.value(0)); }); + connect(ui->mainAction, &QPushButton::clicked, this, [this]{ emit action(ui->actions.value(0)); }); connect(ui->mainAction, &QPushButton::clicked, this, &MainAction::hideDropdown); connect(ui->otherCards, &QToolButton::clicked, this, &MainAction::showDropdown); + adjustSize(); } MainAction::~MainAction() @@ -75,7 +74,7 @@ void MainAction::hideDropdown() for(QPushButton *other: ui->list) other->deleteLater(); ui->list.clear(); - setStyleSheet(QStringLiteral("QPushButton { border-top-left-radius: 2px; }")); + setStyleSheet(QStringLiteral("QPushButton { border-top-left-radius: 4px; }")); } bool MainAction::eventFilter(QObject *watched, QEvent *event) @@ -86,39 +85,12 @@ bool MainAction::eventFilter(QObject *watched, QEvent *event) if(watched == parentWidget()) { move(parentWidget()->width() - width(), parentWidget()->height() - height()); - int i = 1; - for(QPushButton *other: ui->list) - other->move(pos() + QPoint(0, (-height() - 1) * (i++))); - } - break; - case QEvent::MouseButtonPress: - if(watched == ui->otherCards) - ui->otherCards->setProperty("pressed", true); - break; - case QEvent::MouseButtonRelease: - if(watched == ui->otherCards) - ui->otherCards->setProperty("pressed", false); - break; - case QEvent::Paint: - if(watched == ui->otherCards) - { - auto *button = qobject_cast(watched); - QPainter painter(button); - painter.setRenderHint(QPainter::Antialiasing); - if(ui->otherCards->property("pressed").toBool()) - painter.fillRect(button->rect(), QStringLiteral("#41B6E6")); - else if(button->rect().contains(button->mapFromGlobal(QCursor::pos()))) - painter.fillRect(button->rect(), QStringLiteral("#008DCF")); - else - painter.fillRect(button->rect(), QStringLiteral("#006EB5")); - QRect rect(0, 0, 13, 6); - rect.moveCenter(button->rect().center()); - painter.setPen(QPen(Qt::white, 2)); - QPainterPath path(rect.bottomLeft()); - path.lineTo(rect.center().x(), rect.top()); - path.lineTo(rect.bottomRight()); - painter.drawPath(path); - return true; + QWidget* prev = this; + for(QPushButton *other: std::as_const(ui->list)) + { + other->move(prev->pos() + QPoint(0, -height() - 1)); + prev = other; + } } break; default: break; @@ -146,18 +118,15 @@ void MainAction::setButtonEnabled(bool enabled) ui->mainAction->setEnabled(enabled); } -void MainAction::showActions(const QList &actions) +void MainAction::showActions(QList actions) { - QList order = actions; - if(order.size() == 2 && - std::all_of(order.cbegin(), order.cend(), [] (Actions action) { + if(actions.size() == 2 && + std::all_of(actions.cbegin(), actions.cend(), [] (Actions action) { return action == SignatureMobile || action == SignatureSmartID; }) && !Settings::MOBILEID_ORDER) - { - std::reverse(order.begin(), order.end()); - } - ui->actions = std::move(order); + std::reverse(actions.begin(), actions.end()); + ui->actions = std::move(actions); update(); ui->otherCards->setVisible(ui->actions.size() > 1); show(); @@ -167,25 +136,28 @@ void MainAction::showDropdown() { if(ui->actions.size() > 1 && ui->list.isEmpty()) { - for(QList::const_iterator i = ui->actions.cbegin() + 1; i != ui->actions.cend(); ++i) + QWidget* prev = this; + for(auto i = std::next(ui->actions.cbegin()); i != ui->actions.cend(); ++i) { auto *other = new QPushButton(label(*i), parentWidget()); other->setCursor(ui->mainAction->cursor()); - other->setFont(ui->mainAction->font()); other->resize(size()); - other->move(pos() + QPoint(0, (-height() - 1) * (ui->list.size() + 1))); + other->move(prev->pos() + QPoint(0, -height() - 1)); + prev = other; other->show(); other->setStyleSheet(ui->mainAction->styleSheet() + - QStringLiteral("\nborder-top-left-radius: 2px; border-top-right-radius: 2px;")); - if (*i == Actions::SignatureMobile) - connect(other, &QPushButton::clicked, this, []{ Settings::MOBILEID_ORDER = true; }); - if (*i == Actions::SignatureSmartID) - connect(other, &QPushButton::clicked, this, []{ Settings::MOBILEID_ORDER = false; }); - connect(other, &QPushButton::clicked, this, &MainAction::hideDropdown); - connect(other, &QPushButton::clicked, this, [=]{ emit this->action(*i); }); + (i + 1 == ui->actions.cend() ? QStringLiteral("\nQPushButton { border-top-left-radius: 4px; }") : QString())); + connect(other, &QPushButton::clicked, this, [i, this]{ + hideDropdown(); + if (*i == Actions::SignatureMobile) + Settings::MOBILEID_ORDER = true; + if (*i == Actions::SignatureSmartID) + Settings::MOBILEID_ORDER = false; + emit action(*i); + }); ui->list.push_back(other); } - setStyleSheet(QStringLiteral("QPushButton { border-top-left-radius: 0px; }")); + setStyleSheet({}); } else hideDropdown(); diff --git a/client/widgets/MainAction.h b/client/widgets/MainAction.h index 263d95ff0..b558e15b1 100644 --- a/client/widgets/MainAction.h +++ b/client/widgets/MainAction.h @@ -33,7 +33,7 @@ class MainAction final : public QWidget void hideDropdown(); void setButtonEnabled(bool enabled); - void showActions(const QList &actions); + void showActions(QList actions); signals: void action(ria::qdigidoc4::Actions action); diff --git a/client/widgets/MainAction.ui b/client/widgets/MainAction.ui index 9c00d7548..faf517e33 100644 --- a/client/widgets/MainAction.ui +++ b/client/widgets/MainAction.ui @@ -10,9 +10,14 @@ 65
+ + + 200 + 65 + + - border-radius: 2px 0 0 0; -background-color: #1a7dbc; + QPushButton { border-top-left-radius: 4px; } @@ -44,35 +49,31 @@ background-color: #1a7dbc; 65 - - - Roboto Condensed - 16 - - PointingHandCursor QPushButton { - border-top-left-radius: 2px; - border: none; - color: #ffffff; - background-color: #006EB5; +border: 0px; +color: #ffffff; +background-color: #2F70B6; +font-family: Roboto, Helvetica; +font-size: 16px; +font-weight: 700; } -QPushButton:pressed { - background-color: #41B6E6; +QPushButton:hover { +background-color: #2B66A6; } -QPushButton:hover:!pressed { - background-color: #008DCF; +QPushButton:pressed { +background-color: #215081; } QPushButton:disabled { - background-color: #D3D3D3; +background-color: #82A9D3; } - ALLKIRJASTA -ID-KAARDIGA + Allkirjasta +ID-Kaardiga
@@ -98,17 +99,16 @@ ID-KAARDIGA QToolButton { - border: solid #1a7dbc; - border-width: 0px 0px 0px 1px; - background-color: #006EB5; -} -QToolButton:pressed { - background-color: #41B6E6; +border: 0px solid #E7EAEF; +border-width: 0px 0px 0px 1px; +background-color: #2F70B6; } -QToolButton:hover:!pressed { - background-color: #008DCF; +QToolButton:hover { +background-color: #2B66A6; } - +QToolButton:pressed { +background-color: #215081; +} diff --git a/client/widgets/SignatureItem.cpp b/client/widgets/SignatureItem.cpp index 1ffcacf83..bcf341343 100644 --- a/client/widgets/SignatureItem.cpp +++ b/client/widgets/SignatureItem.cpp @@ -53,8 +53,8 @@ SignatureItem::SignatureItem(DigiDocSignature s, QWidget *parent) ui->remove->setVisible(ui->signature.container()->isSupported()); connect(ui->remove, &QToolButton::clicked, this, [this]{ const SslCertificate c = ui->signature.cert(); - auto *dlg = new WarningDialog(tr("Remove signature %1?") - .arg(c.toString(c.showCN() ? QStringLiteral("CN serialNumber") : QStringLiteral("GN SN serialNumber"))), this); + auto *dlg = WarningDialog::create(this)->withTitle(tr("Remove signature %1?") + .arg(c.toString(c.showCN() ? QStringLiteral("CN serialNumber") : QStringLiteral("GN SN serialNumber")))); dlg->setCancelText(WarningDialog::Cancel); dlg->resetCancelStyle(false); dlg->addButton(WarningDialog::Remove, QMessageBox::Ok, true); diff --git a/client/widgets/VerifyCert.cpp b/client/widgets/VerifyCert.cpp index cec31fbfe..d55bf91fc 100644 --- a/client/widgets/VerifyCert.cpp +++ b/client/widgets/VerifyCert.cpp @@ -49,37 +49,45 @@ VerifyCert::VerifyCert(QWidget *parent) pinType == QSmartCardData::Pin1Type ? QStringLiteral("-auth") : QStringLiteral("-sign")); }); connect(ui->checkCert, &QPushButton::clicked, this, [this]{ - QString msg = tr("Read more here."); + auto *dlg = WarningDialog::create(this); + QString readMore = tr("Read more here."); switch(c.validateOnline()) { case SslCertificate::Good: if(SslCertificate::CertType::TempelType == c.type()) - msg.prepend(tr("Certificate is valid. ")); + dlg->withTitle(tr("Certificate is valid")); else if(c.keyUsage().contains(SslCertificate::NonRepudiation)) - msg.prepend(tr("Your ID-card signing certificate is valid. ")); + dlg->withTitle(tr("Your ID-card signing certificate is valid")); else - msg.prepend(tr("Your ID-card authentication certificate is valid. ")); + dlg->withTitle(tr("Your ID-card authentication certificate is valid")); break; case SslCertificate::Revoked: if(SslCertificate::CertType::TempelType == c.type()) - msg.prepend(tr("Certificate is not valid. A valid certificate is required for electronic use. ")); + dlg->withTitle(tr("Certificate is not valid")) + ->withText(tr("A valid certificate is required for electronic use. ") + readMore); else if(c.keyUsage().contains(SslCertificate::NonRepudiation)) - msg.prepend(tr("Your ID-card signing certificate is not valid. You need valid certificates to use your ID-card electronically. ")); + dlg->withTitle(tr("Your ID-card signing certificate is not valid")) + ->withText(tr("You need valid certificates to use your ID-card electronically. ") + readMore); else - msg.prepend(tr("Your ID-card authentication certificate is not valid. You need valid certificates to use your ID-card electronically. ")); + dlg->withTitle(tr("Your ID-card authentication certificate is not valid")) + ->withText(tr("You need valid certificates to use your ID-card electronically. ") + readMore); break; case SslCertificate::Unknown: if(SslCertificate::CertType::TempelType == c.type()) - msg.prepend(tr("Certificate status is unknown. A valid certificate is required for electronic use. ")); + dlg->withTitle(tr("Certificate status is unknown")) + ->withText(tr("A valid certificate is required for electronic use. ") + readMore); else if(c.keyUsage().contains(SslCertificate::NonRepudiation)) - msg.prepend(tr("Your ID-card signing certificate status is unknown. You need valid certificates to use your ID-card electronically. ")); + dlg->withTitle(tr("Your ID-card signing certificate status is unknown")) + ->withText(tr("You need valid certificates to use your ID-card electronically. ") + readMore); else - msg.prepend(tr("Your ID-card authentication certificate status is unknown. You need valid certificates to use your ID-card electronically. ")); + dlg->withTitle(tr("Your ID-card authentication certificate status is unknown")) + ->withText(tr("You need valid certificates to use your ID-card electronically. ") + readMore); break; default: - msg = tr("Certificate status check failed. Please check your internet connection."); + dlg->withTitle(tr("Certificate status check failed")) + ->withText(tr("Please check your internet connection.")); } - WarningDialog::show(this, msg); + dlg->open(); }); clear(); diff --git a/client/widgets/WarningItem.cpp b/client/widgets/WarningItem.cpp index c91e0dc35..d7b2423e8 100644 --- a/client/widgets/WarningItem.cpp +++ b/client/widgets/WarningItem.cpp @@ -76,10 +76,12 @@ void WarningItem::lookupWarning() setObjectName("WarningItemError"); ui->warningText->setText(tr("Certificates have expired!")); url = tr("https://www.politsei.ee/en/instructions/applying-for-an-id-card-for-an-adult/"); + _page = MyEid; break; case CertExpiryWarning: ui->warningText->setText(tr("Certificates expire soon!")); url = tr("https://www.politsei.ee/en/instructions/applying-for-an-id-card-for-an-adult/"); + _page = MyEid; break; case ActivatePin1WithPUKWarning: case UnblockPin1Warning: @@ -87,6 +89,7 @@ void WarningItem::lookupWarning() VerifyCert::tr("PIN%1 has been blocked because PIN%1 code has been entered incorrectly 3 times.").arg(1), VerifyCert::tr("Unblock to reuse PIN%1.").arg(1))); ui->warningAction->setText(VerifyCert::tr("Unblock")); + _page = MyEid; break; case ActivatePin2WithPUKWarning: case UnblockPin2Warning: @@ -94,11 +97,13 @@ void WarningItem::lookupWarning() VerifyCert::tr("PIN%1 has been blocked because PIN%1 code has been entered incorrectly 3 times.").arg(2), VerifyCert::tr("Unblock to reuse PIN%1.").arg(2))); ui->warningAction->setText(VerifyCert::tr("Unblock")); + _page = MyEid; break; case ActivatePin2Warning: ui->warningText->setText(tr("Signing with an ID-card isn't possible yet. PIN%1 code must be changed in order to sign.").arg(2)); ui->warningAction->setText(tr("Additional information")); url = tr("https://www.id.ee/en/article/changing-id-card-pin-codes-and-puk-code/"); + _page = MyEid; break; // SignDetails case InvalidSignatureError: @@ -153,7 +158,8 @@ void WarningItem::lookupWarning() ui->warningAction->hide(); _page = SignDetails; break; - default: break; + case NoWarning: + break; } } diff --git a/client/widgets/WarningItem.h b/client/widgets/WarningItem.h index 3613881de..a9d971eac 100644 --- a/client/widgets/WarningItem.h +++ b/client/widgets/WarningItem.h @@ -50,5 +50,5 @@ class WarningItem final: public StyledWidget Ui::WarningItem *ui; WarningText warnText; QString url; - int _page = -1; + ria::qdigidoc4::Pages _page = ria::qdigidoc4::MyEid; }; diff --git a/client/widgets/WarningList.cpp b/client/widgets/WarningList.cpp index 8adfa6362..e76287d9b 100644 --- a/client/widgets/WarningList.cpp +++ b/client/widgets/WarningList.cpp @@ -4,41 +4,16 @@ #include -using namespace ria::qdigidoc4; - WarningList::WarningList(QWidget *parent) : StyledWidget(parent) {} -void WarningList::clearMyEIDWarnings() -{ - static const QList warningTypes { - CertExpiredError, CertExpiryWarning, - UnblockPin1Warning, UnblockPin2Warning, - ActivatePin2Warning, - }; - for(auto *warning: findChildren()) - { - if(warningTypes.contains(warning->warningType())) - warning->deleteLater(); - } -} - -void WarningList::closeWarning(int warningType) -{ - for(auto *warning: findChildren()) - { - if(warning->warningType() == warningType) - warning->deleteLater(); - } -} - void WarningList::closeWarnings(int page) { for(auto *warning: findChildren()) { if(warning->page() == page) - warning->deleteLater(); + delete warning; } } @@ -56,5 +31,5 @@ void WarningList::showWarning(WarningText warningText) void WarningList::updateWarnings(int page) { for(auto *warning: findChildren()) - warning->setVisible(warning->page() == page || warning->page() == -1); + warning->setVisible(warning->page() == page || warning->page() == ria::qdigidoc4::MyEid); } diff --git a/client/widgets/WarningList.h b/client/widgets/WarningList.h index 518b47a10..d3da2b809 100644 --- a/client/widgets/WarningList.h +++ b/client/widgets/WarningList.h @@ -29,10 +29,7 @@ class WarningList: public StyledWidget public: explicit WarningList(QWidget *parent = nullptr); - void clearMyEIDWarnings(); - void closeWarning(int warningType); void closeWarnings(int page); void showWarning(WarningText warningText); void updateWarnings(int page); - };