NewsBlurPage.qml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 NewsBlur 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: 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.movingBusy && !root.rootItem.deletingBusy)
  36. contentsBusy: (((root.rootItem != null) && root.rootItem.childrenBusy) || root.__serviceBusy)
  37. function pageForItem(item) {
  38. var itemType = item.itemType;
  39. if(itemType == NewsBlurItem.FolderItem)
  40. return "/plugins/newsblur/qml/pages/FolderPage.qml";
  41. else if ((itemType == NewsBlurItem.FeedItem) ||
  42. (itemType == NewsBlurItem.StarredGroup) ||
  43. (itemType == NewsBlurItem.EverythingGroup))
  44. return "/plugins/newsblur/qml/pages/FeedPage.qml"
  45. else if(itemType == NewsBlurItem.StoryItem)
  46. return "/plugins/newsblur/qml/pages/StoryPage.qml"
  47. else
  48. return "";
  49. }
  50. contents: Shared.CommonListPageContents {
  51. id: listPageContents
  52. rootItem: root.rootItem
  53. rootIndex: webFeedsApp.pageItemModel.index(root.rootItem);
  54. busy: root.contentsBusy
  55. emptyListText: qsTr("No feeds")
  56. pageHeader: Shared.CommonPageHeader {
  57. titleText: root.rootItem.title
  58. subTitleColor: UIConstants.HEADER_SUBTITLE_COLOR
  59. titleColor: "white"
  60. backgrounColor: UIConstants.HIGHLIGHT_COLOR
  61. titleFont: UIConstants.FONT_FAMILY_LIGHT
  62. rightHelperItem: Misc.HeaderCountBubble {
  63. busy: root.rootItem.busy
  64. neutralCount: root.rootItem.unreadCount
  65. negativeCount: root.rootItem.negUnreadCount
  66. positiveCount: root.rootItem.posUnreadCount
  67. }
  68. Shared.Separator {
  69. id: separator
  70. anchors.bottom: parent.bottom
  71. }
  72. }
  73. cacheBuffer: UIConstants.DEFAULT_DELEGATE_HEIGHT * 64
  74. delegate: Delegates.NewsBlurPageListDelegate {
  75. onReleased: {
  76. createPageForItem(listPageContents.itemForRow(row));
  77. }
  78. onHolded: showContextMenuForItem(listPageContents.itemForRow(row));
  79. }
  80. }
  81. tools: Shared.CommonToolBarLayout {
  82. enabled: root.userInteractionEnabled
  83. Shared.BackToolButton {pageItem: root.rootItem; page: root}
  84. Buttons.MarkEverythingAsReadToolButton {pageItem: root.rootItem}
  85. Buttons.AddToolButton {pageItem: root.rootItem;}
  86. Shared.MenuToolButton {pageItem: root.rootItem; page: root}
  87. }
  88. }