NewsBlurPageListDelegate.qml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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 "../../../../shared/qml" as Shared
  24. import "../../../../shared/qml/UIConstants.js" as UIConstants
  25. import "../misc" as Misc
  26. import NewsBlur 1.0
  27. Item {
  28. id: root
  29. signal released(int row)
  30. signal holded(int row)
  31. property int titleSize: UIConstants.LIST_TILE_SIZE
  32. property int titleWeight: Font.Bold
  33. property color titleColor: UIConstants.LIST_TITLE_COLOR
  34. property int subtitleSize: UIConstants.LIST_SUBTILE_SIZE
  35. property int subtitleWeight: Font.Light
  36. property color subtitleColor: UIConstants.LIST_SUBTITLE_COLOR
  37. property bool __alternativeUnreadCountDisplay: ((model.itemType == NewsBlurItem.FolderItem)
  38. || (model.itemType == NewsBlurItem.EverythingGroup)
  39. || (model.itemType == NewsBlurItem.StarredGroup))
  40. height: UIConstants.DEFAULT_DELEGATE_HEIGHT
  41. width: parent.width
  42. BorderImage {
  43. id: background
  44. anchors.fill: parent
  45. // Fill page porders
  46. anchors.leftMargin: -UIConstants.DEFAULT_MARGIN
  47. anchors.rightMargin: -UIConstants.DEFAULT_MARGIN
  48. visible: mouseArea.pressed
  49. source: "image://theme/meegotouch-panel-background-pressed"
  50. }
  51. Component {
  52. id: progressBarComponenet
  53. Shared.ProgressBar {
  54. indeterminate: true
  55. }
  56. }
  57. Shared.Separator {
  58. id: separator
  59. anchors.top: parent.top
  60. anchors.left: parent.left
  61. anchors.leftMargin: UIConstants.DEFAULT_MARGIN
  62. anchors.right: parent.right
  63. anchors.rightMargin: UIConstants.DEFAULT_MARGIN
  64. visible: index
  65. }
  66. Item {
  67. id: conents
  68. anchors.top: parent.top
  69. anchors.bottom: parent.bottom
  70. anchors.left: parent.left
  71. anchors.leftMargin: UIConstants.DEFAULT_MARGIN
  72. anchors.right: parent.right
  73. anchors.rightMargin: UIConstants.DEFAULT_MARGIN
  74. Shared.FeedIcon {
  75. id: iconImage
  76. anchors.left: parent.left
  77. anchors.verticalCenter: parent.verticalCenter
  78. visible: model.iconSource
  79. source: model.iconSource
  80. isFeedIcon: (model.itemType == NewsBlurItem.FeedItem)
  81. }
  82. Column {
  83. anchors.left: iconImage.right
  84. anchors.leftMargin: UIConstants.LIST_ITEM_SPACING
  85. anchors.right: rightRow.left
  86. anchors.rightMargin: UIConstants.LIST_ITEM_SPACING
  87. anchors.verticalCenter: parent.verticalCenter
  88. Text {
  89. id: mainText
  90. text: model.title
  91. font.family: UIConstants.FONT_FAMILY
  92. font.weight: root.titleWeight
  93. font.pixelSize: root.titleSize
  94. color: root.titleColor
  95. width: parent.width
  96. elide: Text.ElideRight
  97. wrapMode: Text.Wrap
  98. maximumLineCount: root.__alternativeUnreadCountDisplay ? 1 : 2
  99. textFormat: Text.PlainText
  100. }
  101. Text {
  102. id: unreadCountText
  103. text: root.__alternativeUnreadCountDisplay ? model.unreadCountText : ""
  104. font.pixelSize: UIConstants.FONT_LSMALL
  105. font.family: UIConstants.FONT_FAMILY_LIGHT
  106. color: "dimgray"
  107. elide: Text.ElideRight
  108. maximumLineCount: 1
  109. width: parent.width
  110. visible: root.__alternativeUnreadCountDisplay && unreadCountText.text.length
  111. }
  112. Loader {
  113. sourceComponent: model.movingBusy || model.deletingBusy ? progressBarComponenet : undefined;
  114. width: parent.width
  115. }
  116. }
  117. Row {
  118. id: rightRow
  119. anchors.right: parent.right
  120. anchors.top: parent.top
  121. anchors.bottom: parent.bottom
  122. Misc.ClassificationCountBubble {
  123. id: countBubble
  124. anchors.verticalCenter: parent.verticalCenter
  125. neutralCount: model.unreadCount
  126. positiveCount: model.posUnreadCount
  127. negativeCount: model.negUnreadCount
  128. visible: !root.__alternativeUnreadCountDisplay
  129. }
  130. MoreIndicator {
  131. id: moreIndicator
  132. anchors.verticalCenter: parent.verticalCenter
  133. visible: root.__alternativeUnreadCountDisplay
  134. }
  135. }
  136. }
  137. MouseArea {
  138. id: mouseArea;
  139. anchors.fill: parent
  140. onReleased: {
  141. if(!mouse.wasHeld && (!model.movingBusy && !model.deletingBusy))
  142. root.released(index);
  143. }
  144. onPressAndHold: {
  145. if(!model.movingBusy && !model.deletingBusy)
  146. root.holded(index);
  147. }
  148. }
  149. }