5 //width: 480; height: 360;
6 width: parent.width; height: parent.height;
7 property string feedid: parent.feedid
8 //property string feedid: "61ac1458d761423344998dc76770e36e" //articlesItem.feedid;
9 //property string hideReadArticles: "";
10 property alias articleShown: articleView.visible;
11 property bool zoomEnabled: false;
12 property bool vertPanningEnabled: true
14 function modulo(x,y) {
15 // Fixes modulo for negative numbers
20 articles.xml = articleViewer.feedid == "" ? "<?xml version=\"1.0\" encoding=\"utf-8\"?><xml></xml>" : controller.getArticlesXml(articleViewer.feedid);
25 if (articleView.visible) {
26 //articleView.positionViewAtIndex(modulo(articleView.currentIndex+1, articleView.count), ListView.Contain);
27 articleView.incrementCurrentIndex();
32 if (articleView.visible) {
33 //articleView.positionViewAtIndex(modulo(articleView.currentIndex-1, articleView.count), ListView.Contain);
34 articleView.decrementCurrentIndex();
38 function markAllAsRead() {
40 controller.markAllAsRead(feedid)
45 function viewArticle(articleid) {
47 for (var i=0; i<articleList.count; ++i) {
48 if (articles.get(0).articleid==articleid) {
52 articleView.positionViewAtIndex(index, ListView.Contain); articleView.visible = true;
56 id: articleList; model: visualModel.parts.list; z: 6
57 width: parent.width; height: parent.height; /*x: 0;*/
59 flickDeceleration: 1500
63 id: articleView; model: visualModel.parts.flip; orientation: ListView.Horizontal
64 width: parent.width; height: parent.height; visible: false; z:8
65 //onCurrentIndexChanged: photosGridView.positionViewAtIndex(currentIndex, GridView.Contain)
66 highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem
68 onMovementStarted: articleViewer.vertPanningEnabled=false;
69 onMovementEnded: articleViewer.vertPanningEnabled=true;
70 highlightMoveDuration: 300;
75 //width: parent.width; height: parent.height;
77 anchors.centerIn: parent;
80 Text { id: noText; color: "#ffffff"; anchors.centerIn: parent; text: qsTr("No articles available"); }
81 Image { id: loadingImage; anchors.centerIn: parent; source: "common/images/loading.png";
82 height: 96; width: 96;
83 NumberAnimation on rotation {
84 from: 0; to: 360; running: (loadingImage.visible == true); loops: Animation.Infinite; duration: 900
89 name: "noArticle"; when: articles.count==0 && articles.status==XmlListModel.Ready
90 PropertyChanges { target: noArticle; visible: true; }
91 PropertyChanges { target: loadingImage; visible: false; }
92 PropertyChanges { target: noText; visible: true; }
94 name: "loading"; when: articles.count==0 && articles.status != XmlListModel.Ready
95 PropertyChanges { target: noArticle; visible: true; }
96 PropertyChanges { target: noText; visible: false; }
97 PropertyChanges { target: loadingImage; visible: true; }
106 Item { id: flipItem; Package.name: 'flip'; width: articleViewer.width; height: articleViewer.height;
108 property string url: (articleView.visible && Math.abs(articleView.currentIndex-index)<2) ? path: ""; //http://localhost:8000/html/" + articleViewer.feedid + "/" + articleid : "";
109 property string html: controller.getArticle(articleViewer.feedid, articleid)
111 zoomEnabled: articleViewer.zoomEnabled;
112 property bool vertPanningEnabled: articleViewer.vertPanningEnabled;
115 name: 'articleIsRead';
116 when: articleView.visible && articleView.currentIndex == index;
120 flipItem.url=path; //"http://localhost:8000/html/" + articleViewer.feedid + "/" + articleid;
121 controller.setEntryRead(articleViewer.feedid, articleid)
125 name: 'articleIsClose'; when: articleView.visible && Math.abs(articleView.currentIndex-index)<2;
127 script: { flipItem.url=path; } //"http://localhost:8000/html/" + articleViewer.feedid + "/" + articleid;}
134 Item { Package.name: 'list';
135 id: wrapper; width: articleViewer.width; height: 86
138 Rectangle { id: backRect; color: "black"; opacity: index % 2 ? 0.2 : 0.4; height: 84; width: wrapper.width; y: 1 }
140 anchors.fill: backRect
142 verticalAlignment: Text.AlignVCenter; text: title; color: (unread=="True") ? "white" : "#7b97fd";
143 width: wrapper.width; wrapMode: Text.WordWrap; font.bold: false;
146 MouseArea { anchors.fill: wrapper;
147 onClicked: { articleView.positionViewAtIndex(index, ListView.Contain); articleView.visible = true; }
157 //source: articleViewer.feedid == "" ? "" : "http://localhost:8000/articles/" + feedid + "?onlyUnread=" + hideReadArticles
158 xml: articleViewer.feedid == "" ? "" : controller.getArticlesXml(articleViewer.feedid)
159 query: "/xml/article"
161 XmlRole { name: "title"; query: "title/string()" }
162 XmlRole { name: "articleid"; query: "articleid/string()"; isKey: true }
163 XmlRole { name: "path"; query: "path/string()" }
164 XmlRole { name: "unread"; query: "unread/string()"; isKey: true}