@ -36,7 +36,12 @@ Column {
property var cityName: ""
property var cityName: ""
property var countryName: ""
property var countryName: ""
function getIp ( ) {
/ * T h i s i s a n e x t r a G e o I P l o o k u p , w h i c h w i l l f i n d b e t t e r - a c c u r a c y
* location data for the user ' s IP , and then sets the current timezone
* and map location . Call it from Component . onCompleted so that
* it happens "on time" before the page is shown .
* /
function getIpOnline ( ) {
var xhr = new XMLHttpRequest
var xhr = new XMLHttpRequest
xhr . onreadystatechange = function ( ) {
xhr . onreadystatechange = function ( ) {
@ -59,6 +64,16 @@ Column {
xhr . send ( )
xhr . send ( )
}
}
/ * T h i s i s a n " o f f l i n e " G e o I P l o o k u p - - i t j u s t f o l l o w s w h a t
* Calamares itself has figured out with its GeoIP or configuration .
* Call it from the * * Component * * onActivate ( ) -- in localeq . qml --
* so it happens as the page is shown .
* /
function getIpOffline ( ) {
cityName = config . currentLocation . zone
countryName = config . currentLocation . countryCode
}
/ * T h i s i s a n * * a c c u r a t e * * T Z l o o k u p m e t h o d : i t q u e r i e s a n
/ * T h i s i s a n * * a c c u r a t e * * T Z l o o k u p m e t h o d : i t q u e r i e s a n
* online service for the TZ at the given coordinates . It
* online service for the TZ at the given coordinates . It
* requires an internet connection , though , and the distribution
* requires an internet connection , though , and the distribution
@ -239,7 +254,11 @@ Column {
anchors.centerIn: parent
anchors.centerIn: parent
}
}
Component.onCompleted: getIp ( ) ;
/ * I f y o u w a n t a n e x t r a ( a n d a c c u r a t e ) G e o I P l o o k u p ,
* enable this one and disable the offline lookup in
* onActivate ( ) .
Component.onCompleted: getIpOnline ( ) ;
* /
}
}
}
}