2 import "common" as Common
3 // Depends on qt4-declarative-qmlviewer
12 anchors.fill: parent; color: "#343434";
14 function modulo(x,y) {
15 // Fixes modulo for negative numbers
19 function categoryClicked(catid) {
20 feedsItem.catid = catid;
21 categoriesItem.isShown = false;
22 feedsItem.visible = true;
25 function feedClicked(feedid) {
26 articlesItem.feedid = feedid;
27 articlesItem.visible = true;
30 function articleClicked(articleid, index) {
31 // Assign the articleId for the current, next and previous article to the associated variables
32 // Note the modulo, so it goes around
33 articleDisplay.articleindex = modulo(index,articlesItem.count)
34 articleDisplay.nextArticle = articlesItem.getArticleid(modulo(index+1,articlesItem.count))
35 articleDisplay.prevArticle = articlesItem.getArticleid(modulo(index-1,articlesItem.count))
36 articleDisplay.articleid = articleid
37 articleDisplay.visible = true;
40 function backClicked() {
41 if (articleDisplay.visible) {
42 // We're viewing an article, and going back to article listing
43 articleDisplay.visible = false;
44 articleDisplay.articleid = "";
45 articleDisplay.value = 1;
49 if (articlesItem.visible) {
50 // Viewing articles, going back to feeds
51 //articlesItem.feedid = "";
53 articlesItem.visible = false;
54 //articlesItem.reload();
57 if (feedsItem.visible) {
58 // Viewing feeds, going back to categories
59 //feedsItem.catid = "";
60 feedsItem.visible = false;
62 categoriesItem.isShown = true;
65 if (!feedsItem.visible) {
66 // Viewing categories, quitting
74 property string hideReadFeeds : "False"
75 property string hideReadArticles : "False"
77 property bool isShown: false;
79 //width: parent.width; height: parent.height;
83 name: "shown"; when: config.isShown == true
84 PropertyChanges { target: config; y: 66 }
87 transitions: Transition {
88 NumberAnimation { properties: "y"; duration: 300; easing.type: "InOutQuad" }
93 Common.ConfirmationMessage {
94 id: confirmationMessage;
96 onOkClicked: { var doc = new XMLHttpRequest();
97 console.log(articlesItem.url+"&markAllAsRead=True")
98 var url = articlesItem.url+"&markAllAsRead=True"
100 doc.open("GET", url);
102 var xmlDoc=doc.responseXML;
103 articlesItem.reload();
107 onCancelClicked: visible=false
112 height: 66; anchors.top: parent.top; width: parent.width; opacity: 0.9
113 button1Label: qsTr("Config"); button2Label: qsTr("Back")
114 nextLabel: qsTr("Next"); prevLabel: qsTr("Previous")
115 markAllLabel: qsTr("Mark All As Read"); zoomLabel: qsTr("Zoom")
116 taskSwitcherLabel: qsTr("Task Switch")
117 onButton1Clicked: config.isShown = !config.isShown;
118 onButton2Clicked: container.backClicked()
119 onPrevClicked: container.articleClicked(articleDisplay.prevArticle, articleDisplay.articleindex-1)
120 onNextClicked: container.articleClicked(articleDisplay.nextArticle, articleDisplay.articleindex+1)
122 confirmationMessage.text = qsTr("Do you want to mark all items as read?");
123 confirmationMessage.visible = true;
125 onZoomClicked: { articleDisplay.zoomEnabled = !articleDisplay.zoomEnabled; }
126 onTaskSwitcherClicked: {
127 var doc = new XMLHttpRequest();
128 var url = "http://localhost:8000/task"
129 doc.open("GET", url);
131 //var xmlDoc=doc.responseXML;
135 name: "navButtons"; when: articleDisplay.articleid != ""
136 PropertyChanges { target: toolBar; nextVisible: true; }
137 PropertyChanges { target: toolBar; prevVisible: true; }
138 PropertyChanges { target: toolBar; zoomVisible: true; }
141 name: "feedButtons"; when: (articleDisplay.articleid == "")&&(articlesItem.feedid!="")
142 PropertyChanges { target: toolBar; markAllVisible: true; }
151 width: parent.width // - 4
152 anchors.top: toolBar.bottom; anchors.bottom: parent.bottom
155 // Loads the categoryList view and delegate
157 property bool isShown: true;
160 name: "shown"; when: categoriesItem.isShown == false
161 PropertyChanges { target: categoriesItem; x: -screen.width }
164 transitions: Transition {
165 NumberAnimation { properties: "x"; duration: 300; easing.type: "InOutQuad" }
172 // Loads the feedList view and delegate
174 property string hideReadFeeds: config.hideReadFeeds
178 State { name: "articlesShown"; when: articlesItem.visible; PropertyChanges { target: feedsItem; x: -parent.width } },
179 State { name: "shown"; when: feedsItem.visible; PropertyChanges { target: feedsItem; x: 0 } }
182 transitions: Transition {
183 NumberAnimation { properties: "x"; duration: 300; easing.type: "InOutQuad" }
189 // Loads the articleLost view and delegate
191 property string hideReadArticles: config.hideReadArticles
195 State { name: "shown"; when: articleDisplay.visible; PropertyChanges { target: articlesItem; x: -parent.width }
197 State { name: "articleShown"; when: articlesItem.visible; PropertyChanges { target: articlesItem; x: 0 }
201 transitions: Transition {
202 NumberAnimation { properties: "x"; duration: 300; easing.type: "InOutQuad" }
209 //anchors.top: toolBar.bottom;
210 //anchors.bottom: screen.bottom;
211 height: parent.height;
213 property string feedid: articlesItem.feedid;
214 property string articleid: "";
215 property int articleindex: 0;
216 property string nextArticle: "";
217 property string prevArticle: "";
218 property string url: (articleid == "") ? "" : "http://localhost:8000/html/" + articleDisplay.feedid + "/" + articleDisplay.articleid;
231 states: State { name: "shown"; when: articleDisplay.visible; PropertyChanges { target: articleDisplay; x: 0 }
234 transitions: Transition {
235 NumberAnimation { properties: "x"; duration: 300; easing.type: "InOutQuad" }