Read country codes from zone.tab.

This commit is contained in:
Teo Mrnjavac 2016-08-03 18:30:41 +02:00
parent a51061029e
commit 471d94a02e
2 changed files with 8 additions and 3 deletions

View file

@ -1,6 +1,6 @@
/* === This file is part of Calamares - <http://github.com/calamares> === /* === This file is part of Calamares - <http://github.com/calamares> ===
* *
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org> * Copyright 2014-2016, Teo Mrnjavac <teo@kde.org>
* *
* Originally from the Manjaro Installation Framework * Originally from the Manjaro Installation Framework
* by Roland Singer <roland@manjaro.org> * by Roland Singer <roland@manjaro.org>
@ -149,10 +149,15 @@ void LocaleGlobal::initLocations() {
if (timezone.size() < 2) if (timezone.size() < 2)
continue; continue;
QString countryCode = list.at(0).trimmed();
if (countryCode.size() != 2)
continue;
location.region = timezone.takeFirst(); location.region = timezone.takeFirst();
location.zone = timezone.join( '/' ); location.zone = timezone.join( '/' );
location.latitude = getRightGeoLocation(list.at(1).mid(0, cooSplitPos)); location.latitude = getRightGeoLocation(list.at(1).mid(0, cooSplitPos));
location.longitude = getRightGeoLocation(list.at(1).mid(cooSplitPos)); location.longitude = getRightGeoLocation(list.at(1).mid(cooSplitPos));
location.country = countryCode;
locations[location.region].append(location); locations[location.region].append(location);
} }

View file

@ -1,6 +1,6 @@
/* === This file is part of Calamares - <http://github.com/calamares> === /* === This file is part of Calamares - <http://github.com/calamares> ===
* *
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org> * Copyright 2014-2016, Teo Mrnjavac <teo@kde.org>
* *
* Originally from the Manjaro Installation Framework * Originally from the Manjaro Installation Framework
* by Roland Singer <roland@manjaro.org> * by Roland Singer <roland@manjaro.org>
@ -43,7 +43,7 @@ public:
}; };
struct Location { struct Location {
QString region, zone; QString region, zone, country;
double latitude, longitude; double latitude, longitude;
static QString pretty( const QString& s ); static QString pretty( const QString& s );
QString comment() const; QString comment() const;