From e5b7e66ee94b065f513c71b75e47d85b2179ee5b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 5 Nov 2020 00:33:45 +0100 Subject: [PATCH] [locale] Filter zones combo always The drop-down of zones was initially unfiltered, so you could start in Europe/Amsterdam and the zones drop-down would also show Australian zones; picking Perth would have weird effects, since Europe/Perth doesn't exist and so you'd end up in New York instead. - set the filtering region immediately, rather than only when the region changes. --- src/modules/locale/LocalePage.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/modules/locale/LocalePage.cpp b/src/modules/locale/LocalePage.cpp index 7a6ed8b15..e296b790b 100644 --- a/src/modules/locale/LocalePage.cpp +++ b/src/modules/locale/LocalePage.cpp @@ -91,10 +91,16 @@ LocalePage::LocalePage( Config* config, QWidget* parent ) // Set up the location before connecting signals, to avoid a signal // storm as various parts interact. - m_regionCombo->setModel( m_config->regionModel() ); - m_zoneCombo->setModel( m_config->regionalZonesModel() ); - locationChanged( m_config->currentLocation() ); // doesn't inform TZ widget - m_tzWidget->setCurrentLocation( m_config->currentLocation() ); + { + auto* regions = m_config->regionModel(); + auto* zones = m_config->regionalZonesModel(); + auto* location = m_config->currentLocation(); + zones->setRegion( location->region() ); + m_regionCombo->setModel( regions ); + m_zoneCombo->setModel( zones ); + m_tzWidget->setCurrentLocation( location ); + locationChanged( location ); // doesn't inform TZ widget + } connect( config, &Config::currentLCStatusChanged, m_formatsLabel, &QLabel::setText ); connect( config, &Config::currentLanguageStatusChanged, m_localeLabel, &QLabel::setText ); -- 2.11.0