[welcome] Only do GeoIP query if it's useful

- If badly-configured, then type is none; this is warned about
   in the constructor of Handler()
 - Only run the query if it's a useful type.
This commit is contained in:
Adriaan de Groot 2019-06-18 12:34:52 +02:00
parent 68dc1f5e31
commit 0f66a89236

View File

@ -128,6 +128,8 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap )
CalamaresUtils::getString( geoip, "style" ),
CalamaresUtils::getString( geoip, "url" ),
CalamaresUtils::getString( geoip, "selector" ) );
if ( handler->type() != CalamaresUtils::GeoIP::Handler::Type::None )
{
auto* future = new FWString();
connect( future, &FWString::finished, [view=this, f=future, h=handler]()
{
@ -139,6 +141,12 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap )
} );
future->setFuture( handler->queryRaw() );
}
else
{
// Would not produce useful country code anyway.
delete handler;
}
}
QString language = CalamaresUtils::getString( configurationMap, "languageIcon" );