[locale] Move more business logic to Config
- writing *localeConf* settings to GS can be done always when the formats are set, rather than special-cased. The code that handles the "special case" of no widget existing for the ViewStep overlooks the other crashes that happen then. - Since Config knows what jobs to create, just ask it rather than keeping a copy.
This commit is contained in:
parent
f6419d5de1
commit
0c9480aa3f
@ -170,18 +170,28 @@ Config::Config( QObject* parent )
|
||||
|
||||
connect( this, &Config::currentLocationChanged, [&]() {
|
||||
auto* gs = Calamares::JobQueue::instance()->globalStorage();
|
||||
|
||||
// Update the GS region and zone (and possibly the live timezone)
|
||||
const auto* location = currentLocation();
|
||||
bool locationChanged = ( location->region() != gs->value( "locationRegion" ) )
|
||||
|| ( location->zone() != gs->value( "locationZone" ) );
|
||||
|
||||
gs->insert( "locationRegion", location->region() );
|
||||
gs->insert( "locationZone", location->zone() );
|
||||
|
||||
if ( locationChanged && m_adjustLiveTimezone )
|
||||
{
|
||||
QProcess::execute( "timedatectl", // depends on systemd
|
||||
{ "set-timezone", location->region() + '/' + location->zone() } );
|
||||
}
|
||||
|
||||
// Update GS localeConf (the LC_ variables)
|
||||
auto map = localeConfiguration().toMap();
|
||||
QVariantMap vm;
|
||||
for ( auto it = map.constBegin(); it != map.constEnd(); ++it )
|
||||
{
|
||||
vm.insert( it.key(), it.value() );
|
||||
}
|
||||
gs->insert( "localeConf", vm );
|
||||
} );
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ LocaleViewStep::isAtEnd() const
|
||||
Calamares::JobList
|
||||
LocaleViewStep::jobs() const
|
||||
{
|
||||
return m_jobs;
|
||||
return m_config->createJobs();
|
||||
}
|
||||
|
||||
|
||||
@ -165,24 +165,6 @@ LocaleViewStep::onActivate()
|
||||
void
|
||||
LocaleViewStep::onLeave()
|
||||
{
|
||||
if ( m_actualWidget )
|
||||
{
|
||||
m_jobs = m_config->createJobs();
|
||||
|
||||
auto map = m_config->localeConfiguration().toMap();
|
||||
QVariantMap vm;
|
||||
for ( auto it = map.constBegin(); it != map.constEnd(); ++it )
|
||||
{
|
||||
vm.insert( it.key(), it.value() );
|
||||
}
|
||||
|
||||
Calamares::JobQueue::instance()->globalStorage()->insert( "localeConf", vm );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_jobs.clear();
|
||||
Calamares::JobQueue::instance()->globalStorage()->remove( "localeConf" );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,8 +71,6 @@ private:
|
||||
LocalePage* m_actualWidget;
|
||||
bool m_nextEnabled;
|
||||
|
||||
Calamares::JobList m_jobs;
|
||||
|
||||
CalamaresUtils::GeoIP::RegionZonePair m_startingTimezone;
|
||||
std::unique_ptr< CalamaresUtils::GeoIP::Handler > m_geoip;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user