Merge lp:~dragly/ubuntu-rssreader-app/initial-design into lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk
- initial-design
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Joey Chan |
Approved revision: | 9 |
Merged at revision: | 6 |
Proposed branch: | lp:~dragly/ubuntu-rssreader-app/initial-design |
Merge into: | lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk |
Diff against target: |
606 lines (+242/-135) 9 files modified
EntryListPage.qml (+12/-28) EntryListTab.qml (+12/-0) FeedListPage.qml (+15/-9) SingleEntryPage.qml (+20/-0) TodayPage.qml (+77/-0) databasemodule.js (+47/-15) rssreader.qmlproject (+1/-1) tabshelper.js (+1/-0) ubuntu-rssreader-app.qml (+57/-82) |
To merge this branch: | bzr merge lp:~dragly/ubuntu-rssreader-app/initial-design |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Approve | |
Ubuntu Shorts Developers | Pending | ||
Review via email: mp+158862@code.launchpad.net |
Commit message
Implemented design proposal with horizontal swipes between feeds on main screen.
Description of the change
Changed the layout of the app to show feeds in tabs in the main view. Sideways scrolling changes feed. Currently no page for "all" feeds - to be added. Very hackish solution to show multiple tabs with auto-generated QML on the fly. Needs upstream fix (see bug #1124071 for details).
The layout is based on a combination of Tabs + PageStack. The topmost element of the stack is the only with tabs (to avoid confusion with the back key on lower levels).
Feed list is accessible from the toolbar icon.
Single feeds may be seen via this menu.
Single entries are shown in a separate page.
Adding feeds is reflected in updated tabs in the main view.
Updated databasemodule.js with function to read feed information. Also removed global dbResult object in favor of functions returning values/objects. (Could possibly be replaced with asynchronous callbacks, but the LocalStorage API is synchronous, so this should not result in any problems.)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
FAILED: Autolanding.
No commit message was specified in the merge proposal. Hit 'Add commit message' on the merge proposal web page or follow the link below. You can approve the merge proposal yourself to rerun.
https:/
Joey Chan (qqworini) wrote : | # |
Well, I can approve but Jenkins Bot can't :P
Svenn-Arne, pls add commit message soon
Svenn-Arne Dragly (dragly) wrote : | # |
> Well, I can approve but Jenkins Bot can't :P
>
> Svenn-Arne, pls add commit message soon
Thanks! I've added a commit message now.
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) : | # |
Preview Diff
1 | === renamed file 'NewsListPage.qml' => 'EntryListPage.qml' | |||
2 | --- NewsListPage.qml 2013-03-24 13:19:16 +0000 | |||
3 | +++ EntryListPage.qml 2013-04-15 08:44:35 +0000 | |||
4 | @@ -7,20 +7,19 @@ | |||
5 | 7 | 7 | ||
6 | 8 | import "databasemodule.js" as DB | 8 | import "databasemodule.js" as DB |
7 | 9 | 9 | ||
8 | 10 | import QtWebKit 3.0 | ||
9 | 11 | |||
10 | 12 | Page { | 10 | Page { |
11 | 13 | 11 | ||
12 | 14 | signal backRequst | 12 | signal backRequst |
13 | 13 | property string feedLink: "" | ||
14 | 15 | 14 | ||
15 | 16 | /* 1. Loading data from database by url. | 15 | /* 1. Loading data from database by url. |
16 | 17 | * 2. Appending data to ListModel for displaying. | 16 | * 2. Appending data to ListModel for displaying. |
17 | 18 | */ | 17 | */ |
18 | 19 | function loadEntriesByUrl(strUrl) { | 18 | function loadEntriesByUrl(strUrl) { |
19 | 20 | newsListModel.clear() | 19 | newsListModel.clear() |
23 | 21 | var isAll = (strUrl === "") | 20 | var isAll = (feedLink === "") |
24 | 22 | DB.loadEntries(strUrl, isAll) | 21 | var entries = DB.loadEntries(feedLink, isAll) |
25 | 23 | var entries = DB.dbResult.rows | 22 | // var entries = DB.dbResult.rows |
26 | 24 | for (var i = 0; i < entries.length; i++) { | 23 | for (var i = 0; i < entries.length; i++) { |
27 | 25 | newsListModel.append({"title":entries.item(i).title, | 24 | newsListModel.append({"title":entries.item(i).title, |
28 | 26 | "pubDate":entries.item(i).pubDate, | 25 | "pubDate":entries.item(i).pubDate, |
29 | @@ -28,6 +27,11 @@ | |||
30 | 28 | "description":entries.item(i).description, | 27 | "description":entries.item(i).description, |
31 | 29 | "hash":entries.item(i).hash}) | 28 | "hash":entries.item(i).hash}) |
32 | 30 | } | 29 | } |
33 | 30 | console.log("Loaded entries by URL " + strUrl) | ||
34 | 31 | } | ||
35 | 32 | |||
36 | 33 | onFeedLinkChanged: { | ||
37 | 34 | loadEntriesByUrl(feedLink) | ||
38 | 31 | } | 35 | } |
39 | 32 | 36 | ||
40 | 33 | tools: ToolbarActions { | 37 | tools: ToolbarActions { |
41 | @@ -43,12 +47,8 @@ | |||
42 | 43 | ListView { | 47 | ListView { |
43 | 44 | id: newsList | 48 | id: newsList |
44 | 45 | 49 | ||
45 | 46 | width: parent.width | ||
46 | 47 | height: units.gu(40) | ||
47 | 48 | clip: true | 50 | clip: true |
51 | 49 | anchors { | 51 | anchors.fill: parent |
49 | 50 | top: parent.top | ||
50 | 51 | } | ||
52 | 52 | 52 | ||
53 | 53 | model: ListModel { | 53 | model: ListModel { |
54 | 54 | id: newsListModel | 54 | id: newsListModel |
55 | @@ -64,29 +64,13 @@ | |||
56 | 64 | } | 64 | } |
57 | 65 | 65 | ||
58 | 66 | onClicked: { | 66 | onClicked: { |
60 | 67 | contentLabel.loadHtml((model.content !== "")? model.content : model.description) // FIRST WAY | 67 | mainPageStack.push(singleEntryPage) |
61 | 68 | singleEntryPage.content.loadHtml((model.content !== "")? model.content : model.description) // FIRST WAY | ||
62 | 68 | // contentLabel.text = (model.content != "")? model.content : model.description // SECOND WAY | 69 | // contentLabel.text = (model.content != "")? model.content : model.description // SECOND WAY |
63 | 69 | } | 70 | } |
64 | 70 | } // delegate | 71 | } // delegate |
65 | 71 | } // ListView | 72 | } // ListView |
66 | 72 | 73 | ||
67 | 73 | /* FIRST WAY OF DISPLAYING FEED */ | ||
68 | 74 | WebView { | ||
69 | 75 | id: contentLabel | ||
70 | 76 | width: parent.width | ||
71 | 77 | |||
72 | 78 | |||
73 | 79 | onNavigationRequested: { | ||
74 | 80 | if (request.navigationType == 0) | ||
75 | 81 | request.action = 1 | ||
76 | 82 | } | ||
77 | 83 | |||
78 | 84 | anchors { | ||
79 | 85 | top: newsList.bottom | ||
80 | 86 | bottom: parent.bottom | ||
81 | 87 | } | ||
82 | 88 | } | ||
83 | 89 | |||
84 | 90 | /* SECOND WAY OF DISPLAYING FEED. DOES NOT WORK ON MY QT5 LIBS, BUG */ | 74 | /* SECOND WAY OF DISPLAYING FEED. DOES NOT WORK ON MY QT5 LIBS, BUG */ |
85 | 91 | // Flickable { | 75 | // Flickable { |
86 | 92 | // id: tmpLabelFlick | 76 | // id: tmpLabelFlick |
87 | 93 | 77 | ||
88 | === added file 'EntryListTab.qml' | |||
89 | --- EntryListTab.qml 1970-01-01 00:00:00 +0000 | |||
90 | +++ EntryListTab.qml 2013-04-15 08:44:35 +0000 | |||
91 | @@ -0,0 +1,12 @@ | |||
92 | 1 | import QtQuick 2.0 | ||
93 | 2 | import Ubuntu.Components 0.1 | ||
94 | 3 | |||
95 | 4 | Tab { | ||
96 | 5 | // title: i18n.tr("News") // todo replace with feed name | ||
97 | 6 | property alias entryListPage: entryListPageLocal | ||
98 | 7 | property alias feedLink: entryListPageLocal.feedLink | ||
99 | 8 | |||
100 | 9 | page: EntryListPage { | ||
101 | 10 | id: entryListPageLocal | ||
102 | 11 | } | ||
103 | 12 | } | ||
104 | 0 | 13 | ||
105 | === modified file 'FeedListPage.qml' | |||
106 | --- FeedListPage.qml 2013-03-24 13:19:16 +0000 | |||
107 | +++ FeedListPage.qml 2013-04-15 08:44:35 +0000 | |||
108 | @@ -11,19 +11,21 @@ | |||
109 | 11 | id: pageItself | 11 | id: pageItself |
110 | 12 | 12 | ||
111 | 13 | signal feedSelected(string selectedFeed) | 13 | signal feedSelected(string selectedFeed) |
112 | 14 | signal feedsReloaded | ||
113 | 15 | signal feedDeleted(string feedLink) | ||
114 | 14 | 16 | ||
115 | 15 | ListView { | 17 | ListView { |
116 | 16 | id: feedList | 18 | id: feedList |
117 | 17 | 19 | ||
118 | 18 | function reloadFeeds() { | 20 | function reloadFeeds() { |
119 | 19 | feedListModel.clear() | 21 | feedListModel.clear() |
127 | 20 | DB.loadFeeds() | 22 | var feeds = DB.loadFeeds() |
128 | 21 | var feeds = DB.dbResult | 23 | // var feeds = DB.dbResult |
129 | 22 | for (var i = 0; i < feeds.rows.length; i++) { | 24 | for (var i = 0; i < feeds.length; i++) { |
130 | 23 | feedListModel.append({"link":feeds.rows.item(i).link, | 25 | feedListModel.append({"link":feeds.item(i).link, |
131 | 24 | "displayName":feeds.rows.item(i).displayName, | 26 | "displayName":feeds.item(i).displayName, |
132 | 25 | "siteLink":feeds.rows.item(i).siteLink, | 27 | "siteLink":feeds.item(i).siteLink, |
133 | 26 | "description":feeds.rows.item(i).description}) | 28 | "description":feeds.item(i).description}) |
134 | 27 | } | 29 | } |
135 | 28 | } | 30 | } |
136 | 29 | 31 | ||
137 | @@ -195,6 +197,7 @@ | |||
138 | 195 | // DB.addEntry(curUrl, entry.title, entry.pubDate, Qt.md5(entry.title) /*TODO MORE DATA IN HASH*/, | 197 | // DB.addEntry(curUrl, entry.title, entry.pubDate, Qt.md5(entry.title) /*TODO MORE DATA IN HASH*/, |
139 | 196 | // entry.description, entry.content) | 198 | // entry.description, entry.content) |
140 | 197 | } | 199 | } |
141 | 200 | feedsReloaded() | ||
142 | 198 | } | 201 | } |
143 | 199 | break | 202 | break |
144 | 200 | case XmlListModel.Loading: | 203 | case XmlListModel.Loading: |
145 | @@ -251,10 +254,12 @@ | |||
146 | 251 | onTriggered: { | 254 | onTriggered: { |
147 | 252 | PopupUtils.close(popover) | 255 | PopupUtils.close(popover) |
148 | 253 | var link = feedListModel.get(feedList.currentIndex).link | 256 | var link = feedListModel.get(feedList.currentIndex).link |
151 | 254 | DB.deleteFeed(link) | 257 | var dbResult = DB.deleteFeed(link) |
152 | 255 | if (DB.dbResult.rowsAffected > 0) | 258 | if (dbResult.rowsAffected > 0) { |
153 | 256 | DB.removeEntriesOfFeed(link) | 259 | DB.removeEntriesOfFeed(link) |
154 | 257 | feedListModel.remove(feedList.currentIndex) | 260 | feedListModel.remove(feedList.currentIndex) |
155 | 261 | } | ||
156 | 262 | feedDeleted(link) | ||
157 | 258 | } | 263 | } |
158 | 259 | } | 264 | } |
159 | 260 | 265 | ||
160 | @@ -264,6 +269,7 @@ | |||
161 | 264 | PopupUtils.close(popover) | 269 | PopupUtils.close(popover) |
162 | 265 | DB.dropTables() | 270 | DB.dropTables() |
163 | 266 | feedListModel.clear() | 271 | feedListModel.clear() |
164 | 272 | feedsReloaded() | ||
165 | 267 | } | 273 | } |
166 | 268 | } | 274 | } |
167 | 269 | } // ActionList | 275 | } // ActionList |
168 | 270 | 276 | ||
169 | === added file 'SingleEntryPage.qml' | |||
170 | --- SingleEntryPage.qml 1970-01-01 00:00:00 +0000 | |||
171 | +++ SingleEntryPage.qml 2013-04-15 08:44:35 +0000 | |||
172 | @@ -0,0 +1,20 @@ | |||
173 | 1 | import QtQuick 2.0 | ||
174 | 2 | |||
175 | 3 | import QtWebKit 3.0 | ||
176 | 4 | |||
177 | 5 | Rectangle { | ||
178 | 6 | width: 30 | ||
179 | 7 | height: 30 | ||
180 | 8 | property alias content: contentLabel | ||
181 | 9 | |||
182 | 10 | /* FIRST WAY OF DISPLAYING FEED */ | ||
183 | 11 | WebView { | ||
184 | 12 | id: contentLabel | ||
185 | 13 | anchors.fill: parent | ||
186 | 14 | |||
187 | 15 | onNavigationRequested: { | ||
188 | 16 | if (request.navigationType == 0) | ||
189 | 17 | request.action = 1 | ||
190 | 18 | } | ||
191 | 19 | } | ||
192 | 20 | } | ||
193 | 0 | 21 | ||
194 | === added file 'TodayPage.qml' | |||
195 | --- TodayPage.qml 1970-01-01 00:00:00 +0000 | |||
196 | +++ TodayPage.qml 2013-04-15 08:44:35 +0000 | |||
197 | @@ -0,0 +1,77 @@ | |||
198 | 1 | import QtQuick 2.0 | ||
199 | 2 | import Ubuntu.Components 0.1 | ||
200 | 3 | |||
201 | 4 | import "databasemodule.js" as DB | ||
202 | 5 | import "tabshelper.js" as TabsHelper | ||
203 | 6 | |||
204 | 7 | Page { | ||
205 | 8 | id: todayPage | ||
206 | 9 | visible: false | ||
207 | 10 | property bool firstRefresh: true | ||
208 | 11 | |||
209 | 12 | signal requestFeedListPage | ||
210 | 13 | |||
211 | 14 | function refresh() { | ||
212 | 15 | if(firstRefresh) { | ||
213 | 16 | todayTabs.destroy() | ||
214 | 17 | firstRefresh = false | ||
215 | 18 | } | ||
216 | 19 | var tabsString = "import QtQuick 2.0; import Ubuntu.Components 0.1; Tabs {id: todayTabs; anchors.fill: parent;" | ||
217 | 20 | var feeds = DB.loadFeeds() | ||
218 | 21 | if(feeds.length > 0) { | ||
219 | 22 | for(var i = 0; i < feeds.length; i++) { | ||
220 | 23 | var feed = feeds[i]; | ||
221 | 24 | console.log("displayName: " + feed.displayName) | ||
222 | 25 | // ourTabs.__tabsModel.children[i].title = feed.displayName | ||
223 | 26 | // ourTabs.__tabsModel.children[i].entryListPage.loadEntriesByUrl(feed.link) | ||
224 | 27 | tabsString += "EntryListTab {" | ||
225 | 28 | tabsString += "title: \"" + feed.displayName + "\";" | ||
226 | 29 | tabsString += "feedLink: \"" + feed.link + "\";" | ||
227 | 30 | tabsString += "}" | ||
228 | 31 | } | ||
229 | 32 | } else { | ||
230 | 33 | var labelText = i18n.tr("No feeds added.\nClick the feed icon in the toolbar to get started.") | ||
231 | 34 | tabsString += "Tab { title: \"No feeds\"; page: Page { anchors.fill: parent; Label { anchors.centerIn: parent; text: \"" + labelText + "\"; } } }" | ||
232 | 35 | } | ||
233 | 36 | tabsString += "}"; // END Tabs component | ||
234 | 37 | |||
235 | 38 | console.log(tabsString) | ||
236 | 39 | console.log(TabsHelper.tabsObject) | ||
237 | 40 | if(TabsHelper.tabsObject !== null) { | ||
238 | 41 | TabsHelper.tabsObject.destroy() | ||
239 | 42 | } | ||
240 | 43 | |||
241 | 44 | TabsHelper.tabsObject = Qt.createQmlObject(tabsString, | ||
242 | 45 | todayPage, "todayTabs") | ||
243 | 46 | } | ||
244 | 47 | |||
245 | 48 | tools: ToolbarActions { | ||
246 | 49 | Action { | ||
247 | 50 | objectName: "action" | ||
248 | 51 | id: sampleAction | ||
249 | 52 | |||
250 | 53 | iconSource: Qt.resolvedUrl("avatar.png") | ||
251 | 54 | text: i18n.tr("Feeds") | ||
252 | 55 | |||
253 | 56 | onTriggered: { | ||
254 | 57 | // mainPageStack.push(feedListPage) | ||
255 | 58 | requestFeedListPage() | ||
256 | 59 | } | ||
257 | 60 | } | ||
258 | 61 | |||
259 | 62 | // back: Action { | ||
260 | 63 | // onTriggered: { | ||
261 | 64 | // console.log("Back triggered!") | ||
262 | 65 | // } | ||
263 | 66 | // } | ||
264 | 67 | } | ||
265 | 68 | |||
266 | 69 | Tabs { | ||
267 | 70 | id: todayTabs | ||
268 | 71 | anchors.fill: parent | ||
269 | 72 | |||
270 | 73 | Tab { | ||
271 | 74 | |||
272 | 75 | } | ||
273 | 76 | } | ||
274 | 77 | } | ||
275 | 0 | 78 | ||
276 | === modified file 'databasemodule.js' | |||
277 | --- databasemodule.js 2013-03-24 13:19:16 +0000 | |||
278 | +++ databasemodule.js 2013-04-15 08:44:35 +0000 | |||
279 | @@ -22,20 +22,23 @@ | |||
280 | 22 | 22 | ||
281 | 23 | /* This variable will store result of any operation with database. | 23 | /* This variable will store result of any operation with database. |
282 | 24 | */ | 24 | */ |
284 | 25 | var dbResult | 25 | //var dbResult |
285 | 26 | 26 | ||
286 | 27 | /* Load all feed from database. | 27 | /* Load all feed from database. |
287 | 28 | * Mb later we will need some criteria, such as tag, date and so on! | 28 | * Mb later we will need some criteria, such as tag, date and so on! |
288 | 29 | */ | 29 | */ |
289 | 30 | function loadFeeds() { | 30 | function loadFeeds() { |
290 | 31 | var db = openStdDataBase() | 31 | var db = openStdDataBase() |
292 | 32 | 32 | var dbResultLocal | |
293 | 33 | var feeds | ||
294 | 33 | db.transaction(function(tx) { | 34 | db.transaction(function(tx) { |
295 | 34 | ensureFeedTableExists(tx) | 35 | ensureFeedTableExists(tx) |
298 | 35 | dbResult = tx.executeSql("SELECT * FROM UserFeeds") | 36 | dbResultLocal = tx.executeSql("SELECT * FROM UserFeeds") |
299 | 36 | console.log("SELECTED: ", dbResult.rows.length) | 37 | console.log("SELECTED: ", dbResultLocal.rows.length) |
300 | 38 | feeds = dbResultLocal.rows | ||
301 | 37 | } | 39 | } |
302 | 38 | ) | 40 | ) |
303 | 41 | return feeds; | ||
304 | 39 | } | 42 | } |
305 | 40 | 43 | ||
306 | 41 | /* Add feed to database. | 44 | /* Add feed to database. |
307 | @@ -46,6 +49,7 @@ | |||
308 | 46 | console.log("Database, AddFeed: 0.link can't be empty") | 49 | console.log("Database, AddFeed: 0.link can't be empty") |
309 | 47 | return | 50 | return |
310 | 48 | } | 51 | } |
311 | 52 | var dbResult | ||
312 | 49 | 53 | ||
313 | 50 | d.displayName = d.displayName || "" | 54 | d.displayName = d.displayName || "" |
314 | 51 | d.siteLink = d.siteLink || "" | 55 | d.siteLink = d.siteLink || "" |
315 | @@ -70,13 +74,14 @@ | |||
316 | 70 | console.log("INSERT ID", dbResult.insertId) | 74 | console.log("INSERT ID", dbResult.insertId) |
317 | 71 | } | 75 | } |
318 | 72 | ) | 76 | ) |
319 | 77 | return dbResult | ||
320 | 73 | } | 78 | } |
321 | 74 | 79 | ||
322 | 75 | /* Update information about feed with new information. | 80 | /* Update information about feed with new information. |
323 | 76 | */ | 81 | */ |
324 | 77 | function updateFeedWithInfo(link, d) { | 82 | function updateFeedWithInfo(link, d) { |
325 | 78 | var db = openStdDataBase() | 83 | var db = openStdDataBase() |
327 | 79 | 84 | var dbResult | |
328 | 80 | db.transaction(function (tx) { | 85 | db.transaction(function (tx) { |
329 | 81 | ensureFeedTableExists(tx) | 86 | ensureFeedTableExists(tx) |
330 | 82 | dbResult = tx.executeSql('UPDATE UserFeeds SET displayName=?, siteLink=?, description=? WHERE link=?', | 87 | dbResult = tx.executeSql('UPDATE UserFeeds SET displayName=?, siteLink=?, description=? WHERE link=?', |
331 | @@ -84,19 +89,23 @@ | |||
332 | 84 | console.log("UPDATE, AFFECTED ROWS", dbResult.rowsAffected) | 89 | console.log("UPDATE, AFFECTED ROWS", dbResult.rowsAffected) |
333 | 85 | } | 90 | } |
334 | 86 | ) | 91 | ) |
335 | 92 | return dbResult | ||
336 | 87 | } | 93 | } |
337 | 88 | 94 | ||
338 | 89 | /* Delete feed from database. | 95 | /* Delete feed from database. |
339 | 90 | */ | 96 | */ |
340 | 91 | function deleteFeed(link) { | 97 | function deleteFeed(link) { |
341 | 92 | var db = openStdDataBase() | 98 | var db = openStdDataBase() |
343 | 93 | 99 | var result | |
344 | 94 | db.transaction(function (tx) { | 100 | db.transaction(function (tx) { |
345 | 101 | var dbResultLocal | ||
346 | 95 | ensureFeedTableExists(tx) | 102 | ensureFeedTableExists(tx) |
349 | 96 | dbResult = tx.executeSql('DELETE FROM UserFeeds WHERE link = ?', [link]) | 103 | dbResultLocal = tx.executeSql('DELETE FROM UserFeeds WHERE link = ?', [link]) |
350 | 97 | console.log("DELETE, AFFECTED ROWS", dbResult.rowsAffected) | 104 | console.log("DELETE, AFFECTED ROWS", dbResultLocal.rowsAffected) |
351 | 105 | result = dbResultLocal | ||
352 | 98 | } | 106 | } |
353 | 99 | ) | 107 | ) |
354 | 108 | return result | ||
355 | 100 | } | 109 | } |
356 | 101 | 110 | ||
357 | 102 | /* Select all entries from database. | 111 | /* Select all entries from database. |
358 | @@ -104,22 +113,43 @@ | |||
359 | 104 | function loadEntries(feedLink, all) { | 113 | function loadEntries(feedLink, all) { |
360 | 105 | all = all || false | 114 | all = all || false |
361 | 106 | var db = openStdDataBase() | 115 | var db = openStdDataBase() |
362 | 116 | var entries; | ||
363 | 107 | 117 | ||
364 | 108 | db.transaction(function(tx) { | 118 | db.transaction(function(tx) { |
365 | 109 | ensureEntriesTableExists(tx) | 119 | ensureEntriesTableExists(tx) |
366 | 120 | var dbResultLocal | ||
367 | 110 | if (all) | 121 | if (all) |
373 | 111 | dbResult = tx.executeSql('SELECT * FROM FeedEntries') | 122 | dbResultLocal = tx.executeSql('SELECT * FROM FeedEntries') |
374 | 112 | else dbResult = tx.executeSql('SELECT * FROM FeedEntries WHERE feedLink = ?', [feedLink]) | 123 | else dbResultLocal = tx.executeSql('SELECT * FROM FeedEntries WHERE feedLink = ?', [feedLink]) |
375 | 113 | console.log("loadEntries, SELECTED ROWS", dbResult.rows.length) | 124 | console.log("loadEntries, SELECTED ROWS", dbResultLocal.rows.length) |
376 | 114 | } | 125 | entries = dbResultLocal.rows; |
377 | 115 | ) | 126 | } |
378 | 127 | ) | ||
379 | 128 | return entries; | ||
380 | 129 | } | ||
381 | 130 | |||
382 | 131 | /* Select all entries from database. | ||
383 | 132 | */ | ||
384 | 133 | function loadFeed(feedLink) { | ||
385 | 134 | var db = openStdDataBase() | ||
386 | 135 | var feed = {displayName: "Unknown"} | ||
387 | 136 | db.transaction(function(tx) { | ||
388 | 137 | ensureEntriesTableExists(tx) | ||
389 | 138 | var dbResult = tx.executeSql('SELECT * FROM UserFeeds WHERE link = ?', [feedLink]) | ||
390 | 139 | console.log("feedName, SELECTED ROWS", dbResult.rows.length) | ||
391 | 140 | if(dbResult.rows.length > 0) { | ||
392 | 141 | feed = dbResult.rows.item(0) | ||
393 | 142 | } | ||
394 | 143 | } | ||
395 | 144 | ) | ||
396 | 145 | return feed | ||
397 | 116 | } | 146 | } |
398 | 117 | 147 | ||
399 | 118 | /* Append entry to database. | 148 | /* Append entry to database. |
400 | 119 | */ | 149 | */ |
401 | 120 | function addEntry(feedLink, hash, d) { | 150 | function addEntry(feedLink, hash, d) { |
402 | 121 | var db = openStdDataBase() | 151 | var db = openStdDataBase() |
404 | 122 | 152 | var dbResult | |
405 | 123 | if (feedLink === undefined || hash === undefined) { | 153 | if (feedLink === undefined || hash === undefined) { |
406 | 124 | console.log("Database, addEntry: feedLink and hash can't be undefined") | 154 | console.log("Database, addEntry: feedLink and hash can't be undefined") |
407 | 125 | return | 155 | return |
408 | @@ -142,18 +172,20 @@ | |||
409 | 142 | // console.log("ENTRY INSERT ID", dbResult.insertId) | 172 | // console.log("ENTRY INSERT ID", dbResult.insertId) |
410 | 143 | } | 173 | } |
411 | 144 | ) | 174 | ) |
412 | 175 | return dbResult | ||
413 | 145 | } | 176 | } |
414 | 146 | 177 | ||
415 | 147 | /* Remove all entries from database by feed link. | 178 | /* Remove all entries from database by feed link. |
416 | 148 | */ | 179 | */ |
417 | 149 | function removeEntriesOfFeed(feedLink) { | 180 | function removeEntriesOfFeed(feedLink) { |
418 | 150 | var db = openStdDataBase() | 181 | var db = openStdDataBase() |
420 | 151 | 182 | var dbResult | |
421 | 152 | db.transaction(function(tx) { | 183 | db.transaction(function(tx) { |
422 | 153 | ensureEntriesTableExists(tx) | 184 | ensureEntriesTableExists(tx) |
423 | 154 | dbResult = tx.executeSql('DELETE FROM FeedEntries WHERE feedLink = ?', [feedLink]) | 185 | dbResult = tx.executeSql('DELETE FROM FeedEntries WHERE feedLink = ?', [feedLink]) |
424 | 155 | } | 186 | } |
425 | 156 | ) | 187 | ) |
426 | 188 | return dbResult | ||
427 | 157 | } | 189 | } |
428 | 158 | 190 | ||
429 | 159 | /* Only for debug purposes. | 191 | /* Only for debug purposes. |
430 | 160 | 192 | ||
431 | === modified file 'rssreader.qmlproject' | |||
432 | --- rssreader.qmlproject 2013-03-02 20:42:07 +0000 | |||
433 | +++ rssreader.qmlproject 2013-04-15 08:44:35 +0000 | |||
434 | @@ -3,7 +3,7 @@ | |||
435 | 3 | import QmlProject 1.1 | 3 | import QmlProject 1.1 |
436 | 4 | 4 | ||
437 | 5 | Project { | 5 | Project { |
439 | 6 | mainFile: "rssreader.qml" | 6 | mainFile: "ubuntu-rssreader-app.qml" |
440 | 7 | 7 | ||
441 | 8 | /* Include .qml, .js, and image files from current directory and subdirectories */ | 8 | /* Include .qml, .js, and image files from current directory and subdirectories */ |
442 | 9 | QmlFiles { | 9 | QmlFiles { |
443 | 10 | 10 | ||
444 | === added file 'tabshelper.js' | |||
445 | --- tabshelper.js 1970-01-01 00:00:00 +0000 | |||
446 | +++ tabshelper.js 2013-04-15 08:44:35 +0000 | |||
447 | @@ -0,0 +1,1 @@ | |||
448 | 1 | var tabsObject = null; | ||
449 | 0 | 2 | ||
450 | === modified file 'ubuntu-rssreader-app.qml' | |||
451 | --- ubuntu-rssreader-app.qml 2013-04-11 21:21:44 +0000 | |||
452 | +++ ubuntu-rssreader-app.qml 2013-04-15 08:44:35 +0000 | |||
453 | @@ -9,6 +9,8 @@ | |||
454 | 9 | second Tab has a single ToolbarAction. | 9 | second Tab has a single ToolbarAction. |
455 | 10 | */ | 10 | */ |
456 | 11 | 11 | ||
457 | 12 | import "databasemodule.js" as DB | ||
458 | 13 | |||
459 | 12 | MainView { | 14 | MainView { |
460 | 13 | // objectName for functional testing purposes (autopilot-qt5) | 15 | // objectName for functional testing purposes (autopilot-qt5) |
461 | 14 | objectName: "rssreader" | 16 | objectName: "rssreader" |
462 | @@ -17,89 +19,62 @@ | |||
463 | 17 | width: units.gu(50) | 19 | width: units.gu(50) |
464 | 18 | height: units.gu(75) | 20 | height: units.gu(75) |
465 | 19 | 21 | ||
469 | 20 | 22 | PageStack { | |
470 | 21 | Tabs { | 23 | id: mainPageStack |
471 | 22 | id: tabs | 24 | Component.onCompleted: { |
472 | 25 | push(todayPage) | ||
473 | 26 | todayPage.refresh() | ||
474 | 27 | } | ||
475 | 23 | anchors.fill: parent | 28 | anchors.fill: parent |
555 | 24 | 29 | __showHeader: false | |
556 | 25 | Tab { | 30 | TodayPage { |
557 | 26 | objectName: "Tab1" | 31 | id: todayPage |
558 | 27 | 32 | visible: false | |
559 | 28 | title: i18n.tr("RSS Reader") | 33 | onRequestFeedListPage: mainPageStack.push(feedListPage) |
560 | 29 | 34 | } | |
561 | 30 | page: FeedListPage { | 35 | |
562 | 31 | id: feedListPage | 36 | FeedListPage { |
563 | 32 | 37 | id: feedListPage | |
564 | 33 | onFeedSelected: { | 38 | visible: false |
565 | 34 | console.log("Feed SELECTED, switch tab next") | 39 | anchors.fill: parent |
566 | 35 | newsListPage.loadEntriesByUrl(selectedFeed) | 40 | onFeedSelected: { |
567 | 36 | tabs.selectedTabIndex = 1 | 41 | if(selectedFeed != "") { |
568 | 37 | } | 42 | mainPageStack.push(selectedEntryListPageView) |
569 | 38 | } | 43 | selectedEntryListPage.feedLink = selectedFeed |
570 | 39 | } | 44 | var feed = DB.loadFeed(selectedFeed) |
571 | 40 | 45 | selectedEntryTab.title = feed.displayName | |
572 | 41 | Tab { | 46 | } else { |
573 | 42 | title: i18n.tr("News") // todo replace with feed name | 47 | mainPageStack.clear() |
574 | 43 | 48 | mainPageStack.push(todayPage) | |
575 | 44 | page: NewsListPage { | 49 | } |
576 | 45 | id: newsListPage | 50 | } |
577 | 46 | 51 | onFeedsReloaded: { | |
578 | 47 | onBackRequst: { | 52 | todayPage.refresh() |
579 | 48 | tabs.selectedTabIndex = 0 | 53 | } |
580 | 49 | } | 54 | onFeedDeleted: { |
581 | 50 | } | 55 | todayPage.refresh() |
582 | 51 | } | 56 | } |
583 | 52 | 57 | } | |
584 | 53 | // Second tab begins here | 58 | Page { |
585 | 54 | Tab { | 59 | anchors.fill: parent |
586 | 55 | objectName: "Tab2" | 60 | id: selectedEntryListPageView |
587 | 56 | 61 | visible: false | |
588 | 57 | title: i18n.tr("Optional Screen") | 62 | Tabs { |
589 | 58 | page: Page { | 63 | anchors.fill: parent |
590 | 59 | id: secondPage | 64 | Tab { |
591 | 60 | anchors.margins: units.gu(2) | 65 | id: selectedEntryTab |
592 | 61 | 66 | title: i18n.tr("Selected feed") // todo replace with feed name | |
593 | 62 | tools: ToolbarActions { | 67 | page: EntryListPage { |
594 | 63 | Action { | 68 | anchors.fill: parent |
595 | 64 | objectName: "action" | 69 | id: selectedEntryListPage |
596 | 65 | id: sampleAction | 70 | } |
597 | 66 | 71 | } | |
598 | 67 | iconSource: Qt.resolvedUrl("avatar.png") | 72 | } |
599 | 68 | text: i18n.tr("Tap me!") | 73 | } |
600 | 69 | 74 | SingleEntryPage { | |
601 | 70 | onTriggered: { | 75 | id: singleEntryPage |
602 | 71 | label.text = i18n.tr("Toolbar icon tapped") | 76 | visible: false |
603 | 72 | } | 77 | anchors.fill: parent |
525 | 73 | } | ||
526 | 74 | |||
527 | 75 | back: Action { | ||
528 | 76 | onTriggered: { | ||
529 | 77 | console.log("Back triggered!") | ||
530 | 78 | } | ||
531 | 79 | } | ||
532 | 80 | } | ||
533 | 81 | |||
534 | 82 | |||
535 | 83 | |||
536 | 84 | Column { | ||
537 | 85 | anchors.centerIn: parent | ||
538 | 86 | Label { | ||
539 | 87 | id: label | ||
540 | 88 | objectName: "label" | ||
541 | 89 | |||
542 | 90 | text: i18n.tr("Swipe from bottom to up to reveal the toolbar.") | ||
543 | 91 | } | ||
544 | 92 | |||
545 | 93 | Button { | ||
546 | 94 | text: "Toolbar Test" | ||
547 | 95 | width: units.gu(15) | ||
548 | 96 | anchors.horizontalCenter: parent.horizontalCenter | ||
549 | 97 | onClicked: { | ||
550 | 98 | secondPage.tools.active = true | ||
551 | 99 | } | ||
552 | 100 | } | ||
553 | 101 | } | ||
554 | 102 | } | ||
604 | 103 | } | 78 | } |
605 | 104 | } | 79 | } |
606 | 105 | } | 80 | } |
FAILED: Continuous integration, rev:9 /code.launchpad .net/~dragly/ ubuntu- rssreader- app/initial- design/ +merge/ 158862/ +edit-commit- message
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https:/
http:// 91.189. 93.125: 8080/job/ ubuntu- rssreader- app-ci/ 7/ 91.189. 93.125: 8080/job/ ubuntu- rssreader- app-quantal- amd64-ci/ 7 91.189. 93.125: 8080/job/ ubuntu- rssreader- app-raring- amd64-ci/ 7
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.125: 8080/job/ ubuntu- rssreader- app-ci/ 7/rebuild
http://