2023-07-29 11:01:56 +02:00
|
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
2023-02-25 12:44:46 +01:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
2023-03-09 10:19:58 +01:00
|
|
|
import QtQuick.Controls.Material
|
2023-02-25 12:44:46 +01:00
|
|
|
import QtQuick.Effects
|
|
|
|
import QtQuick.Particles
|
|
|
|
import QtQml.XmlListModel
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
implicitWidth: 480
|
|
|
|
implicitHeight: 480
|
|
|
|
|
|
|
|
XmlListModel {
|
|
|
|
id: feedModel
|
2023-07-29 11:01:56 +02:00
|
|
|
source: "https://www.theguardian.com/world/rss"
|
|
|
|
query: "/rss/channel/item"
|
2023-02-25 12:44:46 +01:00
|
|
|
onStatusChanged: {
|
|
|
|
if (status === XmlListModel.Error) {
|
2023-08-20 11:59:02 +02:00
|
|
|
console.log("Error: " + errorString);
|
2023-02-25 12:44:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-11 10:07:39 +02:00
|
|
|
XmlListModelRole {
|
2023-07-29 11:01:56 +02:00
|
|
|
name: "title"
|
|
|
|
elementName: "title"
|
2023-06-11 10:07:39 +02:00
|
|
|
}
|
|
|
|
XmlListModelRole {
|
2023-07-29 11:01:56 +02:00
|
|
|
name: "link"
|
|
|
|
elementName: "link"
|
2023-06-11 10:07:39 +02:00
|
|
|
}
|
|
|
|
XmlListModelRole {
|
2023-07-29 11:01:56 +02:00
|
|
|
name: "description"
|
|
|
|
elementName: "description"
|
2023-06-11 10:07:39 +02:00
|
|
|
}
|
|
|
|
XmlListModelRole {
|
|
|
|
name: "category"
|
|
|
|
elementName: "category"
|
2023-07-29 11:01:56 +02:00
|
|
|
attributeName: "domain"
|
2023-06-11 10:07:39 +02:00
|
|
|
}
|
|
|
|
XmlListModelRole {
|
2023-07-29 11:01:56 +02:00
|
|
|
name: "pubDate"
|
|
|
|
elementName: "pubDate"
|
2023-06-11 10:07:39 +02:00
|
|
|
}
|
|
|
|
XmlListModelRole {
|
2023-07-29 11:01:56 +02:00
|
|
|
name: "guid"
|
|
|
|
elementName: "guid"
|
|
|
|
}
|
|
|
|
XmlListModelRole {
|
|
|
|
name: "creator"
|
|
|
|
elementName: "dc:creator"
|
|
|
|
}
|
|
|
|
XmlListModelRole {
|
|
|
|
name: "date"
|
|
|
|
elementName: "dc:date"
|
2023-06-11 10:07:39 +02:00
|
|
|
}
|
|
|
|
XmlListModelRole {
|
2023-07-29 11:01:56 +02:00
|
|
|
name: "mediaContent"
|
|
|
|
elementName: "media:content"
|
|
|
|
attributeName: "url"
|
2023-06-11 10:07:39 +02:00
|
|
|
}
|
2023-02-25 12:44:46 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: list
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: 10
|
|
|
|
anchors.topMargin: 20
|
|
|
|
spacing: 10
|
|
|
|
model: feedModel
|
|
|
|
delegate: PostDelegate {
|
2023-07-29 11:01:56 +02:00
|
|
|
width: root.width
|
2023-02-25 12:44:46 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|