2
import QtQuick.XmlListModel 2.0
4
import Ubuntu.Components 0.1
5
import Ubuntu.Components.ListItems 0.1 as ListItems
6
import Ubuntu.Components.Popups 0.1
8
import "../databasemodule_v2.js" as DB
12
signal articleSelected(var data) // mb id.
13
property var updateData: null
15
function reloadPageContent() {
16
loadArticles(updateData)
17
title = updateData.title
20
/* 1. Loading data from database by url.
21
* 2. Appending data to ListModel for displaying.
23
function loadArticles(params) {
24
articleList.model = null // TMP - doesn't work properly without that, mb bug.
25
articleListModel.clear()
27
var res = DB.loadArticles(params)
28
var entries = res.rows
30
for (var i = 0; i < entries.length; i++) {
31
var e = entries.item(i)
32
articleListModel.append({"title" : e.title,
33
"content" : e.content,
35
"description" : e.description,
36
"pubdate" : e.pubdate,
38
"favourite" : e.favourite,
39
"feed_id" : e.feed_id,
41
"feed_name" : e.feed_name,
42
"guid" : e.guid}) // for what?
45
articleList.model = articleListModel // TMP - doesn't work properly without that, mb bug.
46
articleListToolbar.opened = false
50
id: articleListToolbar
59
model: articleListModel
61
delegate: ListItems.Subtitled {
63
subText: model.pubdate
68
function selectIcon() {
70
// console.log("DELEGATE IMG", img)
71
return (model.image == null || model.image == "" ) ? Qt.resolvedUrl("../rssreader64.png"): model.image
75
articleList.currentIndex = model.index
79
console.log("ARTICLE SELECTED", model.title)
81
mainView.toRssPage(articleListModel, model.index)
93
text: i18n.tr("There are no articles in selected feed")
94
anchors.centerIn: parent
95
visible: articleListModel.count == 0