GoogleReaderPage.qml 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /****************************************************************************
  2. **
  3. ** Copyright (C) 2012 Róbert Márki
  4. **
  5. ** This file is part of Web Feeds.
  6. **
  7. ** Web Feeds is free software: you can redistribute it and/or modify
  8. ** it under the terms of the GNU General Public License as published by
  9. ** the Free Software Foundation, either version 3 of the License, or
  10. ** (at your option) any later version.
  11. **
  12. ** Web Feeds is distributed in the hope that it will be useful,
  13. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ** GNU General Public License for more details.
  16. **
  17. ** You should have received a copy of the GNU General Public License
  18. ** along with Web Feeds. If not, see <http://www.gnu.org/licenses/>.
  19. ****************************************************************************/
  20. import QtQuick 1.1
  21. import com.nokia.meego 1.0
  22. import com.nokia.extras 1.1
  23. import WebFeeds 1.0
  24. import GoogleReader 1.0
  25. import "../../../../shared/qml/UIConstants.js" as UIConstants
  26. import "../../../../shared/qml" as Shared
  27. import "../delegates" as Delegates
  28. import "../misc" as Misc
  29. import "../buttons" as Buttons
  30. Shared.CommonPage {
  31. id: root
  32. property variant service: root.rootItem.service
  33. property bool __serviceBusy: service ? service.busy : false
  34. property bool userInteractionEnabled: !root.__serviceBusy && !(root.pageStack && root.pageStack.busy)
  35. && ((root.rootItem != null) && !root.rootItem.editingBusy)
  36. contentsBusy: root.__serviceBusy
  37. function pageForItem(item) {
  38. var itemType = item.itemType;
  39. if(itemType == GoogleReaderItem.ItFolderItem)
  40. return "/plugins/google_reader/qml/pages/FolderPage.qml";
  41. else if((itemType == GoogleReaderItem.ItFeedItem)
  42. || (itemType == GoogleReaderItem.ItEverythingTagItem)
  43. || (itemType == GoogleReaderItem.ItStarredTagItem)
  44. || (itemType == GoogleReaderItem.ItTagItem))
  45. return "/plugins/google_reader/qml/pages/FeedPage.qml";
  46. else if(itemType == GoogleReaderItem.ItStoryItem)
  47. return "/plugins/google_reader/qml/pages/StoryPage.qml";
  48. else
  49. return "";
  50. }
  51. Component {
  52. id: delegateComponent
  53. Delegates.GoogleReaderPageListDelegate {
  54. service: root.rootItem.service;
  55. onReleased: {
  56. createPageForItem(listPageContents.itemForRow(row));
  57. }
  58. onHolded: showContextMenuForItem(listPageContents.itemForRow(row));
  59. }
  60. }
  61. contents: Shared.CommonListPageContents {
  62. id: listPageContents
  63. rootItem: root.rootItem
  64. rootIndex: webFeedsApp.pageItemModel.index(root.rootItem);
  65. busy: root.contentsBusy
  66. emptyListText: qsTr("No subscriptions")
  67. pageHeader: Shared.CommonPageHeader {
  68. titleText: root.rootItem.title
  69. subTitleColor: UIConstants.HEADER_SUBTITLE_COLOR
  70. titleColor: "white"
  71. backgrounColor: UIConstants.HIGHLIGHT_COLOR
  72. titleFont: UIConstants.FONT_FAMILY_LIGHT
  73. rightHelperItem: Misc.HeaderCountBubble {
  74. busy: root.rootItem.busy
  75. unreadCount: root.rootItem.unreadCount
  76. limit: service.unreadCountLimit
  77. }
  78. Shared.Separator {
  79. id: separator
  80. anchors.bottom: parent.bottom
  81. }
  82. }
  83. cacheBuffer: UIConstants.DEFAULT_DELEGATE_HEIGHT * 64
  84. delegate: delegateComponent
  85. }
  86. tools: Shared.CommonToolBarLayout {
  87. enabled: root.userInteractionEnabled
  88. Shared.BackToolButton {pageItem: root.rootItem; page: root}
  89. Buttons.MarkEverythingAsReadToolButton {pageItem: root.rootItem}
  90. Buttons.AddFeedToolButton {pageItem: root.rootItem;}
  91. Shared.MenuToolButton {pageItem: root.rootItem; page: root}
  92. }
  93. }