[locale] Check all XML TimeZone elements if needed

- reduce warnings about loop-executed-only-once
 - if there is more than one TimeZone element, use the virst valid one
 - warn if nothing is found
This commit is contained in:
Adriaan de Groot 2018-05-07 05:18:35 -04:00
parent 3beb4bc87f
commit a38a2a54f7

View File

@ -42,8 +42,14 @@ GeoIPXML::processReply( const QByteArray& data )
for ( int it = 0; it < tzElements.length(); ++it ) for ( int it = 0; it < tzElements.length(); ++it )
{ {
auto e = tzElements.at(it).toElement(); auto e = tzElements.at(it).toElement();
return splitTZString( e.text() ); auto tz = splitTZString( e.text() );
if ( !tz.first.isEmpty() )
return tz;
} }
// None of them valid
cWarning() << "GeopIP XML had no recognizable timezone";
return qMakePair( QString(), QString() );
} }
else else
{ {
@ -51,5 +57,4 @@ GeoIPXML::processReply( const QByteArray& data )
} }
return qMakePair( QString(), QString() ); return qMakePair( QString(), QString() );
} }