[welcome] Provide API for updating the country

- Changing country will pre-select the language most likely
   for that country (it doesn't, yet, since we don't have the data).
This commit is contained in:
Adriaan de Groot 2019-05-10 07:53:44 -04:00
parent cb7c38daba
commit 2a448c057d
2 changed files with 25 additions and 3 deletions

View File

@ -126,9 +126,11 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap )
CalamaresUtils::getString( geoip, "url" ),
CalamaresUtils::getString( geoip, "selector" ) );
auto* future = new FWString();
connect( future, &FWString::finished, [f=future, h=handler]()
connect( future, &FWString::finished, [view=this, f=future, h=handler]()
{
cDebug() << "GeoIP result for welcome=" << f->future().result();
QString countryResult = f->future().result();
cDebug() << "GeoIP result for welcome=" << countryResult;
view->setCountry( countryResult );
f->deleteLater();
delete h;
} );
@ -136,7 +138,20 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap )
}
}
Calamares::RequirementsList WelcomeViewStep::checkRequirements()
Calamares::RequirementsList
WelcomeViewStep::checkRequirements()
{
return m_requirementsChecker->checkRequirements();
}
void
WelcomeViewStep::setCountry( const QString& countryCode )
{
if ( countryCode.length() != 2 )
{
cDebug() << "Unusable country code" << countryCode;
return;
}
cDebug() << "TODO: update country" << countryCode;
}

View File

@ -54,6 +54,13 @@ public:
void setConfigurationMap( const QVariantMap& configurationMap ) override;
/** @brief Sets the country that Calamares is running in.
*
* This (ideally) sets up language and locale settings that are right for
* the given 2-letter country code.
*/
void setCountry( const QString& );
Calamares::RequirementsList checkRequirements() override;
private: