diff options
Diffstat (limited to 'raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp')
| -rw-r--r-- | raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp b/raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp index 6c4e4a3..b2108c6 100644 --- a/raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp +++ b/raveos-calamares-module/welcome/RaveWelcomeViewStep.cpp @@ -6,6 +6,7 @@ #include <QLabel> #include <QLocale> #include <QPainter> +#include <QProcess> #include <QPixmap> #include <QResizeEvent> #include <QVBoxLayout> @@ -103,6 +104,10 @@ void RaveWelcomeViewStep::buildWidget() m_langCombo->setCurrentIndex(m_currentLocaleIndex); + // Make the live keyboard layout match the initial language right away, + // so the WiFi password input is not stuck on the boot default (US). + applyLiveKeyboardLayout(m_localeIds.value(m_currentLocaleIndex)); + connect(m_langCombo, QOverload<int>::of(&QComboBox::activated), this, &RaveWelcomeViewStep::onLanguageChanged); @@ -168,6 +173,10 @@ void RaveWelcomeViewStep::onLanguageChanged(int index) gs->insert("locale", lang); } } + + // Apply the matching live keyboard layout immediately, so the WiFi + // password input follows the selected language (before the keyboard page). + applyLiveKeyboardLayout(localeId); } QString RaveWelcomeViewStep::brandingTranslationsPrefix() const @@ -177,6 +186,29 @@ QString RaveWelcomeViewStep::brandingTranslationsPrefix() const return QString(); } +void RaveWelcomeViewStep::applyLiveKeyboardLayout(const QString& localeId) +{ + QString layout = QStringLiteral("us"); + if (localeId.startsWith(QLatin1String("hu"))) + { + layout = QStringLiteral("hu"); + } + else if (localeId.startsWith(QLatin1String("de"))) + { + layout = QStringLiteral("de"); + } + else if (localeId == QLatin1String("en_GB")) + { + layout = QStringLiteral("gb"); + } + + // Best effort: apply the layout to the running X11 session so the WiFi + // password input matches the selected language immediately. A missing + // setxkbmap or non-X11 session must not break the installer. + const QStringList args { QStringLiteral("-layout"), layout }; + QProcess::startDetached(QStringLiteral("setxkbmap"), args); +} + bool RaveWelcomeViewStep::isNextEnabled() const { return true; } bool RaveWelcomeViewStep::isBackEnabled() const { return false; } bool RaveWelcomeViewStep::isAtBeginning() const { return true; } |