From 824cb4d4b841f59220abd09be8d191c98e93fcf3 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 22 Jul 2020 17:03:25 +0200 Subject: [PATCH] [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. --- src/modules/locale/LocalePage.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/modules/locale/LocalePage.cpp b/src/modules/locale/LocalePage.cpp index 3999599c9..406f27a6e 100644 --- a/src/modules/locale/LocalePage.cpp +++ b/src/modules/locale/LocalePage.cpp @@ -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