psa: made text more readable for n950
[feedingit] / psa_harmattan / feedingit / deb_dist / feedingit-0.1.0 / debian / feedingit / usr / share / feedingit / qml / Feeds.qml
1 import Qt 4.7
2
3 Item {
4     property string catid : parent.catid
5     property bool inEditMode: false
6     width: parent.width; height: parent.height;
7
8     signal feedClicked(string feedid)
9
10     function reload() {
11         feeds.xml = catid == "" ? "<?xml version=\"1.0\" encoding=\"utf-8\"?><xml></xml>" : controller.getFeedsXml(catid);
12         //feeds.reload()
13         //console.log(feeds.xml)
14     }
15
16     //Component.onCompleted: { console.log(catid + "/" + parent.catid); console.log(feeds.xml) }
17
18     //onCatidChanged: console.log("catid changed: "+catid)
19
20     ListView {
21         id: feedList; model: feeds; delegate: feedDelegate; z: 6
22         width: parent.width; height: parent.height; /*x: 0;*/
23         cacheBuffer: 100;
24         flickDeceleration: 1500
25     }
26
27     XmlListModel {
28
29         id: feeds
30
31         //source: catid == "" ? "" : "http://localhost:8000/feeds/" + catid //+ "?onlyUnread=" + parent.hideReadArticles
32         xml: catid == "" ? "<?xml version=\"1.0\" encoding=\"utf-8\"?><xml></xml>" : controller.getFeedsXml(catid)
33         query: "/xml/feed"
34
35         XmlRole { name: "title"; query: "feedname/string()" }
36         XmlRole { name: "feedid"; query: "feedid/string()"; isKey: true }
37         XmlRole { name: "unread"; query: "unread/string()"; isKey: true }
38         XmlRole { name: "updatedDate"; query: "updatedDate/string()" }
39         XmlRole { name: "icon"; query: "icon/string()" }
40         XmlRole { name: "updating"; query: "updating/string()"; isKey: true }
41         //XmlRole { name: "url"; query: "url/string()"; }
42     }
43
44     Component {
45         id: feedDelegate
46
47         Item {
48
49             //Component.onCompleted: console.log("item:"+feedid + " "+ visible + " "+ height + " " + width)
50             id: wrapper;
51             //width: wrapper.ListView.view.width;
52             visible: (unread == "0" && feedsItem.hideReadFeeds=="True") ? false : true
53             //visible: true
54             height: (visible) ? 86 : 0
55             width: parent.width
56
57             Item {
58                 id: moveMe
59                 Rectangle { color: "#dddddd"; opacity: index % 2 ? 0.2 : 0.4; height: 84; width: wrapper.width; y: 1 }
60                 Rectangle {
61                     x: 3; y: 4; width: 77; height: 77; color: "#000000"; smooth: true
62                     Image { width:32; height: 32; anchors.verticalCenter: parent.verticalCenter; anchors.horizontalCenter: parent.horizontalCenter;
63                         source: (updating=="True")? "common/images/loading.png" : (icon == "False") ? "common/images/feedingit.png" : icon;
64                         NumberAnimation on rotation {
65                             from: 0; to: 360; running: (updating=="True"); loops: Animation.Infinite; duration: 900
66                         }
67                     }
68                 }
69
70                 Column {
71                     x: 92; width: wrapper.ListView.view.width - 95; y: 5; spacing: 2
72                     Text { text: title; color: "white"; width: parent.width; font.bold: true; elide: Text.ElideRight; style: Text.Raised; styleColor: "black"; font.pointSize: 18 }
73                     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"; font.pointSize: 12 }
74                     //Text { text: feedname; width: parent.width; elide: Text.ElideLeft; color: "#cccccc"; style: Text.Raised; styleColor: "black" }
75                 }
76 ////                Item {
77 ////                    x: wrapper.ListView.view.width - 128; y: 12
78 ////                    height: 58; width: 58;
79 ////                    //anchors.horizontalCenter: parent.horizontalCenter;
80 ////                    Image { source: "common/images/wmEditIcon.png" }
81 ////                    MouseArea {
82 ////                        anchors.fill: parent; onClicked: { container.feedEdit(feedname, feedid, url); }
83 ////                    }
84 ////                    visible: inEditMode
85 ////                }
86 //                Item {
87 //                    x: wrapper.ListView.view.width - 64; y: 12
88 //                    height: 58; width: 58;
89 //                    //anchors.horizontalCenter: parent.horizontalCenter;
90 //                    Image { source: "common/images/delete.png" }
91 //                    MouseArea {
92 //                        anchors.fill: parent; onClicked: { container.feedDeleted(feedid); }
93 //                    }
94 //                    visible: inEditMode
95 //                }
96             }
97             MouseArea { 
98                 anchors.fill: wrapper; 
99                 onClicked: { 
100                     //controller.feedClicked(model.feed)
101                     feedClicked(feedid)
102                     
103                 }
104             }
105
106         }
107     }
108
109 }