Merge lp:~qqworini/ubuntu-rssreader-app/alpha-2 into lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk
- alpha-2
- Merge into trunk
Proposed by
Joey Chan
Status: | Merged |
---|---|
Approved by: | Roman Shchekin |
Approved revision: | 28 |
Merged at revision: | 29 |
Proposed branch: | lp:~qqworini/ubuntu-rssreader-app/alpha-2 |
Merge into: | lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk |
Diff against target: |
3322 lines (+2087/-776) 27 files modified
ArticleFullImg.qml (+0/-77) ArticleOneImgA.qml (+0/-82) ArticleOneImgB.qml (+0/-99) ArticleTextA.qml (+0/-58) ArticleTextB.qml (+0/-60) ArticleTwoImgA.qml (+0/-86) ListColumnDelegate.qml (+11/-7) ListColumnView.qml (+5/-3) RssFeedPage.qml (+40/-71) TopicTab.qml (+41/-8) XmlNetwork.qml (+75/-1) addDelegate.js (+25/-47) article_items/ArticleFullImg.qml (+156/-0) article_items/ArticleOneImgA.qml (+153/-0) article_items/ArticleOneImgB.qml (+180/-0) article_items/ArticleTextA.qml (+118/-0) article_items/ArticleTextB.qml (+121/-0) article_items/ArticleTwoImgA.qml (+256/-0) debian/ubuntu-rssreader-app.install (+1/-0) feeds/ChooseTopicPage.qml (+2/-0) feeds/CreateTopicPage.qml (+3/-0) feeds/EditFeed.qml (+178/-0) feeds/FeedComponent.qml (+52/-0) feeds/TopicComponent.qml (+203/-0) feeds/TopicManagement.qml (+262/-0) structure.txt (+0/-57) ubuntu-rssreader-app.qml (+205/-120) |
To merge this branch: | bzr merge lp:~qqworini/ubuntu-rssreader-app/alpha-2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Ubuntu Shorts Developers | Pending | ||
Review via email: mp+178421@code.launchpad.net |
Commit message
alpha-1 release
features implemented:
1. view topics;
2. view articles in grid mode;
3. add feeds;
4. search feed using Google Feed API;
5. add topics;
6. feeds and topics management (with drag and drop);
7. visual design ;
8. list mode ;
next objective:
1. fix other UI's detail (in progress) ;
2. new grid view with new algorithm
Description of the change
alpha-1 release
features implemented:
1. view topics;
2. view articles in grid mode;
3. add feeds;
4. search feed using Google Feed API;
5. add topics;
6. feeds and topics management (with drag and drop);
7. visual design ;
8. list mode ;
next objective:
1. fix other UI's detail (in progress) ;
2. new grid view with new algorithm
To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) : | # |
review:
Approve
(continuous-integration)
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === removed file 'ArticleFullImg.qml' |
2 | --- ArticleFullImg.qml 2013-07-23 16:56:15 +0000 |
3 | +++ ArticleFullImg.qml 1970-01-01 00:00:00 +0000 |
4 | @@ -1,77 +0,0 @@ |
5 | -import QtQuick 2.0 |
6 | -import Ubuntu.Components 0.1 |
7 | -import Ubuntu.Components.ListItems 0.1 as ListItem |
8 | -import "./dateutils.js" as DateUtils |
9 | - |
10 | -Column { |
11 | - width: units.gu(26) |
12 | - height: units.gu(20) |
13 | - // anchors.fill: parent |
14 | - property variant rss_item |
15 | - property variant imageArray: [] |
16 | - property variant rss_model |
17 | - property int model_index |
18 | - |
19 | - // Row |
20 | - // { |
21 | - // spacing: units.gu(1) |
22 | - // anchors.fill: parent |
23 | - //// layoutDirection: Qt.RightToLeft |
24 | - |
25 | - UbuntuShape |
26 | - { |
27 | - id: u_pic |
28 | - width: units.gu(24) |
29 | - height: units.gu(17) |
30 | - image: Image { |
31 | - id: pic |
32 | - width: units.gu(24) |
33 | - fillMode: Image.PreserveAspectCrop |
34 | - source: imageArray[0] |
35 | - } |
36 | - |
37 | - Rectangle |
38 | - { |
39 | - id: rec_label_bg |
40 | - color: "black" |
41 | - anchors.top: label_title.top |
42 | - anchors.bottom: label_title.bottom |
43 | - width: parent.width |
44 | - opacity: 0.5 |
45 | - } |
46 | - |
47 | - Label |
48 | - { |
49 | - id: label_title |
50 | - text: rss_item.title |
51 | - anchors.bottom: parent.bottom |
52 | - anchors.bottomMargin: units.gu(1) |
53 | - anchors.horizontalCenter: parent.horizontalCenter |
54 | - width: parent.width - units.gu(1) |
55 | - wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
56 | - color: "white" |
57 | - fontSize: "medium" |
58 | - textFormat: Text.StyledText |
59 | - } |
60 | - |
61 | - MouseArea |
62 | - { |
63 | - anchors.fill: parent |
64 | - |
65 | - onClicked: |
66 | - { |
67 | - mainView.toRssPage(rss_model, model_index) ; |
68 | - } |
69 | - } |
70 | - } |
71 | - |
72 | - Label |
73 | - { |
74 | - id: label_time |
75 | - text: DateUtils.formatRelativeTime(i18n, rss_item.pubdate) |
76 | - color: "black" |
77 | - fontSize: "medium" |
78 | - } |
79 | - |
80 | - // } |
81 | -} |
82 | |
83 | === removed file 'ArticleOneImgA.qml' |
84 | --- ArticleOneImgA.qml 2013-07-23 16:56:15 +0000 |
85 | +++ ArticleOneImgA.qml 1970-01-01 00:00:00 +0000 |
86 | @@ -1,82 +0,0 @@ |
87 | -import QtQuick 2.0 |
88 | -import Ubuntu.Components 0.1 |
89 | -import Ubuntu.Components.ListItems 0.1 as ListItem |
90 | -import "./dateutils.js" as DateUtils |
91 | - |
92 | -Column { |
93 | - id: delegate_item |
94 | - width: units.gu(34) |
95 | -// height: units.gu(16) |
96 | -// anchors.fill: parent |
97 | - property variant rss_item |
98 | - property variant imageArray: [] |
99 | - property variant rss_model |
100 | - property int model_index |
101 | - |
102 | - Row |
103 | - { |
104 | - id: row |
105 | - spacing: units.gu(1) |
106 | -// anchors.fill: parent |
107 | - |
108 | - Label |
109 | - { |
110 | - id: label_title |
111 | - text: rss_item.title |
112 | -// anchors.horizontalCenter: parent.horizontalCenter |
113 | - width: units.gu(14) |
114 | - wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
115 | - color: "black" |
116 | - fontSize: "medium" |
117 | - textFormat: Text.PlainText |
118 | - horizontalAlignment: Text.AlignRight |
119 | - |
120 | - MouseArea |
121 | - { |
122 | - x:0; y:0 |
123 | - width: delegate_item.width |
124 | - height: delegate_item.height |
125 | - |
126 | - onClicked: |
127 | - { |
128 | - mainView.toRssPage(rss_model, model_index) ; |
129 | - } |
130 | - } |
131 | - } |
132 | - |
133 | - UbuntuShape |
134 | - { |
135 | - id: u_pic |
136 | - width: units.gu(18) |
137 | - height: pic.height |
138 | - image: Image { |
139 | - id: pic |
140 | - width: units.gu(18) |
141 | - fillMode: Image.PreserveAspectFit |
142 | - source: imageArray[0] |
143 | -// { |
144 | -// if (imageArray == 0) |
145 | -// { |
146 | -// label_title.width = units.gu(30) |
147 | -// label_title.fontSize = "large" |
148 | -// return "" |
149 | -// } |
150 | -// else if (imageArray.length > 0) |
151 | -// return imageArray[0] |
152 | -// } |
153 | - } |
154 | - } |
155 | - |
156 | - |
157 | - } |
158 | - |
159 | - Label |
160 | - { |
161 | - id: label_time |
162 | - text: DateUtils.formatRelativeTime(i18n, rss_item.pubdate) |
163 | - color: "black" |
164 | - fontSize: "medium" |
165 | - horizontalAlignment: Text.AlignRight |
166 | - width: parent.width |
167 | - } |
168 | -} |
169 | |
170 | === removed file 'ArticleOneImgB.qml' |
171 | --- ArticleOneImgB.qml 2013-07-23 16:56:15 +0000 |
172 | +++ ArticleOneImgB.qml 1970-01-01 00:00:00 +0000 |
173 | @@ -1,99 +0,0 @@ |
174 | -import QtQuick 2.0 |
175 | -import Ubuntu.Components 0.1 |
176 | -import Ubuntu.Components.ListItems 0.1 as ListItem |
177 | -import "./dateutils.js" as DateUtils |
178 | - |
179 | -Column { |
180 | - id: delegate_item |
181 | - width: units.gu(34) |
182 | -// height: units.gu(16) |
183 | -// anchors.fill: parent |
184 | - property variant rss_item |
185 | - property variant imageArray: [] |
186 | - property variant rss_model |
187 | - property int model_index |
188 | - |
189 | - Row |
190 | - { |
191 | - id: row |
192 | - spacing: units.gu(1) |
193 | -// anchors.fill: parent |
194 | -// layoutDirection: Qt.RightToLeft |
195 | - |
196 | - |
197 | - |
198 | - UbuntuShape |
199 | - { |
200 | - id: u_pic |
201 | - width: units.gu(18) |
202 | - height: pic.height |
203 | - image: Image { |
204 | - id: pic |
205 | - width: units.gu(18) |
206 | - fillMode: Image.PreserveAspectFit |
207 | - source: imageArray[0] |
208 | -// { |
209 | -// if (imageArray == 0) |
210 | -// { |
211 | -// label_title.width = units.gu(30) |
212 | -// label_title.fontSize = "large" |
213 | -// return "" |
214 | -// } |
215 | -// else if (imageArray.length > 0) |
216 | -// return imageArray[0] |
217 | -// } |
218 | - } |
219 | - |
220 | - MouseArea |
221 | - { |
222 | - x:0; y:0 |
223 | - width: delegate_item.width |
224 | - height: delegate_item.height |
225 | - |
226 | - onClicked: |
227 | - { |
228 | - mainView.toRssPage(rss_model, model_index) ; |
229 | - } |
230 | - } |
231 | - } |
232 | - |
233 | - Label |
234 | - { |
235 | - id: label_title |
236 | - text: rss_item.title |
237 | -// anchors.horizontalCenter: parent.horizontalCenter |
238 | - width: units.gu(14) |
239 | - wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
240 | - color: "black" |
241 | - fontSize: "medium" |
242 | - textFormat: Text.StyledText |
243 | - } |
244 | - |
245 | -// Image { |
246 | -// id: pic |
247 | -// width: units.gu(18) |
248 | -// fillMode: Image.PreserveAspectFit |
249 | -// source: imageArray[0] |
250 | -// { |
251 | -// if (imageArray == undefined) |
252 | -// { |
253 | -// return "" |
254 | -// } |
255 | -// else if (imageArray.length > 0) |
256 | -// return imageArray[0] |
257 | -//// else |
258 | -//// return "" |
259 | -// } |
260 | -// anchors.centerIn: parent |
261 | -// anchors.verticalCenter: parent.verticalCenter |
262 | -// } |
263 | - } |
264 | - |
265 | - Label |
266 | - { |
267 | - id: label_time |
268 | - text: DateUtils.formatRelativeTime(i18n, rss_item.pubdate) |
269 | - color: "black" |
270 | - fontSize: "medium" |
271 | - } |
272 | -} |
273 | |
274 | === removed file 'ArticleTextA.qml' |
275 | --- ArticleTextA.qml 2013-07-23 16:56:15 +0000 |
276 | +++ ArticleTextA.qml 1970-01-01 00:00:00 +0000 |
277 | @@ -1,58 +0,0 @@ |
278 | -import QtQuick 2.0 |
279 | -import Ubuntu.Components 0.1 |
280 | -import Ubuntu.Components.ListItems 0.1 as ListItem |
281 | -import "./dateutils.js" as DateUtils |
282 | - |
283 | -Column { |
284 | - width: units.gu(30) |
285 | -// height: units.gu(15) |
286 | -// anchors.fill: parent |
287 | - property variant rss_item |
288 | - property variant imageArray: [] |
289 | - property variant rss_model |
290 | - property int model_index |
291 | - |
292 | -// Row |
293 | -// { |
294 | - spacing: units.gu(1) |
295 | -// anchors.fill: parent |
296 | - |
297 | - Label |
298 | - { |
299 | - id: label_title |
300 | - text: rss_item.title |
301 | -// anchors.horizontalCenter: parent.horizontalCenter |
302 | - width: units.gu(30) |
303 | - wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
304 | - color: "black" |
305 | - fontSize: "large" |
306 | - textFormat: Text.PlainText |
307 | - |
308 | - MouseArea |
309 | - { |
310 | - anchors.fill: parent |
311 | - |
312 | - onClicked: |
313 | - { |
314 | - mainView.toRssPage(rss_model, model_index) ; |
315 | - } |
316 | - } |
317 | - } |
318 | -// } |
319 | - |
320 | - Label |
321 | - { |
322 | - id: label_time |
323 | - text: DateUtils.formatRelativeTime(i18n, rss_item.pubdate) |
324 | - color: "black" |
325 | - fontSize: "medium" |
326 | - width: parent.width |
327 | - wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
328 | - } |
329 | - |
330 | - Item |
331 | - { |
332 | - width: parent.width |
333 | - height: units.gu(2) |
334 | - } |
335 | -} |
336 | |
337 | === removed file 'ArticleTextB.qml' |
338 | --- ArticleTextB.qml 2013-07-23 16:56:15 +0000 |
339 | +++ ArticleTextB.qml 1970-01-01 00:00:00 +0000 |
340 | @@ -1,60 +0,0 @@ |
341 | -import QtQuick 2.0 |
342 | -import Ubuntu.Components 0.1 |
343 | -import Ubuntu.Components.ListItems 0.1 as ListItem |
344 | -import "./dateutils.js" as DateUtils |
345 | - |
346 | -Column { |
347 | - width: units.gu(30) |
348 | -// height: units.gu(15) |
349 | -// anchors.fill: parent |
350 | - property variant rss_item |
351 | - property variant imageArray: [] |
352 | - property variant rss_model |
353 | - property int model_index |
354 | - |
355 | -// Row |
356 | -// { |
357 | - spacing: units.gu(1) |
358 | -// anchors.fill: parent |
359 | - |
360 | - Label |
361 | - { |
362 | - id: label_title |
363 | - text: rss_item.title |
364 | -// anchors.horizontalCenter: parent.horizontalCenter |
365 | - width: units.gu(30) |
366 | - wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
367 | - color: "black" |
368 | - fontSize: "large" |
369 | - textFormat: Text.PlainText |
370 | - horizontalAlignment: Text.AlignRight |
371 | - |
372 | - MouseArea |
373 | - { |
374 | - anchors.fill: parent |
375 | - |
376 | - onClicked: |
377 | - { |
378 | - mainView.toRssPage(rss_model, model_index) ; |
379 | - } |
380 | - } |
381 | - } |
382 | -// } |
383 | - |
384 | - Label |
385 | - { |
386 | - id: label_time |
387 | - text: DateUtils.formatRelativeTime(i18n, rss_item.pubdate) |
388 | - color: "black" |
389 | - fontSize: "medium" |
390 | - horizontalAlignment: Text.AlignRight |
391 | - width: parent.width |
392 | - wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
393 | - } |
394 | - |
395 | - Item |
396 | - { |
397 | - width: parent.width |
398 | - height: units.gu(2) |
399 | - } |
400 | -} |
401 | |
402 | === removed file 'ArticleTwoImgA.qml' |
403 | --- ArticleTwoImgA.qml 2013-07-23 16:56:15 +0000 |
404 | +++ ArticleTwoImgA.qml 1970-01-01 00:00:00 +0000 |
405 | @@ -1,86 +0,0 @@ |
406 | -import QtQuick 2.0 |
407 | -import Ubuntu.Components 0.1 |
408 | -import Ubuntu.Components.ListItems 0.1 as ListItem |
409 | -import "./dateutils.js" as DateUtils |
410 | - |
411 | -Column { |
412 | - id: delegate_item |
413 | - width: units.gu(34) |
414 | -// height: units.gu(30) |
415 | -// anchors.fill: parent |
416 | - property variant rss_item |
417 | - property variant imageArray: [] |
418 | - property variant rss_model |
419 | - property int model_index |
420 | - |
421 | - Row |
422 | - { |
423 | - id: row |
424 | - spacing: units.gu(1) |
425 | -// anchors.fill: parent |
426 | - |
427 | - Label |
428 | - { |
429 | - id: label_title |
430 | - text: rss_item.title |
431 | -// anchors.horizontalCenter: parent.horizontalCenter |
432 | - width: units.gu(14) |
433 | - wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
434 | - color: "black" |
435 | - fontSize: "medium" |
436 | - textFormat: Text.PlainText |
437 | - |
438 | - MouseArea |
439 | - { |
440 | - x:0; y:0 |
441 | - width: delegate_item.width |
442 | - height: delegate_item.height |
443 | - |
444 | - onClicked: |
445 | - { |
446 | - mainView.toRssPage(rss_model, model_index) ; |
447 | - } |
448 | - } |
449 | - } |
450 | - |
451 | - Column |
452 | - { |
453 | - spacing: units.gu(1) |
454 | - |
455 | - UbuntuShape |
456 | - { |
457 | - id: u_pic0 |
458 | - width: units.gu(15) |
459 | - height: pic0.height |
460 | - image: Image { |
461 | - id: pic0 |
462 | - width: units.gu(15) |
463 | - fillMode: Image.PreserveAspectFit |
464 | - source: imageArray[0] |
465 | - } |
466 | - } |
467 | - |
468 | - UbuntuShape |
469 | - { |
470 | - id: u_pic1 |
471 | - width: units.gu(15) |
472 | - height: pic1.height |
473 | - image: Image { |
474 | - id: pic1 |
475 | - width: units.gu(15) |
476 | - fillMode: Image.PreserveAspectFit |
477 | - source: imageArray[1] |
478 | - } |
479 | - } |
480 | - } |
481 | - |
482 | - } |
483 | - |
484 | - Label |
485 | - { |
486 | - id: label_time |
487 | - text: DateUtils.formatRelativeTime(i18n, rss_item.pubdate) |
488 | - color: "black" |
489 | - fontSize: "medium" |
490 | - } |
491 | -} |
492 | |
493 | === modified file 'ListColumnDelegate.qml' |
494 | --- ListColumnDelegate.qml 2013-08-01 14:56:04 +0000 |
495 | +++ ListColumnDelegate.qml 2013-08-03 10:10:38 +0000 |
496 | @@ -6,6 +6,7 @@ |
497 | |
498 | import "./addDelegate.js" as AddD |
499 | import "./imgSeparator.js" as ImgS |
500 | +//import "./article_items" |
501 | |
502 | Column { |
503 | id: rss_item_delegate |
504 | @@ -13,7 +14,7 @@ |
505 | // height: units.gu(75) |
506 | |
507 | // height: parent.height |
508 | - spacing: units.gu(3) |
509 | + spacing: units.gu(2) |
510 | |
511 | property bool isFull: false |
512 | property real childrenSumHeight: 0 |
513 | @@ -22,17 +23,19 @@ |
514 | |
515 | function addItem(rss_item, rss_description, model, index) |
516 | { |
517 | -// console.log("delegate height: ", rss_item_delegate.height) ; |
518 | - var newD = AddD.addDelegate(rss_item, ImgS.separate(rss_description), model, index); |
519 | + var newD = AddD.addDelegate(rss_item, ImgS.separate(rss_description), model, index, rss_item_delegate); |
520 | getChildrenRect() ; |
521 | rss_item_delegate.width = childrenMaxWidth ; |
522 | - //console.log("childrenSumHeight, column.height: ", childrenSumHeight, rss_item_delegate.height) |
523 | +// console.log("childrenSumHeight, column.height: ", childrenSumHeight, rss_item_delegate.childrenRect.height) |
524 | //console.log("children list: ", rss_item_delegate.children.length) |
525 | - if (childrenSumHeight > rss_item_delegate.height) |
526 | + if (childrenSumHeight > rss_item_delegate.height + units.gu(2)) |
527 | { |
528 | isFull = true ; |
529 | newD.destroy() ; |
530 | + getChildrenRect() ; |
531 | + rss_item_delegate.width = childrenMaxWidth ; |
532 | // rss_item_delegate.children[rss_item_delegate.children.length-1].destroy() ; |
533 | +// rss_item_delegate.spacing = (childrenSumHeight - rss_item_delegate.height) / (rss_item_delegate.children.length + 2) |
534 | return false ; |
535 | } |
536 | else |
537 | @@ -46,9 +49,10 @@ |
538 | { |
539 | childrenSumHeight = 0 ; |
540 | childrenMaxWidth = 0 ; |
541 | - for (var i=0; i<rss_item_delegate.children.length; i++) |
542 | + var length = rss_item_delegate.children.length ; |
543 | + for (var i=0; i<length; i++) |
544 | { |
545 | - childrenSumHeight += rss_item_delegate.children[i].height ; |
546 | + childrenSumHeight += (rss_item_delegate.children[i].height + units.gu(2) * length) ; |
547 | if (rss_item_delegate.children[i].width > childrenMaxWidth) |
548 | { |
549 | childrenMaxWidth = rss_item_delegate.children[i].width |
550 | |
551 | === modified file 'ListColumnView.qml' |
552 | --- ListColumnView.qml 2013-08-01 14:56:04 +0000 |
553 | +++ ListColumnView.qml 2013-08-03 10:10:38 +0000 |
554 | @@ -8,6 +8,7 @@ |
555 | |
556 | Item { |
557 | anchors.fill: parent |
558 | + anchors.bottomMargin: units.gu(7) |
559 | |
560 | property int tag_id |
561 | property bool isAll: false |
562 | @@ -49,7 +50,7 @@ |
563 | } |
564 | else |
565 | { |
566 | - var articles = DB.loadArticles(); |
567 | + var articles = DB.loadArticles({"isAll": true}); |
568 | var temp |
569 | for (var i=0; i < articles.rows.length; i++) |
570 | { |
571 | @@ -87,9 +88,10 @@ |
572 | ListView { |
573 | id: list_column |
574 | anchors.fill: parent |
575 | + anchors.margins: units.gu(2) |
576 | orientation: ListView.Horizontal |
577 | // flickableDirection: Flickable.HorizontalFlick |
578 | - spacing: units.gu(4) |
579 | + spacing: units.gu(3) |
580 | cacheBuffer: 99999 |
581 | |
582 | function loadArticles(/*temp_model*/) |
583 | @@ -104,7 +106,7 @@ |
584 | // model++ ; |
585 | // currentIndex = model - 1 ; |
586 | // console.log("model index: ", i) |
587 | - while (!currentItem.addItem(tempmodel.get(i), tempmodel.get(i).content, tempmodel, i)) |
588 | + while (!currentItem.addItem(tempmodel.get(i), /*tempmodel.get(i).description == "" ? */tempmodel.get(i).content /*: tempmodel.get(i).description*/ , tempmodel, i)) |
589 | { |
590 | // model++ ; |
591 | column_model.append( { "nothing": "nothing" } ) ; |
592 | |
593 | === modified file 'RssFeedPage.qml' |
594 | --- RssFeedPage.qml 2013-07-29 18:31:05 +0000 |
595 | +++ RssFeedPage.qml 2013-08-03 10:10:38 +0000 |
596 | @@ -4,30 +4,13 @@ |
597 | description of this file: |
598 | a page for viewing a user selected RSS feed ; |
599 | |
600 | - Architecture: |
601 | - page |
602 | - { |
603 | - ToolbarActions |
604 | - |
605 | - Rectangle |
606 | - { |
607 | - label(RSS feed title) |
608 | - } |
609 | - |
610 | - ListView |
611 | - { |
612 | - } |
613 | - |
614 | - Component(delegate) |
615 | - |
616 | - XmlListModel(rss feed) |
617 | - } |
618 | */ |
619 | |
620 | import QtQuick 2.0 |
621 | import QtQuick.XmlListModel 2.0 |
622 | import Ubuntu.Components 0.1 |
623 | import Ubuntu.Components.ListItems 0.1 as ListItem |
624 | +import "./dateutils.js" as DateUtils |
625 | |
626 | Page { |
627 | id: page_feed |
628 | @@ -59,28 +42,6 @@ |
629 | |
630 | ToolbarButton { |
631 | action: Action { |
632 | - text: i18n.tr("index 0") |
633 | - iconSource: Qt.resolvedUrl("avatar.png") |
634 | - onTriggered: |
635 | - { |
636 | - rss_listview.currentIndex = 10 |
637 | - } |
638 | - } |
639 | - } |
640 | - |
641 | - ToolbarButton { |
642 | - action: Action { |
643 | - text: i18n.tr("index 1") |
644 | - iconSource: Qt.resolvedUrl("avatar.png") |
645 | - onTriggered: |
646 | - { |
647 | - rss_listview.currentIndex = 20 |
648 | - } |
649 | - } |
650 | - } |
651 | - |
652 | - ToolbarButton { |
653 | - action: Action { |
654 | text: i18n.tr("Open site") |
655 | iconSource: Qt.resolvedUrl("avatar.png") |
656 | onTriggered: |
657 | @@ -93,25 +54,25 @@ |
658 | } |
659 | |
660 | ////////////////////////////////////////////// shows the RSS feed title |
661 | - Rectangle |
662 | - { |
663 | - id: rec_title |
664 | - width: parent.width |
665 | - height: label_title.height + units.gu(1) |
666 | - color: "orange" |
667 | +// Rectangle |
668 | +// { |
669 | +// id: rec_title |
670 | +// width: parent.width |
671 | +// height: label_title.height + units.gu(1) |
672 | +// color: "orange" |
673 | |
674 | - Label |
675 | - { |
676 | - id: label_title |
677 | - anchors.centerIn: parent |
678 | - width: parent.width - units.gu(2) |
679 | -// ItemStyle.class: "title" |
680 | - wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
681 | - text: rsstitle |
682 | - fontSize: "large" |
683 | - color: "white" |
684 | - } |
685 | - } |
686 | +// Label |
687 | +// { |
688 | +// id: label_title |
689 | +// anchors.centerIn: parent |
690 | +// width: parent.width - units.gu(2) |
691 | +//// ItemStyle.class: "title" |
692 | +// wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
693 | +// text: rsstitle |
694 | +// fontSize: "large" |
695 | +// color: "white" |
696 | +// } |
697 | +// } |
698 | |
699 | ////////////////////////////////////////////// a listview to show the RSS content |
700 | ListView |
701 | @@ -119,8 +80,8 @@ |
702 | id: rss_listview |
703 | width: parent.width |
704 | anchors.bottom: parent.bottom |
705 | - // anchors.bottomMargin: units.gu(1) |
706 | - anchors.top: rec_title.bottom |
707 | + anchors.bottomMargin: units.gu(2) |
708 | + anchors.top: parent.top |
709 | anchors.topMargin: units.gu(2) |
710 | snapMode: ListView.SnapOneItem |
711 | cacheBuffer: 90 |
712 | @@ -161,31 +122,39 @@ |
713 | spacing: units.gu(2) |
714 | width: parent.width |
715 | |
716 | + Label |
717 | + { |
718 | + id: label_time |
719 | + text: DateUtils.formatRelativeTime(i18n, pubdate) |
720 | + fontSize: "small" |
721 | + anchors.horizontalCenter: parent.horizontalCenter |
722 | + width: parent.width - units.gu(4) |
723 | + } |
724 | + |
725 | Label { |
726 | fontSize: "large" |
727 | text: title |
728 | anchors.horizontalCenter: parent.horizontalCenter |
729 | width: parent.width - units.gu(4) |
730 | wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
731 | - color: "black" |
732 | } |
733 | |
734 | Label { |
735 | - text: content |
736 | + text: description == "" ? content : description |
737 | anchors.horizontalCenter: parent.horizontalCenter |
738 | width: parent.width - units.gu(4) |
739 | wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
740 | - color: "black" |
741 | clip: true |
742 | + } |
743 | |
744 | - MouseArea |
745 | - { |
746 | - anchors.fill: parent |
747 | - onClicked: |
748 | - { |
749 | - console.log("current index : " + index) ; |
750 | - } |
751 | - } |
752 | + Label |
753 | + { |
754 | + id: label_feedname |
755 | + text: rsstitle |
756 | + fontSize: "small" |
757 | + anchors.horizontalCenter: parent.horizontalCenter |
758 | + width: parent.width - units.gu(4) |
759 | + wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
760 | } |
761 | } |
762 | |
763 | |
764 | === modified file 'TopicTab.qml' |
765 | --- TopicTab.qml 2013-07-05 13:59:01 +0000 |
766 | +++ TopicTab.qml 2013-08-03 10:10:38 +0000 |
767 | @@ -32,23 +32,56 @@ |
768 | } |
769 | |
770 | page: Page { |
771 | - anchors.margins: units.gu(2) |
772 | +// anchors.margins: units.gu(2) |
773 | |
774 | tools: ToolbarItems { |
775 | id: toolbar |
776 | |
777 | - ToolbarButton { |
778 | + back: ToolbarButton { |
779 | action: Action { |
780 | text: i18n.tr("Refresh") |
781 | - iconSource: Qt.resolvedUrl("avatar.png") |
782 | + iconSource: Qt.resolvedUrl("./icons_tmp/reload.svg") |
783 | onTriggered: |
784 | { |
785 | -// refresh(); |
786 | -// toolbar.opened = false; |
787 | xmlnetwork.addFeedList(feedArray) ; |
788 | - } |
789 | - } |
790 | - } |
791 | + toolbar.opened = false; |
792 | + } |
793 | + } |
794 | + } |
795 | + |
796 | + ToolbarButton { |
797 | + action: Action { |
798 | + text: i18n.tr("List view") |
799 | + iconSource: Qt.resolvedUrl("./icons_tmp/view-fullscreen.svg") |
800 | + onTriggered: { |
801 | + console.log("NOT IMPLEMENTED") |
802 | + } |
803 | + } |
804 | + } |
805 | + |
806 | + ToolbarButton { |
807 | + id: addReadsBtn |
808 | + action: Action { |
809 | + text: i18n.tr("Add reads") |
810 | + iconSource: Qt.resolvedUrl("./icons_tmp/add.svg") |
811 | + onTriggered: { |
812 | + // pageStack.push(editFeedsPage) |
813 | + PopupUtils.open(addReadsPopoverComp, addReadsBtn) |
814 | + } |
815 | + } |
816 | + } |
817 | + |
818 | + ToolbarButton { |
819 | + action: Action { |
820 | + text: i18n.tr("Edit topics") |
821 | + iconSource: Qt.resolvedUrl("./icons_tmp/edit.svg") |
822 | + onTriggered: { |
823 | +// pageStack.push(editFeedsPage) |
824 | + pageStack.push(topicManagement); |
825 | + } |
826 | + } |
827 | + } |
828 | + |
829 | } |
830 | |
831 | ListColumnView |
832 | |
833 | === modified file 'XmlNetwork.qml' |
834 | --- XmlNetwork.qml 2013-07-29 18:31:05 +0000 |
835 | +++ XmlNetwork.qml 2013-08-03 10:10:38 +0000 |
836 | @@ -38,6 +38,80 @@ |
837 | googleFeedApi.loadFeed(currentFeed.source) |
838 | } |
839 | |
840 | + /* Temporary here - TODO move to separate file. |
841 | + */ |
842 | + function updateFeedInfo(feedId, feedLink, responseData) { |
843 | + var entries = responseData.feed.entries |
844 | + var f = responseData.feed |
845 | + |
846 | + // TODO MB NO NEED |
847 | + DB.updateFeedByXml(feedId, f.feedUrl === f.link ? feedLink : f.link, // Sometimes google fails and sends site link equal to feed url. |
848 | + f.description, f.title) |
849 | + console.log(" -------- UPDATE INFO -------- ") |
850 | + console.log(f.title, f.link, f.feedUrl, f.description) |
851 | + |
852 | + DB.clearArticles(feedId) |
853 | + articleModel.clear(); |
854 | + |
855 | + for (var i = 0; i < entries.length; i++) |
856 | + { |
857 | + var temp = |
858 | + { |
859 | + "title": entries[i].title |
860 | + ,"content": entries[i].content |
861 | + ,"link": entries[i].link |
862 | + ,"description": entries[i].contentSnippet |
863 | + ,"pubDate": entries[i].publishedDate |
864 | + ,"guid": Qt.md5(entries[i].content + entries[i].publishedDate) |
865 | + } |
866 | + articleModel.append(temp); |
867 | + } |
868 | + DB.addArticles(articleModel, feedId); |
869 | + |
870 | + //////////////////////////////////////// ************************** |
871 | + /////// pls dont't operate the db too often, will block the main thread |
872 | + //////////////////////////////////////// ************************** |
873 | + |
874 | + // TODO TEMP SLOW SOLUTION |
875 | + // Later must replace it with adapted addArticles |
876 | +// for (var i = 0; i < entries.length; i++) { |
877 | +// var e = entries[i] |
878 | +// var dbResult = DB.addArticle(e.title, e.content, e.link, e.contentSnippet, e.publishedDate, |
879 | +// Qt.md5(e.content + e.publishedDate), feedId) |
880 | + |
881 | +// if (dbResult.error) |
882 | +// continue |
883 | + |
884 | +// // ------- TODO naive solution of getting image ---------- |
885 | +// var imageFound = false |
886 | +// if (e.mediaGroups) { |
887 | +// // console.log("MEDIA GROUPS FOUND") |
888 | +// var cont = e.mediaGroups[0].contents[0] |
889 | +// if (cont.type === "image/jpeg" || cont.type === "image/png" || |
890 | +// cont.type === "image/jpeg" || cont.type === "image/pjpeg" || |
891 | +// cont.type === "image/svg+xml") { |
892 | +// DB.updateArticleImage(dbResult.articleId, cont.url) |
893 | +// imageFound = true |
894 | +// } |
895 | +// } |
896 | + |
897 | +// if (!imageFound) { |
898 | +// var image = ImageUtils.getFirstImage(e.content) |
899 | +// if (image != null) { |
900 | +// DB.updateArticleImage(dbResult.articleId, image) |
901 | +// } |
902 | +// } |
903 | + |
904 | +// // ------------------------------------------------------- |
905 | +// } |
906 | + } |
907 | + |
908 | + ///////////////////////////////////////// for DB.addArticles() |
909 | + ListModel |
910 | + { |
911 | + id: articleModel |
912 | + } |
913 | + |
914 | // ------------------------------------- GOOGLE API |
915 | |
916 | Connections { |
917 | @@ -50,7 +124,7 @@ |
918 | return |
919 | } |
920 | |
921 | - pageStack.updateFeedInfo(currentFeed.id, currentFeed.link, result.responseData) |
922 | + /*pageStack.*/updateFeedInfo(currentFeed.id, currentFeed.link, result.responseData) |
923 | |
924 | downloadFeed(); |
925 | } |
926 | |
927 | === modified file 'addDelegate.js' |
928 | --- addDelegate.js 2013-07-23 16:56:15 +0000 |
929 | +++ addDelegate.js 2013-08-03 10:10:38 +0000 |
930 | @@ -4,7 +4,7 @@ |
931 | //var mob_component; |
932 | //var mob_sprite; |
933 | |
934 | -function addDelegate(rss_item, imageArray, model, index) |
935 | +function addDelegate(rss_item, imageArray, model, index, parentItem) |
936 | { |
937 | // console.log("add delegate start") |
938 | // component = undefined ; |
939 | @@ -23,18 +23,18 @@ |
940 | // component = Qt.createComponent("./ArticledelegateOneImgB.qml"); |
941 | // sprite = component.createObject(rss_item_delegate, {"rss_title": rss_title, "imageArray": imageArray}); |
942 | // console.log("delegate BBBBB") |
943 | - newD = delegateOneImgA (rss_item, imageArray, model, index) |
944 | + newD = delegateOneImgA (rss_item, imageArray, model, index, parentItem) |
945 | } |
946 | else if (rand > 70) |
947 | { |
948 | // component = Qt.createComponent("./ArticledelegateOneImgA.qml"); |
949 | // sprite = component.createObject(rss_item_delegate, {"rss_title": rss_title, "imageArray": imageArray}); |
950 | // console.log("delegate AAAAA") |
951 | - newD = delegateOneImgB (rss_item, imageArray, model, index) |
952 | + newD = delegateOneImgB (rss_item, imageArray, model, index, parentItem) |
953 | } |
954 | else |
955 | { |
956 | - newD = delegateFullImg (rss_item, imageArray, model, index) |
957 | + newD = delegateFullImg (rss_item, imageArray, model, index, parentItem) |
958 | } |
959 | |
960 | } |
961 | @@ -42,49 +42,27 @@ |
962 | { |
963 | if (rand > 50) |
964 | { |
965 | - newD = delegateTextA (rss_item/*, imageArray*/, model, index) ; |
966 | + newD = delegateTextA (rss_item/*, imageArray*/, model, index, parentItem) ; |
967 | } |
968 | else |
969 | { |
970 | - newD = delegateTextB (rss_item/*, imageArray*/, model, index) ; |
971 | + newD = delegateTextB (rss_item/*, imageArray*/, model, index, parentItem) ; |
972 | } |
973 | } |
974 | else |
975 | { |
976 | - newD = delegateTwoImgA (rss_item, imageArray, model, index) |
977 | + newD = delegateTwoImgA (rss_item, imageArray, model, index, parentItem) |
978 | } |
979 | |
980 | -// else if (imageArray == undefined ) |
981 | -// { |
982 | -//// component = Qt.createComponent("./ArticledelegateTextA.qml"); |
983 | -//// sprite = component.createObject(rss_item_delegate, {"rss_title": rss_title, "imageArray": imageArray}); |
984 | -//// console.log("delegate CCCCC") |
985 | -// delegateTextA (rss_title, imageArray) |
986 | -// } |
987 | - |
988 | -// else if (imageArray.length == 0) |
989 | -// { |
990 | -//// component = Qt.createComponent("./ArticledelegateTextA.qml"); |
991 | -//// sprite = component.createObject(rss_item_delegate, {"rss_title": rss_title, "imageArray": imageArray}); |
992 | -//// console.log("delegate CCCCC") |
993 | -// delegateTextA (rss_title, imageArray) |
994 | -// } |
995 | - |
996 | - // sprite.showPage(status); |
997 | - |
998 | - |
999 | - |
1000 | -// console.log("add delegate end") |
1001 | -// console.timeEnd("add delegate"); |
1002 | return newD ; |
1003 | } |
1004 | |
1005 | -function delegateOneImgA (rss_item, imageArray, model, index) |
1006 | +function delegateOneImgA (rss_item, imageArray, model, index, parentItem) |
1007 | { |
1008 | var component; |
1009 | var sprite; |
1010 | - component = Qt.createComponent("./ArticleOneImgA.qml"); |
1011 | - sprite = component.createObject(rss_item_delegate, {"rss_item": rss_item, "imageArray": imageArray, "rss_model": model, "model_index": index}); |
1012 | + component = Qt.createComponent("./article_items/ArticleOneImgA.qml"); |
1013 | + sprite = component.createObject(parentItem, {"rss_item": rss_item, "imageArray": imageArray, "rss_model": model, "model_index": index}); |
1014 | // console.log("delegate AAAAA") |
1015 | |
1016 | if (sprite == null) { |
1017 | @@ -95,12 +73,12 @@ |
1018 | return sprite |
1019 | } |
1020 | |
1021 | -function delegateOneImgB (rss_item, imageArray, model, index) |
1022 | +function delegateOneImgB (rss_item, imageArray, model, index, parentItem) |
1023 | { |
1024 | var component; |
1025 | var sprite; |
1026 | - component = Qt.createComponent("./ArticleOneImgB.qml"); |
1027 | - sprite = component.createObject(rss_item_delegate, {"rss_item": rss_item, "imageArray": imageArray, "rss_model": model, "model_index": index}); |
1028 | + component = Qt.createComponent("./article_items/ArticleOneImgB.qml"); |
1029 | + sprite = component.createObject(parentItem, {"rss_item": rss_item, "imageArray": imageArray, "rss_model": model, "model_index": index}); |
1030 | // console.log("delegate BBBBB") |
1031 | |
1032 | if (sprite == null) { |
1033 | @@ -111,12 +89,12 @@ |
1034 | return sprite |
1035 | } |
1036 | |
1037 | -function delegateTextA (rss_item, model, index) |
1038 | +function delegateTextA (rss_item, model, index, parentItem) |
1039 | { |
1040 | var component; |
1041 | var sprite; |
1042 | - component = Qt.createComponent("./ArticleTextA.qml"); |
1043 | - sprite = component.createObject(rss_item_delegate, {"rss_item": rss_item, "rss_model": model, "model_index": index}); |
1044 | + component = Qt.createComponent("./article_items/ArticleTextA.qml"); |
1045 | + sprite = component.createObject(parentItem, {"rss_item": rss_item, "rss_model": model, "model_index": index}); |
1046 | // console.log("delegate CCCCC") |
1047 | |
1048 | if (sprite == null) { |
1049 | @@ -127,12 +105,12 @@ |
1050 | return sprite |
1051 | } |
1052 | |
1053 | -function delegateTextB (rss_item, model, index) |
1054 | +function delegateTextB (rss_item, model, index, parentItem) |
1055 | { |
1056 | var component; |
1057 | var sprite; |
1058 | - component = Qt.createComponent("./ArticleTextB.qml"); |
1059 | - sprite = component.createObject(rss_item_delegate, {"rss_item": rss_item, "rss_model": model, "model_index": index}); |
1060 | + component = Qt.createComponent("./article_items/ArticleTextB.qml"); |
1061 | + sprite = component.createObject(parentItem, {"rss_item": rss_item, "rss_model": model, "model_index": index}); |
1062 | // console.log("delegate CCCCC") |
1063 | |
1064 | if (sprite == null) { |
1065 | @@ -143,12 +121,12 @@ |
1066 | return sprite |
1067 | } |
1068 | |
1069 | -function delegateFullImg (rss_item, imageArray, model, index) |
1070 | +function delegateFullImg (rss_item, imageArray, model, index, parentItem) |
1071 | { |
1072 | var component; |
1073 | var sprite; |
1074 | - component = Qt.createComponent("./ArticleFullImg.qml"); |
1075 | - sprite = component.createObject(rss_item_delegate, {"rss_item": rss_item, "imageArray": imageArray, "rss_model": model, "model_index": index}); |
1076 | + component = Qt.createComponent("./article_items/ArticleFullImg.qml"); |
1077 | + sprite = component.createObject(parentItem, {"rss_item": rss_item, "imageArray": imageArray, "rss_model": model, "model_index": index}); |
1078 | // console.log("delegate DDDDD") |
1079 | |
1080 | if (sprite == null) { |
1081 | @@ -159,12 +137,12 @@ |
1082 | return sprite |
1083 | } |
1084 | |
1085 | -function delegateTwoImgA (rss_item, imageArray, model, index) |
1086 | +function delegateTwoImgA (rss_item, imageArray, model, index, parentItem) |
1087 | { |
1088 | var component; |
1089 | var sprite; |
1090 | - component = Qt.createComponent("./ArticleTwoImgA.qml"); |
1091 | - sprite = component.createObject(rss_item_delegate, {"rss_item": rss_item, "imageArray": imageArray, "rss_model": model, "model_index": index}); |
1092 | + component = Qt.createComponent("./article_items/ArticleTwoImgA.qml"); |
1093 | + sprite = component.createObject(parentItem, {"rss_item": rss_item, "imageArray": imageArray, "rss_model": model, "model_index": index}); |
1094 | |
1095 | if (sprite == null) { |
1096 | // Error Handling |
1097 | |
1098 | === added directory 'article_items' |
1099 | === added file 'article_items/ArticleFullImg.qml' |
1100 | --- article_items/ArticleFullImg.qml 1970-01-01 00:00:00 +0000 |
1101 | +++ article_items/ArticleFullImg.qml 2013-08-03 10:10:38 +0000 |
1102 | @@ -0,0 +1,156 @@ |
1103 | +import QtQuick 2.0 |
1104 | +import Ubuntu.Components 0.1 |
1105 | +import Ubuntu.Components.ListItems 0.1 as ListItem |
1106 | +import "../dateutils.js" as DateUtils |
1107 | + |
1108 | +UbuntuShape |
1109 | +{ |
1110 | + id: articleFullImg |
1111 | + width: units.gu(24) |
1112 | + height: units.gu(19) |
1113 | + radius: "medium" |
1114 | + // anchors.fill: parent |
1115 | + property variant rss_item |
1116 | + property variant imageArray: [] |
1117 | + property variant rss_model |
1118 | + property int model_index |
1119 | + |
1120 | + image: Image { |
1121 | + id: pic |
1122 | + width: articleFullImg.width |
1123 | +// anchors.top: articleFullImg.top |
1124 | + fillMode: Image.PreserveAspectCrop |
1125 | + source: imageArray[0] |
1126 | + } |
1127 | + |
1128 | + Rectangle |
1129 | + { |
1130 | + id: rec_label_bg |
1131 | + color: "black" |
1132 | + anchors.top: content.top |
1133 | + anchors.bottom: content.bottom |
1134 | + width: parent.width |
1135 | + opacity: 0.7 |
1136 | + } |
1137 | + |
1138 | + Column |
1139 | + { |
1140 | + id: content |
1141 | + anchors.bottom: parent.bottom |
1142 | + anchors.bottomMargin: units.gu(1) |
1143 | + anchors.horizontalCenter: parent.horizontalCenter |
1144 | + width: parent.width - units.gu(1) |
1145 | + spacing: units.gu(1) |
1146 | + |
1147 | + Label |
1148 | + { |
1149 | + id: label_time |
1150 | + text: DateUtils.formatRelativeTime(i18n, rss_item.pubdate) |
1151 | + fontSize: "small" |
1152 | + } |
1153 | + |
1154 | + Label |
1155 | + { |
1156 | + id: label_title |
1157 | + text: rss_item.title |
1158 | + width: parent.width |
1159 | + wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1160 | + // color: "white" |
1161 | + fontSize: "medium" |
1162 | + textFormat: Text.StyledText |
1163 | + font.bold: true |
1164 | + } |
1165 | + |
1166 | + Label |
1167 | + { |
1168 | + id: label_feedname |
1169 | + text: rss_item.feed_name |
1170 | + fontSize: "small" |
1171 | + width: parent.width |
1172 | + wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1173 | + } |
1174 | + } |
1175 | + |
1176 | + MouseArea |
1177 | + { |
1178 | + anchors.fill: parent |
1179 | + |
1180 | + onClicked: |
1181 | + { |
1182 | + mainView.toRssPage(rss_model, model_index) ; |
1183 | + } |
1184 | + } |
1185 | +} |
1186 | + |
1187 | +//Column { |
1188 | +// width: units.gu(26) |
1189 | +// height: units.gu(20) |
1190 | +// // anchors.fill: parent |
1191 | +// property variant rss_item |
1192 | +// property variant imageArray: [] |
1193 | +// property variant rss_model |
1194 | +// property int model_index |
1195 | + |
1196 | +// // Row |
1197 | +// // { |
1198 | +// // spacing: units.gu(1) |
1199 | +// // anchors.fill: parent |
1200 | +// //// layoutDirection: Qt.RightToLeft |
1201 | + |
1202 | +// UbuntuShape |
1203 | +// { |
1204 | +// id: u_pic |
1205 | +// width: units.gu(24) |
1206 | +// height: units.gu(17) |
1207 | +// image: Image { |
1208 | +// id: pic |
1209 | +// width: units.gu(24) |
1210 | +// fillMode: Image.PreserveAspectCrop |
1211 | +// source: imageArray[0] |
1212 | +// } |
1213 | + |
1214 | +// Rectangle |
1215 | +// { |
1216 | +// id: rec_label_bg |
1217 | +//// color: "black" |
1218 | +// anchors.top: label_title.top |
1219 | +// anchors.bottom: label_title.bottom |
1220 | +// width: parent.width |
1221 | +// opacity: 0.5 |
1222 | +// } |
1223 | + |
1224 | +// Label |
1225 | +// { |
1226 | +// id: label_title |
1227 | +// text: rss_item.title |
1228 | +// anchors.bottom: parent.bottom |
1229 | +// anchors.bottomMargin: units.gu(1) |
1230 | +// anchors.horizontalCenter: parent.horizontalCenter |
1231 | +// width: parent.width - units.gu(1) |
1232 | +// wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1233 | +//// color: "white" |
1234 | +// fontSize: "medium" |
1235 | +// textFormat: Text.StyledText |
1236 | +// } |
1237 | + |
1238 | +// MouseArea |
1239 | +// { |
1240 | +// anchors.fill: parent |
1241 | + |
1242 | +// onClicked: |
1243 | +// { |
1244 | +// mainView.toRssPage(rss_model, model_index) ; |
1245 | +// } |
1246 | +// } |
1247 | +// } |
1248 | + |
1249 | +// Label |
1250 | +// { |
1251 | +// id: label_time |
1252 | +// text: DateUtils.formatRelativeTime(i18n, rss_item.pubdate) |
1253 | +//// color: "black" |
1254 | +// fontSize: "medium" |
1255 | +// } |
1256 | + |
1257 | +// // } |
1258 | +//} |
1259 | |
1260 | === added file 'article_items/ArticleOneImgA.qml' |
1261 | --- article_items/ArticleOneImgA.qml 1970-01-01 00:00:00 +0000 |
1262 | +++ article_items/ArticleOneImgA.qml 2013-08-03 10:10:38 +0000 |
1263 | @@ -0,0 +1,153 @@ |
1264 | +import QtQuick 2.0 |
1265 | +import Ubuntu.Components 0.1 |
1266 | +import Ubuntu.Components.ListItems 0.1 as ListItem |
1267 | +import "../dateutils.js" as DateUtils |
1268 | + |
1269 | +UbuntuShape |
1270 | +{ |
1271 | + width: units.gu(20) |
1272 | + height: content.height + units.gu(1.5) |
1273 | + radius: "medium" |
1274 | + color: "#3D3028" |
1275 | + |
1276 | + property variant rss_item |
1277 | + property variant imageArray: [] |
1278 | + property variant rss_model |
1279 | + property int model_index |
1280 | + |
1281 | + Column |
1282 | + { |
1283 | + id: content |
1284 | + anchors{ left: parent.left; right: parent.right } |
1285 | + spacing: units.gu(1) |
1286 | + |
1287 | + UbuntuShape |
1288 | + { |
1289 | + id: u_pic |
1290 | + width: parent.width |
1291 | + height: pic.height > units.gu(12) ? pic.height : units.gu(12) |
1292 | + radius: "medium" |
1293 | + image: Image { |
1294 | + id: pic |
1295 | + width: u_pic.width |
1296 | + fillMode: Image.PreserveAspectFit |
1297 | + source: imageArray[0] |
1298 | + } |
1299 | + } |
1300 | + |
1301 | + Column |
1302 | + { |
1303 | + anchors{ left: parent.left; right: parent.right; margins: units.gu(2) } |
1304 | + spacing: units.gu(1) |
1305 | + |
1306 | + Label |
1307 | + { |
1308 | + id: label_time |
1309 | + text: DateUtils.formatRelativeTime(i18n, rss_item.pubdate) |
1310 | + fontSize: "small" |
1311 | + // horizontalAlignment: Text.AlignRight |
1312 | + width: parent.width |
1313 | + } |
1314 | + |
1315 | + Label |
1316 | + { |
1317 | + id: label_title |
1318 | + text: rss_item.title |
1319 | + // anchors.horizontalCenter: parent.horizontalCenter |
1320 | + width: parent.width |
1321 | + wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1322 | + fontSize: "medium" |
1323 | + textFormat: Text.PlainText |
1324 | + // horizontalAlignment: Text.AlignRight |
1325 | + font.bold: true |
1326 | + } |
1327 | + |
1328 | + Label |
1329 | + { |
1330 | + id: label_feedname |
1331 | + text: rss_item.feed_name |
1332 | + fontSize: "small" |
1333 | + width: parent.width |
1334 | + wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1335 | + } |
1336 | + } |
1337 | + } |
1338 | + |
1339 | + MouseArea |
1340 | + { |
1341 | + anchors.fill: parent |
1342 | + |
1343 | + onClicked: |
1344 | + { |
1345 | + mainView.toRssPage(rss_model, model_index) ; |
1346 | + } |
1347 | + } |
1348 | +} |
1349 | + |
1350 | +//Column { |
1351 | +// id: delegate_item |
1352 | +// width: units.gu(34) |
1353 | +//// height: units.gu(16) |
1354 | +//// anchors.fill: parent |
1355 | +// property variant rss_item |
1356 | +// property variant imageArray: [] |
1357 | +// property variant rss_model |
1358 | +// property int model_index |
1359 | + |
1360 | +// Row |
1361 | +// { |
1362 | +// id: row |
1363 | +// spacing: units.gu(1) |
1364 | +//// anchors.fill: parent |
1365 | + |
1366 | +// Label |
1367 | +// { |
1368 | +// id: label_title |
1369 | +// text: rss_item.title |
1370 | +//// anchors.horizontalCenter: parent.horizontalCenter |
1371 | +// width: units.gu(14) |
1372 | +// wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1373 | +//// color: "black" |
1374 | +// fontSize: "medium" |
1375 | +// textFormat: Text.PlainText |
1376 | +// horizontalAlignment: Text.AlignRight |
1377 | + |
1378 | + |
1379 | +// } |
1380 | + |
1381 | +// UbuntuShape |
1382 | +// { |
1383 | +// id: u_pic |
1384 | +// width: units.gu(18) |
1385 | +// height: pic.height |
1386 | +// image: Image { |
1387 | +// id: pic |
1388 | +// width: units.gu(18) |
1389 | +// fillMode: Image.PreserveAspectFit |
1390 | +// source: imageArray[0] |
1391 | +//// { |
1392 | +//// if (imageArray == 0) |
1393 | +//// { |
1394 | +//// label_title.width = units.gu(30) |
1395 | +//// label_title.fontSize = "large" |
1396 | +//// return "" |
1397 | +//// } |
1398 | +//// else if (imageArray.length > 0) |
1399 | +//// return imageArray[0] |
1400 | +//// } |
1401 | +// } |
1402 | +// } |
1403 | + |
1404 | + |
1405 | +// } |
1406 | + |
1407 | +// Label |
1408 | +// { |
1409 | +// id: label_time |
1410 | +// text: DateUtils.formatRelativeTime(i18n, rss_item.pubdate) |
1411 | +//// color: "black" |
1412 | +// fontSize: "medium" |
1413 | +// horizontalAlignment: Text.AlignRight |
1414 | +// width: parent.width |
1415 | +// } |
1416 | +//} |
1417 | |
1418 | === added file 'article_items/ArticleOneImgB.qml' |
1419 | --- article_items/ArticleOneImgB.qml 1970-01-01 00:00:00 +0000 |
1420 | +++ article_items/ArticleOneImgB.qml 2013-08-03 10:10:38 +0000 |
1421 | @@ -0,0 +1,180 @@ |
1422 | +import QtQuick 2.0 |
1423 | +import Ubuntu.Components 0.1 |
1424 | +import Ubuntu.Components.ListItems 0.1 as ListItem |
1425 | +import "../dateutils.js" as DateUtils |
1426 | + |
1427 | +UbuntuShape |
1428 | +{ |
1429 | + width: units.gu(20) |
1430 | + height: content.height + units.gu(1.5) |
1431 | + radius: "medium" |
1432 | + color: "#3D3028" |
1433 | + |
1434 | + property variant rss_item |
1435 | + property variant imageArray: [] |
1436 | + property variant rss_model |
1437 | + property int model_index |
1438 | + |
1439 | + Column |
1440 | + { |
1441 | + id: content |
1442 | + anchors{ left: parent.left; right: parent.right; bottom: parent.bottom } |
1443 | + spacing: units.gu(1) |
1444 | + |
1445 | + Column |
1446 | + { |
1447 | + anchors{ left: parent.left; right: parent.right; margins: units.gu(2) } |
1448 | + spacing: units.gu(1) |
1449 | + |
1450 | + Label |
1451 | + { |
1452 | + id: label_time |
1453 | + text: DateUtils.formatRelativeTime(i18n, rss_item.pubdate) |
1454 | + fontSize: "small" |
1455 | + // horizontalAlignment: Text.AlignRight |
1456 | + width: parent.width |
1457 | + } |
1458 | + |
1459 | + Label |
1460 | + { |
1461 | + id: label_title |
1462 | + text: rss_item.title |
1463 | + // anchors.horizontalCenter: parent.horizontalCenter |
1464 | + width: parent.width |
1465 | + wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1466 | + fontSize: "medium" |
1467 | + textFormat: Text.PlainText |
1468 | + // horizontalAlignment: Text.AlignRight |
1469 | + font.bold: true |
1470 | + } |
1471 | + |
1472 | + Label |
1473 | + { |
1474 | + id: label_feedname |
1475 | + text: rss_item.feed_name |
1476 | + fontSize: "small" |
1477 | + width: parent.width |
1478 | + wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1479 | + } |
1480 | + } |
1481 | + |
1482 | + UbuntuShape |
1483 | + { |
1484 | + id: u_pic |
1485 | + width: parent.width |
1486 | + height: pic.height > units.gu(12) ? pic.height : units.gu(12) |
1487 | + radius: "medium" |
1488 | + image: Image { |
1489 | + id: pic |
1490 | + width: u_pic.width |
1491 | + fillMode: Image.PreserveAspectFit |
1492 | + source: imageArray[0] |
1493 | + } |
1494 | + } |
1495 | + } |
1496 | + |
1497 | + MouseArea |
1498 | + { |
1499 | + anchors.fill: parent |
1500 | + |
1501 | + onClicked: |
1502 | + { |
1503 | + mainView.toRssPage(rss_model, model_index) ; |
1504 | + } |
1505 | + } |
1506 | +} |
1507 | + |
1508 | +//Column { |
1509 | +// id: delegate_item |
1510 | +// width: units.gu(34) |
1511 | +//// height: units.gu(16) |
1512 | +//// anchors.fill: parent |
1513 | +// property variant rss_item |
1514 | +// property variant imageArray: [] |
1515 | +// property variant rss_model |
1516 | +// property int model_index |
1517 | + |
1518 | +// Row |
1519 | +// { |
1520 | +// id: row |
1521 | +// spacing: units.gu(1) |
1522 | +//// anchors.fill: parent |
1523 | +//// layoutDirection: Qt.RightToLeft |
1524 | + |
1525 | + |
1526 | + |
1527 | +// UbuntuShape |
1528 | +// { |
1529 | +// id: u_pic |
1530 | +// width: units.gu(18) |
1531 | +// height: pic.height |
1532 | +// image: Image { |
1533 | +// id: pic |
1534 | +// width: units.gu(18) |
1535 | +// fillMode: Image.PreserveAspectFit |
1536 | +// source: imageArray[0] |
1537 | +//// { |
1538 | +//// if (imageArray == 0) |
1539 | +//// { |
1540 | +//// label_title.width = units.gu(30) |
1541 | +//// label_title.fontSize = "large" |
1542 | +//// return "" |
1543 | +//// } |
1544 | +//// else if (imageArray.length > 0) |
1545 | +//// return imageArray[0] |
1546 | +//// } |
1547 | +// } |
1548 | + |
1549 | +// MouseArea |
1550 | +// { |
1551 | +// x:0; y:0 |
1552 | +// width: delegate_item.width |
1553 | +// height: delegate_item.height |
1554 | + |
1555 | +// onClicked: |
1556 | +// { |
1557 | +// mainView.toRssPage(rss_model, model_index) ; |
1558 | +// } |
1559 | +// } |
1560 | +// } |
1561 | + |
1562 | +// Label |
1563 | +// { |
1564 | +// id: label_title |
1565 | +// text: rss_item.title |
1566 | +//// anchors.horizontalCenter: parent.horizontalCenter |
1567 | +// width: units.gu(14) |
1568 | +// wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1569 | +//// color: "black" |
1570 | +// fontSize: "medium" |
1571 | +// textFormat: Text.StyledText |
1572 | +// } |
1573 | + |
1574 | +//// Image { |
1575 | +//// id: pic |
1576 | +//// width: units.gu(18) |
1577 | +//// fillMode: Image.PreserveAspectFit |
1578 | +//// source: imageArray[0] |
1579 | +//// { |
1580 | +//// if (imageArray == undefined) |
1581 | +//// { |
1582 | +//// return "" |
1583 | +//// } |
1584 | +//// else if (imageArray.length > 0) |
1585 | +//// return imageArray[0] |
1586 | +////// else |
1587 | +////// return "" |
1588 | +//// } |
1589 | +//// anchors.centerIn: parent |
1590 | +//// anchors.verticalCenter: parent.verticalCenter |
1591 | +//// } |
1592 | +// } |
1593 | + |
1594 | +// Label |
1595 | +// { |
1596 | +// id: label_time |
1597 | +// text: DateUtils.formatRelativeTime(i18n, rss_item.pubdate) |
1598 | +//// color: "black" |
1599 | +// fontSize: "medium" |
1600 | +// } |
1601 | +//} |
1602 | |
1603 | === added file 'article_items/ArticleTextA.qml' |
1604 | --- article_items/ArticleTextA.qml 1970-01-01 00:00:00 +0000 |
1605 | +++ article_items/ArticleTextA.qml 2013-08-03 10:10:38 +0000 |
1606 | @@ -0,0 +1,118 @@ |
1607 | +import QtQuick 2.0 |
1608 | +import Ubuntu.Components 0.1 |
1609 | +import Ubuntu.Components.ListItems 0.1 as ListItem |
1610 | +import "../dateutils.js" as DateUtils |
1611 | + |
1612 | +UbuntuShape |
1613 | +{ |
1614 | + width: units.gu(16) |
1615 | + height: content.height + units.gu(4) |
1616 | + color: "#32222C" |
1617 | + radius: "medium" |
1618 | + |
1619 | + property variant rss_item |
1620 | + property variant imageArray: [] |
1621 | + property variant rss_model |
1622 | + property int model_index |
1623 | + |
1624 | + Column |
1625 | + { |
1626 | + id: content |
1627 | + anchors{ left: parent.left; right: parent.right; margins: units.gu(2); verticalCenter: parent.verticalCenter } |
1628 | + spacing: units.gu(1) |
1629 | + |
1630 | + Label |
1631 | + { |
1632 | + id: label_time |
1633 | + text: DateUtils.formatRelativeTime(i18n, rss_item.pubdate) |
1634 | + fontSize: "small" |
1635 | + width: parent.width |
1636 | + wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1637 | + } |
1638 | + |
1639 | + Label |
1640 | + { |
1641 | + id: label_title |
1642 | + text: rss_item.title |
1643 | + width: parent.width |
1644 | + wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1645 | + fontSize: "medium" |
1646 | + textFormat: Text.PlainText |
1647 | + font.bold: true |
1648 | + |
1649 | + } |
1650 | + |
1651 | + Label |
1652 | + { |
1653 | + id: label_feedname |
1654 | + text: rss_item.feed_name |
1655 | + fontSize: "small" |
1656 | + width: parent.width |
1657 | + wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1658 | + } |
1659 | + } |
1660 | + |
1661 | + MouseArea |
1662 | + { |
1663 | + anchors.fill: parent |
1664 | + |
1665 | + onClicked: |
1666 | + { |
1667 | + mainView.toRssPage(rss_model, model_index) ; |
1668 | + } |
1669 | + } |
1670 | +} |
1671 | + |
1672 | +//Column { |
1673 | +// width: units.gu(30) |
1674 | +//// height: units.gu(15) |
1675 | +//// anchors.fill: parent |
1676 | +// property variant rss_item |
1677 | +// property variant imageArray: [] |
1678 | +// property variant rss_model |
1679 | +// property int model_index |
1680 | + |
1681 | +//// Row |
1682 | +//// { |
1683 | +// spacing: units.gu(1) |
1684 | +//// anchors.fill: parent |
1685 | + |
1686 | +// Label |
1687 | +// { |
1688 | +// id: label_title |
1689 | +// text: rss_item.title |
1690 | +//// anchors.horizontalCenter: parent.horizontalCenter |
1691 | +// width: units.gu(30) |
1692 | +// wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1693 | +//// color: "black" |
1694 | +// fontSize: "large" |
1695 | +// textFormat: Text.PlainText |
1696 | + |
1697 | +// MouseArea |
1698 | +// { |
1699 | +// anchors.fill: parent |
1700 | + |
1701 | +// onClicked: |
1702 | +// { |
1703 | +// mainView.toRssPage(rss_model, model_index) ; |
1704 | +// } |
1705 | +// } |
1706 | +// } |
1707 | +//// } |
1708 | + |
1709 | +// Label |
1710 | +// { |
1711 | +// id: label_time |
1712 | +// text: DateUtils.formatRelativeTime(i18n, rss_item.pubdate) |
1713 | +//// color: "black" |
1714 | +// fontSize: "medium" |
1715 | +// width: parent.width |
1716 | +// wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1717 | +// } |
1718 | + |
1719 | +// Item |
1720 | +// { |
1721 | +// width: parent.width |
1722 | +// height: units.gu(2) |
1723 | +// } |
1724 | +//} |
1725 | |
1726 | === added file 'article_items/ArticleTextB.qml' |
1727 | --- article_items/ArticleTextB.qml 1970-01-01 00:00:00 +0000 |
1728 | +++ article_items/ArticleTextB.qml 2013-08-03 10:10:38 +0000 |
1729 | @@ -0,0 +1,121 @@ |
1730 | +import QtQuick 2.0 |
1731 | +import Ubuntu.Components 0.1 |
1732 | +import Ubuntu.Components.ListItems 0.1 as ListItem |
1733 | +import "../dateutils.js" as DateUtils |
1734 | + |
1735 | +UbuntuShape |
1736 | +{ |
1737 | + width: units.gu(18) |
1738 | + height: content.height + units.gu(4) |
1739 | + color: "#32222C" |
1740 | + radius: "medium" |
1741 | + |
1742 | + property variant rss_item |
1743 | + property variant imageArray: [] |
1744 | + property variant rss_model |
1745 | + property int model_index |
1746 | + |
1747 | + Column |
1748 | + { |
1749 | + id: content |
1750 | + anchors{ left: parent.left; right: parent.right; margins: units.gu(2); verticalCenter: parent.verticalCenter } |
1751 | + spacing: units.gu(1) |
1752 | + |
1753 | + Label |
1754 | + { |
1755 | + id: label_time |
1756 | + text: DateUtils.formatRelativeTime(i18n, rss_item.pubdate) |
1757 | + fontSize: "small" |
1758 | + width: parent.width |
1759 | + wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1760 | + horizontalAlignment: Text.AlignRight |
1761 | + } |
1762 | + |
1763 | + Label |
1764 | + { |
1765 | + id: label_title |
1766 | + text: rss_item.title |
1767 | + width: parent.width |
1768 | + wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1769 | + fontSize: "medium" |
1770 | + textFormat: Text.PlainText |
1771 | + font.bold: true |
1772 | + horizontalAlignment: Text.AlignRight |
1773 | + } |
1774 | + |
1775 | + Label |
1776 | + { |
1777 | + id: label_feedname |
1778 | + text: rss_item.feed_name |
1779 | + fontSize: "small" |
1780 | + width: parent.width |
1781 | + wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1782 | + horizontalAlignment: Text.AlignRight |
1783 | + } |
1784 | + } |
1785 | + |
1786 | + MouseArea |
1787 | + { |
1788 | + anchors.fill: parent |
1789 | + |
1790 | + onClicked: |
1791 | + { |
1792 | + mainView.toRssPage(rss_model, model_index) ; |
1793 | + } |
1794 | + } |
1795 | +} |
1796 | +//Column { |
1797 | +// width: units.gu(30) |
1798 | +//// height: units.gu(15) |
1799 | +//// anchors.fill: parent |
1800 | +// property variant rss_item |
1801 | +// property variant imageArray: [] |
1802 | +// property variant rss_model |
1803 | +// property int model_index |
1804 | + |
1805 | +//// Row |
1806 | +//// { |
1807 | +// spacing: units.gu(1) |
1808 | +//// anchors.fill: parent |
1809 | + |
1810 | +// Label |
1811 | +// { |
1812 | +// id: label_title |
1813 | +// text: rss_item.title |
1814 | +//// anchors.horizontalCenter: parent.horizontalCenter |
1815 | +// width: units.gu(30) |
1816 | +// wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1817 | +//// color: "black" |
1818 | +// fontSize: "large" |
1819 | +// textFormat: Text.PlainText |
1820 | +// horizontalAlignment: Text.AlignRight |
1821 | + |
1822 | +// MouseArea |
1823 | +// { |
1824 | +// anchors.fill: parent |
1825 | + |
1826 | +// onClicked: |
1827 | +// { |
1828 | +// mainView.toRssPage(rss_model, model_index) ; |
1829 | +// } |
1830 | +// } |
1831 | +// } |
1832 | +//// } |
1833 | + |
1834 | +// Label |
1835 | +// { |
1836 | +// id: label_time |
1837 | +// text: DateUtils.formatRelativeTime(i18n, rss_item.pubdate) |
1838 | +//// color: "black" |
1839 | +// fontSize: "medium" |
1840 | +// horizontalAlignment: Text.AlignRight |
1841 | +// width: parent.width |
1842 | +// wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1843 | +// } |
1844 | + |
1845 | +// Item |
1846 | +// { |
1847 | +// width: parent.width |
1848 | +// height: units.gu(2) |
1849 | +// } |
1850 | +//} |
1851 | |
1852 | === added file 'article_items/ArticleTwoImgA.qml' |
1853 | --- article_items/ArticleTwoImgA.qml 1970-01-01 00:00:00 +0000 |
1854 | +++ article_items/ArticleTwoImgA.qml 2013-08-03 10:10:38 +0000 |
1855 | @@ -0,0 +1,256 @@ |
1856 | +import QtQuick 2.0 |
1857 | +import Ubuntu.Components 0.1 |
1858 | +import Ubuntu.Components.ListItems 0.1 as ListItem |
1859 | +import "../dateutils.js" as DateUtils |
1860 | + |
1861 | +UbuntuShape |
1862 | +{ |
1863 | + width: units.gu(24) |
1864 | + height: content.height + units.gu(1.5) |
1865 | + radius: "medium" |
1866 | + color: "#3D3028" |
1867 | + |
1868 | + property variant rss_item |
1869 | + property variant imageArray: [] |
1870 | + property variant rss_model |
1871 | + property int model_index |
1872 | + |
1873 | + Column |
1874 | + { |
1875 | + id: content |
1876 | + anchors{ left: parent.left; right: parent.right } |
1877 | + spacing: units.gu(1) |
1878 | + |
1879 | + Row |
1880 | + { |
1881 | +// anchors{ left: parent.left; right: parent.right } |
1882 | + height: u_pic.height > u_pic1.height ? u_pic.height : u_pic1.height |
1883 | + |
1884 | + UbuntuShape |
1885 | + { |
1886 | + id: u_pic |
1887 | + width: content.width / 2 |
1888 | + height: pic.height > units.gu(8) ? pic.height : units.gu(8) |
1889 | + radius: "medium" |
1890 | + image: Image { |
1891 | + id: pic |
1892 | + width: u_pic.width |
1893 | + fillMode: Image.PreserveAspectFit |
1894 | + source: imageArray[0] |
1895 | + } |
1896 | + } |
1897 | + |
1898 | + UbuntuShape |
1899 | + { |
1900 | + id: u_pic1 |
1901 | + width: content.width / 2 |
1902 | + height: pic1.height > units.gu(8) ? pic1.height : units.gu(8) |
1903 | + radius: "medium" |
1904 | + image: Image { |
1905 | + id: pic1 |
1906 | + width: u_pic1.width |
1907 | + fillMode: Image.PreserveAspectFit |
1908 | + source: imageArray[1] |
1909 | + } |
1910 | + } |
1911 | + } |
1912 | + |
1913 | + Column |
1914 | + { |
1915 | + anchors{ left: parent.left; right: parent.right; margins: units.gu(2) } |
1916 | + spacing: units.gu(1) |
1917 | + |
1918 | + Label |
1919 | + { |
1920 | + id: label_time |
1921 | + text: DateUtils.formatRelativeTime(i18n, rss_item.pubdate) |
1922 | + fontSize: "small" |
1923 | + // horizontalAlignment: Text.AlignRight |
1924 | + width: parent.width |
1925 | + } |
1926 | + |
1927 | + Label |
1928 | + { |
1929 | + id: label_title |
1930 | + text: rss_item.title |
1931 | + // anchors.horizontalCenter: parent.horizontalCenter |
1932 | + width: parent.width |
1933 | + wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1934 | + fontSize: "medium" |
1935 | + textFormat: Text.PlainText |
1936 | + // horizontalAlignment: Text.AlignRight |
1937 | + font.bold: true |
1938 | + } |
1939 | + |
1940 | + Label |
1941 | + { |
1942 | + id: label_feedname |
1943 | + text: rss_item.feed_name |
1944 | + fontSize: "small" |
1945 | + width: parent.width |
1946 | + wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1947 | + } |
1948 | + } |
1949 | + } |
1950 | + |
1951 | + MouseArea |
1952 | + { |
1953 | + anchors.fill: parent |
1954 | + |
1955 | + onClicked: |
1956 | + { |
1957 | + mainView.toRssPage(rss_model, model_index) ; |
1958 | + } |
1959 | + } |
1960 | +} |
1961 | + |
1962 | +//Column { |
1963 | +// id: delegate_item |
1964 | +// width: units.gu(34) |
1965 | +//// height: units.gu(16) |
1966 | +//// anchors.fill: parent |
1967 | +// property variant rss_item |
1968 | +// property variant imageArray: [] |
1969 | +// property variant rss_model |
1970 | +// property int model_index |
1971 | + |
1972 | +// Row |
1973 | +// { |
1974 | +// id: row |
1975 | +// spacing: units.gu(1) |
1976 | +//// anchors.fill: parent |
1977 | + |
1978 | +// Label |
1979 | +// { |
1980 | +// id: label_title |
1981 | +// text: rss_item.title |
1982 | +//// anchors.horizontalCenter: parent.horizontalCenter |
1983 | +// width: units.gu(14) |
1984 | +// wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
1985 | +//// color: "black" |
1986 | +// fontSize: "medium" |
1987 | +// textFormat: Text.PlainText |
1988 | +// horizontalAlignment: Text.AlignRight |
1989 | + |
1990 | + |
1991 | +// } |
1992 | + |
1993 | +// UbuntuShape |
1994 | +// { |
1995 | +// id: u_pic |
1996 | +// width: units.gu(18) |
1997 | +// height: pic.height |
1998 | +// image: Image { |
1999 | +// id: pic |
2000 | +// width: units.gu(18) |
2001 | +// fillMode: Image.PreserveAspectFit |
2002 | +// source: imageArray[0] |
2003 | +//// { |
2004 | +//// if (imageArray == 0) |
2005 | +//// { |
2006 | +//// label_title.width = units.gu(30) |
2007 | +//// label_title.fontSize = "large" |
2008 | +//// return "" |
2009 | +//// } |
2010 | +//// else if (imageArray.length > 0) |
2011 | +//// return imageArray[0] |
2012 | +//// } |
2013 | +// } |
2014 | +// } |
2015 | + |
2016 | + |
2017 | +// } |
2018 | + |
2019 | +// Label |
2020 | +// { |
2021 | +// id: label_time |
2022 | +// text: DateUtils.formatRelativeTime(i18n, rss_item.pubdate) |
2023 | +//// color: "black" |
2024 | +// fontSize: "medium" |
2025 | +// horizontalAlignment: Text.AlignRight |
2026 | +// width: parent.width |
2027 | +// } |
2028 | +//} |
2029 | + |
2030 | + |
2031 | +//Column { |
2032 | +// id: delegate_item |
2033 | +// width: units.gu(34) |
2034 | +//// height: units.gu(30) |
2035 | +//// anchors.fill: parent |
2036 | +// property variant rss_item |
2037 | +// property variant imageArray: [] |
2038 | +// property variant rss_model |
2039 | +// property int model_index |
2040 | + |
2041 | +// Row |
2042 | +// { |
2043 | +// id: row |
2044 | +// spacing: units.gu(1) |
2045 | +//// anchors.fill: parent |
2046 | + |
2047 | +// Label |
2048 | +// { |
2049 | +// id: label_title |
2050 | +// text: rss_item.title |
2051 | +//// anchors.horizontalCenter: parent.horizontalCenter |
2052 | +// width: units.gu(14) |
2053 | +// wrapMode: Text.WrapAtWordBoundaryOrAnywhere |
2054 | +//// color: "black" |
2055 | +// fontSize: "medium" |
2056 | +// textFormat: Text.PlainText |
2057 | + |
2058 | +// MouseArea |
2059 | +// { |
2060 | +// x:0; y:0 |
2061 | +// width: delegate_item.width |
2062 | +// height: delegate_item.height |
2063 | + |
2064 | +// onClicked: |
2065 | +// { |
2066 | +// mainView.toRssPage(rss_model, model_index) ; |
2067 | +// } |
2068 | +// } |
2069 | +// } |
2070 | + |
2071 | +// Column |
2072 | +// { |
2073 | +// spacing: units.gu(1) |
2074 | + |
2075 | +// UbuntuShape |
2076 | +// { |
2077 | +// id: u_pic0 |
2078 | +// width: units.gu(15) |
2079 | +// height: pic0.height |
2080 | +// image: Image { |
2081 | +// id: pic0 |
2082 | +// width: units.gu(15) |
2083 | +// fillMode: Image.PreserveAspectFit |
2084 | +// source: imageArray[0] |
2085 | +// } |
2086 | +// } |
2087 | + |
2088 | +// UbuntuShape |
2089 | +// { |
2090 | +// id: u_pic1 |
2091 | +// width: units.gu(15) |
2092 | +// height: pic1.height |
2093 | +// image: Image { |
2094 | +// id: pic1 |
2095 | +// width: units.gu(15) |
2096 | +// fillMode: Image.PreserveAspectFit |
2097 | +// source: imageArray[1] |
2098 | +// } |
2099 | +// } |
2100 | +// } |
2101 | + |
2102 | +// } |
2103 | + |
2104 | +// Label |
2105 | +// { |
2106 | +// id: label_time |
2107 | +// text: DateUtils.formatRelativeTime(i18n, rss_item.pubdate) |
2108 | +//// color: "black" |
2109 | +// fontSize: "medium" |
2110 | +// } |
2111 | +//} |
2112 | |
2113 | === modified file 'debian/ubuntu-rssreader-app.install' |
2114 | --- debian/ubuntu-rssreader-app.install 2013-08-01 19:27:09 +0000 |
2115 | +++ debian/ubuntu-rssreader-app.install 2013-08-03 10:10:38 +0000 |
2116 | @@ -5,3 +5,4 @@ |
2117 | *.js usr/share/ubuntu-rssreader-app/ |
2118 | feeds usr/share/ubuntu-rssreader-app/ |
2119 | listview usr/share/ubuntu-rssreader-app/ |
2120 | +article_items usr/share/ubuntu-rssreader-app/ |
2121 | \ No newline at end of file |
2122 | |
2123 | === modified file 'feeds/ChooseTopicPage.qml' |
2124 | --- feeds/ChooseTopicPage.qml 2013-07-29 18:31:05 +0000 |
2125 | +++ feeds/ChooseTopicPage.qml 2013-08-03 10:10:38 +0000 |
2126 | @@ -15,6 +15,7 @@ |
2127 | |
2128 | property var feedsToAdd: null |
2129 | |
2130 | + signal feedAdded(int feedId, int topicId) |
2131 | |
2132 | tools: ToolbarItems { |
2133 | id: appendFeedTools |
2134 | @@ -124,6 +125,7 @@ |
2135 | DB.updateFeedByXml(dbResult.feedId, f.link, f.description, feedTitle) |
2136 | |
2137 | DB.addFeedTag(dbResult.feedId, tagId) |
2138 | + feedAdded(dbResult.feedId, tagId) ; |
2139 | } |
2140 | |
2141 | pageStack.pop() |
2142 | |
2143 | === modified file 'feeds/CreateTopicPage.qml' |
2144 | --- feeds/CreateTopicPage.qml 2013-07-24 17:43:11 +0000 |
2145 | +++ feeds/CreateTopicPage.qml 2013-08-03 10:10:38 +0000 |
2146 | @@ -13,6 +13,8 @@ |
2147 | visible: false |
2148 | flickable: null |
2149 | |
2150 | + signal topicAdded() |
2151 | + |
2152 | tools: ToolbarItems { |
2153 | id: createTopicTools |
2154 | |
2155 | @@ -64,6 +66,7 @@ |
2156 | } |
2157 | } |
2158 | |
2159 | + topicAdded() ; |
2160 | pageStack.pop() |
2161 | } |
2162 | } |
2163 | |
2164 | === added file 'feeds/EditFeed.qml' |
2165 | --- feeds/EditFeed.qml 1970-01-01 00:00:00 +0000 |
2166 | +++ feeds/EditFeed.qml 2013-08-03 10:10:38 +0000 |
2167 | @@ -0,0 +1,178 @@ |
2168 | +import QtQuick 2.0 |
2169 | +import Ubuntu.Components 0.1 |
2170 | +import Ubuntu.Components.ListItems 0.1 as ListItem |
2171 | +import Ubuntu.Components.Popups 0.1 |
2172 | +import Ubuntu.Layouts 0.1 |
2173 | + |
2174 | +import "../databasemodule_v2.js" as DB |
2175 | + |
2176 | +Page { |
2177 | + id: editPage |
2178 | + |
2179 | + title: i18n.tr("Edit Feed") |
2180 | + flickable: null/*content*/ |
2181 | + tools: ToolbarItems { |
2182 | + id: toolbar |
2183 | + |
2184 | + opened: true |
2185 | + locked: true |
2186 | + |
2187 | +// ToolbarButton { |
2188 | +// id: actionsButton |
2189 | +// text: i18n.tr("Reads") |
2190 | +// iconSource: Qt.resolvedUrl("avatar.png") |
2191 | +// onTriggered: ; |
2192 | +// visible: true |
2193 | +// } |
2194 | + Button |
2195 | + { |
2196 | + id: btnDelete |
2197 | + text: i18n.tr("Delete") |
2198 | + gradient: UbuntuColors.orangeGradient |
2199 | + anchors.verticalCenter: parent.verticalCenter |
2200 | + |
2201 | + onClicked: |
2202 | + { |
2203 | + DB.deleteFeed(feedId) ; |
2204 | + deleteFeed(feedId, previousTopicId) ; |
2205 | + pageStack.pop() ; |
2206 | + } |
2207 | + } |
2208 | + |
2209 | + Button |
2210 | + { |
2211 | + id: btnApply |
2212 | + text: i18n.tr("Apply") |
2213 | + gradient: UbuntuColors.orangeGradient |
2214 | + anchors.verticalCenter: parent.verticalCenter |
2215 | + |
2216 | + onClicked: |
2217 | + { |
2218 | + DB.updateFeedByUser(feedId, feedTitle, feedURL) ; |
2219 | + DB.deleteFeedTag(feedId, previousTopicId) ; |
2220 | + DB.addFeedTag(feedId, newTopicId) ; |
2221 | + apply(feedId, newTopicId, previousTopicId) ; |
2222 | + pageStack.pop() ; |
2223 | + } |
2224 | + } |
2225 | + } |
2226 | + |
2227 | + signal apply(int feedId, int newTopicId, int previousTopicId) |
2228 | + signal deleteFeed(int feedId, int topicId) |
2229 | + |
2230 | + property int feedId |
2231 | + property string feedTitle: "" |
2232 | + property string feedURL: "" |
2233 | + property int previousTopicId |
2234 | + property int newTopicId |
2235 | + property variant dbTags |
2236 | + property variant topicArray |
2237 | + |
2238 | + function setValues(feedid, title, url, pTopicId) |
2239 | + { |
2240 | + feedId = feedid ; |
2241 | + feedTitle = title ; |
2242 | + feedURL = url ; |
2243 | + previousTopicId = pTopicId ; |
2244 | + topicArray = [] ; |
2245 | + var tags = DB.loadTags() ; |
2246 | + var tArray = [] ; |
2247 | + var tagsArray = [] ; |
2248 | + var index |
2249 | + for (var i=0; i<tags.rows.length; i++) |
2250 | + { |
2251 | + if(tags.rows[i].id == previousTopicId) |
2252 | + { |
2253 | + index = i ; |
2254 | + } |
2255 | + tArray.push(tags.rows[i].name) ; |
2256 | + tagsArray.push(tags.rows[i]) ; |
2257 | + } |
2258 | + dbTags = tagsArray ; |
2259 | + topicArray = tArray ; |
2260 | + seletorTopic.selectedIndex = index ; |
2261 | + } |
2262 | + |
2263 | + function reloadPageContent() { |
2264 | + |
2265 | + } |
2266 | + |
2267 | + Flickable { |
2268 | + id: content |
2269 | + anchors { fill: parent; topMargin: units.gu(2)/*margins: units.gu(2)*/ } |
2270 | + contentHeight: contentItem.childrenRect.height |
2271 | + boundsBehavior: (contentHeight > editPage.height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds |
2272 | + |
2273 | + Column |
2274 | + { |
2275 | + anchors{ left: parent.left; right: parent.right } |
2276 | + spacing: units.gu(2) |
2277 | + |
2278 | + Row |
2279 | + { |
2280 | + anchors{ left: parent.left; right: parent.right; leftMargin: units.gu(2); rightMargin: units.gu(2) } |
2281 | + spacing: units.gu(1) |
2282 | + |
2283 | + Label |
2284 | + { |
2285 | + id: labelTitle |
2286 | + text: i18n.tr("Title: ") |
2287 | + width: units.gu(6) |
2288 | + anchors.verticalCenter: parent.verticalCenter |
2289 | + } |
2290 | + |
2291 | + TextField |
2292 | + { |
2293 | + text: feedTitle |
2294 | + width: parent.width - labelTitle.width - parent.spacing |
2295 | + anchors.verticalCenter: parent.verticalCenter |
2296 | + } |
2297 | + } |
2298 | + |
2299 | + Row |
2300 | + { |
2301 | + anchors{ left: parent.left; right: parent.right; leftMargin: units.gu(2); rightMargin: units.gu(2) } |
2302 | + spacing: units.gu(1) |
2303 | + |
2304 | + Label |
2305 | + { |
2306 | + id: labelURL |
2307 | + text: i18n.tr("URL: ") |
2308 | + width: labelTitle.width |
2309 | + anchors.verticalCenter: parent.verticalCenter |
2310 | + } |
2311 | + |
2312 | + TextField |
2313 | + { |
2314 | + text: feedURL |
2315 | + width: parent.width - labelURL.width - parent.spacing |
2316 | + anchors.verticalCenter: parent.verticalCenter |
2317 | + } |
2318 | + } |
2319 | + |
2320 | + ListItem.ValueSelector { |
2321 | + id: seletorTopic |
2322 | + text: i18n.tr("Topic: ") |
2323 | + values: topicArray == [] ? [""] : topicArray |
2324 | +// selectedIndex: 0 |
2325 | + |
2326 | + onSelectedIndexChanged: |
2327 | + { |
2328 | + var tArray = topicArray ; |
2329 | + var topicname = tArray[seletorTopic.selectedIndex] ; |
2330 | + var tags = dbTags ; |
2331 | + console.log("detail: ", JSON.stringify(tags)) ; |
2332 | + for (var i=0; i<tags.length; i++) |
2333 | + { |
2334 | + if(tags[i].name == topicname) |
2335 | + { |
2336 | + newTopicId = tags[i].id ; |
2337 | + break ; |
2338 | + } |
2339 | + } |
2340 | + console.log("new topic id: ", newTopicId) ; |
2341 | + } |
2342 | + } |
2343 | + } |
2344 | + } |
2345 | +} |
2346 | |
2347 | === added file 'feeds/FeedComponent.qml' |
2348 | --- feeds/FeedComponent.qml 1970-01-01 00:00:00 +0000 |
2349 | +++ feeds/FeedComponent.qml 2013-08-03 10:10:38 +0000 |
2350 | @@ -0,0 +1,52 @@ |
2351 | +import QtQuick 2.0 |
2352 | +import Ubuntu.Components 0.1 |
2353 | +import Ubuntu.Components.ListItems 0.1 as ListItem |
2354 | + |
2355 | +//ListItem.Standard { |
2356 | +// id: feedComponent |
2357 | +//} |
2358 | + |
2359 | +Item |
2360 | +{ |
2361 | + id: feedComponent |
2362 | + |
2363 | + property string text |
2364 | + property int feedId |
2365 | + property int topicId |
2366 | + |
2367 | + signal pressHold |
2368 | + |
2369 | + Label |
2370 | + { |
2371 | + text: feedComponent.text |
2372 | + anchors.verticalCenter: parent.verticalCenter |
2373 | + anchors.leftMargin: units.gu(3) |
2374 | + anchors.left: divider.left |
2375 | + } |
2376 | + |
2377 | + ListItem.ThinDivider |
2378 | + { |
2379 | + id: divider |
2380 | + anchors.bottom: parent.bottom |
2381 | + } |
2382 | + |
2383 | +// UbuntuShape |
2384 | +// { |
2385 | +// anchors { fill: parent; margins: units.gu(1) } |
2386 | +// gradientColor: "green" |
2387 | + |
2388 | +// Label |
2389 | +// { |
2390 | +// text: feedComponent.text + " , " + topicId |
2391 | +// } |
2392 | +// } |
2393 | + |
2394 | +// ListItem.Standard |
2395 | +// { |
2396 | +// anchors.fill: parent |
2397 | +// text: feedComponent.text |
2398 | +// removable: true |
2399 | + |
2400 | +// onPressAndHold: feedComponent.pressHold() |
2401 | +// } |
2402 | +} |
2403 | |
2404 | === added file 'feeds/TopicComponent.qml' |
2405 | --- feeds/TopicComponent.qml 1970-01-01 00:00:00 +0000 |
2406 | +++ feeds/TopicComponent.qml 2013-08-03 10:10:38 +0000 |
2407 | @@ -0,0 +1,203 @@ |
2408 | +import QtQuick 2.0 |
2409 | +import Ubuntu.Components 0.1 |
2410 | +import Ubuntu.Components.ListItems 0.1 as ListItem |
2411 | + |
2412 | +import "../databasemodule_v2.js" as DB |
2413 | + |
2414 | +ListItem.Empty { |
2415 | + id: topicComponent |
2416 | + |
2417 | + height: columnContent.height |
2418 | +// removable: true |
2419 | +// highlightWhenPressed : true |
2420 | + showDivider : true |
2421 | +// clip: true |
2422 | + |
2423 | + property bool isExpended: false |
2424 | + property string topicName |
2425 | + property int topicId |
2426 | + |
2427 | +// onClicked: isExpended = !isExpended ; |
2428 | + |
2429 | + onStateChanged: |
2430 | + { |
2431 | + if (isExpended) |
2432 | + { |
2433 | + reloadFeed() ; |
2434 | + } |
2435 | + } |
2436 | + |
2437 | + Behavior on height { |
2438 | + NumberAnimation { duration: 150; easing.type: Easing.OutQuad } |
2439 | + } |
2440 | + |
2441 | + function reloadFeed () |
2442 | + { |
2443 | +// for (var j=0; j < columnFeeds.children.length; j++) |
2444 | +// { |
2445 | +// columnFeeds.children[j].destroy() ; |
2446 | +// } |
2447 | + feedModel.clear() ; |
2448 | + var feeds_tag = DB.loadFeedsFromTag(topicId) ; |
2449 | +// var feed_array = [] ; |
2450 | + for (var i=0; i< feeds_tag.rows.length; i++) |
2451 | + { |
2452 | +// feed_array.push(feeds_tag.rows.item(i)) ; |
2453 | +// var component = Qt.createComponent("./FeedComponent.qml"); |
2454 | +// var sprite = component.createObject(columnFeeds, {"text": feeds_tag.rows[i].title}); |
2455 | + feedModel.append(feeds_tag.rows[i]) ; |
2456 | + } |
2457 | +// columnFeeds.height = columnFeeds.childrenRect.height ; |
2458 | +// return feed_array ; |
2459 | + } |
2460 | + |
2461 | + Column |
2462 | + { |
2463 | + id: columnContent |
2464 | + anchors{ left: parent.left; right: parent.right } |
2465 | + |
2466 | + ListItem.Standard |
2467 | + { |
2468 | + id: headerTopic |
2469 | + text: topicName |
2470 | + |
2471 | + onClicked: isExpended = !isExpended ; |
2472 | + } |
2473 | + |
2474 | + ListView |
2475 | + { |
2476 | + id: feedList |
2477 | + anchors{ left: parent.left; right: parent.right } |
2478 | + height: 0 |
2479 | + opacity: 0 |
2480 | + interactive: false |
2481 | + |
2482 | + Behavior on opacity { |
2483 | + PropertyAnimation { duration: 150; easing.type: Easing.OutQuad } |
2484 | + } |
2485 | + |
2486 | + model: VisualDataModel { |
2487 | + id: visualModel |
2488 | + model: ListModel { |
2489 | + id: feedModel |
2490 | + } |
2491 | + delegate: MouseArea { |
2492 | + id: delegateFeed |
2493 | + |
2494 | + property int visualIndex: VisualDataModel.itemsIndex |
2495 | + property int feedId: model.id |
2496 | + property int topicId: topicComponent.topicId |
2497 | + |
2498 | +// anchors{ left: parent.left; right: parent.right } |
2499 | + width: feedList.width |
2500 | + height: feedItem.height |
2501 | + |
2502 | + function pressHold() |
2503 | + { |
2504 | + console.log("press and hold") |
2505 | + delegateFeed.drag.target = feedItem ; |
2506 | + feedItem.opacity = 0.5 ; |
2507 | +// topicComponent.isExpended = false ; |
2508 | + topicList.collapseAll() ; |
2509 | + } |
2510 | + |
2511 | + onPressAndHold: |
2512 | + { |
2513 | + pressHold() ; |
2514 | + } |
2515 | + |
2516 | + onClicked: |
2517 | + { |
2518 | + mainView.toEditFeed(model.id, model.title, model.source, delegateFeed.topicId) ; |
2519 | + } |
2520 | + |
2521 | + onReleased: |
2522 | + { |
2523 | +// console.log("release drag") |
2524 | + feedItem.Drag.drop() ; |
2525 | + feedItem.Drag.active = false ; |
2526 | + } |
2527 | + |
2528 | + FeedComponent |
2529 | + { |
2530 | + id: feedItem |
2531 | + text: model.title |
2532 | + feedId: model.id |
2533 | + topicId: delegateFeed.topicId |
2534 | + width: parent.width |
2535 | + height: units.gu(6) |
2536 | +// removable: true |
2537 | + |
2538 | + Drag.active: delegateFeed.drag.active |
2539 | + Drag.source: delegateFeed |
2540 | + |
2541 | + onPressHold: |
2542 | + { |
2543 | + parent.pressHold() ; |
2544 | + } |
2545 | + } |
2546 | + |
2547 | + states: [ |
2548 | + State { |
2549 | + name: "draging" |
2550 | + when: feedItem.Drag.active |
2551 | + ParentChange { |
2552 | + target: feedItem |
2553 | + parent: topicManagement |
2554 | + } |
2555 | + |
2556 | + AnchorChanges { |
2557 | + target: feedItem; |
2558 | + anchors.horizontalCenter: undefined; |
2559 | + anchors.verticalCenter: undefined |
2560 | + } |
2561 | + }, |
2562 | + |
2563 | + State |
2564 | + { |
2565 | + name: "" |
2566 | + ParentChange { |
2567 | + target: feedItem |
2568 | + parent: delegateFeed |
2569 | + } |
2570 | + |
2571 | +// AnchorChanges { |
2572 | +// target: feedItem; |
2573 | +// anchors.left: delegateFeed.left |
2574 | +// anchors.top: delegateFeed.top |
2575 | +// } |
2576 | + } |
2577 | + |
2578 | + ] |
2579 | + } |
2580 | + } |
2581 | + } |
2582 | + } |
2583 | + |
2584 | + |
2585 | + |
2586 | + states: [ |
2587 | + State { |
2588 | + name: "expended" |
2589 | + when: isExpended |
2590 | + PropertyChanges |
2591 | + { |
2592 | + target: feedList |
2593 | + height: feedList.contentItem.childrenRect.height |
2594 | + opacity: 1 |
2595 | + } |
2596 | + }, |
2597 | + |
2598 | + State { |
2599 | + name: "" |
2600 | +// when: isExpended |
2601 | + PropertyChanges |
2602 | + { |
2603 | + target: feedList |
2604 | + height: 0 |
2605 | + opacity: 0 |
2606 | + } |
2607 | + } |
2608 | + ] |
2609 | +} |
2610 | + |
2611 | |
2612 | === added file 'feeds/TopicManagement.qml' |
2613 | --- feeds/TopicManagement.qml 1970-01-01 00:00:00 +0000 |
2614 | +++ feeds/TopicManagement.qml 2013-08-03 10:10:38 +0000 |
2615 | @@ -0,0 +1,262 @@ |
2616 | +import QtQuick 2.0 |
2617 | +import Ubuntu.Components 0.1 |
2618 | +import Ubuntu.Components.ListItems 0.1 as ListItem |
2619 | +import Ubuntu.Components.Popups 0.1 |
2620 | +import Ubuntu.Layouts 0.1 |
2621 | + |
2622 | +import "../databasemodule_v2.js" as DB |
2623 | + |
2624 | +Page { |
2625 | + id: topicManagement |
2626 | + |
2627 | +// width: units.gu(50) |
2628 | +// height: units.gu(75) |
2629 | + |
2630 | + title: i18n.tr("Management") |
2631 | + flickable: content |
2632 | + tools: ToolbarItems { |
2633 | + id: toolbar |
2634 | + |
2635 | + ToolbarButton { |
2636 | + id: actionsButton |
2637 | + text: i18n.tr("Add Feed") |
2638 | + iconSource: Qt.resolvedUrl("../icons_tmp/add.svg") |
2639 | + onTriggered: pageStack.push(appendFeedPage/*, {"isDirty" : true}*/) ; |
2640 | + visible: true |
2641 | + } |
2642 | + } |
2643 | + |
2644 | + Component.onCompleted: |
2645 | + { |
2646 | + reloadTopics () ; |
2647 | + } |
2648 | + |
2649 | + function reloadTopics () |
2650 | + { |
2651 | + topicModel.clear() ; |
2652 | +// for (var j=0; j < topicColumn.children.length; j++) |
2653 | +// { |
2654 | +// topicColumn.children[j].destroy() ; |
2655 | +// } |
2656 | + |
2657 | + var topics = DB.loadTags() ; |
2658 | + for (var i=0; i < topics.rows.length; i++) |
2659 | + { |
2660 | + topicModel.append( |
2661 | + { |
2662 | + "id": topics.rows[i].id |
2663 | + ,"name": topics.rows[i].name |
2664 | + }); |
2665 | + |
2666 | +// var component = Qt.createComponent("./TopicComponent.qml"); |
2667 | +// var sprite = component.createObject(topicColumn, {"topicName": topics.rows[i].name}); |
2668 | + } |
2669 | + } |
2670 | + |
2671 | + function reloadPageContent() { |
2672 | + |
2673 | + } |
2674 | + |
2675 | + Flickable { |
2676 | + id: content |
2677 | + anchors.fill: parent |
2678 | + contentHeight: contentItem.childrenRect.height |
2679 | + boundsBehavior: (contentHeight > topicManagement.height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds |
2680 | + |
2681 | + Column |
2682 | + { |
2683 | + anchors{ left: parent.left; right: parent.right } |
2684 | + |
2685 | + Item { |
2686 | + id: itemAddTopic |
2687 | + anchors{ left: parent.left; right: parent.right } |
2688 | + height: units.gu(8) |
2689 | + |
2690 | + UbuntuShape |
2691 | + { |
2692 | + id: uAddTopic |
2693 | + anchors { fill: parent; margins: units.gu(1) } |
2694 | + gradientColor: "goldenrod" |
2695 | + radius: "medium" |
2696 | + |
2697 | + Label |
2698 | + { |
2699 | + text: i18n.tr("Add a Topic") |
2700 | + fontSize: "large" |
2701 | + anchors.centerIn: parent |
2702 | + } |
2703 | + |
2704 | + MouseArea |
2705 | + { |
2706 | + id: maAddTopic |
2707 | + anchors.fill: parent |
2708 | + onClicked: pageStack.push(createTopicPage) |
2709 | + } |
2710 | + |
2711 | + states: [ |
2712 | + State { |
2713 | + name: "pressed" |
2714 | + when: maAddTopic.pressed |
2715 | + |
2716 | + PropertyChanges |
2717 | + { |
2718 | + target: uAddTopic |
2719 | + gradientColor: "grey" |
2720 | + } |
2721 | + } |
2722 | + ] |
2723 | + } |
2724 | + } |
2725 | + |
2726 | + ListView |
2727 | + { |
2728 | + id: topicList |
2729 | + anchors{ left: parent.left; right: parent.right } |
2730 | + height: contentItem.childrenRect.height |
2731 | + interactive: false |
2732 | +// clip: true |
2733 | + |
2734 | + signal collapseAllItem() |
2735 | + |
2736 | + function collapseAll() |
2737 | + { |
2738 | +// console.log("topicList length", topicList.contentItem.children.length) ; |
2739 | +// for (var j=0; j < topicList.contentItem.children.length; j++) |
2740 | +// { |
2741 | +// console.log("topicList children", topicList.contentItem.children[j]) ; |
2742 | +// topicList.contentItem.children[j].isExpended = false ; |
2743 | +// } |
2744 | + collapseAllItem() ; |
2745 | + } |
2746 | + |
2747 | + displaced: Transition { |
2748 | + NumberAnimation { properties: "x,y"; easing.type: Easing.OutQuad } |
2749 | + } |
2750 | + |
2751 | + model: VisualDataModel { |
2752 | + id: visualModel |
2753 | + model: ListModel { |
2754 | + id: topicModel |
2755 | + } |
2756 | + delegate: MouseArea { |
2757 | + id: delegateRoot |
2758 | + |
2759 | + property int visualIndex: VisualDataModel.itemsIndex |
2760 | + property alias isExpended: topicItem.isExpended |
2761 | + |
2762 | + anchors{ left: parent.left; right: parent.right } |
2763 | + height: topicItem.height |
2764 | + |
2765 | +// onPressAndHold: |
2766 | +// { |
2767 | +// delegateRoot.drag.target = icon |
2768 | +// } |
2769 | + |
2770 | + TopicComponent |
2771 | + { |
2772 | + id: topicItem |
2773 | + topicName: model.name |
2774 | + topicId: model.id |
2775 | +// isExpended: delegateRoot.isExpended |
2776 | + } |
2777 | + |
2778 | + DropArea { |
2779 | + anchors { fill: parent; margins: 0 } |
2780 | + |
2781 | + onEntered: |
2782 | + { |
2783 | +// console.log("enter", drag.source) |
2784 | + topicItem.selected = true ; |
2785 | + } |
2786 | + |
2787 | + onExited: |
2788 | + { |
2789 | +// console.log("exit", drag.source) |
2790 | + topicItem.selected = false ; |
2791 | + } |
2792 | + |
2793 | + onDropped: |
2794 | + { |
2795 | +// console.log("drop", drag.source) ; |
2796 | + topicItem.selected = false ; |
2797 | + drag.source.opacity = 0 ; |
2798 | + console.log("dropped item feed id", drag.source.feedId) ; |
2799 | + console.log("dropped item topic id", drag.source.topicId) ; |
2800 | + DB.deleteFeedTag(drag.source.feedId, drag.source.topicId) ; |
2801 | + DB.addFeedTag(drag.source.feedId, model.id) ; |
2802 | + delegateRoot.isExpended = true ; |
2803 | + } |
2804 | + } |
2805 | + |
2806 | + Connections |
2807 | + { |
2808 | + id: connTopicList |
2809 | + target: topicList |
2810 | + |
2811 | + onCollapseAllItem: |
2812 | + { |
2813 | + delegateRoot.isExpended = false ; |
2814 | + } |
2815 | + } |
2816 | + |
2817 | + Connections |
2818 | + { |
2819 | + id: connEditFeed0 |
2820 | + target: editFeed |
2821 | + |
2822 | + onApply: |
2823 | + { |
2824 | + if (model.id == newTopicId || model.id == previousTopicId) |
2825 | + { |
2826 | + topicItem.reloadFeed() ; |
2827 | + topicItem.isExpended = true ; |
2828 | + } |
2829 | + } |
2830 | + |
2831 | + onDeleteFeed: |
2832 | + { |
2833 | + if (model.id == topicId) |
2834 | + { |
2835 | + topicItem.reloadFeed() ; |
2836 | + topicItem.isExpended = true ; |
2837 | + } |
2838 | + } |
2839 | + } |
2840 | + } |
2841 | + } |
2842 | + } // listview |
2843 | + |
2844 | + } // column |
2845 | + } // flickable |
2846 | + |
2847 | + Connections |
2848 | + { |
2849 | + id: connAddTopic |
2850 | + target: createTopicPage |
2851 | + |
2852 | + onTopicAdded: |
2853 | + { |
2854 | + reloadTopics() ; |
2855 | + } |
2856 | + } |
2857 | + |
2858 | + Connections |
2859 | + { |
2860 | + id: connAddFeed |
2861 | + target: chooseTopicPage |
2862 | + |
2863 | + onFeedAdded: |
2864 | + { |
2865 | + reloadTopics() ; |
2866 | + for (var i=0; i<topicModel.count; i++) |
2867 | + { |
2868 | + if (topicModel.get(i).id == topicId) |
2869 | + { |
2870 | + topicList.currentIndex = i ; |
2871 | + topicList.currentItem.isExpended = true ; |
2872 | + } |
2873 | + } |
2874 | + } |
2875 | + } |
2876 | + |
2877 | +} |
2878 | |
2879 | === removed file 'structure.txt' |
2880 | --- structure.txt 2013-07-09 16:08:27 +0000 |
2881 | +++ structure.txt 1970-01-01 00:00:00 +0000 |
2882 | @@ -1,57 +0,0 @@ |
2883 | -how does this demo works |
2884 | - |
2885 | - |
2886 | -1. main view |
2887 | - 1.1 related file: ubuntu-rssreader-app.qml / |
2888 | - TopicTab.qml / |
2889 | - RssFeedPage.qml / |
2890 | - XmlNetwork.qml / |
2891 | - databasemodule_v2.js |
2892 | - |
2893 | - 1.2 Execution order |
2894 | - a. main view, if db is empty, add test data into db ( function mainview.component.oncompleted in line 18); |
2895 | - b. load tabs from db ( function repeater.reloadTabs() in line 36 ); |
2896 | - c. tabs will automaticly load articles from db ( function in ListColumnView.qml); |
2897 | - d. (opional) function refresh is for downloading all articles using XmlNetwork.qml ; |
2898 | - e. (opional) function toRssPage is for showing single article page using RssFeedPage.qml ; |
2899 | - |
2900 | -2. TopicTab |
2901 | - 2.1 related file: TopicTab.qml / |
2902 | - ListColumnView.qml / |
2903 | - databasemodule_v2.js |
2904 | - |
2905 | - 2.2 Execution order |
2906 | - a. get tag id and tag name from db (tag == topic) ; |
2907 | - b. load all feeds related to this tag id, store these feeds in "property variant feedArray" ; |
2908 | - c. load all articles related to these feeds in ListColumnView.qml |
2909 | - |
2910 | -3. ListColumnView |
2911 | - 3.1 related file: ListColumnDelegate.qml / |
2912 | - databasemodule_v2.js |
2913 | - |
2914 | - 3.2 Execution order |
2915 | - a. get tag id and feedArray from TopicTab ; |
2916 | - b. load related articles from db ; |
2917 | - c. put all articles data to a list model ; |
2918 | - d. show all articles in ListColumnDelegate.qml as delegate in ListColumnView ; |
2919 | - |
2920 | -4. ListColumnDelegate |
2921 | - 4.1 related file: addDelegate.js / |
2922 | - imgSeparator.js |
2923 | - |
2924 | - 4.2 Execution order |
2925 | - a. function add item, using addDelegate.js to load a random component ; |
2926 | - b. if ListColumnDelegate is full with random component, stop adding ; |
2927 | - |
2928 | -5. random components |
2929 | - 5.1 related file: Article*.qml (they are all random components) / |
2930 | - addDelegate.js |
2931 | - |
2932 | - 5.2 Execution order |
2933 | - a. generate a random number ; |
2934 | - b. choose a component base on the random number ; |
2935 | - c. (opional) user click a componet will activate (1.2.e) using model from (3.2.c) ; |
2936 | - |
2937 | -6. XmlNetwork |
2938 | - 6.1 function: |
2939 | - a. function addFeedList(feedarray) will automaticly download all feeds from feedarray then emit a signal after finished |
2940 | \ No newline at end of file |
2941 | |
2942 | === modified file 'ubuntu-rssreader-app.qml' |
2943 | --- ubuntu-rssreader-app.qml 2013-07-29 18:31:05 +0000 |
2944 | +++ ubuntu-rssreader-app.qml 2013-08-03 10:10:38 +0000 |
2945 | @@ -25,7 +25,7 @@ |
2946 | Component.onCompleted: |
2947 | { |
2948 | ////////////////////////////////////////////////////////////// below DB operation is for avoid empty db |
2949 | - // DB.dropTable() |
2950 | +// DB.dropTable() |
2951 | var feeds = DB.loadFeeds(); |
2952 | |
2953 | if (feeds.rows.length < 1) |
2954 | @@ -42,6 +42,9 @@ |
2955 | DB.addFeedTag(3, 3) ; |
2956 | refresh() ; |
2957 | } |
2958 | + |
2959 | + else repeater.reloadTabs() ; // load tabs from db |
2960 | + |
2961 | } |
2962 | |
2963 | function refresh() // download all articles |
2964 | @@ -61,6 +64,12 @@ |
2965 | pageStack.push(feed_page) |
2966 | } |
2967 | |
2968 | + function toEditFeed(feedid, title, url, pTopicId) |
2969 | + { |
2970 | + editFeed.setValues(feedid, title, url, pTopicId) ; |
2971 | + pageStack.push(editFeed) ; |
2972 | + } |
2973 | + |
2974 | PageStack { |
2975 | id: pageStack |
2976 | |
2977 | @@ -136,127 +145,84 @@ |
2978 | text: i18n.tr("Edit topics") |
2979 | iconSource: Qt.resolvedUrl("./icons_tmp/edit.svg") |
2980 | onTriggered: { |
2981 | - pageStack.push(editFeedsPage) |
2982 | - } |
2983 | - } |
2984 | - } |
2985 | - } |
2986 | - |
2987 | - /* Temporary here - TODO move to separate file. |
2988 | - */ |
2989 | - function updateFeedInfo(feedId, feedLink, responseData) { |
2990 | - var entries = responseData.feed.entries |
2991 | - var f = responseData.feed |
2992 | - |
2993 | - // TODO MB NO NEED |
2994 | - DB.updateFeedByXml(feedId, f.feedUrl === f.link ? feedLink : f.link, // Sometimes google fails and sends site link equal to feed url. |
2995 | - f.description, f.title) |
2996 | - console.log(" -------- UPDATE INFO -------- ") |
2997 | - console.log(f.title, f.link, f.feedUrl, f.description) |
2998 | - |
2999 | - DB.clearArticles(feedId) |
3000 | - |
3001 | - // TODO TEMP SLOW SOLUTION |
3002 | - // Later must replace it with adapted addArticles |
3003 | - for (var i = 0; i < entries.length; i++) { |
3004 | - var e = entries[i] |
3005 | - var dbResult = DB.addArticle(e.title, e.content, e.link, e.contentSnippet, e.publishedDate, |
3006 | - Qt.md5(e.content + e.publishedDate), feedId) |
3007 | - |
3008 | - if (dbResult.error) |
3009 | - continue |
3010 | - |
3011 | - // ------- TODO naive solution of getting image ---------- |
3012 | - var imageFound = false |
3013 | - if (e.mediaGroups) { |
3014 | - // console.log("MEDIA GROUPS FOUND") |
3015 | - var cont = e.mediaGroups[0].contents[0] |
3016 | - if (cont.type === "image/jpeg" || cont.type === "image/png" || |
3017 | - cont.type === "image/jpeg" || cont.type === "image/pjpeg" || |
3018 | - cont.type === "image/svg+xml") { |
3019 | - DB.updateArticleImage(dbResult.articleId, cont.url) |
3020 | - imageFound = true |
3021 | - } |
3022 | - } |
3023 | - |
3024 | - if (!imageFound) { |
3025 | - var image = ImageUtils.getFirstImage(e.content) |
3026 | - if (image != null) { |
3027 | - DB.updateArticleImage(dbResult.articleId, image) |
3028 | - } |
3029 | - } |
3030 | - |
3031 | - // ------------------------------------------------------- |
3032 | - } |
3033 | - } |
3034 | - |
3035 | - Page { |
3036 | +// pageStack.push(editFeedsPage) |
3037 | + pageStack.push(topicManagement) ; |
3038 | + } |
3039 | + } |
3040 | + } |
3041 | + } |
3042 | + |
3043 | + |
3044 | + |
3045 | + Page |
3046 | + { |
3047 | id: tabs |
3048 | visible: false |
3049 | - title: i18n.tr("Shorts") |
3050 | - // anchors.margins: units.gu(4) |
3051 | - |
3052 | - function reloadPageContent() { |
3053 | - |
3054 | - } |
3055 | - |
3056 | - tools: mainCommonToolbar |
3057 | - |
3058 | - Component.onCompleted: shorts_view.reload() ; |
3059 | - |
3060 | - ListColumnView |
3061 | - { |
3062 | - id: shorts_view |
3063 | - anchors.margins: units.gu(2) |
3064 | - isAll: true |
3065 | - } |
3066 | - |
3067 | - Component { |
3068 | - id: addReadsPopoverComp |
3069 | - |
3070 | - ActionSelectionPopover { |
3071 | - id: addReadsPopover |
3072 | - |
3073 | - actions: ActionList { |
3074 | - id: popoverActionsList |
3075 | - |
3076 | - Action { |
3077 | - text: i18n.tr("+ Add feeds") |
3078 | - onTriggered: { |
3079 | - /* When we want to show "Append feed" page from |
3080 | - * any page except of "Choose topic", |
3081 | - * we should clear it (mark as dirty). |
3082 | - */ |
3083 | - pageStack.push(appendFeedPage, {"isDirty" : true}) |
3084 | - } |
3085 | - } |
3086 | - |
3087 | - Action { |
3088 | - text: i18n.tr("+ New topic") |
3089 | - onTriggered: { |
3090 | - pageStack.push(createTopicPage) |
3091 | - } |
3092 | - } |
3093 | - |
3094 | - Action { |
3095 | - text: i18n.tr("Add online accounts") |
3096 | - onTriggered: { |
3097 | - console.log("NOT IMPLEMENTED") |
3098 | - } |
3099 | - } |
3100 | - |
3101 | - Action { |
3102 | - text: i18n.tr("Import subscriptions") |
3103 | - onTriggered: { |
3104 | - console.log("NOT IMPLEMENTED") |
3105 | - } |
3106 | - } |
3107 | - } // ActionList |
3108 | - } // ActionSelectionPopover |
3109 | - } // Component |
3110 | + anchors.fill: parent |
3111 | + |
3112 | + |
3113 | + Tabs { |
3114 | + id: tabstabs |
3115 | +// visible: parent.visible |
3116 | + |
3117 | + anchors.fill: parent |
3118 | + // anchors.topMargin: units.gu(3) |
3119 | + // anchors.bottomMargin: units.gu(7) |
3120 | + // title: i18n.tr("Shorts") |
3121 | + // anchors.margins: units.gu(4) |
3122 | + |
3123 | + function reloadPageContent() { |
3124 | + |
3125 | + } |
3126 | + |
3127 | + Tab { |
3128 | + objectName: "Tab0" |
3129 | + |
3130 | + title: i18n.tr("Shorts") |
3131 | + page: Page { |
3132 | + // anchors.margins: units.gu(2) |
3133 | + |
3134 | + tools: mainCommonToolbar |
3135 | + |
3136 | + Component.onCompleted: shorts_view.reload() ; |
3137 | + |
3138 | + ListColumnView |
3139 | + { |
3140 | + id: shorts_view |
3141 | + // anchors.margins: units.gu(2) |
3142 | + isAll: true |
3143 | + } |
3144 | + |
3145 | + } |
3146 | + } |
3147 | + |
3148 | + Repeater |
3149 | + { |
3150 | + id: repeater |
3151 | + model: 0 |
3152 | + TopicTab{ } |
3153 | + |
3154 | + function reloadTabs() |
3155 | + { |
3156 | + repeater.model = 0 ; |
3157 | + var tags = DB.loadTags() |
3158 | + repeater.model = tags.rows.length ; |
3159 | + for (var i=0; i< tags.rows.length; i++) |
3160 | + { |
3161 | + console.log(JSON.stringify(tags.rows.item(i))); |
3162 | + repeater.itemAt(i).title = tags.rows.item(i).name ; |
3163 | + repeater.itemAt(i).tag_id = tags.rows.item(i).id ; |
3164 | + repeater.itemAt(i).isAll = false ; |
3165 | + repeater.itemAt(i).reload() ; |
3166 | + } |
3167 | + } |
3168 | + } |
3169 | + } |
3170 | } // Page "Shorts" |
3171 | |
3172 | |
3173 | + |
3174 | + |
3175 | // ************************************************************* //////////////////////////////////// |
3176 | |
3177 | |
3178 | @@ -307,6 +273,18 @@ |
3179 | visible: false |
3180 | } |
3181 | |
3182 | + TopicManagement // by Joey |
3183 | + { |
3184 | + id: topicManagement |
3185 | + visible: false |
3186 | + } |
3187 | + |
3188 | + EditFeed // by Joey |
3189 | + { |
3190 | + id: editFeed |
3191 | + visible: false |
3192 | + } |
3193 | + |
3194 | // ************************************************************* //////////////////////////////////// |
3195 | |
3196 | FeedListPage { |
3197 | @@ -328,15 +306,122 @@ |
3198 | } |
3199 | } |
3200 | |
3201 | + Component { |
3202 | + id: addReadsPopoverComp |
3203 | + |
3204 | + ActionSelectionPopover { |
3205 | + id: addReadsPopover |
3206 | + |
3207 | + actions: ActionList { |
3208 | + id: popoverActionsList |
3209 | + |
3210 | + Action { |
3211 | + text: i18n.tr("+ Add feeds") |
3212 | + onTriggered: { |
3213 | + /* When we want to show "Append feed" page from |
3214 | + * any page except of "Choose topic", |
3215 | + * we should clear it (mark as dirty). |
3216 | + */ |
3217 | + pageStack.push(appendFeedPage, {"isDirty" : true}) |
3218 | + } |
3219 | + } |
3220 | + |
3221 | + Action { |
3222 | + text: i18n.tr("+ New topic") |
3223 | + onTriggered: { |
3224 | + pageStack.push(createTopicPage) |
3225 | + } |
3226 | + } |
3227 | + |
3228 | + Action { |
3229 | + text: i18n.tr("Add online accounts") |
3230 | + onTriggered: { |
3231 | + console.log("NOT IMPLEMENTED") |
3232 | + } |
3233 | + } |
3234 | + |
3235 | + Action { |
3236 | + text: i18n.tr("Import subscriptions") |
3237 | + onTriggered: { |
3238 | + console.log("NOT IMPLEMENTED") |
3239 | + } |
3240 | + } |
3241 | + } // ActionList |
3242 | + } // ActionSelectionPopover |
3243 | + } // Component |
3244 | + |
3245 | XmlNetwork // all download and xml parse functions here |
3246 | { |
3247 | id: xmlnetwork |
3248 | |
3249 | onDownloadFinish: |
3250 | { |
3251 | - // griddemo.reload(); |
3252 | - shorts_view.reload() ; |
3253 | - // repeater.reloadTabs() ; |
3254 | + shorts_view.reload() ; |
3255 | + repeater.reloadTabs() ; |
3256 | + } |
3257 | + } |
3258 | + |
3259 | + //////////////////////////////////////////////////////////////////////// |
3260 | + //////////// Connections for handling the add topic and add feed event |
3261 | + Connections |
3262 | + { |
3263 | + id: connAddTopic |
3264 | + target: createTopicPage |
3265 | + |
3266 | + onTopicAdded: |
3267 | + { |
3268 | + shorts_view.reload() ; |
3269 | + repeater.reloadTabs() ; |
3270 | + } |
3271 | + } |
3272 | + |
3273 | + Connections |
3274 | + { |
3275 | + id: connAddFeed |
3276 | + target: chooseTopicPage |
3277 | + |
3278 | + onFeedAdded: |
3279 | + { |
3280 | + shorts_view.reload() ; |
3281 | + repeater.reloadTabs() ; |
3282 | + } |
3283 | + } |
3284 | + |
3285 | + // Workaround for https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1201400. |
3286 | + // Inspired by the KeyboardRectangle component, originally written for the |
3287 | + // telephony application. |
3288 | + Connections { |
3289 | + target: Qt.inputMethod |
3290 | + |
3291 | + onVisibleChanged: { |
3292 | + console.log("keyboard visible: ", Qt.inputMethod.visible) |
3293 | + if (!Qt.inputMethod.visible) { |
3294 | + var focusedItem = recursiveFindFocusedItem(window); |
3295 | + if (focusedItem != null) { |
3296 | + focusedItem.focus = false; |
3297 | + } |
3298 | + } |
3299 | + } |
3300 | + |
3301 | + function recursiveFindFocusedItem(parent) { |
3302 | + if (parent.activeFocus) { |
3303 | + return parent; |
3304 | + } |
3305 | + |
3306 | + for (var i in parent.children) { |
3307 | + var child = parent.children[i]; |
3308 | + if (child.activeFocus) { |
3309 | + return child; |
3310 | + } |
3311 | + |
3312 | + var item = recursiveFindFocusedItem(child); |
3313 | + |
3314 | + if (item != null) { |
3315 | + return item; |
3316 | + } |
3317 | + } |
3318 | + |
3319 | + return null; |
3320 | } |
3321 | } |
3322 | } |