diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt
index 1870a02d..30f0e63d 100644
--- a/src/ui/CMakeLists.txt
+++ b/src/ui/CMakeLists.txt
@@ -1,6 +1,9 @@
add_library(ui STATIC
certificatewidget.cpp
certificatewidget.hpp
+ languageselect.cpp
+ languageselect.hpp
+ languageselect.ui
punycode.hpp
ui.cpp
webeiddialog.cpp
@@ -12,6 +15,7 @@ file(GLOB FONTS fonts/*.ttf)
qt_add_resources(ui resources BASE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX / FILES
../../install/appicon_128.png
dark.qss
+ languageselect.qss
${IMAGES}
${FONTS}
)
diff --git a/src/ui/dark.qss b/src/ui/dark.qss
index eb12ec47..fda55a34 100644
--- a/src/ui/dark.qss
+++ b/src/ui/dark.qss
@@ -3,36 +3,11 @@ background-color: #232325;
color: white;
}
QPushButton {
-border-color: #4E4E53;
-background-color: #4E4E53;
-}
-QPushButton::disabled {
-border-color: #27272A;
-background-color: #27272A;
-}
-QPushButton::hover {
-background-color: #76767B;
-border-color: #76767B;
-}
-QPushButton::focus {
-background-color: #76767B;
-border-color: #DEDEDE;
+color: #FF5C79;
+border-color: #FF5C79;
}
-QPushButton:default {
-background-color: #113F8E;
-border-color: #113F8E;
-}
-QPushButton:default::disabled {
-background-color: #15213E;
-border-color: #15213E;
-}
-QPushButton:default::hover {
-background-color: #008EEA;
-border-color: #008EEA;
-}
-QPushButton:default::focus {
-background-color: #008EEA;
-border-color: #DEDEDE;
+QPushButton:hover, QPushButton:pressed {
+background-color: #232325;
}
#langButton {
color: #FFFFFF;
@@ -41,13 +16,6 @@ background-image: url(:images/down_dark.svg);
#langButton::hover {
background-color: #4E4E53;
}
-#langMenu {
-border-color: #4E4E53;
-background-color: #4E4E53;
-}
-#langMenu > QPushButton {
-color: #FFFFFF;
-}
CertificateButton, CertificateWidget {
border-color: #4E4E53;
}
diff --git a/src/ui/dialog.ui b/src/ui/dialog.ui
index 6d222049..7d021372 100644
--- a/src/ui/dialog.ui
+++ b/src/ui/dialog.ui
@@ -27,43 +27,32 @@ font-family: "Roboto";
color: black;
}
QPushButton {
-font-size: 17px;
-border: 3px solid #EFEFEF;
-border-radius: 3px;
-height: 39px;
-padding-left: 17px;
-padding-right: 17px;
-min-width: 30px;
-background-color: #EFEFEF;
-}
-QPushButton::disabled {
-background-color: #FAFAFA;
-border-color: #FAFAFA;
+color: #AD2A45;
+border: 1px solid #AD2A45;
+border-radius: 4px;
+padding: 11px 12px;
+font-family: Roboto, Helvetica;
+font-size: 14px;
+font-weight: 700;
}
-QPushButton::hover {
-background-color: #DEDEDE;
-border-color: #DEDEDE;
+QPushButton:hover {
+background-color: #F5EBED;
}
-QPushButton::focus {
-background-color: #DEDEDE;
-border-color: #76767B;
+QPushButton:pressed {
+background-color: #E1C1C6;
}
-QPushButton:default {
+QPushButton::default, #helpButton {
color: white;
-background-color: #113F8E;
-border-color: #113F8E;
+border-color: #2F70B6;
+background-color: #2F70B6;
}
-QPushButton:default::disabled {
-background-color: #B7C5DD;
-border-color: #B7C5DD;
+QPushButton::default:hover, #helpButton:hover {
+border-color: #2B66A6;
+background-color: #2B66A6;
}
-QPushButton:default::hover {
-background-color: #003168;
-border-color: #003168
-}
-QPushButton:default::focus {
-background-color: #003168;
-border-color: #008EEA;
+QPushButton::default:pressed, #helpButton:pressed {
+border-color: #215081;
+background-color: #215081;
}
#langButton {
color: #003168;
@@ -83,23 +72,6 @@ background-image: url(:images/down.svg);
#langButton::hover {
background-color: #EFEFEF;
}
-#langMenu {
-border: 3px solid #EFEFEF;
-border-radius: 3px;
-background-color: #EFEFEF;
-}
-#langMenu > QPushButton {
-color: #003168;
-border: 0px;
-max-height: 22px;
-padding-left: 7px;
-padding-right: 6px;
-font-size: 14px;
-text-align: left;
-}
-#langMenu > QPushButton:checked {
-font-weight: bold;
-}
CertificateButton, CertificateWidget {
border: 1px solid rgba(0,49,104,0.1);
border-radius: 4px;
@@ -183,9 +155,6 @@ border-radius: 3px;
#fatalErrorLabel, #aboutAlert {
color: #CD2541;
}
-#helpButton {
-color: #003168;
-}
#aboutVersion {
color: #76767B;
}
@@ -913,21 +882,24 @@ border-radius: 4px;
PointingHandCursor
+
+ Qt::RightToLeft
+
Help
- :/images/help.svg:/images/help.svg
+ :/images/link.svg:/images/link.svg
- 30
- 26
+ 16
+ 16
-
- false
+
+ true
@@ -939,16 +911,6 @@ border-radius: 4px;
Confirm
-
-
- :/images/arrow.svg:/images/arrow.svg
-
-
-
- 20
- 16
-
-
true
diff --git a/src/ui/images/arrow.svg b/src/ui/images/arrow.svg
deleted file mode 100644
index 1a6a0997..00000000
--- a/src/ui/images/arrow.svg
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
\ No newline at end of file
diff --git a/src/ui/images/help.svg b/src/ui/images/help.svg
deleted file mode 100644
index c9fe386e..00000000
--- a/src/ui/images/help.svg
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
\ No newline at end of file
diff --git a/src/ui/images/help_dark.svg b/src/ui/images/help_dark.svg
deleted file mode 100644
index 0388ea38..00000000
--- a/src/ui/images/help_dark.svg
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
\ No newline at end of file
diff --git a/src/ui/images/link.svg b/src/ui/images/link.svg
new file mode 100644
index 00000000..b576d24b
--- /dev/null
+++ b/src/ui/images/link.svg
@@ -0,0 +1,3 @@
+
\ No newline at end of file
diff --git a/src/ui/languageselect.cpp b/src/ui/languageselect.cpp
new file mode 100644
index 00000000..17d867b5
--- /dev/null
+++ b/src/ui/languageselect.cpp
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2020-2024 Estonian Information System Authority
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "languageselect.hpp"
+#include "ui_languageselect.h"
+
+#include "application.hpp"
+
+#include
+#include
+#include
+
+LanguageSelect::LanguageSelect(QWidget* parent) :
+ QDialog(parent), ui(std::make_unique())
+{
+ ui->setupUi(this);
+ if (Application::isDarkTheme()) {
+ if (QFile f(QStringLiteral(":languageselect.qss")); f.open(QFile::ReadOnly | QFile::Text)) {
+ style()->unpolish(this);
+ setStyleSheet(styleSheet() + QTextStream(&f).readAll());
+ style()->polish(this);
+ }
+ }
+ auto current = QSettings().value(QStringLiteral("lang")).toString();
+ if (auto* btn = findChild(current))
+ btn->setChecked(true);
+ connect(ui->langGroup, qOverload(&QButtonGroup::buttonClicked), this,
+ [this](QAbstractButton* action) {
+ QSettings().setValue(QStringLiteral("lang"), action->objectName());
+ qApp->loadTranslations();
+ ui->retranslateUi(this);
+ });
+ connect(ui->select, &QPushButton::clicked, this, &LanguageSelect::accept);
+ connect(ui->cancel, &QPushButton::clicked, this, [this, current] {
+ if (current.isEmpty()) {
+ QSettings().remove(QStringLiteral("lang"));
+ } else {
+ QSettings().setValue(QStringLiteral("lang"), current);
+ }
+ qApp->loadTranslations();
+ reject();
+ });
+}
+
+LanguageSelect::~LanguageSelect() noexcept = default;
diff --git a/src/ui/languageselect.hpp b/src/ui/languageselect.hpp
new file mode 100644
index 00000000..40c631aa
--- /dev/null
+++ b/src/ui/languageselect.hpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2020-2024 Estonian Information System Authority
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#pragma once
+
+#include
+
+#include
+
+namespace Ui
+{
+class LanguageSelect;
+}
+
+class LanguageSelect : public QDialog
+{
+ Q_OBJECT
+public:
+ explicit LanguageSelect(QWidget* parent = nullptr);
+ ~LanguageSelect() noexcept;
+
+private:
+ std::unique_ptr ui;
+};
diff --git a/src/ui/languageselect.qss b/src/ui/languageselect.qss
new file mode 100644
index 00000000..844970bf
--- /dev/null
+++ b/src/ui/languageselect.qss
@@ -0,0 +1,21 @@
+
+#LanguageSelect {
+background-color: #232325;
+}
+#label {
+color: white;
+}
+QPushButton {
+color: #FF5C79;
+border-color: #FF5C79;
+}
+QPushButton:hover, QPushButton:pressed {
+background-color: #232325;
+}
+QToolButton {
+color: white;
+border-color: #92A0B7;
+}
+QToolButton:checked {
+background-color: #415982;
+}
diff --git a/src/ui/languageselect.ui b/src/ui/languageselect.ui
new file mode 100644
index 00000000..a657ed75
--- /dev/null
+++ b/src/ui/languageselect.ui
@@ -0,0 +1,372 @@
+
+
+ LanguageSelect
+
+
+
+ 0
+ 0
+ 540
+ 438
+
+
+
+ Select language
+
+
+ #LanguageSelect {
+background-color: white;
+}
+#label {
+font-family: Roboto, Helvetica;
+font-size: 20px;
+font-weight: 700;
+color: #003168;
+}
+QAbstractButton {
+font-family: Roboto, Helvetica;
+font-size: 14px;
+font-weight: 700;
+}
+QToolButton {
+color: #07142A;
+border: 1px solid #AEB9CA;
+border-radius: 5px;
+padding: 16px;
+}
+QToolButton:checked {
+border-color: #003168;
+background-color: #EAF1F8
+}
+QPushButton {
+color: #AD2A45;
+border: 1px solid #AD2A45;
+border-radius: 4px;
+padding: 11px 12px;
+}
+QPushButton:hover {
+background-color: #F5EBED;
+}
+QPushButton:pressed {
+background-color: #E1C1C6;
+}
+QPushButton::default {
+color: white;
+border-color: #2F70B6;
+background-color: #2F70B6;
+}
+QPushButton::default:hover {
+border-color: #2B66A6;
+background-color: #2B66A6;
+}
+QPushButton::default:pressed {
+border-color: #215081;
+background-color: #215081;
+}
+
+
+
+ QLayout::SetFixedSize
+
+
+ 40
+
+
+ 32
+
+
+ 40
+
+
+ 32
+
+
+ 0
+
+
+ 40
+
+ -
+
+
+ Select language
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ Eesti keel
+
+
+ true
+
+
+ true
+
+
+ langGroup
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ English
+
+
+ true
+
+
+ langGroup
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ Русский
+
+
+ true
+
+
+ langGroup
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ Suomi
+
+
+ true
+
+
+ langGroup
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ Hrvatska
+
+
+ true
+
+
+ langGroup
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ Deutsch
+
+
+ true
+
+
+ langGroup
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ Française
+
+
+ true
+
+
+ langGroup
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ Nederlands
+
+
+ true
+
+
+ langGroup
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ Čeština
+
+
+ true
+
+
+ langGroup
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ PointingHandCursor
+
+
+ Slovenština
+
+
+ true
+
+
+ langGroup
+
+
+
+
+
+ -
+
+
+ PointingHandCursor
+
+
+ Cancel
+
+
+ false
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 317
+ 20
+
+
+
+
+ -
+
+
+ PointingHandCursor
+
+
+ Select
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/ui/translations/cs.ts b/src/ui/translations/cs.ts
index a792748e..93fe5a70 100644
--- a/src/ui/translations/cs.ts
+++ b/src/ui/translations/cs.ts
@@ -38,6 +38,21 @@
PIN zablokován
+
+ LanguageSelect
+
+ Cancel
+ Zrušit
+
+
+ Select language
+ Vyberte jazyk
+
+
+ Select
+ Vybrat
+
+
WebEidDialog
@@ -293,5 +308,14 @@
Active language
CS
+
+ PIN entry disabled
+ Zadávání PINu je zakázáno.
+
+
+ English
+ Active language accessible
+ Čeština
+
diff --git a/src/ui/translations/de.ts b/src/ui/translations/de.ts
index 34f50dd2..c676935c 100644
--- a/src/ui/translations/de.ts
+++ b/src/ui/translations/de.ts
@@ -38,6 +38,21 @@
PIN gesperrt
+
+ LanguageSelect
+
+ Cancel
+ Abbrechen
+
+
+ Select language
+ Sprache auswählen
+
+
+ Select
+ Auswählen
+
+
WebEidDialog
@@ -291,5 +306,14 @@
Active language
DE
+
+ PIN entry disabled
+ PIN-Eingabe deaktiviert.
+
+
+ English
+ Active language accessible
+ Deutsch
+
diff --git a/src/ui/translations/en.ts b/src/ui/translations/en.ts
index 899f3838..00be86c5 100644
--- a/src/ui/translations/en.ts
+++ b/src/ui/translations/en.ts
@@ -38,6 +38,21 @@
Pin locked
+
+ LanguageSelect
+
+ Cancel
+ Cancel
+
+
+ Select language
+ Select language
+
+
+ Select
+ Select
+
+
WebEidDialog
@@ -291,5 +306,14 @@
Active language
EN
+
+ PIN entry disabled
+ PIN entry disabled
+
+
+ English
+ Active language accessible
+ English
+
diff --git a/src/ui/translations/et.ts b/src/ui/translations/et.ts
index 9f816f59..2b18d689 100644
--- a/src/ui/translations/et.ts
+++ b/src/ui/translations/et.ts
@@ -38,6 +38,21 @@
PIN-kood on lukus
+
+ LanguageSelect
+
+ Cancel
+ Katkesta
+
+
+ Select language
+ Vali keel
+
+
+ Select
+ Vali
+
+
WebEidDialog
@@ -291,5 +306,14 @@
Active language
ET
+
+ PIN entry disabled
+ PIN'i sisestamine on keelatud.
+
+
+ English
+ Active language accessible
+ Eesti
+
diff --git a/src/ui/translations/fi.ts b/src/ui/translations/fi.ts
index 8e76e203..6a240b4e 100644
--- a/src/ui/translations/fi.ts
+++ b/src/ui/translations/fi.ts
@@ -38,6 +38,21 @@
Pin lukittu
+
+ LanguageSelect
+
+ Cancel
+ Peruuta
+
+
+ Select language
+ Valitse kieli
+
+
+ Select
+ Valitse
+
+
WebEidDialog
@@ -284,12 +299,21 @@
Please enter PIN for signing in the PIN dialog window that opens.
- Syötä PIN kirjautumista varten avautuvaan PIN-valintaikkunaan.
+ Syötä PIN allekirjoittamista varten avautuvaan PIN-valintaikkunaan.
EN
Active language
FI
+
+ PIN entry disabled
+ PIN-koodin syöttö ei ole käytössä.
+
+
+ English
+ Active language accessible
+ Suomi
+
diff --git a/src/ui/translations/fr.ts b/src/ui/translations/fr.ts
index fd326d96..0995deb3 100644
--- a/src/ui/translations/fr.ts
+++ b/src/ui/translations/fr.ts
@@ -38,6 +38,21 @@
Pin bloquée
+
+ LanguageSelect
+
+ Cancel
+ Annuler
+
+
+ Select language
+ Sélectionner la langue
+
+
+ Select
+ Sélectionner
+
+
WebEidDialog
@@ -291,5 +306,14 @@
Active language
FR
+
+ PIN entry disabled
+ Saisie du code PIN désactivée.
+
+
+ English
+ Active language accessible
+ Française
+
diff --git a/src/ui/translations/hr.ts b/src/ui/translations/hr.ts
index d21d019c..de2e6397 100644
--- a/src/ui/translations/hr.ts
+++ b/src/ui/translations/hr.ts
@@ -38,6 +38,21 @@
<b>%1</b><br />Izdavatelj: %2<br />Vrijedi: %3 do %4%5
+
+ LanguageSelect
+
+ Cancel
+ Prekid
+
+
+ Select language
+ Odabir jezika
+
+
+ Select
+ Odabir
+
+
WebEidDialog
@@ -286,12 +301,21 @@
Please enter PIN for signing in the PIN dialog window that opens.
- Unesite PIN za prijavu u dijaloški prozor PIN-a koji se otvara.
+ Unesite PIN za potpisivanje u dijaloški prozor PIN-a koji se otvara.
EN
Active language
HR
+
+ PIN entry disabled
+ Unos PIN-a onemogućen.
+
+
+ English
+ Active language accessible
+ Hrvatska
+
diff --git a/src/ui/translations/nl.ts b/src/ui/translations/nl.ts
index 18a89a3c..66320b14 100644
--- a/src/ui/translations/nl.ts
+++ b/src/ui/translations/nl.ts
@@ -38,6 +38,21 @@
PIN geblokkeerd
+
+ LanguageSelect
+
+ Cancel
+ Annuleer
+
+
+ Select language
+ Selecteer taal
+
+
+ Select
+ Selecteer
+
+
WebEidDialog
@@ -291,5 +306,14 @@
Active language
NL
+
+ PIN entry disabled
+ PIN-invoer uitgeschakeld.
+
+
+ English
+ Active language accessible
+ Nederlands
+
diff --git a/src/ui/translations/ru.ts b/src/ui/translations/ru.ts
index 87e52566..f5b60f8c 100644
--- a/src/ui/translations/ru.ts
+++ b/src/ui/translations/ru.ts
@@ -38,6 +38,21 @@
PIN-код заблокирован
+
+ LanguageSelect
+
+ Cancel
+ Прервать
+
+
+ Select language
+ Выберите язык
+
+
+ Select
+ Выбрать
+
+
WebEidDialog
@@ -293,5 +308,14 @@
Active language
RU
+
+ PIN entry disabled
+ Ввод PIN запрещён.
+
+
+ English
+ Active language accessible
+ Русский
+
diff --git a/src/ui/translations/sk.ts b/src/ui/translations/sk.ts
index 759935fd..bbf6bce2 100644
--- a/src/ui/translations/sk.ts
+++ b/src/ui/translations/sk.ts
@@ -38,6 +38,21 @@
PIN zablokovaný
+
+ LanguageSelect
+
+ Cancel
+ Zrušiť
+
+
+ Select language
+ Vyberte jazyk
+
+
+ Select
+ Vybrať
+
+
WebEidDialog
@@ -293,5 +308,14 @@
Active language
SK
+
+ PIN entry disabled
+ Zadávanie PIN je zakázané.
+
+
+ English
+ Active language accessible
+ Slovenština
+
diff --git a/src/ui/webeiddialog.cpp b/src/ui/webeiddialog.cpp
index 4f381ed8..74afb7a3 100644
--- a/src/ui/webeiddialog.cpp
+++ b/src/ui/webeiddialog.cpp
@@ -22,6 +22,7 @@
#include "webeiddialog.hpp"
#include "application.hpp"
+#include "languageselect.hpp"
#include "punycode.hpp"
#include "ui_dialog.h"
@@ -43,8 +44,6 @@
#include
#endif
-#include
-
#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
constexpr inline QLatin1String operator"" _L1(const char* str, size_t size) noexcept
{
@@ -80,7 +79,6 @@ WebEidDialog::WebEidDialog(QWidget* parent) : WebEidUI(parent), ui(new Private)
ui->cardChipIcon->setPixmap(pixmap("no-id-card"_L1));
ui->fatalErrorIcon->setPixmap(pixmap("fatal"_L1));
ui->aboutIcon->setPixmap(pixmap("fatal"_L1));
- ui->helpButton->setIcon(QIcon(QStringLiteral(":/images/help_dark.svg")));
}
}
setWindowFlag(Qt::CustomizeWindowHint);
@@ -92,65 +90,9 @@ WebEidDialog::WebEidDialog(QWidget* parent) : WebEidUI(parent), ui(new Private)
ui->langButton = new QToolButton(this);
ui->langButton->setObjectName("langButton");
- static const std::vector> LANG_LIST {
- {QStringLiteral("et"), QStringLiteral("Eesti")},
- {QStringLiteral("en"), QStringLiteral("English")},
- {QStringLiteral("ru"), QStringLiteral("Русский")},
- {QStringLiteral("fi"), QStringLiteral("Suomi")},
- {QStringLiteral("hr"), QStringLiteral("Hrvatska")},
- {QStringLiteral("de"), QStringLiteral("Deutsch")},
- {QStringLiteral("fr"), QStringLiteral("Française")},
- {QStringLiteral("nl"), QStringLiteral("Nederlands")},
- {QStringLiteral("cs"), QStringLiteral("Čeština")},
- {QStringLiteral("sk"), QStringLiteral("Slovenština")}};
ui->langButton->setText(tr("EN", "Active language"));
- if (auto i = std::find_if(LANG_LIST.cbegin(), LANG_LIST.cend(),
- [lang = ui->langButton->text().toLower()](const auto& elem) {
- return elem.first == lang;
- });
- i != LANG_LIST.cend()) {
- ui->langButton->setAccessibleName(i->second);
- }
- connect(ui->langButton, &QToolButton::clicked, this, [this] {
- if (auto* menu = findChild(QStringLiteral("langMenu"))) {
- menu->deleteLater();
- return;
- }
- auto* menu = new QWidget(this);
- menu->setObjectName("langMenu");
- auto* layout = new QGridLayout(menu);
- layout->setContentsMargins(1, 1, 1, 1);
- layout->setHorizontalSpacing(1);
-#ifndef Q_OS_DARWIN
- layout->setVerticalSpacing(1);
-#endif
- layout->setSizeConstraint(QLayout::SetFixedSize);
- auto* langGroup = new QButtonGroup(menu);
- langGroup->setExclusive(true);
- int i {};
- for (const auto& [lang, title] : LANG_LIST) {
- auto* action = new QPushButton(menu);
- action->setText(title);
- action->setProperty("lang", lang);
- action->setAutoDefault(false);
- layout->addWidget(action, i / 2, i % 2);
- langGroup->addButton(action);
- action->setCheckable(true);
- action->setChecked(lang == ui->langButton->text().toLower());
- action->setMinimumSize(action->sizeHint() + QSize(1, 0));
- ++i;
- }
- menu->show();
- menu->move(ui->langButton->geometry().bottomRight() - menu->geometry().topRight()
- + QPoint(0, 2));
- connect(langGroup, qOverload(&QButtonGroup::buttonClicked), menu,
- [this, menu](QAbstractButton* action) {
- QSettings().setValue(QStringLiteral("lang"), action->property("lang"));
- ui->langButton->setText(action->property("lang").toString().toUpper());
- qApp->loadTranslations();
- menu->deleteLater();
- });
- });
+ ui->langButton->setAccessibleName(tr("English", "Active language accessible"));
+ connect(ui->langButton, &QToolButton::clicked, this, [] { LanguageSelect().exec(); });
ui->pinInput->setAttribute(Qt::WA_MacShowFocusRect, false);
auto pinInputFont = ui->pinInput->font();
@@ -171,7 +113,8 @@ WebEidDialog::WebEidDialog(QWidget* parent) : WebEidUI(parent), ui(new Private)
if (auto* button =
qobject_cast(ui->selectionGroup->checkedButton())) {
ui->lockedWarning->setHidden(button->certificateInfo().cardActive);
- ui->okButton->setEnabled(currentCommand == CommandType::AUTHENTICATE || button->certificateInfo().cardActive);
+ ui->okButton->setEnabled(currentCommand == CommandType::AUTHENTICATE
+ || button->certificateInfo().cardActive);
}
ui->okButton->setFocus();
});
@@ -525,14 +468,11 @@ bool WebEidDialog::event(QEvent* event)
switch (event->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
+ ui->langButton->setText(tr("EN", "Active language"));
+ ui->langButton->setAccessibleName(tr("English", "Active language accessible"));
emit languageChange();
resizeHeight();
break;
- case QEvent::MouseButtonRelease:
- if (auto* w = findChild(QStringLiteral("langMenu"))) {
- w->deleteLater();
- }
- break;
case QEvent::Resize:
ui->langButton->move(width() - ui->langButton->width() - 20, ui->pageStack->pos().y() - 20);
break;
@@ -666,7 +606,8 @@ void WebEidDialog::setupPinPadProgressBarAndEmitWait(const EidCertificateAndPinI
void WebEidDialog::setupPinInput(const EidCertificateAndPinInfo& certAndPinInfo)
{
ui->lockedWarning->setHidden(certAndPinInfo.cardActive);
- setupPinPrompt(certAndPinInfo.pinInfo, currentCommand == CommandType::AUTHENTICATE || certAndPinInfo.cardActive);
+ setupPinPrompt(certAndPinInfo.pinInfo,
+ currentCommand == CommandType::AUTHENTICATE || certAndPinInfo.cardActive);
// The allowed character ranges are from the SafeNet eToken guide:
// 1. English uppercase letters (ASCII 0x41...0x5A).
// 2. English lowercase letters (ASCII 0x61...0x7A).