2 import com.nokia.meego 1.0
7 property int buffer: 60
8 property string feedid: parent.feedid
9 property bool zoomEnabled: false
10 property bool vertPanningEnabled: true
11 width: parent.width; height: parent.height;
12 property int webviewFontSize: settings.webviewFontSize
15 if (flickableFront.state == "visible") {
16 flickableBack.moveFromRight();
18 flickableFront.moveFromRight();
23 if (flickableFront.state == "visible") {
24 flickableBack.moveFromLeft();
26 flickableFront.moveFromLeft();
30 function setNextId() {
31 articlePage.mainArticleId = controller.getNextId(articlePage.feedid,articlePage.mainArticleId, settings.hideReadArticles)
34 function setPreviousId() {
35 articlePage.mainArticleId = controller.getPreviousId(articlePage.feedid,articlePage.mainArticleId, settings.hideReadArticles)
38 Component.onCompleted: {
39 webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId);
44 //anchors.fill: screen;
45 height: articlePage.height;
46 width: articlePage.width;
47 contentWidth: boundsRecFront.width
48 contentHeight: boundsRecFront.height
49 boundsBehavior: Flickable.StopAtBounds
50 //contentWidth: childrenRect.width; contentHeight: childrenRect.height
51 //interactive: parent.vertPanningEnabled;
53 flickDeceleration: 5000;
54 //flickableDirection: Flickable.VerticalFlick
56 property bool contentIsReady: false
57 property bool isSwitchable: false
61 width: webViewFront.html == "" ? articlePage.width : webViewFront.width*webViewFront.scale + 2*buffer
62 height: Math.max(articlePage.height,webViewFront.height*webViewFront.scale)
66 anchors.horizontalCenter: parent.horizontalCenter
68 preferredWidth: articlePage.width
69 //preferredHeight: articleView.height
71 transformOrigin: Item.TopLeft
72 //scale: slider.value;
73 settings.defaultFontSize: articlePage.webviewFontSize
76 flickableFront.contentX = buffer
77 controller.setEntryRead(articlePage.feedid, articlePage.mainArticleId)
79 flickableFront.contentIsReady = true
80 switchableTimer.start()
90 PropertyChanges { target: flickableFront; x: 0; }
93 PropertyChanges { target: flickableFront; x: boundsRecBack.width; }
96 PropertyChanges { target: flickableFront; x: -boundsRecFront.width; }
103 SequentialAnimation {
104 ScriptAction { script: flickableFront.isSwitchable=false; }
105 PropertyAnimation { target: flickableFront
106 easing.type: Easing.InOutSine
107 properties: "x"; duration: 1000 }
108 ScriptAction { script: flickableFront.isSwitchable=true; }
113 SequentialAnimation {
114 ScriptAction { script: flickableFront.isSwitchable=false; }
115 PropertyAnimation { target: flickableFront
116 easing.type: Easing.InOutSine
117 properties: "x"; duration: 1000 }
118 ScriptAction { script: flickableFront.isSwitchable=true; }
125 // Disable animations/page shifting for 400ms, to give time to the page to setup properly
130 onTriggered: flickableFront.isSwitchable=true;
133 function moveFromLeft() {
134 flickableFront.contentIsReady = false
136 //articlePage.mainArticleId = controller.getPreviousId(articlePage.feedid,articlePage.mainArticleId)
137 webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId);
140 flickableBack.state = "toRight"
143 function moveFromRight() {
144 flickableFront.contentIsReady = false
146 //articlePage.mainArticleId = controller.getNextId(articlePage.feedid,articlePage.mainArticleId)
147 webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId);
150 flickableBack.state = "toLeft"
153 Behavior on contentX {
155 enabled: flickableFront.contentIsReady
156 NumberAnimation { duration: 200 }
158 onMovingHorizontallyChanged: {
159 if (flickableFront.isSwitchable) {
160 if (!movingHorizontally && (!atXBeginning || !atXEnd)) {
161 flickableFront.contentX = buffer //flickable.width/2
166 onAtXBeginningChanged: {
167 if (flickableFront.isSwitchable) {
168 if (atXBeginning && contentIsReady) {
169 flickableBack.moveFromLeft()
175 if (flickableFront.isSwitchable) {
176 if (atXEnd && contentIsReady) {
177 flickableBack.moveFromRight()
187 //anchors.fill: screen;
188 height: articlePage.height;
189 width: articlePage.width;
190 contentWidth: boundsRecBack.width
191 contentHeight: boundsRecBack.height
192 boundsBehavior: Flickable.StopAtBounds
194 //contentWidth: childrenRect.width; contentHeight: childrenRect.height
195 //interactive: parent.vertPanningEnabled;
197 flickDeceleration: 5000;
198 //flickableDirection: Flickable.VerticalFlick
200 property bool contentIsReady: false
201 property bool isSwitchable: false
205 width: webViewBack.html == "" ? articlePage.width : webViewBack.width*webViewBack.scale + 2*buffer // flickable.width
206 height: Math.max(articlePage.height,webViewBack.height*webViewBack.scale)
210 anchors.horizontalCenter: parent.horizontalCenter
212 //html: controller.getArticle(articlePage.feedid, articlePage.mainArticleId);
213 preferredWidth: articlePage.width
214 //preferredHeight: articleView.height
216 transformOrigin: Item.TopLeft
217 //scale: slider.value;
218 settings.defaultFontSize: articlePage.webviewFontSize
221 flickableBack.contentX = buffer
222 controller.setEntryRead(articlePage.feedid, articlePage.mainArticleId)
223 flickableBack.contentIsReady = true
232 PropertyChanges { target: flickableBack; x: 0; }
235 PropertyChanges { target: flickableBack; x: boundsRecFront.width; }
238 PropertyChanges { target: flickableBack; x: -boundsRecBack.width; }
245 SequentialAnimation {
246 ScriptAction { script: flickableBack.isSwitchable=false; }
247 PropertyAnimation { target: flickableBack
248 easing.type: Easing.InOutSine
249 properties: "x"; duration: 1000 }
250 ScriptAction { script: flickableBack.isSwitchable=true; }
255 SequentialAnimation {
256 ScriptAction { script: flickableBack.isSwitchable=false; }
257 PropertyAnimation { target: flickableBack
258 easing.type: Easing.InOutSine
259 properties: "x"; duration: 1000 }
260 ScriptAction { script: flickableBack.isSwitchable=true; }
265 function moveFromLeft() {
266 flickableBack.contentIsReady = false
268 //articlePage.mainArticleId = controller.getPreviousId(articlePage.feedid,articlePage.mainArticleId)
269 webViewBack.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId);
272 flickableFront.state = "toRight"
275 function moveFromRight() {
276 flickableBack.contentIsReady = false
278 //articlePage.mainArticleId = controller.getNextId(articlePage.feedid,articlePage.mainArticleId)
279 webViewBack.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId);
282 flickableFront.state = "toLeft"
285 Behavior on contentX {
286 id: contentXBehaviorBack
287 enabled: flickableBack.contentIsReady
288 NumberAnimation { duration: 200 }
291 onMovingHorizontallyChanged: {
292 if (flickableBack.isSwitchable) {
293 if (!movingHorizontally && (!atXBeginning || !atXEnd)) {
294 flickableBack.contentX = buffer //flickable.width/2
299 onAtXBeginningChanged: {
300 if (flickableBack.isSwitchable) {
301 if (atXBeginning && contentIsReady) {
302 flickableFront.moveFromLeft()
308 if (flickableBack.isSwitchable) {
309 if (atXEnd && contentIsReady) {
310 flickableFront.moveFromRight()
317 id: updateBarArticles
320 value: window.updateProgressValue
321 visible: window.isUpdateInProgress
323 anchors.bottom: parent.bottom