diff --git a/src/modules/welcome/WelcomeViewStep.cpp b/src/modules/welcome/WelcomeViewStep.cpp index a27cc4cf0..cccf49458 100644 --- a/src/modules/welcome/WelcomeViewStep.cpp +++ b/src/modules/welcome/WelcomeViewStep.cpp @@ -133,7 +133,7 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap ) { QString countryResult = f->future().result(); cDebug() << "GeoIP result for welcome=" << countryResult; - view->setCountry( countryResult ); + view->setCountry( countryResult, h ); f->deleteLater(); delete h; } ); @@ -156,12 +156,22 @@ WelcomeViewStep::checkRequirements() return m_requirementsChecker->checkRequirements(); } +static inline void +logGeoIPHandler( CalamaresUtils::GeoIP::Handler* handler ) +{ + if ( handler ) + { + cDebug() << Logger::SubEntry << "Obtained from" << handler->url() << " (" << static_cast( handler->type() ) << handler->selector() << ')'; + } +} + void -WelcomeViewStep::setCountry( const QString& countryCode ) +WelcomeViewStep::setCountry( const QString& countryCode, CalamaresUtils::GeoIP::Handler* handler ) { if ( countryCode.length() != 2 ) { cDebug() << "Unusable country code" << countryCode; + logGeoIPHandler( handler ); return; } @@ -169,6 +179,7 @@ WelcomeViewStep::setCountry( const QString& countryCode ) if ( c_l.first == QLocale::Country::AnyCountry ) { cDebug() << "Unusable country code" << countryCode; + logGeoIPHandler( handler ); return; } else diff --git a/src/modules/welcome/WelcomeViewStep.h b/src/modules/welcome/WelcomeViewStep.h index 7deed2167..5d27d7aad 100644 --- a/src/modules/welcome/WelcomeViewStep.h +++ b/src/modules/welcome/WelcomeViewStep.h @@ -32,6 +32,14 @@ class WelcomePage; class GeneralRequirements; +namespace CalamaresUtils +{ + namespace GeoIP + { + class Handler; + } +} // namespace + class PLUGINDLLEXPORT WelcomeViewStep : public Calamares::ViewStep { Q_OBJECT @@ -57,9 +65,10 @@ public: /** @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. + * the given 2-letter country code. Uses the handler's information (if + * given) for error reporting. */ - void setCountry( const QString& ); + void setCountry( const QString&, CalamaresUtils::GeoIP::Handler* handler ); Calamares::RequirementsList checkRequirements() override;