2 import com.nokia.meego 1.0
7 property int buffer: 60
8 property string mainArticleId: parent.mainArticleId;
9 property string feedid: parent.feedid
10 property bool zoomEnabled: false
11 property bool vertPanningEnabled: true
12 width: parent.width; height: parent.height;
13 property int webviewFontSize: settings.webviewFontSize
25 property bool flipped: false
26 property int targetAngle: 0
32 origin.x: flipable.width/2
33 origin.y: flipable.height/2
34 axis.x: 0; axis.y: 1; axis.z: 0 // set axis.y to 1 to rotate around y-axis
35 angle: 0 // the default angle
40 PropertyChanges { target: rotation; angle: 180 }
41 when: flipable.flipped
44 PropertyChanges { target: rotation; angle: 0 }
45 when: !flipable.flipped
48 transitions: Transition {
49 NumberAnimation { target: rotation; property: "angle"; easing.type: Easing.InOutQuad; duration: 500 }
52 function flipRight() {
53 targetAngle = rotation.angle + 180
54 flipable.flipped = !flipable.flipped
59 targetAngle = rotation.angle - 180
60 flipable.flipped = !flipable.flipped
67 //anchors.fill: screen;
68 height: articlePage.height;
69 width: articlePage.width;
70 contentWidth: boundsRecFront.width
71 contentHeight: boundsRecFront.height
72 //contentWidth: childrenRect.width; contentHeight: childrenRect.height
73 //interactive: parent.vertPanningEnabled;
75 flickDeceleration: 1500;
76 //flickableDirection: Flickable.VerticalFlick
78 property bool contentIsReady: false
82 width: webViewFront.width*webViewFront.scale + 2*buffer
83 height: Math.max(articlePage.height,webViewFront.height*webViewFront.scale)
87 anchors.horizontalCenter: parent.horizontalCenter
89 html: controller.getArticle(articlePage.feedid, articlePage.mainArticleId);
90 preferredWidth: articlePage.width
91 //preferredHeight: articleView.height
93 transformOrigin: Item.TopLeft
94 //scale: slider.value;
95 settings.defaultFontSize: articlePage.webviewFontSize
98 flickableFront.contentX = buffer //flickable.width/2
99 flickableFront.contentIsReady = true
100 flipable.flipRight();
107 // console.log("start contentx"+contentX)
108 // console.log("start contenty"+contentY)
111 Behavior on contentX {
113 enabled: flickableFront.contentIsReady
114 NumberAnimation { duration: 200 }
116 onMovingHorizontallyChanged: {
117 if (!movingHorizontally && (!atXBeginning || !atXEnd)) {
118 flickableFront.contentX = buffer //flickable.width/2
122 onAtXBeginningChanged: {
123 if (atXBeginning && contentIsReady) {
124 flickableBack.contentIsReady = false
125 //console.log("previous")
126 articlePage.mainArticleId = controller.getNextId(articlePage.feedid,articlePage.mainArticleId)
127 // if (flipable.side == Flipable.Back) {
128 // webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId);
130 webViewBack.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId);
132 //flickableBack.contentY = 0
133 flickableFront.contentX = buffer
134 //flipable.flipped = !flipable.flipped
135 //flipable.flipLeft()
140 if (atXEnd && contentIsReady) {
141 //console.log("next")
142 flickableBack.contentIsReady = false
143 articlePage.mainArticleId = controller.getPreviousId(articlePage.feedid,articlePage.mainArticleId)
144 // if (flipable.side == Flipable.Back) {
145 // webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId);
147 webViewBack.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId);
149 //flickableBack.contentY = 0
150 flickableFront.contentX = buffer
151 //flipable.flipped = !flipable.flipped
152 //flipable.flipRight();
160 //anchors.fill: screen;
161 height: articlePage.height;
162 width: articlePage.width;
163 contentWidth: boundsRecBack.width
164 contentHeight: boundsRecBack.height
165 //contentWidth: childrenRect.width; contentHeight: childrenRect.height
166 //interactive: parent.vertPanningEnabled;
168 flickDeceleration: 1500;
169 //flickableDirection: Flickable.VerticalFlick
171 property bool contentIsReady: false
175 width: webViewBack.width*webViewBack.scale + 2*buffer // flickable.width
176 height: Math.max(articlePage.height,webViewBack.height*webViewBack.scale)
180 anchors.horizontalCenter: parent.horizontalCenter
182 preferredWidth: articlePage.width
183 //preferredHeight: articleView.height
185 transformOrigin: Item.TopLeft
186 //scale: slider.value;
187 settings.defaultFontSize: articlePage.webviewFontSize
190 flickableBack.contentX = buffer //flickable.width/2
191 flickableBack.contentIsReady = true
192 flipable.flipRight();
199 // console.log("start contentx"+contentX)
200 // console.log("start contenty"+contentY)
203 Behavior on contentX {
204 id: contentXBehaviorBack
205 enabled: flickableBack.contentIsReady
206 NumberAnimation { duration: 200 }
208 onMovingHorizontallyChanged: {
209 if (!movingHorizontally && (!atXBeginning || !atXEnd)) {
210 flickableBack.contentX = buffer //flickable.width/2
214 onAtXBeginningChanged: {
215 if (atXBeginning && contentIsReady) {
216 flickableFront.contentIsReady = false
217 //console.log("previous")
218 articlePage.mainArticleId = controller.getNextId(articlePage.feedid,articlePage.mainArticleId)
219 // if (flipable.side == Flipable.Back) {
220 webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId);
222 // webViewBack.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId);
224 //flickableFront.contentY = 0
225 //flickableBack.contentX = buffer
226 //flipable.flipped = !flipable.flipped
227 //flipable.flipLeft()
232 if (atXEnd && contentIsReady) {
233 flickableFront.contentIsReady = false
234 //console.log("next")
235 articlePage.mainArticleId = controller.getPreviousId(articlePage.feedid,articlePage.mainArticleId)
236 // if (flipable.side == Flipable.Back) {
237 webViewFront.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId);
239 // webViewBack.html = controller.getArticle(articlePage.feedid, articlePage.mainArticleId);
241 //flickableFront.contentY = 0
242 //flickableBack.contentX = buffer
243 //flipable.flipped = !flipable.flipped
244 //flipable.flipRight();
253 // model: articlesModel;
255 // property int webviewFontSize: settings.webviewFontSize
256 // orientation: ListView.Horizontal
257 // width: parent.width;
258 // height: updateBarArticles.visible? parent.height-updateBarArticles.height : parent.height;
259 // //onCurrentIndexChanged: articleView.positionViewAtIndex(currentIndex, ListView.Contain)
260 // highlightRangeMode: ListView.StrictlyEnforceRange; snapMode: ListView.SnapOneItem
261 // cacheBuffer: width;
262 // onMovementStarted: articlePage.vertPanningEnabled=false;
263 // onMovementEnded: articlePage.vertPanningEnabled=true;
264 // highlightMoveDuration: 300;
266 // boundsBehavior: Flickable.DragOverBounds
268 // onCurrentIndexChanged: {
269 // if (currentIndex >= count-1) {
270 // articlesModel.append({articleid: controller.getNextId(feedid, articlesModel.get(currentIndex).articleid)})
276 // articleView.currentIndex = 1
282 id: updateBarArticles
285 value: window.updateProgressValue
286 visible: window.isUpdateInProgress
288 anchors.bottom: parent.bottom
302 width: articleDisplay.width;
303 height: articleView.height;
305 //property string url: (articleView.visible && Math.abs(articleView.currentIndex-index)<2) ? path: "";
306 property string html: controller.getArticle(articlePage.feedid, articleid)
309 zoomEnabled: articlePage.zoomEnabled;
310 property bool vertPanningEnabled: articlePage.vertPanningEnabled;
313 name: 'articleIsRead';
314 when: articleView.currentIndex == index;
319 controller.setEntryRead(articlePage.feedid, articleid)
320 // if (articlesModel.count==1) {
331 Component.onCompleted: {
332 articlesModel.append({articleid: mainArticleId})
333 //articlesModel.append({articleid: controller.getPreviousId(feedid, mainArticleId)})
335 //articleView.currentIndex = 1
340 // interval: 500; running: false; repeat: false
342 // articlesModel.insert(0,{articleid: controller.getNextId(feedid, mainArticleId)})
343 // articlesModel.append({articleid: controller.getPreviousId(feedid, mainArticleId)})