1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
import QtQuick 2.0
import Ubuntu.Components 0.1
import Ubuntu.Components.ListItems 0.1 as ListItem
import Ubuntu.Components.Popups 0.1
import "databasemodule_v2.js" as DB
import "listview"
Tab {
id: topicTab
property int topicId: -1
property bool isAll: false
property var feedArray: []
property bool isListMode: pageStack.isListView
page: isListMode ? listPage : gridPage
function reload() {
if (isListMode)
listPage.reload()
else gridPage.reload()
}
onIsListModeChanged: {
if (topicId == -1) // Ignore first undefined state.
return
console.log("onIsListModeChanged, tag ID: ", topicId)
reload()
}
ListModePage {
id: listPage
visible: isListMode
topicId: topicTab.topicId
tools: mainCommonToolbar
}
Page {
id: gridPage
/* TO RSS READER TEAM
* Guys, this looks like a bug in SDK.
* If I uncomment line below, app will become buggy
* after start (header and toolbar undefined bahavior).
* But let's go on - if after uncommenting line below
* you will comment that line
* tools: mainCommonToolbar
* in definition of listPage, you can't see toolbar anymore.
* If you didn't understand - experiment with commenting
* line where Page's tools property changes.
*/
// tools: mainCommonToolbar
visible: !isListMode
// flickable: null
function reload () {
switch (topicId) {
case -1:
break
case -2:
organicGridView.reload()
break
default:
var feedTags = DB.loadFeedsFromTag(topicId)
var feeds = []
for (var i=0; i < feedTags.rows.length; i++) {
feeds.push(feedTags.rows.item(i))
}
feedArray = feeds
organicGridView.reload()
}
}
OrganicGrid {
id: organicGridView
tag_id: topicTab.topicId
isAll: topicTab.isAll
feedArray: topicTab.feedArray
}
}
}
|