Advertisement
Guest User

Untitled

a guest
Jun 30th, 2011
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. import QtQuick 1.0
  2.  
  3. Rectangle {
  4. signal checkNetworkStatus
  5.  
  6. width: 360
  7. height: 360
  8.  
  9. Component.onCompleted: {
  10. queryData(); //Comment or Uncomment this line for testing
  11. autoUpdateTimer.start();
  12. }
  13.  
  14. function queryData(){
  15. var queryURL = 'http://www.google.com';
  16. var response = new XMLHttpRequest();
  17. response.onreadystatechange = function() {
  18. if (response.readyState == XMLHttpRequest.DONE) {
  19. console.log("Connection successful. Now disconnect from wifi for testing");
  20. }
  21. }
  22.  
  23. response.open("GET", queryURL);
  24. response.send();
  25. }
  26.  
  27. Timer {
  28. id: autoUpdateTimer
  29. interval: 20000
  30. repeat: true
  31. onTriggered: {
  32. checkNetworkStatus();
  33. }
  34. }
  35. Text {
  36. text: "Hello World"
  37. anchors.centerIn: parent
  38. }
  39. MouseArea {
  40. anchors.fill: parent
  41. onClicked: {
  42. Qt.quit();
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement