5 //width: 480; height: 360;
6 width: parent.width; height: parent.height;
7 //property string feedid: "61ac1458d761423344998dc76770e36e" //articlesItem.feedid;
8 //property string hideReadArticles: "";
9 property alias articleShown: articleView.visible;
10 property bool zoomEnabled: false;
11 property bool vertPanningEnabled: true
13 function modulo(x,y) {
14 // Fixes modulo for negative numbers
23 if (articleView.visible) {
24 //articleView.positionViewAtIndex(modulo(articleView.currentIndex+1, articleView.count), ListView.Contain);
25 articleView.incrementCurrentIndex();
30 if (articleView.visible) {
31 //articleView.positionViewAtIndex(modulo(articleView.currentIndex-1, articleView.count), ListView.Contain);
32 articleView.decrementCurrentIndex();
36 function markAllAsRead() {
38 var doc = new XMLHttpRequest();
39 //console.log(articlesItem.url+"&markAllAsRead=True")
40 var url = "http://localhost:8000/articles/" + feedid + "?markAllAsRead=True"
48 function viewArticle(articleid) {
50 for (var i=0; i<articleList.count; ++i) {
51 if (articles.get(0).articleid==articleid) {
55 articleView.positionViewAtIndex(index, ListView.Contain); articleView.visible = true;
59 id: articleList; model: visualModel.parts.list; z: 6
60 width: parent.width; height: parent.height; /*x: 0;*/
62 flickDeceleration: 1500
66 id: articleView; model: visualModel.parts.flip; orientation: ListView.Horizontal
67 width: parent.width; height: parent.height; visible: false; z:8
68 //onCurrentIndexChanged: photosGridView.positionViewAtIndex(currentIndex, GridView.Contain)
69 highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem
71 onMovementStarted: articleViewer.vertPanningEnabled=false;
72 onMovementEnded: articleViewer.vertPanningEnabled=true;
73 highlightMoveDuration: 300;
78 //width: parent.width; height: parent.height;
80 anchors.centerIn: parent;
83 Text { id: noText; color: "#ffffff"; anchors.centerIn: parent; text: qsTr("No articles available"); }
84 Image { id: loadingImage; anchors.centerIn: parent; source: "common/images/loading.png";
85 height: 96; width: 96;
86 NumberAnimation on rotation {
87 from: 0; to: 360; running: (loadingImage.visible == true); loops: Animation.Infinite; duration: 900
92 name: "noArticle"; when: articles.count==0 && articles.status==XmlListModel.Ready
93 PropertyChanges { target: noArticle; visible: true; }
94 PropertyChanges { target: loadingImage; visible: false; }
95 PropertyChanges { target: noText; visible: true; }
97 name: "loading"; when: articles.count==0 && articles.status != XmlListModel.Ready
98 PropertyChanges { target: noArticle; visible: true; }
99 PropertyChanges { target: noText; visible: false; }
100 PropertyChanges { target: loadingImage; visible: true; }
109 Item { id: flipItem; Package.name: 'flip'; width: articleViewer.width; height: articleViewer.height;
111 property string url: (articleView.visible && Math.abs(articleView.currentIndex-index)<2) ? path: ""; //http://localhost:8000/html/" + articleViewer.feedid + "/" + articleid : "";
113 zoomEnabled: articleViewer.zoomEnabled;
114 property bool vertPanningEnabled: articleViewer.vertPanningEnabled;
117 name: 'articleIsRead';
118 when: articleView.visible && articleView.currentIndex == index;
122 flipItem.url=path; //"http://localhost:8000/html/" + articleViewer.feedid + "/" + articleid;
123 var doc = new XMLHttpRequest();
124 var url = "http://localhost:8000/read/" + articleViewer.feedid + "/" + articleid;
126 doc.open("GET", url);
128 //var xmlDoc=doc.responseXML;
132 name: 'articleIsClose'; when: articleView.visible && Math.abs(articleView.currentIndex-index)<2;
134 script: { flipItem.url=path; } //"http://localhost:8000/html/" + articleViewer.feedid + "/" + articleid;}
141 Item { Package.name: 'list';
142 id: wrapper; width: articleViewer.width; height: 86
145 Rectangle { id: backRect; color: "black"; opacity: index % 2 ? 0.2 : 0.4; height: 84; width: wrapper.width; y: 1 }
147 anchors.fill: backRect
149 verticalAlignment: Text.AlignVCenter; text: title; color: (unread=="True") ? "white" : "#7b97fd";
150 width: wrapper.width; wrapMode: Text.WordWrap; font.bold: false;
153 MouseArea { anchors.fill: wrapper;
154 onClicked: { articleView.positionViewAtIndex(index, ListView.Contain); articleView.visible = true; }
164 source: articleViewer.feedid == "" ? "" : "http://localhost:8000/articles/" + feedid + "?onlyUnread=" + hideReadArticles
165 query: "/xml/article"
167 XmlRole { name: "title"; query: "title/string()" }
168 XmlRole { name: "articleid"; query: "articleid/string()"; isKey: true }
169 XmlRole { name: "path"; query: "path/string()" }
170 XmlRole { name: "unread"; query: "unread/string()"; isKey: true}