[localeq] Offer a Config setting to set location from region/zone
- already had methods for various kinds of broken-up data, but not one for plain "region/zone" strings; having this makes it easier for QML to report a zone. - use the region/zone method from QML, so that clicking on the world map updates the actual TZ in Config.
This commit is contained in:
parent
e78cde7ccb
commit
a4ed160060
@ -218,6 +218,15 @@ Config::setCurrentLocation()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Config::setCurrentLocation(const QString& regionzone)
|
||||||
|
{
|
||||||
|
auto r = CalamaresUtils::GeoIP::splitTZString( regionzone );
|
||||||
|
if ( r.isValid() )
|
||||||
|
{
|
||||||
|
setCurrentLocation( r.first, r.second );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Config::setCurrentLocation( const QString& regionName, const QString& zoneName )
|
Config::setCurrentLocation( const QString& regionName, const QString& zoneName )
|
||||||
{
|
{
|
||||||
|
@ -92,7 +92,14 @@ public Q_SLOTS:
|
|||||||
/// Set LC (formats) by user-choice, overriding future location changes
|
/// Set LC (formats) by user-choice, overriding future location changes
|
||||||
void setLCLocaleExplicitly( const QString& locale );
|
void setLCLocaleExplicitly( const QString& locale );
|
||||||
|
|
||||||
/** @brief Sets a location by name
|
/** @brief Sets a location by full name
|
||||||
|
*
|
||||||
|
* @p regionzone should be an identifier from zone.tab, e.g. "Africa/Abidjan",
|
||||||
|
* which is split into regon and zone. Invalid names will **not**
|
||||||
|
* change the actual location.
|
||||||
|
*/
|
||||||
|
void setCurrentLocation( const QString& regionzone );
|
||||||
|
/** @brief Sets a location by split name
|
||||||
*
|
*
|
||||||
* @p region should be "America" or the like, while @p zone
|
* @p region should be "America" or the like, while @p zone
|
||||||
* names a zone within that region.
|
* names a zone within that region.
|
||||||
|
@ -74,6 +74,7 @@ Column {
|
|||||||
var tz2 = responseJSON.timezoneId
|
var tz2 = responseJSON.timezoneId
|
||||||
|
|
||||||
tzText.text = "Timezone: " + tz2
|
tzText.text = "Timezone: " + tz2
|
||||||
|
config.setCurrentLocation(tz2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user