Merge lp:~mrqtros/ubuntu-rssreader-app/ubuntu-rssreader-app-ng-refactor into lp:ubuntu-rssreader-app

Proposed by Roman Shchekin
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
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.

To post a comment you must log in.
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
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

review: Needs Fixing
418. By Roman Shchekin

Forgot "else".

Revision history for this message
Roman Shchekin (mrqtros) wrote :

Do you mean that I forgot "else"? Fixing...

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
419. By Roman Shchekin

"cancelDownload" fixed.

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Joey Chan (qqworini) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'shorts/qml/components/NetworkManager.qml'
--- shorts/qml/components/NetworkManager.qml 2015-12-02 17:03:41 +0000
+++ shorts/qml/components/NetworkManager.qml 2016-01-04 18:43:59 +0000
@@ -19,23 +19,14 @@
19 signal downloadStarted(int tagId)19 signal downloadStarted(int tagId)
2020
21 property string operationStatus: "success"21 property string operationStatus: "success"
22 property bool __useGFA: optionsKeeper.useGoogleSearch
2223
23 function updateFeeds(feedsArray, topicId) {24 function updateFeeds(feedsArray, topicId) {
24 if (optionsKeeper.useGoogleSearch()) {25 d.updateFeeds(feedsArray, topicId)
25 d.updateFeeds(feedsArray, topicId)
26 }
27 else {
28 dNG.updateFeeds(feedsArray, topicId)
29 }
30 }26 }
3127
32 function cancelDownload() {28 function cancelDownload() {
33 if (optionsKeeper.useGoogleSearch()) {29 d.cancelDownload()
34 d.cancelDownload()
35 }
36 else {
37 dNG.cancelDownload()
38 }
39 }30 }
4031
41 /* All private method are inside QtObject.32 /* All private method are inside QtObject.
@@ -69,13 +60,17 @@
69 }60 }
7061
71 currentFeed = feedList.shift()62 currentFeed = feedList.shift()
72 googleFeedApi.loadFeed(currentFeed.source)63 if (__useGFA)
64 googleFeedApi.loadFeed(currentFeed.source)
65 else nonGoogleFeedApi.loadFeed(currentFeed.source)
73 }66 }
7467
75 function cancelDownload() {68 function cancelDownload() {
76 feedList = []69 feedList = []
77 operationStatus = "abort"70 operationStatus = "abort"
78 googleFeedApi.abort()71 if (__useGFA)
72 googleFeedApi.abort()
73 else nonGoogleFeedApi.abort()
79 }74 }
8075
81 function updateFeedInfo(feedId, feedLink, responseData) {76 function updateFeedInfo(feedId, feedLink, responseData) {
@@ -122,67 +117,7 @@
122 console.timeEnd("addArticlesEx")117 console.timeEnd("addArticlesEx")
123 }118 }
124119
125 function clearFromBadTags(content) {120 function updateFeedInfoNg(feedId, feedLink, responseData) {
126 /* Remove non empty too. Useless anyway.
127 */
128 content = content.replace(/alt=".*?"/g, "")
129 content = content.replace(/title=".*?"/g, "")
130 return content
131 }
132
133 property var googleFeedApi: GoogleFeedApi {
134 onLoadResult: {
135 if (result.responseStatus !== 200) {
136 console.log("XML NETWORK GFA:", JSON.stringify(result))
137 if (operationStatus == "success")
138 operationStatus = "withErrors"
139 } else d.updateFeedInfo(d.currentFeed.id, d.currentFeed.link, result.responseData)
140
141 d.updateNextFeed()
142 }
143 } // GFA
144 } // QtObject
145
146 ////////////////////////////////////////// add a new object to refresh non-google feeds
147 QtObject {
148 id: dNG
149
150 property var feedList: [] // Feed list to update.
151 property var currentFeed // Current downloading feed.
152 property int tagId: 0 // Tag to update.
153
154 /* Method updates feeds one by another.
155 * Input: array of objects, each should include
156 * source, link and id (of feed in DB) properties.
157 */
158 function updateFeeds(feedsArray, topicId) {
159 tagId = topicId || 0
160
161 downloadStarted(tagId)
162
163 feedList = feedsArray
164 operationStatus = "success"
165 updateNextFeed()
166 }
167
168 // For inner usage only.
169 function updateNextFeed() {
170 if (feedList.length == 0) {
171 downloadFinished(tagId)
172 return
173 }
174
175 currentFeed = feedList.shift()
176 nonGoogleFeedApi.loadFeed(currentFeed.source)
177 }
178
179 function cancelDownload() {
180 feedList = []
181 operationStatus = "abort"
182 nonGoogleFeedApi.abort()
183 }
184
185 function updateFeedInfo(feedId, feedLink, responseData) {
186 var entries = responseData.item121 var entries = responseData.item
187 var f = responseData122 var f = responseData
188123
@@ -190,8 +125,8 @@
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"]
191126
192 DB.updateFeedByXml(feedId, feedLink, fde, fti)127 DB.updateFeedByXml(feedId, feedLink, fde, fti)
193 console.log(" -------- UPDATE INFO -------- ")128 console.log(" -------- UPDATE INFO (NG) -------- ")
194 // console.log(f.title, f.link, f.feedUrl, f.description)129 console.log(fti, feedLink, f.feedUrl, fde)
195130
196 console.time("addArticlesEx")131 console.time("addArticlesEx")
197132
@@ -200,11 +135,6 @@
200 for (var i = 0; i < maxLength; i++) {135 for (var i = 0; i < maxLength; i++) {
201 var e = entries[i]136 var e = entries[i]
202137
203 // print("article detail: ", JSON.stringify(e))
204 // Grab image from for article.
205 // var articleImage = ImageUtils.grabArticleImage(e)
206 // e.content = clearFromBadTags(e.content)
207
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"]
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"]
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"]
@@ -212,34 +142,25 @@
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"]
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"]
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"]
145
215 var articleImage = utilities.htmlGetImg(de)146 var articleImage = utilities.htmlGetImg(de)
216 if (articleImage.length == 0) { articleImage = utilities.htmlGetImg(co) }147 if (!articleImage.length)
217 else {148 articleImage = utilities.htmlGetImg(co)
218 print("articleImage: ", articleImage[0])
219 }
220 // print("date parse 0: ", pu, DateUtils.parseDate(pu))
221 // print("date parse 1: ", DateUtils.formatRelativeTime(i18n, DateUtils.parseDate(pu)))
222149
223 var temp =150 var temp = {
224 {
225 "title": ti,151 "title": ti,
226 "content": co == "" ? de : co,152 "content": co ? co : de,
227 "link": li,153 "link": li,
228 "author": creator == "" ? au : creator,154 "author": creator ? creator : au ,
229 "description": de,155 "description": de,
230 "pubDate": DateUtils.parseDate(pu),156 "pubDate": DateUtils.parseDate(pu),
231 "guid": Qt.md5(li + pu),157 "guid": Qt.md5(li + pu),
232 "image" : articleImage.length > 0 ? articleImage[0] : "",158 "image" : articleImage.length ? articleImage[0] : "",
233 "media_groups" : ""159 "media_groups" : ""
234 }160 }
235161
236 newArticles.push(temp)162 newArticles.push(temp)
237 }163 }
238// print("new article length: ", newArticles.length)
239
240 // /* Add new articles to DB and restore 'read' status of some of them.
241 // */
242 // DB.addArticles(articleModel, feedId, articleProperties);
243164
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. */
245 try {166 try {
@@ -253,22 +174,34 @@
253174
254 function clearFromBadTags(content) {175 function clearFromBadTags(content) {
255 /* Remove non empty too. Useless anyway.176 /* Remove non empty too. Useless anyway.
256 */177 */
257 content = content.replace(/alt=".*?"/g, "")178 content = content.replace(/alt=".*?"/g, "")
258 content = content.replace(/title=".*?"/g, "")179 content = content.replace(/title=".*?"/g, "")
259 return content180 return content
260 }181 }
261182
183 property var googleFeedApi: GoogleFeedApi {
184 onLoadResult: {
185 if (result.responseStatus !== 200) {
186 console.log("XML NETWORK GFA:", JSON.stringify(result))
187 if (operationStatus == "success")
188 operationStatus = "withErrors"
189 } else d.updateFeedInfo(d.currentFeed.id, d.currentFeed.link, result.responseData)
190
191 d.updateNextFeed()
192 }
193 } // GFA
194
262 property var nonGoogleFeedApi: XmlNetwork {195 property var nonGoogleFeedApi: XmlNetwork {
263 onLoadResult: {196 onLoadResult: {
264 if (result.rss == undefined || result.rss == "") {197 if (!result.rss) {
265// console.log("XML NETWORK GFA:", JSON.stringify(result))198 console.log("XML NETWORK NGA:", JSON.stringify(result))
266 if (operationStatus == "success")199 if (operationStatus == "success")
267 operationStatus = "withErrors"200 operationStatus = "withErrors"
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)
269202
270 dNG.updateNextFeed()203 d.updateNextFeed()
271 }204 }
272 } // GFA205 } // NGA
273 } // QtObject206 } // QtObject
274}207}
275208
=== modified file 'shorts/qml/components/OptionsKeeper.qml'
--- shorts/qml/components/OptionsKeeper.qml 2015-12-02 17:03:41 +0000
+++ shorts/qml/components/OptionsKeeper.qml 2016-01-04 18:43:59 +0000
@@ -9,21 +9,19 @@
9 property int fontSize9 property int fontSize
10 property bool useDarkTheme10 property bool useDarkTheme
11 property bool useListMode11 property bool useListMode
12 property bool useGoogleSearch
1213
13 Component.onCompleted: {14 Component.onCompleted: {
14 fontSize = getFontSize()15 fontSize = getFontSize()
15 useDarkTheme = getUseDarkTheme()16 useDarkTheme = getUseDarkTheme()
16 useListMode = getUseListMode()17 useListMode = getUseListMode()
1718 useGoogleSearch = getUseGoogleSearch()
18
19 if (useGoogleSearch() == undefined ) {
20 setUseGoogleSearch(true)
21 }
22 }19 }
2320
24 onFontSizeChanged: setFontSize(fontSize)21 onFontSizeChanged: setFontSize(fontSize)
25 onUseDarkThemeChanged: setUseDarkTheme(useDarkTheme)22 onUseDarkThemeChanged: setUseDarkTheme(useDarkTheme)
26 onUseListModeChanged: setUseListMode(useListMode)23 onUseListModeChanged: setUseListMode(useListMode)
24 onUseGoogleSearchChanged: setUseGoogleSearch(useGoogleSearch)
2725
28 function getFontSize() {26 function getFontSize() {
29 return settingsDocument.contents.fontSize27 return settingsDocument.contents.fontSize
@@ -69,8 +67,7 @@
69 return settingsDocument.contents.dbLastUpdate67 return settingsDocument.contents.dbLastUpdate
70 }68 }
7169
72 /////////////////////////////////////////////////////// below two functions are get/set "useGoogleSearch" value70 function getUseGoogleSearch() {
73 function useGoogleSearch() {
74 return settingsDocument.contents.useGoogleSearch71 return settingsDocument.contents.useGoogleSearch
75 }72 }
7673
7774
=== modified file 'shorts/qml/nongoogle/AppendNGFeedPage.qml'
--- shorts/qml/nongoogle/AppendNGFeedPage.qml 2015-12-15 15:58:12 +0000
+++ shorts/qml/nongoogle/AppendNGFeedPage.qml 2016-01-04 18:43:59 +0000
@@ -58,18 +58,15 @@
58 id: xmlFeedApi58 id: xmlFeedApi
5959
60 onLoadResult: {60 onLoadResult: {
61 if (result.rss == undefined || result.rss == "") {61 if (!result.rss) {
62 // TODO alert that fail retriving feed data
63 print("onLoadResult failed")62 print("onLoadResult failed")
64 }63 }
65 else {64 else {
66// d.updateFeedInfo(d.currentFeed.id, d.currentFeed.link, result.rss.channel)
67 var f = result.rss.channel65 var f = result.rss.channel
6866
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 ) : ""
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 ) : ""
71// feedUrl = l69 feedLink = f.link ? (f.link["#text"] ? f.link["#text"] : f.link) : ""
72 feedLink = f.link == undefined ? "" : f.link["#text"] == undefined ? f.link : f.link["#text"]
73 feedObj = {70 feedObj = {
74 "url" : feedUrl,71 "url" : feedUrl,
75 "title" : feedTitle,72 "title" : feedTitle,
@@ -77,7 +74,6 @@
77 "link" : feedLink74 "link" : feedLink
78 }75 }
79 }76 }
80
81 }77 }
82 }78 }
8379
@@ -114,20 +110,18 @@
114 anchors.fill: parent110 anchors.fill: parent
115 onClicked: {111 onClicked: {
116 if (Qt.inputMethod.visible)112 if (Qt.inputMethod.visible)
117 tfFeedUrl.accapt()113 tfFeedUrl.accept()
118 }114 }
119 }115 }
120 }116 }
121117
122 onAccepted: {118 onAccepted: accept()
123 accapt()
124 }
125119
126 function accapt() {120 function accept() {
127 Qt.inputMethod.hide()121 Qt.inputMethod.hide()
128 var userInput = text122 var userInput = text
129123
130 if (userInput == "")124 if (!userInput)
131 return125 return
132126
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.
@@ -240,11 +234,8 @@
240 return234 return
241235
242 var selectedFeeds = []236 var selectedFeeds = []
243
244 selectedFeeds.push(feedObj)237 selectedFeeds.push(feedObj)
245
246 pageStack.push(chooseTopicPage, {"feedsToAdd" : selectedFeeds})238 pageStack.push(chooseTopicPage, {"feedsToAdd" : selectedFeeds})
247// pageStack.push(Qt.resolvedUrl("../pages/ChooseTopicPage.qml"), {"feedsToAdd" : selectedFeeds})
248 }239 }
249 }240 }
250 } // Button241 } // Button
251242
=== modified file 'shorts/qml/nongoogle/Positioner.qml'
--- shorts/qml/nongoogle/Positioner.qml 2015-12-15 15:58:12 +0000
+++ shorts/qml/nongoogle/Positioner.qml 2016-01-04 18:43:59 +0000
@@ -82,8 +82,6 @@
82 var doc = new XMLHttpRequest()82 var doc = new XMLHttpRequest()
8383
84 doc.onreadystatechange = function() {84 doc.onreadystatechange = function() {
85
86 // print("positioner onreadystatechange: ", doc.readyState, doc.status, feedUrl)
87 if (doc.readyState === XMLHttpRequest.DONE) {85 if (doc.readyState === XMLHttpRequest.DONE) {
8886
89 var resObj87 var resObj
@@ -92,14 +90,13 @@
92 } else { // Error90 } else { // Error
93 resObj = {"responseDetails" : doc.statusText,91 resObj = {"responseDetails" : doc.statusText,
94 "responseStatus" : doc.status}92 "responseStatus" : doc.status}
95// resObj = ""
96 }93 }
9794
98 countryCode = resObj.countryName95 countryCode = resObj.countryName
99 print("countryCode", resObj)96 print("countryCode", resObj)
10097
101 if (countryCode == "China") {98 if (countryCode == "China") {
102 if (optionsKeeper.useGoogleSearch()) {99 if (optionsKeeper.useGoogleSearch) {
103 PopupUtils.open(componentDialogNG, tabstabs)100 PopupUtils.open(componentDialogNG, tabstabs)
104 }101 }
105 }102 }
106103
=== modified file 'shorts/qml/nongoogle/XmlNetwork.qml'
--- shorts/qml/nongoogle/XmlNetwork.qml 2015-12-15 15:58:12 +0000
+++ shorts/qml/nongoogle/XmlNetwork.qml 2016-01-04 18:43:59 +0000
@@ -29,7 +29,6 @@
2929
30 var resObj30 var resObj
31 if (doc.status == 200) {31 if (doc.status == 200) {
32// resObj = JSON.parse(doc.responseText)
33 resObj = utilities.xmlToJson(doc.responseText)32 resObj = utilities.xmlToJson(doc.responseText)
34 } else { // Error33 } else { // Error
35 resObj = {"responseDetails" : doc.statusText,34 resObj = {"responseDetails" : doc.statusText,
@@ -41,18 +40,6 @@
41 }40 }
42 }41 }
4342
44
45 /* Number of articles to download.
46 */
47// finalRequest += "&num=" + num
48
49 /* Add some optional params.
50 * May be usable:
51 * hl - host language, for example "hl=ru", default en.
52 * num - number of entries, for example "num=50", default 4, maximum 100.
53 * output - format of output, for example "output=json", may be xml, json_xml, json.
54 */
55// doc.open("GET", finalRequest, true);
56 doc.open("GET", feedUrl, true);43 doc.open("GET", feedUrl, true);
57 doc.send();44 doc.send();
58 }45 }
5946
=== modified file 'shorts/qml/pages/EditFeedPage.qml'
--- shorts/qml/pages/EditFeedPage.qml 2015-10-24 07:06:24 +0000
+++ shorts/qml/pages/EditFeedPage.qml 2016-01-04 18:43:59 +0000
@@ -11,7 +11,6 @@
11 objectName: "editfeedpage"11 objectName: "editfeedpage"
12 title: i18n.tr("Edit Feed")12 title: i18n.tr("Edit Feed")
13 flickable: null/*content*/13 flickable: null/*content*/
14// tools: null
1514
16 head.actions: [15 head.actions: [
17 Action {16 Action {
@@ -20,7 +19,6 @@
20 text: i18n.tr("Done")19 text: i18n.tr("Done")
21 onTriggered: {20 onTriggered: {
22 if (previousTopicId != newTopicId) {21 if (previousTopicId != newTopicId) {
23 // DB.updateFeedByUser(feedId, feedTitle, feedURL)
24 DB.deleteFeedTag(feedId, previousTopicId)22 DB.deleteFeedTag(feedId, previousTopicId)
25 DB.addFeedTag(feedId, newTopicId)23 DB.addFeedTag(feedId, newTopicId)
26 apply(feedId, newTopicId, previousTopicId)24 apply(feedId, newTopicId, previousTopicId)
@@ -41,8 +39,7 @@
41 property var dbTags39 property var dbTags
42 property var topicArray40 property var topicArray
4341
44 function setValues(feedid, title, url, pTopicId)42 function setValues(feedid, title, url, pTopicId) {
45 {
46 feedId = feedid ;43 feedId = feedid ;
47 feedTitle = title ;44 feedTitle = title ;
48 feedURL = url ;45 feedURL = url ;
@@ -53,12 +50,9 @@
53 var tArray = [] ;50 var tArray = [] ;
54 var tagsArray = [] ;51 var tagsArray = [] ;
55 var index52 var index
56 for (var i=0; i<tags.rows.length; i++)53 for (var i=0; i<tags.rows.length; i++) {
57 {
58 if(tags.rows[i].id == previousTopicId)54 if(tags.rows[i].id == previousTopicId)
59 {55 index = i
60 index = i ;
61 }
62 tArray.push(tags.rows[i].name) ;56 tArray.push(tags.rows[i].name) ;
63 tagsArray.push(tags.rows[i]) ;57 tagsArray.push(tags.rows[i]) ;
64 }58 }
@@ -67,28 +61,23 @@
67 seletorTopic.selectedIndex = index ;61 seletorTopic.selectedIndex = index ;
68 }62 }
6963
70 function reloadPageContent() {64 function reloadPageContent() { }
71// editPage.tools = toolbar
72 }
7365
74 Flickable {66 Flickable {
75 id: content67 id: content
76 anchors { fill: parent; topMargin: units.gu(2)/*margins: units.gu(2)*/ }68 anchors { fill: parent; topMargin: units.gu(2) }
77 contentHeight: contentItem.childrenRect.height69 contentHeight: contentItem.childrenRect.height
78 boundsBehavior: (contentHeight > editPage.height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds70 boundsBehavior: (contentHeight > editPage.height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds
7971
80 Column72 Column {
81 {
82 anchors{ left: parent.left; right: parent.right }73 anchors{ left: parent.left; right: parent.right }
83 spacing: units.gu(2)74 spacing: units.gu(2)
8475
85 Row76 Row {
86 {
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) }
88 spacing: units.gu(1)78 spacing: units.gu(1)
8979
90 Label80 Label {
91 {
92 id: labelTitle81 id: labelTitle
93 text: i18n.tr("Title: ")82 text: i18n.tr("Title: ")
94 width: units.gu(6)83 width: units.gu(6)
@@ -105,21 +94,18 @@
105 }94 }
106 }95 }
10796
108 Row97 Row {
109 {
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) }
111 spacing: units.gu(1)99 spacing: units.gu(1)
112100
113 Label101 Label {
114 {
115 id: labelURL102 id: labelURL
116 text: i18n.tr("URL: ")103 text: i18n.tr("URL: ")
117 width: labelTitle.width104 width: labelTitle.width
118 anchors.verticalCenter: parent.verticalCenter105 anchors.verticalCenter: parent.verticalCenter
119 }106 }
120107
121 TextField108 TextField {
122 {
123 text: feedURL109 text: feedURL
124 width: parent.width - labelURL.width - parent.spacing110 width: parent.width - labelURL.width - parent.spacing
125 anchors.verticalCenter: parent.verticalCenter111 anchors.verticalCenter: parent.verticalCenter
@@ -132,24 +118,20 @@
132 objectName: "valueselector"118 objectName: "valueselector"
133 id: seletorTopic119 id: seletorTopic
134 text: i18n.tr("Topic: ")120 text: i18n.tr("Topic: ")
135 values: (topicArray == undefined || topicArray.length == 0) ? [""] : topicArray121 values: (topicArray && topicArray.length) ? topicArray : [""]
136// selectedIndex: 0
137122
138 onSelectedIndexChanged:123 onSelectedIndexChanged: {
139 {124 var tArray = topicArray
140 var tArray = topicArray ;125 var topicname = tArray[seletorTopic.selectedIndex]
141 var topicname = tArray[seletorTopic.selectedIndex] ;126 var tags = dbTags
142 var tags = dbTags ;127 console.log("detail: ", JSON.stringify(tags))
143 console.log("detail: ", JSON.stringify(tags)) ;128 for (var i=0; i<tags.length; i++) {
144 for (var i=0; i<tags.length; i++)129 if(tags[i].name == topicname) {
145 {130 newTopicId = tags[i].id
146 if(tags[i].name == topicname)131 break
147 {
148 newTopicId = tags[i].id ;
149 break ;
150 }132 }
151 }133 }
152 console.log("new topic id: ", newTopicId) ;134 console.log("new topic id: ", newTopicId)
153 }135 }
154 }136 }
155 }137 }
156138
=== modified file 'shorts/qml/pages/PageSettings.qml'
--- shorts/qml/pages/PageSettings.qml 2015-12-03 16:01:09 +0000
+++ shorts/qml/pages/PageSettings.qml 2016-01-04 18:43:59 +0000
@@ -9,6 +9,18 @@
9 title: i18n.tr("Settings")9 title: i18n.tr("Settings")
10 flickable: null10 flickable: null
1111
12 property bool preventSave: false
13
14 Component.onCompleted: updateInfoFromOptions()
15
16 function updateInfoFromOptions() {
17 preventSave = true
18
19 swUseGfa.checked = optionsKeeper.useGoogleSearch
20
21 preventSave = false
22 }
23
12 Column {24 Column {
13 anchors {25 anchors {
14 top: parent.top; topMargin: units.gu(1)26 top: parent.top; topMargin: units.gu(1)
@@ -37,26 +49,19 @@
37 }49 }
3850
39 Switch {51 Switch {
52 id: swUseGfa
40 anchors.right: parent.right53 anchors.right: parent.right
41 checked: optionsKeeper.useGoogleSearch()
42
43 Component.onCompleted: {
44 if (optionsKeeper.useGoogleSearch() == undefined ) {
45 optionsKeeper.setUseGoogleSearch(true)
46 checked = true
47 }
48 }
4954
50 onCheckedChanged: {55 onCheckedChanged: {
51 optionsKeeper.setUseGoogleSearch(checked)56 if (preventSave)
57 return
58 optionsKeeper.useGoogleSearch = checked
52 }59 }
53 }60 }
54 }61 }
5562
56 ListItem.ThinDivider{}63 ListItem.ThinDivider{ }
57 ///////////////////////////////////////////////////////////////////// Google RSS engine switch end here64 ///////////////////////////////////////////////////////////////////// Google RSS engine switch end here
58
59
60 }// Column65 }// Column
6166
62}67}
6368
=== modified file 'shorts/qml/shorts-app.qml'
--- shorts/qml/shorts-app.qml 2015-12-02 17:03:41 +0000
+++ shorts/qml/shorts-app.qml 2016-01-04 18:43:59 +0000
@@ -251,7 +251,7 @@
251 objectName: "tabstabs"251 objectName: "tabstabs"
252 visible: false252 visible: false
253253
254 bottomEdgePage: optionsKeeper.useGoogleSearch() ? appendFeedPage : appendNGFeedPage254 bottomEdgePage: optionsKeeper.useGoogleSearch ? appendFeedPage : appendNGFeedPage
255 bottomEdgeTitle: i18n.tr("Add feeds")255 bottomEdgeTitle: i18n.tr("Add feeds")
256 bottomEdgeBackgroundColor: "#F5F5F5" // "#875864"256 bottomEdgeBackgroundColor: "#F5F5F5" // "#875864"
257 bottomEdgeTipColor: "#5533b5e5"// "#E0E0E0" //"#9b616c"257 bottomEdgeTipColor: "#5533b5e5"// "#E0E0E0" //"#9b616c"

Subscribers

People subscribed via source and target branches