-
Notifications
You must be signed in to change notification settings - Fork 0
/
FeedListModel.qml
35 lines (31 loc) · 1.18 KB
/
FeedListModel.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import QtQuick 2.0
import QtQuick.XmlListModel 2.0
import Ubuntu.Components 1.1
XmlListModel {
id: feedListModel
source: "http://netzpolitik.org/feed?pk_campaign=ubuntu-touch-app"
query: "/rss/channel/item"
namespaceDeclarations: "declare namespace dc='http://purl.org/dc/elements/1.1/'; declare namespace content='http://purl.org/rss/1.0/modules/content/';"
XmlRole { name: "title"; query: "title/string()"; }
XmlRole { name: "author"; query: "dc:creator/string()";}
XmlRole { name: "pubDate"; query: "pubDate/string()"; }
XmlRole { name: "description"; query: "description/string()"; }
XmlRole { name: "content"; query: "content:encoded/string()"; }
onStatusChanged: {
if (status === XmlListModel.Loading)
console.log("Loading...")
noticeContent.text = "Loading..."
pageStack.push(noticePage)
if (status === XmlListModel.Ready) {
console.log("Loaded " + source)
if (status === XmlListModel.Error) {
console.log("XmlError: " + errorString())
noticeContent.text = "Error loading: " + errorString()
pageStack.push(noticePage)
} else {
pageStack.clear()
pageStack.push(listPage)
}
}
}
}