MainPage.qml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /**
  2. * Copyright (c) 2012 Nokia Corporation.
  3. */
  4. import QtQuick 1.1
  5. import com.nokia.symbian 1.1
  6. import com.nokia.extras 1.1
  7. import "../Constants.js" as Constants
  8. Page {
  9. id: mainPage
  10. property string infoText: Constants.TIME_INFOTEXT
  11. tools: toolBarBackAndInfo
  12. ListModel{
  13. id: mainViewListModel
  14. ListElement{title: "Item view with time stamp"}
  15. ListElement{title: "Sub list header with timestamps"}
  16. ListElement{title: "List item with timestamps"}
  17. }
  18. Component {
  19. id: delegate
  20. ListItem {
  21. id: listItem
  22. platformInverted: window.platformInverted
  23. subItemIndicator: true
  24. ListItemText {
  25. id: itemText
  26. anchors.verticalCenter: parent.verticalCenter
  27. anchors.left: parent.left
  28. anchors.leftMargin: 10
  29. platformInverted: window.platformInverted
  30. role: "Title"
  31. text: title
  32. width: parent.width
  33. }
  34. onClicked: {
  35. switch(index) {
  36. case 0:
  37. window.pageStack.push(Qt.resolvedUrl("ItemViewPage.qml"));
  38. break
  39. case 1:
  40. window.pageStack.push(Qt.resolvedUrl("ListPage.qml"), {timestampHeaders: true});
  41. break
  42. case 2:
  43. window.pageStack.push(Qt.resolvedUrl("ListPage.qml"), {timestampHeaders: false});
  44. break
  45. }
  46. }
  47. }
  48. }
  49. ListView {
  50. id: listView
  51. anchors.fill: parent
  52. model: mainViewListModel
  53. delegate: delegate
  54. }
  55. }