MainPage.qml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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.EMPTYCONTENT_INFOTEXT
  11. tools: toolBarBackAndInfo
  12. ListModel{
  13. id: mainViewListModel
  14. ListElement{
  15. title: "Example 1"
  16. subTitle: ""
  17. section: "Basic information"
  18. }
  19. ListElement{
  20. title: "Example 2"
  21. subTitle: "Last access: 12.2.2012, (empty)"
  22. section: "Anticipatory information"
  23. }
  24. ListElement{
  25. title: "From Toolbar"
  26. subTitle: ""
  27. section: "Content generation support"
  28. }
  29. ListElement{
  30. title: "From Content area"
  31. subTitle: ""
  32. section: "Content generation support"
  33. }
  34. }
  35. Component {
  36. id: delegate
  37. ListItem {
  38. id: listItem
  39. platformInverted: window.platformInverted
  40. subItemIndicator: true
  41. Column{
  42. anchors.left: parent.paddingItem.left
  43. anchors.right: parent.right
  44. anchors.verticalCenter: parent.verticalCenter
  45. ListItemText {
  46. id: titleLabel
  47. anchors.left: parent.left
  48. platformInverted: window.platformInverted
  49. role: "Title"
  50. text: title
  51. }
  52. ListItemText {
  53. anchors.left: parent.left
  54. platformInverted: window.platformInverted
  55. role: "SubTitle"
  56. text: subTitle
  57. width: parent.width
  58. visible: text != ""
  59. }
  60. }
  61. onClicked: {
  62. switch(index) {
  63. case 0:
  64. window.pageStack.push(Qt.resolvedUrl("EventsPage.qml"));
  65. break
  66. case 1:
  67. window.pageStack.push(Qt.resolvedUrl("ContentPage.qml"));
  68. break
  69. case 2:
  70. window.pageStack.push(Qt.resolvedUrl("ContentPage.qml"), {fromToolBarMode: true});
  71. break
  72. case 3:
  73. window.pageStack.push(Qt.resolvedUrl("ContentPage.qml"), {fromContentAreaMode: true});
  74. break
  75. }
  76. }
  77. }
  78. }
  79. ListView {
  80. id: listView
  81. anchors.fill: parent
  82. model: mainViewListModel
  83. delegate: delegate
  84. }
  85. }