diff options
| author | Nippy <nippy@Nippy-Mac-mini.local> | 2026-09-17 16:14:58 +0200 |
|---|---|---|
| committer | Nippy <nippy@Nippy-Mac-mini.local> | 2026-09-17 16:14:58 +0200 |
| commit | 8839d02e786f5ece0e1a502980fcaada6594e859 (patch) | |
| tree | d96aa79d2014cbb337ee68f3ca4f554a7cd94edc /raveos-calamares-module/desktopselect/DesktopSelectViewStep.cpp | |
| parent | f676fc2bad71c23605c846027a6d3691508075fd (diff) | |
| download | RaveOS-PKGBUILD-8839d02e786f5ece0e1a502980fcaada6594e859.tar.gz RaveOS-PKGBUILD-8839d02e786f5ece0e1a502980fcaada6594e859.zip | |
desktop new/fix
Diffstat (limited to 'raveos-calamares-module/desktopselect/DesktopSelectViewStep.cpp')
| -rw-r--r-- | raveos-calamares-module/desktopselect/DesktopSelectViewStep.cpp | 55 |
1 files changed, 55 insertions, 0 deletions
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 <QDir> #include <QFile> +#include <QLocale> +#include <QQuickItem> #include <QSet> #include <QVBoxLayout> #include <QQuickWidget> @@ -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(); +} |