0.9beta
[feedingit] / src / qml / Feeds.qml
1 import Qt 4.7
2
3 Item {
4     //anchors.fill: parent;
5     width: parent.width;
6     property string catid : ""
7     x: parent.width; height: parent.height;
8     anchors.top: parent.top; anchors.bottom: parent.bottom
9
10     function reload() {
11         feeds.reload()
12     }
13
14     //Component.onCompleted: { console.log(x + " /") }
15
16     ListView {
17         id: feedList; model: feeds; delegate: feedDelegate; z: 6
18         width: parent.width; height: parent.height; /*x: 0;*/
19         cacheBuffer: 100;
20         flickDeceleration: 1500
21     }
22
23     XmlListModel {
24
25         id: feeds
26
27         source: catid == "" ? "" : "http://localhost:8000/feeds/" + catid //+ "?onlyUnread=" + parent.hideReadArticles
28         query: "/xml/feed"
29
30         XmlRole { name: "title"; query: "feedname/string()" }
31         XmlRole { name: "feedid"; query: "feedid/string()"; isKey: true }
32         XmlRole { name: "unread"; query: "unread/string()"; isKey: true }
33         XmlRole { name: "updatedDate"; query: "updatedDate/string()" }
34         XmlRole { name: "icon"; query: "icon/string()" }
35     }
36
37     Component {
38         id: feedDelegate
39
40         Item {
41             id: wrapper; width: wrapper.ListView.view.width;
42             visible: (unread == "0" && feedsItem.hideReadFeeds=="True") ? false : true
43             height: (visible) ? 86 : 0
44
45             Item {
46                 id: moveMe
47                 Rectangle { color: "black"; opacity: index % 2 ? 0.2 : 0.4; height: 84; width: wrapper.width; y: 1 }
48                 Rectangle {
49                     x: 3; y: 4; width: 77; height: 77; color: "#000000"; smooth: true
50                     Image { width:32; height: 32; anchors.verticalCenter: parent.verticalCenter; anchors.horizontalCenter: parent.horizontalCenter; source: (icon == "False") ? "" : icon }
51                 }
52
53                 Column {
54                     x: 92; width: wrapper.ListView.view.width - 95; y: 5; spacing: 2
55                     Text { text: title; color: "white"; width: parent.width; font.bold: true; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" }
56                     Text { text: updatedDate + " / " + qsTr("%1 unread items").arg(unread); color: (unread=="0") ? "white" : "#7b97fd"; width: parent.width; font.bold: false; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" }
57                     //Text { text: feedname; width: parent.width; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" }
58                 }
59             }
60             MouseArea { anchors.fill: wrapper; onClicked: { container.feedClicked(feedid) } }
61         }
62
63     }
64
65 }