SubFolderPage.qml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. /**
  2. * Copyright (c) 2011-2012 Nokia Corporation.
  3. */
  4. import QtQuick 1.1
  5. import com.nokia.symbian 1.1
  6. import "SymbianUIConstants.js" as Constants
  7. Page {
  8. property string folder
  9. tools: ToolBarLayout {
  10. ToolButton {
  11. flat: true
  12. iconSource: "toolbar-back"
  13. onClicked: {
  14. pageStack.pop();
  15. }
  16. }
  17. }
  18. Image{
  19. anchors.fill: parent
  20. source: "qrc:/background.svg"
  21. }
  22. ScrollDecorator {
  23. flickableItem: list.modelView
  24. }
  25. // Main flickable component
  26. Flickable{
  27. id: flick
  28. clip: true
  29. anchors {
  30. top: parent.top;
  31. left: parent.left
  32. right: parent.right
  33. bottom: parent.bottom
  34. }
  35. contentHeight: col.implicitHeight
  36. // Phone mmory folder list
  37. Column{
  38. id: col
  39. width: parent.width
  40. FolderList {
  41. id: list
  42. width: parent.width
  43. contentOpacity: 0
  44. onFolderSelected: {
  45. pageStack.push(Qt.resolvedUrl("SubFolderPage.qml"), { folder: folder });
  46. }
  47. onFileSelected: {
  48. // Try to open the selected file
  49. if (!fileHelper.openUrl(file)) {
  50. console.debug("FileListPage.qml: " +
  51. "phoneMemoryFolderList::onFileSelected: Failed to open",
  52. file);
  53. }
  54. }
  55. Behavior on contentOpacity {
  56. NumberAnimation{
  57. duration: Constants.DEFAULT_ANIM_DURATION
  58. }
  59. }
  60. }
  61. }
  62. }
  63. // Informational text in case the current folder contains no files
  64. Text {
  65. id: noFilesText
  66. anchors.centerIn: parent
  67. opacity: 0
  68. color: "#555555"
  69. font.pixelSize: 50
  70. text: "No files"
  71. Behavior on opacity {
  72. NumberAnimation { duration: Constants.DEFAULT_ANIM_DURATION }
  73. }
  74. }
  75. Timer {
  76. id: timer
  77. interval: Constants.SWITCH_PAGE_ANIM_DURATION
  78. onTriggered: {
  79. list.contentOpacity = 1;
  80. if (list.count == 0) {
  81. noFilesText.opacity = 1;
  82. }
  83. timer.stop();
  84. }
  85. }
  86. Connections{
  87. target: pageStack
  88. onBusyChanged: {
  89. // Check if page switch animation completed, if so set folder
  90. if(pageStack.busy === false)
  91. {
  92. console.log("Page transition finished");
  93. list.folder = folder;
  94. timer.start();
  95. }
  96. }
  97. }
  98. }
  99. // End of file.