smoke.qml 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import Qt 4.7
  2. import QtWebKit 1.0
  3. import SocialConnect 1.0
  4. Item {
  5. width: 320
  6. height: 480
  7. Component.onCompleted: smokeConnection.authenticate();
  8. SmokeConnection {
  9. id: smokeConnection
  10. webInterface: webInterface
  11. clientId: "399096860123557"
  12. onAuthenticatedChanged: console.debug("authenticated = " + authenticated);
  13. onBusyChanged: console.debug("busy = " + busy);
  14. onAccessTokenChanged: console.debug("accessToken = " + accessToken);
  15. onAuthenticateCompleted: {
  16. console.debug("onAuthenticateCompleted success = " + success);
  17. retrieveMessages("", "", 8);
  18. }
  19. onRetrieveMessagesCompleted: {
  20. console.debug("onRetrieveMessagesCompleted success = " + success +
  21. " messages.length = " + messages.length);
  22. }
  23. }
  24. WebInterface {
  25. id: webInterface
  26. onActiveChanged: {
  27. console.debug("active = " + active);
  28. if (active) {
  29. webView.sourceComponent = webViewComponent;
  30. } else {
  31. webView.sourceComponent = undefined;
  32. }
  33. }
  34. onUrlChanged: {
  35. webView.item.url = url;
  36. }
  37. }
  38. Loader {
  39. id: webView
  40. anchors.fill: parent
  41. }
  42. Component {
  43. id: webViewComponent
  44. WebView {
  45. preferredHeight: height
  46. preferredWidth: width
  47. onUrlChanged: webInterface.url = url;
  48. }
  49. }
  50. }