summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdriaan de Groot <groot@kde.org>2019-05-10 07:53:44 -0400
committerAdriaan de Groot <groot@kde.org>2019-05-10 07:53:44 -0400
commit2a448c057deef69aaa272dda53bc800097bb23e3 (patch)
tree93e4b9646b99ac2ff6fb9c9465c8c3ab09b3392c
parentcb7c38dabac4dba625a081cfa7d21cec66694df5 (diff)
[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).
-rw-r--r--src/modules/welcome/WelcomeViewStep.cpp21
-rw-r--r--src/modules/welcome/WelcomeViewStep.h7
2 files changed, 25 insertions, 3 deletions
diff --git a/src/modules/welcome/WelcomeViewStep.cpp b/src/modules/welcome/WelcomeViewStep.cpp
index 91745967e..0442a2d6c 100644
--- a/src/modules/welcome/WelcomeViewStep.cpp
+++ b/src/modules/welcome/WelcomeViewStep.cpp
@@ -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;
+}
diff --git a/src/modules/welcome/WelcomeViewStep.h b/src/modules/welcome/WelcomeViewStep.h
index 937cad246..7deed2167 100644
--- a/src/modules/welcome/WelcomeViewStep.h
+++ b/src/modules/welcome/WelcomeViewStep.h
@@ -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: