From 8839d02e786f5ece0e1a502980fcaada6594e859 Mon Sep 17 00:00:00 2001 From: Nippy Date: Thu, 17 Sep 2026 16:14:58 +0200 Subject: desktop new/fix --- .../desktopselect/DesktopSelectViewStep.cpp | 55 ++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'raveos-calamares-module/desktopselect/DesktopSelectViewStep.cpp') diff --git a/raveos-calamares-module/desktopselect/DesktopSelectViewStep.cpp b/raveos-calamares-module/desktopselect/DesktopSelectViewStep.cpp index 4af261c..a570f58 100644 --- a/raveos-calamares-module/desktopselect/DesktopSelectViewStep.cpp +++ b/raveos-calamares-module/desktopselect/DesktopSelectViewStep.cpp @@ -2,6 +2,8 @@ #include #include +#include +#include #include #include #include @@ -49,6 +51,10 @@ void DesktopSelectViewStep::buildWidget() m_quickWidget->engine()->addImportPath(modulePath); m_quickWidget->rootContext()->setContextProperty("backend", m_backend); + m_locale = getLocale(); + m_backend->setLocale(m_locale); + m_quickWidget->rootContext()->setContextProperty("systemLocale", m_locale); + QString qmlPath = QStringLiteral("/usr/lib/calamares/modules/desktopselect/ui/desktopselect.qml"); if (!QFile::exists(qmlPath)) qmlPath = QDir::currentPath() + QStringLiteral("/desktopselect/ui/desktopselect.qml"); @@ -75,6 +81,25 @@ bool DesktopSelectViewStep::isAtEnd() const { return true; } Calamares::JobList DesktopSelectViewStep::jobs() const { return {}; } +void DesktopSelectViewStep::onActivate() +{ + const QString newLocale = getLocale(); + if (newLocale != m_locale) + { + m_locale = newLocale; + m_backend->setLocale(m_locale); + if (m_quickWidget) + m_quickWidget->rootContext()->setContextProperty("systemLocale", m_locale); + } + + if (m_quickWidget) + { + QQuickItem* root = m_quickWidget->rootObject(); + if (root) + QMetaObject::invokeMethod(root, "updateLanguage", Qt::DirectConnection); + } +} + void DesktopSelectViewStep::onLeave() { if (!m_backend || m_backend->selectedIndex() < 0) @@ -115,3 +140,33 @@ void DesktopSelectViewStep::setConfigurationMap(const QVariantMap& config) m_backend->setDesktops(desktops); } + +QString DesktopSelectViewStep::getLocale() const +{ + if (Calamares::JobQueue::instance()) + { + Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); + if (gs) + { + if (gs->contains("locale")) + { + const QString loc = gs->value("locale").toString(); + if (!loc.isEmpty()) + return loc; + } + + if (gs->contains("localeConf")) + { + const QVariantMap localeConf = gs->value("localeConf").toMap(); + if (localeConf.contains("LANG")) + { + const QString loc = localeConf.value("LANG").toString(); + if (!loc.isEmpty()) + return loc; + } + } + } + } + + return QLocale::system().name(); +} -- cgit v1.3