2
import Ubuntu.Components 1.2
3
import Ubuntu.Components.ListItems 1.0 as ListItems
4
import Ubuntu.Components.Popups 1.0
6
import "../utils/dateutils.js" as DateUtils
11
property int topicId: 0
12
property var listViewModel: null
13
property bool isShorts: topicId == 0
16
listViewModel = getModel()
23
function showArticle(modelIndex) {
24
listArticleView.setFeed(listViewModel, modelIndex)
41
objectName: "feedlistitems"
43
property bool useNoImageIcon: (pic.width == 0 || !model.image)
45
color: model.status == "1" ? "#e5e4e5" : "#b0dded"
48
leftMargin: units.gu(2)
49
rightMargin: units.gu(2)
50
topMargin: units.gu(1)
51
bottomMargin: units.gu(1)
60
color: model.status == "1" ? "#aacccccc" : "#3333b5e5"
72
if (implicitHeight < 50 || implicitWidth < 50)
74
else return uPic.height
79
sourceSize.width: uPic.height * 2
81
function selectIcon() {
83
return !model.image ? "" : model.image
87
Behavior on height { UbuntuNumberAnimation{} }
88
Behavior on opacity { NumberAnimation{} }
94
verticalCenter: parent.verticalCenter
96
leftMargin: units.gu(4)
98
running: pic.status == Image.Loading
102
/* Ubuntu logo for articles without an image.
105
anchors.centerIn: loadingIndicator
106
visible: listItem.useNoImageIcon && !loadingIndicator.running
107
source: Qt.resolvedUrl("/img/qml/icons/dash-home.svg")
116
fill: parent; topMargin: units.gu(0.5); bottomMargin: units.gu(0.5);
117
leftMargin: listItem.height + units.gu(1.5); rightMargin: units.gu(1.5)
119
spacing: units.gu(0.8)
126
height: labelTime.paintedHeight
127
spacing: units.gu(0.5)
131
anchors.verticalCenter: labelTime.verticalCenter
132
fillMode: Image.PreserveAspectCrop
133
source: Qt.resolvedUrl("/img/qml/icons/favorite-selected.svg")
134
sourceSize.height: model.favourite == "1" ? units.gu(1.5) : 0
135
visible: model.favourite == "1"
140
text: DateUtils.formatRelativeTime(i18n, model.pubdate)
142
width: parent.width - units.gu(2)
143
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
150
objectName: "label_title"
157
height: parent.height - parent.spacing * 2 - labelTime.paintedHeight - labelFeedname.paintedHeight
158
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
160
textFormat: Text.PlainText
161
font.weight: Font.DemiBold
162
elide: Text.ElideRight
164
opacity: model.status == "1" ? 0.4 : 0.8
169
objectName: "labelFeedname"
171
text: model.feed_name
177
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
185
if (mainView.isTabletMode)
186
pageItself.showArticle(model.index)
187
else mainView.showArticle(listViewModel, model.index)
198
width: mainView.isTabletMode ? units.gu(50) : parent.width
199
height: parent.height
203
delegate: listModeDelegate
206
criteria: ViewSection.FullString
207
property: isShorts ? "tagId" : "feedId"
208
// labelPositioning: ViewSection.CurrentLabelAtStart | ViewSection.InlineLabels
210
delegate: ListItems.Standard {
212
ListItems.ThinDivider {}
215
text: textBySection()
217
function textBySection() {
220
if (listViewModel == null) {
225
for (var i = 0; i < listViewModel.count; i++) {
226
if (listViewModel.get(i).tagId == s) {
227
return listViewModel.get(i).tagName
231
for (var i = 0; i < listViewModel.count; i++) {
232
if (listViewModel.get(i).feedId == s) {
233
return listViewModel.get(i).feed_name