[locale] As the Page is constructed, it shouldn't change the location

- since the Page hooked up a model and changed the region-selection
  **after** connecting to signals, it would reset the location
  to Africa/Abijan (alphabetically the first timezone) during
  construction. Don't do that.
This commit is contained in:
Adriaan de Groot 2020-07-22 17:03:25 +02:00
parent 4f684be83d
commit 824cb4d4b8

View File

@ -98,6 +98,12 @@ LocalePage::LocalePage( Config* config, QWidget* parent )
setMinimumWidth( m_tzWidget->width() );
setLayout( mainLayout );
// Set up the location before connecting signals, to avoid a signal
// storm as various parts interact.
m_regionCombo->setModel( m_config->regionModel() );
locationChanged( m_config->currentLocation() ); // doesn't inform TZ widget
m_tzWidget->setCurrentLocation( m_config->currentLocation() );
connect( config, &Config::currentLCStatusChanged, m_formatsLabel, &QLabel::setText );
connect( config, &Config::currentLanguageStatusChanged, m_localeLabel, &QLabel::setText );
connect( config, &Config::currentLocationChanged, m_tzWidget, &TimeZoneWidget::setCurrentLocation );
@ -114,9 +120,6 @@ LocalePage::LocalePage( Config* config, QWidget* parent )
connect( m_formatsChangeButton, &QPushButton::clicked, this, &LocalePage::changeFormats );
CALAMARES_RETRANSLATE_SLOT( &LocalePage::updateLocaleLabels )
m_regionCombo->setModel( m_config->regionModel() );
m_regionCombo->currentIndexChanged( m_regionCombo->currentIndex() );
}
@ -178,6 +181,10 @@ LocalePage::zoneChanged( int currentIndex )
void
LocalePage::locationChanged( const CalamaresUtils::Locale::TZZone* location )
{
if ( !location )
{
return;
}
cBoolSetter< true > b( m_blockTzWidgetSet );
// Set region index