Merge lp:~mrqtros/ubuntu-rssreader-app/ubuntu-rssreader-app-ng-refactor into lp:ubuntu-rssreader-app
- ubuntu-rssreader-app-ng-refactor
- Merge into reboot
Status: | Merged |
---|---|
Approved by: | Joey Chan |
Approved revision: | 419 |
Merged at revision: | 416 |
Proposed branch: | lp:~mrqtros/ubuntu-rssreader-app/ubuntu-rssreader-app-ng-refactor |
Merge into: | lp:ubuntu-rssreader-app |
Diff against target: |
609 lines (+95/-203) 8 files modified
shorts/qml/components/NetworkManager.qml (+42/-109) shorts/qml/components/OptionsKeeper.qml (+4/-7) shorts/qml/nongoogle/AppendNGFeedPage.qml (+8/-17) shorts/qml/nongoogle/Positioner.qml (+1/-4) shorts/qml/nongoogle/XmlNetwork.qml (+0/-13) shorts/qml/pages/EditFeedPage.qml (+22/-40) shorts/qml/pages/PageSettings.qml (+17/-12) shorts/qml/shorts-app.qml (+1/-1) |
To merge this branch: | bzr merge lp:~mrqtros/ubuntu-rssreader-app/ubuntu-rssreader-app-ng-refactor |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Joey Chan | Approve | ||
Jenkins Bot | continuous-integration | Approve | |
Review via email: mp+281508@code.launchpad.net |
Commit message
Non-Google engine refactor.
Description of the change
Non-Google engine refactor.
Please, check carefully its functionality.
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
Joey Chan (qqworini) wrote : | # |
Autually functions are work fine,
but BE CAREFUL , in NetworkManager.qml, line 28 : function cancelDownload()
U forgot to clean another "dNG" :P
- 418. By Roman Shchekin
-
Forgot "else".
Roman Shchekin (mrqtros) wrote : | # |
Do you mean that I forgot "else"? Fixing...
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:418
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
- 419. By Roman Shchekin
-
"cancelDownload" fixed.
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote : | # |
PASSED: Continuous integration, rev:419
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
Joey Chan (qqworini) : | # |
Preview Diff
1 | === modified file 'shorts/qml/components/NetworkManager.qml' | |||
2 | --- shorts/qml/components/NetworkManager.qml 2015-12-02 17:03:41 +0000 | |||
3 | +++ shorts/qml/components/NetworkManager.qml 2016-01-04 18:43:59 +0000 | |||
4 | @@ -19,23 +19,14 @@ | |||
5 | 19 | signal downloadStarted(int tagId) | 19 | signal downloadStarted(int tagId) |
6 | 20 | 20 | ||
7 | 21 | property string operationStatus: "success" | 21 | property string operationStatus: "success" |
8 | 22 | property bool __useGFA: optionsKeeper.useGoogleSearch | ||
9 | 22 | 23 | ||
10 | 23 | function updateFeeds(feedsArray, topicId) { | 24 | function updateFeeds(feedsArray, topicId) { |
17 | 24 | if (optionsKeeper.useGoogleSearch()) { | 25 | d.updateFeeds(feedsArray, topicId) |
12 | 25 | d.updateFeeds(feedsArray, topicId) | ||
13 | 26 | } | ||
14 | 27 | else { | ||
15 | 28 | dNG.updateFeeds(feedsArray, topicId) | ||
16 | 29 | } | ||
18 | 30 | } | 26 | } |
19 | 31 | 27 | ||
20 | 32 | function cancelDownload() { | 28 | function cancelDownload() { |
27 | 33 | if (optionsKeeper.useGoogleSearch()) { | 29 | d.cancelDownload() |
22 | 34 | d.cancelDownload() | ||
23 | 35 | } | ||
24 | 36 | else { | ||
25 | 37 | dNG.cancelDownload() | ||
26 | 38 | } | ||
28 | 39 | } | 30 | } |
29 | 40 | 31 | ||
30 | 41 | /* All private method are inside QtObject. | 32 | /* All private method are inside QtObject. |
31 | @@ -69,13 +60,17 @@ | |||
32 | 69 | } | 60 | } |
33 | 70 | 61 | ||
34 | 71 | currentFeed = feedList.shift() | 62 | currentFeed = feedList.shift() |
36 | 72 | googleFeedApi.loadFeed(currentFeed.source) | 63 | if (__useGFA) |
37 | 64 | googleFeedApi.loadFeed(currentFeed.source) | ||
38 | 65 | else nonGoogleFeedApi.loadFeed(currentFeed.source) | ||
39 | 73 | } | 66 | } |
40 | 74 | 67 | ||
41 | 75 | function cancelDownload() { | 68 | function cancelDownload() { |
42 | 76 | feedList = [] | 69 | feedList = [] |
43 | 77 | operationStatus = "abort" | 70 | operationStatus = "abort" |
45 | 78 | googleFeedApi.abort() | 71 | if (__useGFA) |
46 | 72 | googleFeedApi.abort() | ||
47 | 73 | else nonGoogleFeedApi.abort() | ||
48 | 79 | } | 74 | } |
49 | 80 | 75 | ||
50 | 81 | function updateFeedInfo(feedId, feedLink, responseData) { | 76 | function updateFeedInfo(feedId, feedLink, responseData) { |
51 | @@ -122,67 +117,7 @@ | |||
52 | 122 | console.timeEnd("addArticlesEx") | 117 | console.timeEnd("addArticlesEx") |
53 | 123 | } | 118 | } |
54 | 124 | 119 | ||
116 | 125 | function clearFromBadTags(content) { | 120 | function updateFeedInfoNg(feedId, feedLink, responseData) { |
56 | 126 | /* Remove non empty too. Useless anyway. | ||
57 | 127 | */ | ||
58 | 128 | content = content.replace(/alt=".*?"/g, "") | ||
59 | 129 | content = content.replace(/title=".*?"/g, "") | ||
60 | 130 | return content | ||
61 | 131 | } | ||
62 | 132 | |||
63 | 133 | property var googleFeedApi: GoogleFeedApi { | ||
64 | 134 | onLoadResult: { | ||
65 | 135 | if (result.responseStatus !== 200) { | ||
66 | 136 | console.log("XML NETWORK GFA:", JSON.stringify(result)) | ||
67 | 137 | if (operationStatus == "success") | ||
68 | 138 | operationStatus = "withErrors" | ||
69 | 139 | } else d.updateFeedInfo(d.currentFeed.id, d.currentFeed.link, result.responseData) | ||
70 | 140 | |||
71 | 141 | d.updateNextFeed() | ||
72 | 142 | } | ||
73 | 143 | } // GFA | ||
74 | 144 | } // QtObject | ||
75 | 145 | |||
76 | 146 | ////////////////////////////////////////// add a new object to refresh non-google feeds | ||
77 | 147 | QtObject { | ||
78 | 148 | id: dNG | ||
79 | 149 | |||
80 | 150 | property var feedList: [] // Feed list to update. | ||
81 | 151 | property var currentFeed // Current downloading feed. | ||
82 | 152 | property int tagId: 0 // Tag to update. | ||
83 | 153 | |||
84 | 154 | /* Method updates feeds one by another. | ||
85 | 155 | * Input: array of objects, each should include | ||
86 | 156 | * source, link and id (of feed in DB) properties. | ||
87 | 157 | */ | ||
88 | 158 | function updateFeeds(feedsArray, topicId) { | ||
89 | 159 | tagId = topicId || 0 | ||
90 | 160 | |||
91 | 161 | downloadStarted(tagId) | ||
92 | 162 | |||
93 | 163 | feedList = feedsArray | ||
94 | 164 | operationStatus = "success" | ||
95 | 165 | updateNextFeed() | ||
96 | 166 | } | ||
97 | 167 | |||
98 | 168 | // For inner usage only. | ||
99 | 169 | function updateNextFeed() { | ||
100 | 170 | if (feedList.length == 0) { | ||
101 | 171 | downloadFinished(tagId) | ||
102 | 172 | return | ||
103 | 173 | } | ||
104 | 174 | |||
105 | 175 | currentFeed = feedList.shift() | ||
106 | 176 | nonGoogleFeedApi.loadFeed(currentFeed.source) | ||
107 | 177 | } | ||
108 | 178 | |||
109 | 179 | function cancelDownload() { | ||
110 | 180 | feedList = [] | ||
111 | 181 | operationStatus = "abort" | ||
112 | 182 | nonGoogleFeedApi.abort() | ||
113 | 183 | } | ||
114 | 184 | |||
115 | 185 | function updateFeedInfo(feedId, feedLink, responseData) { | ||
117 | 186 | var entries = responseData.item | 121 | var entries = responseData.item |
118 | 187 | var f = responseData | 122 | var f = responseData |
119 | 188 | 123 | ||
120 | @@ -190,8 +125,8 @@ | |||
121 | 190 | var fti = f.title == undefined ? "" : f.title["#text"] == undefined ? f.title : f.title["#text"] | 125 | var fti = f.title == undefined ? "" : f.title["#text"] == undefined ? f.title : f.title["#text"] |
122 | 191 | 126 | ||
123 | 192 | DB.updateFeedByXml(feedId, feedLink, fde, fti) | 127 | DB.updateFeedByXml(feedId, feedLink, fde, fti) |
126 | 193 | console.log(" -------- UPDATE INFO -------- ") | 128 | console.log(" -------- UPDATE INFO (NG) -------- ") |
127 | 194 | // console.log(f.title, f.link, f.feedUrl, f.description) | 129 | console.log(fti, feedLink, f.feedUrl, fde) |
128 | 195 | 130 | ||
129 | 196 | console.time("addArticlesEx") | 131 | console.time("addArticlesEx") |
130 | 197 | 132 | ||
131 | @@ -200,11 +135,6 @@ | |||
132 | 200 | for (var i = 0; i < maxLength; i++) { | 135 | for (var i = 0; i < maxLength; i++) { |
133 | 201 | var e = entries[i] | 136 | var e = entries[i] |
134 | 202 | 137 | ||
135 | 203 | // print("article detail: ", JSON.stringify(e)) | ||
136 | 204 | // Grab image from for article. | ||
137 | 205 | // var articleImage = ImageUtils.grabArticleImage(e) | ||
138 | 206 | // e.content = clearFromBadTags(e.content) | ||
139 | 207 | |||
140 | 208 | var ti = e.title == undefined ? "" : e.title["#text"] == undefined ? e.title : e.title["#text"] | 138 | var ti = e.title == undefined ? "" : e.title["#text"] == undefined ? e.title : e.title["#text"] |
141 | 209 | var li = e.link == undefined ? "" : e.link["#text"] == undefined ? e.link : e.link["#text"] | 139 | var li = e.link == undefined ? "" : e.link["#text"] == undefined ? e.link : e.link["#text"] |
142 | 210 | var au = e.author == undefined ? "" : e.author["#text"] == undefined ? e.author : e.author["#text"] | 140 | var au = e.author == undefined ? "" : e.author["#text"] == undefined ? e.author : e.author["#text"] |
143 | @@ -212,34 +142,25 @@ | |||
144 | 212 | var de = e.description == undefined ? "" : e.description["#text"] == undefined ? e.description : e.description["#text"] | 142 | var de = e.description == undefined ? "" : e.description["#text"] == undefined ? e.description : e.description["#text"] |
145 | 213 | var pu = e.pubDate == undefined ? "" : e.pubDate["#text"] == undefined ? e.pubDate : e.pubDate["#text"] | 143 | var pu = e.pubDate == undefined ? "" : e.pubDate["#text"] == undefined ? e.pubDate : e.pubDate["#text"] |
146 | 214 | var co = e.content == undefined ? "" : e.content["#text"] == undefined ? e.content : e.content["#text"] | 144 | var co = e.content == undefined ? "" : e.content["#text"] == undefined ? e.content : e.content["#text"] |
147 | 145 | |||
148 | 215 | var articleImage = utilities.htmlGetImg(de) | 146 | var articleImage = utilities.htmlGetImg(de) |
155 | 216 | if (articleImage.length == 0) { articleImage = utilities.htmlGetImg(co) } | 147 | if (!articleImage.length) |
156 | 217 | else { | 148 | articleImage = utilities.htmlGetImg(co) |
151 | 218 | print("articleImage: ", articleImage[0]) | ||
152 | 219 | } | ||
153 | 220 | // print("date parse 0: ", pu, DateUtils.parseDate(pu)) | ||
154 | 221 | // print("date parse 1: ", DateUtils.formatRelativeTime(i18n, DateUtils.parseDate(pu))) | ||
157 | 222 | 149 | ||
160 | 223 | var temp = | 150 | var temp = { |
159 | 224 | { | ||
161 | 225 | "title": ti, | 151 | "title": ti, |
170 | 226 | "content": co == "" ? de : co, | 152 | "content": co ? co : de, |
171 | 227 | "link": li, | 153 | "link": li, |
172 | 228 | "author": creator == "" ? au : creator, | 154 | "author": creator ? creator : au , |
173 | 229 | "description": de, | 155 | "description": de, |
174 | 230 | "pubDate": DateUtils.parseDate(pu), | 156 | "pubDate": DateUtils.parseDate(pu), |
175 | 231 | "guid": Qt.md5(li + pu), | 157 | "guid": Qt.md5(li + pu), |
176 | 232 | "image" : articleImage.length > 0 ? articleImage[0] : "", | 158 | "image" : articleImage.length ? articleImage[0] : "", |
177 | 233 | "media_groups" : "" | 159 | "media_groups" : "" |
178 | 234 | } | 160 | } |
179 | 235 | 161 | ||
180 | 236 | newArticles.push(temp) | 162 | newArticles.push(temp) |
181 | 237 | } | 163 | } |
182 | 238 | // print("new article length: ", newArticles.length) | ||
183 | 239 | |||
184 | 240 | // /* Add new articles to DB and restore 'read' status of some of them. | ||
185 | 241 | // */ | ||
186 | 242 | // DB.addArticles(articleModel, feedId, articleProperties); | ||
187 | 243 | 164 | ||
188 | 244 | /* Add new articles to DB and restore 'read' status of some of them. */ | 165 | /* Add new articles to DB and restore 'read' status of some of them. */ |
189 | 245 | try { | 166 | try { |
190 | @@ -253,22 +174,34 @@ | |||
191 | 253 | 174 | ||
192 | 254 | function clearFromBadTags(content) { | 175 | function clearFromBadTags(content) { |
193 | 255 | /* Remove non empty too. Useless anyway. | 176 | /* Remove non empty too. Useless anyway. |
195 | 256 | */ | 177 | */ |
196 | 257 | content = content.replace(/alt=".*?"/g, "") | 178 | content = content.replace(/alt=".*?"/g, "") |
197 | 258 | content = content.replace(/title=".*?"/g, "") | 179 | content = content.replace(/title=".*?"/g, "") |
198 | 259 | return content | 180 | return content |
199 | 260 | } | 181 | } |
200 | 261 | 182 | ||
201 | 183 | property var googleFeedApi: GoogleFeedApi { | ||
202 | 184 | onLoadResult: { | ||
203 | 185 | if (result.responseStatus !== 200) { | ||
204 | 186 | console.log("XML NETWORK GFA:", JSON.stringify(result)) | ||
205 | 187 | if (operationStatus == "success") | ||
206 | 188 | operationStatus = "withErrors" | ||
207 | 189 | } else d.updateFeedInfo(d.currentFeed.id, d.currentFeed.link, result.responseData) | ||
208 | 190 | |||
209 | 191 | d.updateNextFeed() | ||
210 | 192 | } | ||
211 | 193 | } // GFA | ||
212 | 194 | |||
213 | 262 | property var nonGoogleFeedApi: XmlNetwork { | 195 | property var nonGoogleFeedApi: XmlNetwork { |
214 | 263 | onLoadResult: { | 196 | onLoadResult: { |
217 | 264 | if (result.rss == undefined || result.rss == "") { | 197 | if (!result.rss) { |
218 | 265 | // console.log("XML NETWORK GFA:", JSON.stringify(result)) | 198 | console.log("XML NETWORK NGA:", JSON.stringify(result)) |
219 | 266 | if (operationStatus == "success") | 199 | if (operationStatus == "success") |
220 | 267 | operationStatus = "withErrors" | 200 | operationStatus = "withErrors" |
222 | 268 | } else dNG.updateFeedInfo(dNG.currentFeed.id, dNG.currentFeed.link, result.rss.channel) | 201 | } else d.updateFeedInfoNg(d.currentFeed.id, d.currentFeed.link, result.rss.channel) |
223 | 269 | 202 | ||
225 | 270 | dNG.updateNextFeed() | 203 | d.updateNextFeed() |
226 | 271 | } | 204 | } |
228 | 272 | } // GFA | 205 | } // NGA |
229 | 273 | } // QtObject | 206 | } // QtObject |
230 | 274 | } | 207 | } |
231 | 275 | 208 | ||
232 | === modified file 'shorts/qml/components/OptionsKeeper.qml' | |||
233 | --- shorts/qml/components/OptionsKeeper.qml 2015-12-02 17:03:41 +0000 | |||
234 | +++ shorts/qml/components/OptionsKeeper.qml 2016-01-04 18:43:59 +0000 | |||
235 | @@ -9,21 +9,19 @@ | |||
236 | 9 | property int fontSize | 9 | property int fontSize |
237 | 10 | property bool useDarkTheme | 10 | property bool useDarkTheme |
238 | 11 | property bool useListMode | 11 | property bool useListMode |
239 | 12 | property bool useGoogleSearch | ||
240 | 12 | 13 | ||
241 | 13 | Component.onCompleted: { | 14 | Component.onCompleted: { |
242 | 14 | fontSize = getFontSize() | 15 | fontSize = getFontSize() |
243 | 15 | useDarkTheme = getUseDarkTheme() | 16 | useDarkTheme = getUseDarkTheme() |
244 | 16 | useListMode = getUseListMode() | 17 | useListMode = getUseListMode() |
250 | 17 | 18 | useGoogleSearch = getUseGoogleSearch() | |
246 | 18 | |||
247 | 19 | if (useGoogleSearch() == undefined ) { | ||
248 | 20 | setUseGoogleSearch(true) | ||
249 | 21 | } | ||
251 | 22 | } | 19 | } |
252 | 23 | 20 | ||
253 | 24 | onFontSizeChanged: setFontSize(fontSize) | 21 | onFontSizeChanged: setFontSize(fontSize) |
254 | 25 | onUseDarkThemeChanged: setUseDarkTheme(useDarkTheme) | 22 | onUseDarkThemeChanged: setUseDarkTheme(useDarkTheme) |
255 | 26 | onUseListModeChanged: setUseListMode(useListMode) | 23 | onUseListModeChanged: setUseListMode(useListMode) |
256 | 24 | onUseGoogleSearchChanged: setUseGoogleSearch(useGoogleSearch) | ||
257 | 27 | 25 | ||
258 | 28 | function getFontSize() { | 26 | function getFontSize() { |
259 | 29 | return settingsDocument.contents.fontSize | 27 | return settingsDocument.contents.fontSize |
260 | @@ -69,8 +67,7 @@ | |||
261 | 69 | return settingsDocument.contents.dbLastUpdate | 67 | return settingsDocument.contents.dbLastUpdate |
262 | 70 | } | 68 | } |
263 | 71 | 69 | ||
266 | 72 | /////////////////////////////////////////////////////// below two functions are get/set "useGoogleSearch" value | 70 | function getUseGoogleSearch() { |
265 | 73 | function useGoogleSearch() { | ||
267 | 74 | return settingsDocument.contents.useGoogleSearch | 71 | return settingsDocument.contents.useGoogleSearch |
268 | 75 | } | 72 | } |
269 | 76 | 73 | ||
270 | 77 | 74 | ||
271 | === modified file 'shorts/qml/nongoogle/AppendNGFeedPage.qml' | |||
272 | --- shorts/qml/nongoogle/AppendNGFeedPage.qml 2015-12-15 15:58:12 +0000 | |||
273 | +++ shorts/qml/nongoogle/AppendNGFeedPage.qml 2016-01-04 18:43:59 +0000 | |||
274 | @@ -58,18 +58,15 @@ | |||
275 | 58 | id: xmlFeedApi | 58 | id: xmlFeedApi |
276 | 59 | 59 | ||
277 | 60 | onLoadResult: { | 60 | onLoadResult: { |
280 | 61 | if (result.rss == undefined || result.rss == "") { | 61 | if (!result.rss) { |
279 | 62 | // TODO alert that fail retriving feed data | ||
281 | 63 | print("onLoadResult failed") | 62 | print("onLoadResult failed") |
282 | 64 | } | 63 | } |
283 | 65 | else { | 64 | else { |
284 | 66 | // d.updateFeedInfo(d.currentFeed.id, d.currentFeed.link, result.rss.channel) | ||
285 | 67 | var f = result.rss.channel | 65 | var f = result.rss.channel |
286 | 68 | 66 | ||
291 | 69 | feedDesc = f.description == undefined ? "" : f.description["#text"] == undefined ? f.description : f.description["#text"] | 67 | feedDesc = f.description ? (f.description["#text"] ? f.description["#text"] : f.description ) : "" |
292 | 70 | feedTitle = f.title == undefined ? "" : f.title["#text"] == undefined ? f.title : f.title["#text"] | 68 | feedTitle = f.title ? (f.title["#text"] ? f.title["#text"] : f.title ) : "" |
293 | 71 | // feedUrl = l | 69 | feedLink = f.link ? (f.link["#text"] ? f.link["#text"] : f.link) : "" |
290 | 72 | feedLink = f.link == undefined ? "" : f.link["#text"] == undefined ? f.link : f.link["#text"] | ||
294 | 73 | feedObj = { | 70 | feedObj = { |
295 | 74 | "url" : feedUrl, | 71 | "url" : feedUrl, |
296 | 75 | "title" : feedTitle, | 72 | "title" : feedTitle, |
297 | @@ -77,7 +74,6 @@ | |||
298 | 77 | "link" : feedLink | 74 | "link" : feedLink |
299 | 78 | } | 75 | } |
300 | 79 | } | 76 | } |
301 | 80 | |||
302 | 81 | } | 77 | } |
303 | 82 | } | 78 | } |
304 | 83 | 79 | ||
305 | @@ -114,20 +110,18 @@ | |||
306 | 114 | anchors.fill: parent | 110 | anchors.fill: parent |
307 | 115 | onClicked: { | 111 | onClicked: { |
308 | 116 | if (Qt.inputMethod.visible) | 112 | if (Qt.inputMethod.visible) |
310 | 117 | tfFeedUrl.accapt() | 113 | tfFeedUrl.accept() |
311 | 118 | } | 114 | } |
312 | 119 | } | 115 | } |
313 | 120 | } | 116 | } |
314 | 121 | 117 | ||
318 | 122 | onAccepted: { | 118 | onAccepted: accept() |
316 | 123 | accapt() | ||
317 | 124 | } | ||
319 | 125 | 119 | ||
321 | 126 | function accapt() { | 120 | function accept() { |
322 | 127 | Qt.inputMethod.hide() | 121 | Qt.inputMethod.hide() |
323 | 128 | var userInput = text | 122 | var userInput = text |
324 | 129 | 123 | ||
326 | 130 | if (userInput == "") | 124 | if (!userInput) |
327 | 131 | return | 125 | return |
328 | 132 | 126 | ||
329 | 133 | // Very simple logic, URL if there are no spaces and contains dots. | 127 | // Very simple logic, URL if there are no spaces and contains dots. |
330 | @@ -240,11 +234,8 @@ | |||
331 | 240 | return | 234 | return |
332 | 241 | 235 | ||
333 | 242 | var selectedFeeds = [] | 236 | var selectedFeeds = [] |
334 | 243 | |||
335 | 244 | selectedFeeds.push(feedObj) | 237 | selectedFeeds.push(feedObj) |
336 | 245 | |||
337 | 246 | pageStack.push(chooseTopicPage, {"feedsToAdd" : selectedFeeds}) | 238 | pageStack.push(chooseTopicPage, {"feedsToAdd" : selectedFeeds}) |
338 | 247 | // pageStack.push(Qt.resolvedUrl("../pages/ChooseTopicPage.qml"), {"feedsToAdd" : selectedFeeds}) | ||
339 | 248 | } | 239 | } |
340 | 249 | } | 240 | } |
341 | 250 | } // Button | 241 | } // Button |
342 | 251 | 242 | ||
343 | === modified file 'shorts/qml/nongoogle/Positioner.qml' | |||
344 | --- shorts/qml/nongoogle/Positioner.qml 2015-12-15 15:58:12 +0000 | |||
345 | +++ shorts/qml/nongoogle/Positioner.qml 2016-01-04 18:43:59 +0000 | |||
346 | @@ -82,8 +82,6 @@ | |||
347 | 82 | var doc = new XMLHttpRequest() | 82 | var doc = new XMLHttpRequest() |
348 | 83 | 83 | ||
349 | 84 | doc.onreadystatechange = function() { | 84 | doc.onreadystatechange = function() { |
350 | 85 | |||
351 | 86 | // print("positioner onreadystatechange: ", doc.readyState, doc.status, feedUrl) | ||
352 | 87 | if (doc.readyState === XMLHttpRequest.DONE) { | 85 | if (doc.readyState === XMLHttpRequest.DONE) { |
353 | 88 | 86 | ||
354 | 89 | var resObj | 87 | var resObj |
355 | @@ -92,14 +90,13 @@ | |||
356 | 92 | } else { // Error | 90 | } else { // Error |
357 | 93 | resObj = {"responseDetails" : doc.statusText, | 91 | resObj = {"responseDetails" : doc.statusText, |
358 | 94 | "responseStatus" : doc.status} | 92 | "responseStatus" : doc.status} |
359 | 95 | // resObj = "" | ||
360 | 96 | } | 93 | } |
361 | 97 | 94 | ||
362 | 98 | countryCode = resObj.countryName | 95 | countryCode = resObj.countryName |
363 | 99 | print("countryCode", resObj) | 96 | print("countryCode", resObj) |
364 | 100 | 97 | ||
365 | 101 | if (countryCode == "China") { | 98 | if (countryCode == "China") { |
367 | 102 | if (optionsKeeper.useGoogleSearch()) { | 99 | if (optionsKeeper.useGoogleSearch) { |
368 | 103 | PopupUtils.open(componentDialogNG, tabstabs) | 100 | PopupUtils.open(componentDialogNG, tabstabs) |
369 | 104 | } | 101 | } |
370 | 105 | } | 102 | } |
371 | 106 | 103 | ||
372 | === modified file 'shorts/qml/nongoogle/XmlNetwork.qml' | |||
373 | --- shorts/qml/nongoogle/XmlNetwork.qml 2015-12-15 15:58:12 +0000 | |||
374 | +++ shorts/qml/nongoogle/XmlNetwork.qml 2016-01-04 18:43:59 +0000 | |||
375 | @@ -29,7 +29,6 @@ | |||
376 | 29 | 29 | ||
377 | 30 | var resObj | 30 | var resObj |
378 | 31 | if (doc.status == 200) { | 31 | if (doc.status == 200) { |
379 | 32 | // resObj = JSON.parse(doc.responseText) | ||
380 | 33 | resObj = utilities.xmlToJson(doc.responseText) | 32 | resObj = utilities.xmlToJson(doc.responseText) |
381 | 34 | } else { // Error | 33 | } else { // Error |
382 | 35 | resObj = {"responseDetails" : doc.statusText, | 34 | resObj = {"responseDetails" : doc.statusText, |
383 | @@ -41,18 +40,6 @@ | |||
384 | 41 | } | 40 | } |
385 | 42 | } | 41 | } |
386 | 43 | 42 | ||
387 | 44 | |||
388 | 45 | /* Number of articles to download. | ||
389 | 46 | */ | ||
390 | 47 | // finalRequest += "&num=" + num | ||
391 | 48 | |||
392 | 49 | /* Add some optional params. | ||
393 | 50 | * May be usable: | ||
394 | 51 | * hl - host language, for example "hl=ru", default en. | ||
395 | 52 | * num - number of entries, for example "num=50", default 4, maximum 100. | ||
396 | 53 | * output - format of output, for example "output=json", may be xml, json_xml, json. | ||
397 | 54 | */ | ||
398 | 55 | // doc.open("GET", finalRequest, true); | ||
399 | 56 | doc.open("GET", feedUrl, true); | 43 | doc.open("GET", feedUrl, true); |
400 | 57 | doc.send(); | 44 | doc.send(); |
401 | 58 | } | 45 | } |
402 | 59 | 46 | ||
403 | === modified file 'shorts/qml/pages/EditFeedPage.qml' | |||
404 | --- shorts/qml/pages/EditFeedPage.qml 2015-10-24 07:06:24 +0000 | |||
405 | +++ shorts/qml/pages/EditFeedPage.qml 2016-01-04 18:43:59 +0000 | |||
406 | @@ -11,7 +11,6 @@ | |||
407 | 11 | objectName: "editfeedpage" | 11 | objectName: "editfeedpage" |
408 | 12 | title: i18n.tr("Edit Feed") | 12 | title: i18n.tr("Edit Feed") |
409 | 13 | flickable: null/*content*/ | 13 | flickable: null/*content*/ |
410 | 14 | // tools: null | ||
411 | 15 | 14 | ||
412 | 16 | head.actions: [ | 15 | head.actions: [ |
413 | 17 | Action { | 16 | Action { |
414 | @@ -20,7 +19,6 @@ | |||
415 | 20 | text: i18n.tr("Done") | 19 | text: i18n.tr("Done") |
416 | 21 | onTriggered: { | 20 | onTriggered: { |
417 | 22 | if (previousTopicId != newTopicId) { | 21 | if (previousTopicId != newTopicId) { |
418 | 23 | // DB.updateFeedByUser(feedId, feedTitle, feedURL) | ||
419 | 24 | DB.deleteFeedTag(feedId, previousTopicId) | 22 | DB.deleteFeedTag(feedId, previousTopicId) |
420 | 25 | DB.addFeedTag(feedId, newTopicId) | 23 | DB.addFeedTag(feedId, newTopicId) |
421 | 26 | apply(feedId, newTopicId, previousTopicId) | 24 | apply(feedId, newTopicId, previousTopicId) |
422 | @@ -41,8 +39,7 @@ | |||
423 | 41 | property var dbTags | 39 | property var dbTags |
424 | 42 | property var topicArray | 40 | property var topicArray |
425 | 43 | 41 | ||
428 | 44 | function setValues(feedid, title, url, pTopicId) | 42 | function setValues(feedid, title, url, pTopicId) { |
427 | 45 | { | ||
429 | 46 | feedId = feedid ; | 43 | feedId = feedid ; |
430 | 47 | feedTitle = title ; | 44 | feedTitle = title ; |
431 | 48 | feedURL = url ; | 45 | feedURL = url ; |
432 | @@ -53,12 +50,9 @@ | |||
433 | 53 | var tArray = [] ; | 50 | var tArray = [] ; |
434 | 54 | var tagsArray = [] ; | 51 | var tagsArray = [] ; |
435 | 55 | var index | 52 | var index |
438 | 56 | for (var i=0; i<tags.rows.length; i++) | 53 | for (var i=0; i<tags.rows.length; i++) { |
437 | 57 | { | ||
439 | 58 | if(tags.rows[i].id == previousTopicId) | 54 | if(tags.rows[i].id == previousTopicId) |
443 | 59 | { | 55 | index = i |
441 | 60 | index = i ; | ||
442 | 61 | } | ||
444 | 62 | tArray.push(tags.rows[i].name) ; | 56 | tArray.push(tags.rows[i].name) ; |
445 | 63 | tagsArray.push(tags.rows[i]) ; | 57 | tagsArray.push(tags.rows[i]) ; |
446 | 64 | } | 58 | } |
447 | @@ -67,28 +61,23 @@ | |||
448 | 67 | seletorTopic.selectedIndex = index ; | 61 | seletorTopic.selectedIndex = index ; |
449 | 68 | } | 62 | } |
450 | 69 | 63 | ||
454 | 70 | function reloadPageContent() { | 64 | function reloadPageContent() { } |
452 | 71 | // editPage.tools = toolbar | ||
453 | 72 | } | ||
455 | 73 | 65 | ||
456 | 74 | Flickable { | 66 | Flickable { |
457 | 75 | id: content | 67 | id: content |
459 | 76 | anchors { fill: parent; topMargin: units.gu(2)/*margins: units.gu(2)*/ } | 68 | anchors { fill: parent; topMargin: units.gu(2) } |
460 | 77 | contentHeight: contentItem.childrenRect.height | 69 | contentHeight: contentItem.childrenRect.height |
461 | 78 | boundsBehavior: (contentHeight > editPage.height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds | 70 | boundsBehavior: (contentHeight > editPage.height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds |
462 | 79 | 71 | ||
465 | 80 | Column | 72 | Column { |
464 | 81 | { | ||
466 | 82 | anchors{ left: parent.left; right: parent.right } | 73 | anchors{ left: parent.left; right: parent.right } |
467 | 83 | spacing: units.gu(2) | 74 | spacing: units.gu(2) |
468 | 84 | 75 | ||
471 | 85 | Row | 76 | Row { |
470 | 86 | { | ||
472 | 87 | anchors{ left: parent.left; right: parent.right; leftMargin: units.gu(2); rightMargin: units.gu(2) } | 77 | anchors{ left: parent.left; right: parent.right; leftMargin: units.gu(2); rightMargin: units.gu(2) } |
473 | 88 | spacing: units.gu(1) | 78 | spacing: units.gu(1) |
474 | 89 | 79 | ||
477 | 90 | Label | 80 | Label { |
476 | 91 | { | ||
478 | 92 | id: labelTitle | 81 | id: labelTitle |
479 | 93 | text: i18n.tr("Title: ") | 82 | text: i18n.tr("Title: ") |
480 | 94 | width: units.gu(6) | 83 | width: units.gu(6) |
481 | @@ -105,21 +94,18 @@ | |||
482 | 105 | } | 94 | } |
483 | 106 | } | 95 | } |
484 | 107 | 96 | ||
487 | 108 | Row | 97 | Row { |
486 | 109 | { | ||
488 | 110 | anchors{ left: parent.left; right: parent.right; leftMargin: units.gu(2); rightMargin: units.gu(2) } | 98 | anchors{ left: parent.left; right: parent.right; leftMargin: units.gu(2); rightMargin: units.gu(2) } |
489 | 111 | spacing: units.gu(1) | 99 | spacing: units.gu(1) |
490 | 112 | 100 | ||
493 | 113 | Label | 101 | Label { |
492 | 114 | { | ||
494 | 115 | id: labelURL | 102 | id: labelURL |
495 | 116 | text: i18n.tr("URL: ") | 103 | text: i18n.tr("URL: ") |
496 | 117 | width: labelTitle.width | 104 | width: labelTitle.width |
497 | 118 | anchors.verticalCenter: parent.verticalCenter | 105 | anchors.verticalCenter: parent.verticalCenter |
498 | 119 | } | 106 | } |
499 | 120 | 107 | ||
502 | 121 | TextField | 108 | TextField { |
501 | 122 | { | ||
503 | 123 | text: feedURL | 109 | text: feedURL |
504 | 124 | width: parent.width - labelURL.width - parent.spacing | 110 | width: parent.width - labelURL.width - parent.spacing |
505 | 125 | anchors.verticalCenter: parent.verticalCenter | 111 | anchors.verticalCenter: parent.verticalCenter |
506 | @@ -132,24 +118,20 @@ | |||
507 | 132 | objectName: "valueselector" | 118 | objectName: "valueselector" |
508 | 133 | id: seletorTopic | 119 | id: seletorTopic |
509 | 134 | text: i18n.tr("Topic: ") | 120 | text: i18n.tr("Topic: ") |
512 | 135 | values: (topicArray == undefined || topicArray.length == 0) ? [""] : topicArray | 121 | values: (topicArray && topicArray.length) ? topicArray : [""] |
511 | 136 | // selectedIndex: 0 | ||
513 | 137 | 122 | ||
526 | 138 | onSelectedIndexChanged: | 123 | onSelectedIndexChanged: { |
527 | 139 | { | 124 | var tArray = topicArray |
528 | 140 | var tArray = topicArray ; | 125 | var topicname = tArray[seletorTopic.selectedIndex] |
529 | 141 | var topicname = tArray[seletorTopic.selectedIndex] ; | 126 | var tags = dbTags |
530 | 142 | var tags = dbTags ; | 127 | console.log("detail: ", JSON.stringify(tags)) |
531 | 143 | console.log("detail: ", JSON.stringify(tags)) ; | 128 | for (var i=0; i<tags.length; i++) { |
532 | 144 | for (var i=0; i<tags.length; i++) | 129 | if(tags[i].name == topicname) { |
533 | 145 | { | 130 | newTopicId = tags[i].id |
534 | 146 | if(tags[i].name == topicname) | 131 | break |
523 | 147 | { | ||
524 | 148 | newTopicId = tags[i].id ; | ||
525 | 149 | break ; | ||
535 | 150 | } | 132 | } |
536 | 151 | } | 133 | } |
538 | 152 | console.log("new topic id: ", newTopicId) ; | 134 | console.log("new topic id: ", newTopicId) |
539 | 153 | } | 135 | } |
540 | 154 | } | 136 | } |
541 | 155 | } | 137 | } |
542 | 156 | 138 | ||
543 | === modified file 'shorts/qml/pages/PageSettings.qml' | |||
544 | --- shorts/qml/pages/PageSettings.qml 2015-12-03 16:01:09 +0000 | |||
545 | +++ shorts/qml/pages/PageSettings.qml 2016-01-04 18:43:59 +0000 | |||
546 | @@ -9,6 +9,18 @@ | |||
547 | 9 | title: i18n.tr("Settings") | 9 | title: i18n.tr("Settings") |
548 | 10 | flickable: null | 10 | flickable: null |
549 | 11 | 11 | ||
550 | 12 | property bool preventSave: false | ||
551 | 13 | |||
552 | 14 | Component.onCompleted: updateInfoFromOptions() | ||
553 | 15 | |||
554 | 16 | function updateInfoFromOptions() { | ||
555 | 17 | preventSave = true | ||
556 | 18 | |||
557 | 19 | swUseGfa.checked = optionsKeeper.useGoogleSearch | ||
558 | 20 | |||
559 | 21 | preventSave = false | ||
560 | 22 | } | ||
561 | 23 | |||
562 | 12 | Column { | 24 | Column { |
563 | 13 | anchors { | 25 | anchors { |
564 | 14 | top: parent.top; topMargin: units.gu(1) | 26 | top: parent.top; topMargin: units.gu(1) |
565 | @@ -37,26 +49,19 @@ | |||
566 | 37 | } | 49 | } |
567 | 38 | 50 | ||
568 | 39 | Switch { | 51 | Switch { |
569 | 52 | id: swUseGfa | ||
570 | 40 | anchors.right: parent.right | 53 | anchors.right: parent.right |
571 | 41 | checked: optionsKeeper.useGoogleSearch() | ||
572 | 42 | |||
573 | 43 | Component.onCompleted: { | ||
574 | 44 | if (optionsKeeper.useGoogleSearch() == undefined ) { | ||
575 | 45 | optionsKeeper.setUseGoogleSearch(true) | ||
576 | 46 | checked = true | ||
577 | 47 | } | ||
578 | 48 | } | ||
579 | 49 | 54 | ||
580 | 50 | onCheckedChanged: { | 55 | onCheckedChanged: { |
582 | 51 | optionsKeeper.setUseGoogleSearch(checked) | 56 | if (preventSave) |
583 | 57 | return | ||
584 | 58 | optionsKeeper.useGoogleSearch = checked | ||
585 | 52 | } | 59 | } |
586 | 53 | } | 60 | } |
587 | 54 | } | 61 | } |
588 | 55 | 62 | ||
590 | 56 | ListItem.ThinDivider{} | 63 | ListItem.ThinDivider{ } |
591 | 57 | ///////////////////////////////////////////////////////////////////// Google RSS engine switch end here | 64 | ///////////////////////////////////////////////////////////////////// Google RSS engine switch end here |
592 | 58 | |||
593 | 59 | |||
594 | 60 | }// Column | 65 | }// Column |
595 | 61 | 66 | ||
596 | 62 | } | 67 | } |
597 | 63 | 68 | ||
598 | === modified file 'shorts/qml/shorts-app.qml' | |||
599 | --- shorts/qml/shorts-app.qml 2015-12-02 17:03:41 +0000 | |||
600 | +++ shorts/qml/shorts-app.qml 2016-01-04 18:43:59 +0000 | |||
601 | @@ -251,7 +251,7 @@ | |||
602 | 251 | objectName: "tabstabs" | 251 | objectName: "tabstabs" |
603 | 252 | visible: false | 252 | visible: false |
604 | 253 | 253 | ||
606 | 254 | bottomEdgePage: optionsKeeper.useGoogleSearch() ? appendFeedPage : appendNGFeedPage | 254 | bottomEdgePage: optionsKeeper.useGoogleSearch ? appendFeedPage : appendNGFeedPage |
607 | 255 | bottomEdgeTitle: i18n.tr("Add feeds") | 255 | bottomEdgeTitle: i18n.tr("Add feeds") |
608 | 256 | bottomEdgeBackgroundColor: "#F5F5F5" // "#875864" | 256 | bottomEdgeBackgroundColor: "#F5F5F5" // "#875864" |
609 | 257 | bottomEdgeTipColor: "#5533b5e5"// "#E0E0E0" //"#9b616c" | 257 | bottomEdgeTipColor: "#5533b5e5"// "#E0E0E0" //"#9b616c" |
PASSED: Continuous integration, rev:417 /core-apps- jenkins. ubuntu. com/job/ shorts- app-ci/ 11/ /core-apps- jenkins. ubuntu. com/job/ generic- update- mp/286/ console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /core-apps- jenkins. ubuntu. com/job/ shorts- app-ci/ 11/rebuild
https:/