ipinfo.qml Example File
httptest/assets/ipinfo.qml
import bb.cascades 1.0
import Network.ExternalIP 1.0
import "controls"
import my.library 1.0
Page {
Container {
layout: DockLayout {}
ImageView {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
imageSource: "asset:///images/background.png"
}
Container {
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Center
Label {
id: ipaddress
visible: false
text: qsTr("Retrieving IP address")
textStyle {
base: SystemDefaults.TextStyles.BigText;
color: Color.White
fontWeight: FontWeight.Bold
}
}
}
NetworkActivity {
id: progressIndicator
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
title: qsTr("Retrieving IP address")
}
attachedObjects: [
QTimer {
id: timer
interval: 1000
onTimeout: {
netip.getIP();
}
},
ExternalIP {
id : netip
onComplete :{
progressIndicator.active = false;
progressIndicator.visible = false;
ipaddress.text = info;
ipaddress.visible = true;
timer.stop();
}
}
]
onCreationCompleted: {
progressIndicator.active = true;
timer.start();
}
}
}