2 import "common" as Common
3 // Depends on qt4-declarative-qmlviewer
12 /*anchors.fill: parent;*/ color: "#343434";
13 anchors.centerIn: parent
14 transformOrigin: Item.Center
16 function categoryClicked(catid) {
17 feedsItem.catid = catid;
18 categoriesItem.isShown = false;
19 feedsItem.visible = true;
22 function feedClicked(feedid) {
23 flipper.feedid = feedid;
24 flipper.visible = true;
27 // function articleClicked(articleid, index) {
28 // // Assign the articleId for the current, next and previous article to the associated variables
29 // // Note the modulo, so it goes around
30 // //articleDisplay.articleindex = modulo(index,articlesItem.count)
31 // //articleDisplay.nextArticle = articlesItem.getArticleid(modulo(index+1,articlesItem.count))
32 // //articleDisplay.prevArticle = articlesItem.getArticleid(modulo(index-1,articlesItem.count))
33 // //articleDisplay.articleid = articleid
34 // //flipper.model = articlesItem.articles
35 // flipper.visible = true;
38 function backClicked() {
39 if (flipper.visible && flipper.articleShown) {
40 // We're viewing an article, and going back to article listing
41 flipper.articleShown = false;
43 //flipper.articleid = "";
45 //articlesItem.reload()
48 if (flipper.visible) {
50 flipper.visible = false;
55 // if (articlesItem.visible) {
56 // // Viewing articles, going back to feeds
57 // //articlesItem.feedid = "";
58 // feedsItem.reload();
59 // articlesItem.visible = false;
60 // //articlesItem.reload();
63 if (feedsItem.visible) {
64 // Viewing feeds, going back to categories
65 //feedsItem.catid = "";
66 feedsItem.visible = false;
68 categoriesItem.isShown = true;
71 if (!feedsItem.visible) {
72 // Viewing categories, quitting
80 property string hideReadFeeds : "False"
81 property string hideReadArticles : "False"
83 property bool isShown: false;
85 //width: parent.width; height: parent.height;
89 name: "shown"; when: config.isShown == true
90 PropertyChanges { target: config; y: 66 }
93 transitions: Transition {
94 NumberAnimation { properties: "y"; duration: 300; easing.type: "InOutQuad" }
99 Common.ConfirmationMessage {
100 id: confirmationMessage;
102 onOkClicked: { var doc = new XMLHttpRequest();
103 console.log(articlesItem.url+"&markAllAsRead=True")
104 var url = articlesItem.url+"&markAllAsRead=True"
106 doc.open("GET", url);
108 var xmlDoc=doc.responseXML;
109 articlesItem.reload();
113 onCancelClicked: visible=false
118 height: 66; anchors.top: parent.top; width: parent.width; opacity: 0.9
119 menuLabel: qsTr("Config"); backLabel: qsTr("Back")
120 nextLabel: qsTr("Next"); prevLabel: qsTr("Previous")
121 markAllLabel: qsTr("Mark All As Read"); zoomLabel: qsTr("Zoom")
122 taskSwitcherLabel: qsTr("Task Switch")
123 onMenuClicked: config.isShown = !config.isShown;
124 onBackClicked: container.backClicked()
125 onPrevClicked: flipper.prev();
126 onNextClicked: flipper.next();
128 confirmationMessage.text = qsTr("Do you want to mark all items as read?");
129 confirmationMessage.visible = true;
131 onZoomClicked: { flipper.zoomEnabled = !flipper.zoomEnabled; }
132 onTaskSwitcherClicked: {
133 var doc = new XMLHttpRequest();
134 var url = "http://localhost:8000/task"
135 doc.open("GET", url);
137 //var xmlDoc=doc.responseXML;
139 //onRotateClicked: { container.rotation=-90; container.width=screen.height; container.height=screen.width; }
142 name: "navButtons"; when: flipper.articleShown
143 PropertyChanges { target: toolBar; nextVisible: !container.inPortrait; }
144 PropertyChanges { target: toolBar; prevVisible: !container.inPortrait; }
145 PropertyChanges { target: toolBar; zoomVisible: true; }
148 name: "feedButtons"; when: (flipper.visible)&&(!flipper.articleShown)
149 PropertyChanges { target: toolBar; markAllVisible: true; }
152 name: "quitButton"; when: (!feedsItem.visible)
153 PropertyChanges { target: toolBar; quitVisible: true;}
154 PropertyChanges { target: toolBar; backVisible: false; }
163 width: parent.width // - 4
164 height: parent.height-toolBar.height;
165 anchors.top: toolBar.bottom; anchors.bottom: parent.bottom
169 // Loads the categoryList view and delegate
171 property bool isShown: true;
174 name: "shown"; when: categoriesItem.isShown == false
175 PropertyChanges { target: categoriesItem; x: -screen.width }
178 transitions: Transition {
179 NumberAnimation { properties: "x"; duration: 300; easing.type: "InOutQuad" }
186 // Loads the feedList view and delegate
188 property string hideReadFeeds: config.hideReadFeeds
192 State { name: "articlesShown"; when: flipper.visible; PropertyChanges { target: feedsItem; x: -parent.width } },
193 State { name: "shown"; when: feedsItem.visible; PropertyChanges { target: feedsItem; x: 0 } }
196 transitions: Transition {
197 NumberAnimation { properties: "x"; duration: 300; easing.type: "InOutQuad" }
205 property string hideReadArticles: config.hideReadArticles
206 property string feedid: ""
209 states: State { name: "shown"; when: flipper.visible; PropertyChanges { target: flipper; x: 0 }
212 transitions: Transition {
213 NumberAnimation { properties: "x"; duration: 300; easing.type: "InOutQuad" }
218 property bool lockRotation: false
219 property variant selectedOrientation: Orientation.UnknownOrientation
220 property variant activeOrientation: selectedOrientation == Orientation.UnknownOrientation ? runtime.orientation : selectedOrientation
221 state: "orientation " + activeOrientation
222 property bool inPortrait: (activeOrientation == Orientation.Portrait || activeOrientation == Orientation.PortraitInverted);
224 // rotation correction for landscape devices like N900
225 property bool landscapeWindow: screen.width > screen.height
226 property variant rotationDelta: landscapeWindow ? -90 : 0
227 rotation: rotationDelta
229 // initial state is portrait
230 property real baseWidth: landscapeWindow ? screen.height : screen.width
231 property real baseHeight: landscapeWindow ? screen.width : screen.height
236 function getAngle(orientation) {
238 if (orientation == Orientation.Portrait) {
240 } else if (orientation == Orientation.Landscape) {
242 } else if (orientation == Orientation.PortraitInverted) {
244 } else if (orientation == Orientation.LandscapeInverted) {
254 name: "orientation " + Orientation.Landscape
257 rotation: getAngle(Orientation.Landscape)+rotationDelta
261 StateChangeScript { script: console.log(container.width +"/"+container.height) }
264 name: "orientation " + Orientation.PortraitInverted
267 rotation: getAngle(Orientation.PortraitInverted)+rotationDelta
271 StateChangeScript { script: console.log(container.width +"/"+container.height) }
274 name: "orientation " + Orientation.LandscapeInverted
277 rotation: getAngle(Orientation.LandscapeInverted)+rotationDelta
281 StateChangeScript { script: console.log(container.width +"/"+container.height) }
284 transitions: Transition {
287 direction: RotationAnimation.Shortest
289 easing.type: Easing.InOutQuint
292 properties: "x,y,width,height"
294 easing.type: Easing.InOutQuint