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
19 articles.xml = articleViewer.feedid == "" ? "<?xml version=\"1.0\" encoding=\"utf-8\"?><xml></xml>" : controller.getArticlesXml(articleViewer.feedid);
24 if (articleView.visible) {
25 //articleView.positionViewAtIndex(modulo(articleView.currentIndex+1, articleView.count), ListView.Contain);
26 articleView.incrementCurrentIndex();
31 if (articleView.visible) {
32 //articleView.positionViewAtIndex(modulo(articleView.currentIndex-1, articleView.count), ListView.Contain);
33 articleView.decrementCurrentIndex();
37 function markAllAsRead() {
39 controller.markAllAsRead(feedid)
44 function viewArticle(articleid) {
46 for (var i=0; i<articleList.count; ++i) {
47 if (articles.get(0).articleid==articleid) {
51 articleView.positionViewAtIndex(index, ListView.Contain); articleView.visible = true;
55 id: articleList; model: visualModel.parts.list; z: 6
56 width: parent.width; height: parent.height; /*x: 0;*/
58 flickDeceleration: 1500
62 id: articleView; model: visualModel.parts.flip; orientation: ListView.Horizontal
63 width: parent.width; height: parent.height; visible: false; z:8
64 //onCurrentIndexChanged: photosGridView.positionViewAtIndex(currentIndex, GridView.Contain)
65 highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem
67 onMovementStarted: articleViewer.vertPanningEnabled=false;
68 onMovementEnded: articleViewer.vertPanningEnabled=true;
69 highlightMoveDuration: 300;
74 //width: parent.width; height: parent.height;
76 anchors.centerIn: parent;
79 Text { id: noText; color: "#ffffff"; anchors.centerIn: parent; text: qsTr("No articles available"); }
80 Image { id: loadingImage; anchors.centerIn: parent; source: "common/images/loading.png";
81 height: 96; width: 96;
82 NumberAnimation on rotation {
83 from: 0; to: 360; running: (loadingImage.visible == true); loops: Animation.Infinite; duration: 900
88 name: "noArticle"; when: articles.count==0 && articles.status==XmlListModel.Ready
89 PropertyChanges { target: noArticle; visible: true; }
90 PropertyChanges { target: loadingImage; visible: false; }
91 PropertyChanges { target: noText; visible: true; }
93 name: "loading"; when: articles.count==0 && articles.status != XmlListModel.Ready
94 PropertyChanges { target: noArticle; visible: true; }
95 PropertyChanges { target: noText; visible: false; }
96 PropertyChanges { target: loadingImage; visible: true; }
105 Item { id: flipItem; Package.name: 'flip'; width: articleViewer.width; height: articleViewer.height;
107 property string url: (articleView.visible && Math.abs(articleView.currentIndex-index)<2) ? path: ""; //http://localhost:8000/html/" + articleViewer.feedid + "/" + articleid : "";
108 property string html: controller.getArticle(articleViewer.feedid, articleid)
110 zoomEnabled: articleViewer.zoomEnabled;
111 property bool vertPanningEnabled: articleViewer.vertPanningEnabled;
114 name: 'articleIsRead';
115 when: articleView.visible && articleView.currentIndex == index;
119 flipItem.url=path; //"http://localhost:8000/html/" + articleViewer.feedid + "/" + articleid;
120 controller.setEntryRead(articleViewer.feedid, articleid)
124 name: 'articleIsClose'; when: articleView.visible && Math.abs(articleView.currentIndex-index)<2;
126 script: { flipItem.url=path; } //"http://localhost:8000/html/" + articleViewer.feedid + "/" + articleid;}
133 Item { Package.name: 'list';
134 id: wrapper; width: articleViewer.width; height: 86
137 Rectangle { id: backRect; color: "black"; opacity: index % 2 ? 0.2 : 0.4; height: 84; width: wrapper.width; y: 1 }
139 anchors.fill: backRect
141 verticalAlignment: Text.AlignVCenter; text: title; color: (unread=="True") ? "white" : "#7b97fd";
142 width: wrapper.width; wrapMode: Text.WordWrap; font.bold: false;
145 MouseArea { anchors.fill: wrapper;
146 onClicked: { articleView.positionViewAtIndex(index, ListView.Contain); articleView.visible = true; }
156 //source: articleViewer.feedid == "" ? "" : "http://localhost:8000/articles/" + feedid + "?onlyUnread=" + hideReadArticles
157 //xml: articleViewer.feedid == "" ? "" : controller.getArticlesXml(articleViewer.feedid)
158 query: "/xml/article"
160 XmlRole { name: "title"; query: "title/string()" }
161 XmlRole { name: "articleid"; query: "articleid/string()"; isKey: true }
162 XmlRole { name: "path"; query: "path/string()" }
163 XmlRole { name: "unread"; query: "unread/string()"; isKey: true}