Merge lp:~qqworini/ubuntu-rssreader-app/editable-topic-name into lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk
- editable-topic-name
- Merge into trunk
Proposed by
Joey Chan
Status: | Superseded | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~qqworini/ubuntu-rssreader-app/editable-topic-name | ||||
Merge into: | lp:~ubuntu-shorts-dev/ubuntu-rssreader-app/trunk | ||||
Diff against target: |
510 lines (+213/-121) 4 files modified
.bzrignore (+1/-0) databasemodule_v2.js (+16/-1) feeds/TopicComponent.qml (+144/-28) feeds/TopicManagement.qml (+52/-92) |
||||
To merge this branch: | bzr merge lp:~qqworini/ubuntu-rssreader-app/editable-topic-name | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Phone Apps Jenkins Bot | continuous-integration | Needs Fixing | |
Ubuntu Shorts Developers | Pending | ||
Review via email:
|
This proposal has been superseded by a proposal from 2013-08-22.
Commit message
new feature: editable topic name and removable topic item
Description of the change
new feature: editable topic name and removable topic item
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote : | # |
review:
Needs Fixing
(continuous-integration)
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.bzrignore' |
2 | --- .bzrignore 2013-05-23 10:56:53 +0000 |
3 | +++ .bzrignore 2013-08-22 15:37:02 +0000 |
4 | @@ -5,3 +5,4 @@ |
5 | debian/*.debhelper.log |
6 | debian/*.substvars |
7 | RE:\.?[^.]+ |
8 | +./ubuntu-rssreader-app.qmlproject |
9 | |
10 | === modified file 'databasemodule_v2.js' |
11 | --- databasemodule_v2.js 2013-08-08 15:15:39 +0000 |
12 | +++ databasemodule_v2.js 2013-08-22 15:37:02 +0000 |
13 | @@ -167,6 +167,21 @@ |
14 | return dbResult |
15 | } |
16 | |
17 | +function deleteFeedByTagId(tagId) |
18 | +{ |
19 | + var db = openStdDataBase() |
20 | + var dbResult |
21 | + db.transaction(function (tx) { |
22 | +// ensureFeedTableExists(tx) |
23 | + tx.executeSql('PRAGMA foreign_keys = ON;') // enable foreign key support |
24 | + dbResult = tx.executeSql('delete from feed where exists (select 1 from feed_tag where feed_tag.feed_id = feed.id and feed_tag.tag_id = ?)', |
25 | + [tagId]) |
26 | + console.log("feed delete by tag id, AFFECTED ROWS: ", dbResult.rowsAffected) |
27 | + } |
28 | + ) |
29 | + return dbResult |
30 | +} |
31 | + |
32 | // select feeds without of topic (tag). |
33 | function loadFeedsWithoutTopic() |
34 | { |
35 | @@ -515,7 +530,7 @@ |
36 | |
37 | db.transaction(function(tx) { |
38 | dbResult = tx.executeSql("DELETE FROM feed_tag WHERE feed_id = ? AND tag_id = ?", [feedId, tagId]) |
39 | - console.log("feed_tag delete by feedId and tagId: ", dbResult.rows.length) |
40 | + console.log("feed_tag delete by feedId and tagId: ", dbResult.rowsAffected) |
41 | } |
42 | ) |
43 | return dbResult; |
44 | |
45 | === modified file 'feeds/TopicComponent.qml' |
46 | --- feeds/TopicComponent.qml 2013-08-03 10:06:36 +0000 |
47 | +++ feeds/TopicComponent.qml 2013-08-22 15:37:02 +0000 |
48 | @@ -16,14 +16,13 @@ |
49 | property bool isExpended: false |
50 | property string topicName |
51 | property int topicId |
52 | + property int modelIndex |
53 | |
54 | // onClicked: isExpended = !isExpended ; |
55 | |
56 | - onStateChanged: |
57 | - { |
58 | - if (isExpended) |
59 | - { |
60 | - reloadFeed() ; |
61 | + onStateChanged:{ |
62 | + if (isExpended){ |
63 | + reloadFeed() |
64 | } |
65 | } |
66 | |
67 | @@ -31,37 +30,154 @@ |
68 | NumberAnimation { duration: 150; easing.type: Easing.OutQuad } |
69 | } |
70 | |
71 | - function reloadFeed () |
72 | - { |
73 | -// for (var j=0; j < columnFeeds.children.length; j++) |
74 | -// { |
75 | -// columnFeeds.children[j].destroy() ; |
76 | -// } |
77 | - feedModel.clear() ; |
78 | - var feeds_tag = DB.loadFeedsFromTag(topicId) ; |
79 | -// var feed_array = [] ; |
80 | - for (var i=0; i< feeds_tag.rows.length; i++) |
81 | - { |
82 | -// feed_array.push(feeds_tag.rows.item(i)) ; |
83 | -// var component = Qt.createComponent("./FeedComponent.qml"); |
84 | -// var sprite = component.createObject(columnFeeds, {"text": feeds_tag.rows[i].title}); |
85 | + function reloadFeed (){ |
86 | + feedModel.clear() |
87 | + var feeds_tag = DB.loadFeedsFromTag(topicId) |
88 | + for (var i=0; i< feeds_tag.rows.length; i++){ |
89 | feedModel.append(feeds_tag.rows[i]) ; |
90 | } |
91 | -// columnFeeds.height = columnFeeds.childrenRect.height ; |
92 | -// return feed_array ; |
93 | } |
94 | |
95 | - Column |
96 | - { |
97 | + Column{ |
98 | id: columnContent |
99 | anchors{ left: parent.left; right: parent.right } |
100 | |
101 | - ListItem.Standard |
102 | + Item |
103 | { |
104 | - id: headerTopic |
105 | - text: topicName |
106 | - |
107 | - onClicked: isExpended = !isExpended ; |
108 | + anchors{ left: parent.left; right: parent.right } |
109 | + height: units.gu(5) |
110 | + |
111 | + ListItem.Base{ |
112 | + id: headerTopic |
113 | + removable: true |
114 | + height: units.gu(5) |
115 | + |
116 | + onClicked: isExpended = !isExpended |
117 | + |
118 | + onItemRemoved:{ |
119 | + console.log("item about to be removed: ", topicComponent.topicId) |
120 | +// itemCancelDelete.startCounting() |
121 | + var result = DB.deleteFeedByTagId(topicComponent.topicId) |
122 | + if (result.rowsAffected == undefined) |
123 | + { |
124 | + topicManagement.reloadTopics() |
125 | + } |
126 | + result = DB.deleteTag(topicComponent.topicId) |
127 | +// topicManagement.reloadTopics() |
128 | + if (result.rowsAffected == 1) |
129 | + { |
130 | + topicManagement.removeModelItem(topicComponent.modelIndex) |
131 | + } |
132 | + else |
133 | + { |
134 | + topicManagement.reloadTopics() |
135 | + } |
136 | + } |
137 | + |
138 | + Row{ |
139 | + id: rowTopicContent |
140 | + anchors |
141 | + { |
142 | + top: parent.top; bottom: parent.bottom; left: parent.left; |
143 | + leftMargin: units.gu(0); topMargin: units.gu(1); bottomMargin: units.gu(1); |
144 | + } |
145 | + spacing: units.gu(2) |
146 | + |
147 | + property bool isEditing: false |
148 | + |
149 | + Image{ |
150 | + anchors |
151 | + { |
152 | + top: parent.top; bottom: parent.bottom; |
153 | + topMargin: units.gu(0.5); bottomMargin: units.gu(0.5); |
154 | + } |
155 | + fillMode: Image.PreserveAspectFit |
156 | + source: Qt.resolvedUrl("../icons_tmp/compose.svg") |
157 | + smooth: true |
158 | + |
159 | + MouseArea{ |
160 | + anchors { fill: parent; margins: units.gu(-1) } |
161 | + onClicked: |
162 | + { |
163 | + if (rowTopicContent.isEditing) |
164 | + { |
165 | + var result = DB.updateTag(topicComponent.topicId, inputTopicName.text) |
166 | + if (result.rowsAffected == 1) |
167 | + { |
168 | + labelTopicName.text = inputTopicName.text |
169 | + } |
170 | + else |
171 | + { |
172 | + inputTopicName.text = labelTopicName.text |
173 | + } |
174 | + } |
175 | + else |
176 | + {} |
177 | + rowTopicContent.isEditing = !rowTopicContent.isEditing |
178 | + } |
179 | + } |
180 | + } |
181 | + |
182 | + Label{ |
183 | + id: labelTopicName |
184 | + anchors.verticalCenter: parent.verticalCenter |
185 | + text: topicName |
186 | + width: rowTopicContent.isEditing ? 0 : paintedWidth |
187 | + opacity: rowTopicContent.isEditing ? 0 : 1 |
188 | + |
189 | + // Behavior on width { UbuntuNumberAnimation{} } |
190 | + } |
191 | + |
192 | + TextField{ |
193 | + id: inputTopicName |
194 | + anchors.verticalCenter: parent.verticalCenter |
195 | + text: topicName |
196 | + width: rowTopicContent.isEditing ? headerTopic.width - units.gu(15) : 0 |
197 | + opacity: rowTopicContent.isEditing ? 1 : 0 |
198 | + hasClearButton: true |
199 | + activeFocusOnPress: true |
200 | + |
201 | + Behavior on width { UbuntuNumberAnimation{} } |
202 | + |
203 | + Connections { |
204 | + target: Qt.inputMethod |
205 | + onVisibleChanged: { |
206 | + if (!Qt.inputMethod.visible) { |
207 | + topicComponent.focus = true |
208 | + } |
209 | + } |
210 | + } |
211 | + } |
212 | + } |
213 | + |
214 | + Image{ |
215 | + id: imgArrow |
216 | + anchors |
217 | + { |
218 | + right: parent.right; top: parent.top; bottom: parent.bottom; |
219 | + topMargin: units.gu(1.5); bottomMargin: units.gu(1.5); rightMargin: units.gu(2) |
220 | + } |
221 | + fillMode: Image.PreserveAspectFit |
222 | + source: Qt.resolvedUrl("../icons_tmp/go-to.svg") |
223 | + smooth: true |
224 | + |
225 | + Behavior on rotation { UbuntuNumberAnimation{} } |
226 | + |
227 | + states: [ |
228 | + State { |
229 | + name: "expended" |
230 | + when: topicComponent.isExpended |
231 | + |
232 | + PropertyChanges |
233 | + { |
234 | + target: imgArrow |
235 | + rotation: 90 |
236 | + } |
237 | + } |
238 | + ] |
239 | + } |
240 | + } |
241 | + |
242 | } |
243 | |
244 | ListView |
245 | |
246 | === modified file 'feeds/TopicManagement.qml' |
247 | --- feeds/TopicManagement.qml 2013-08-08 17:17:28 +0000 |
248 | +++ feeds/TopicManagement.qml 2013-08-22 15:37:02 +0000 |
249 | @@ -10,9 +10,6 @@ |
250 | objectName: "topicmanagement" |
251 | id: topicManagement |
252 | |
253 | -// width: units.gu(50) |
254 | -// height: units.gu(75) |
255 | - |
256 | title: i18n.tr("Management") |
257 | flickable: content |
258 | tools: ToolbarItems { |
259 | @@ -29,31 +26,26 @@ |
260 | |
261 | Component.onCompleted: |
262 | { |
263 | - reloadTopics () ; |
264 | + reloadTopics () |
265 | } |
266 | |
267 | function reloadTopics () |
268 | { |
269 | - topicModel.clear() ; |
270 | -// for (var j=0; j < topicColumn.children.length; j++) |
271 | -// { |
272 | -// topicColumn.children[j].destroy() ; |
273 | -// } |
274 | - |
275 | - var topics = DB.loadTags() ; |
276 | - for (var i=0; i < topics.rows.length; i++) |
277 | - { |
278 | + topicModel.clear() |
279 | + var topics = DB.loadTags() |
280 | + for (var i=0; i < topics.rows.length; i++){ |
281 | topicModel.append( |
282 | { |
283 | "id": topics.rows[i].id |
284 | ,"name": topics.rows[i].name |
285 | - }); |
286 | - |
287 | -// var component = Qt.createComponent("./TopicComponent.qml"); |
288 | -// var sprite = component.createObject(topicColumn, {"topicName": topics.rows[i].name}); |
289 | + }) |
290 | } |
291 | } |
292 | |
293 | + function removeModelItem (modelIndex){ |
294 | + topicModel.remove(modelIndex) |
295 | + } |
296 | + |
297 | function reloadPageContent() { |
298 | |
299 | } |
300 | @@ -64,8 +56,7 @@ |
301 | contentHeight: contentItem.childrenRect.height |
302 | boundsBehavior: (contentHeight > topicManagement.height) ? Flickable.DragAndOvershootBounds : Flickable.StopAtBounds |
303 | |
304 | - Column |
305 | - { |
306 | + Column{ |
307 | anchors{ left: parent.left; right: parent.right } |
308 | |
309 | Item { |
310 | @@ -74,22 +65,19 @@ |
311 | anchors{ left: parent.left; right: parent.right } |
312 | height: units.gu(8) |
313 | |
314 | - UbuntuShape |
315 | - { |
316 | + UbuntuShape{ |
317 | id: uAddTopic |
318 | anchors { fill: parent; margins: units.gu(1) } |
319 | gradientColor: "goldenrod" |
320 | radius: "medium" |
321 | |
322 | - Label |
323 | - { |
324 | + Label{ |
325 | text: i18n.tr("Add a Topic") |
326 | fontSize: "large" |
327 | anchors.centerIn: parent |
328 | } |
329 | |
330 | - MouseArea |
331 | - { |
332 | + MouseArea{ |
333 | id: maAddTopic |
334 | anchors.fill: parent |
335 | onClicked: pageStack.push(createTopicPage) |
336 | @@ -110,8 +98,7 @@ |
337 | } |
338 | } |
339 | |
340 | - ListView |
341 | - { |
342 | + ListView { |
343 | id: topicList |
344 | anchors{ left: parent.left; right: parent.right } |
345 | height: contentItem.childrenRect.height |
346 | @@ -120,15 +107,8 @@ |
347 | |
348 | signal collapseAllItem() |
349 | |
350 | - function collapseAll() |
351 | - { |
352 | -// console.log("topicList length", topicList.contentItem.children.length) ; |
353 | -// for (var j=0; j < topicList.contentItem.children.length; j++) |
354 | -// { |
355 | -// console.log("topicList children", topicList.contentItem.children[j]) ; |
356 | -// topicList.contentItem.children[j].isExpended = false ; |
357 | -// } |
358 | - collapseAllItem() ; |
359 | + function collapseAll(){ |
360 | + collapseAllItem() |
361 | } |
362 | |
363 | displaced: Transition { |
364 | @@ -149,78 +129,64 @@ |
365 | anchors{ left: parent.left; right: parent.right } |
366 | height: topicItem.height |
367 | |
368 | -// onPressAndHold: |
369 | -// { |
370 | -// delegateRoot.drag.target = icon |
371 | -// } |
372 | - |
373 | - TopicComponent |
374 | - { |
375 | + TopicComponent{ |
376 | id: topicItem |
377 | topicName: model.name |
378 | topicId: model.id |
379 | + modelIndex: index |
380 | // isExpended: delegateRoot.isExpended |
381 | } |
382 | |
383 | DropArea { |
384 | anchors { fill: parent; margins: 0 } |
385 | |
386 | - onEntered: |
387 | - { |
388 | + onEntered:{ |
389 | // console.log("enter", drag.source) |
390 | - topicItem.selected = true ; |
391 | + topicItem.selected = true |
392 | } |
393 | |
394 | - onExited: |
395 | - { |
396 | + onExited:{ |
397 | // console.log("exit", drag.source) |
398 | - topicItem.selected = false ; |
399 | + topicItem.selected = false |
400 | } |
401 | |
402 | - onDropped: |
403 | - { |
404 | -// console.log("drop", drag.source) ; |
405 | - topicItem.selected = false ; |
406 | - drag.source.opacity = 0 ; |
407 | - console.log("dropped item feed id", drag.source.feedId) ; |
408 | - console.log("dropped item topic id", drag.source.topicId) ; |
409 | - DB.deleteFeedTag(drag.source.feedId, drag.source.topicId) ; |
410 | - DB.addFeedTag(drag.source.feedId, model.id) ; |
411 | - delegateRoot.isExpended = true ; |
412 | + onDropped:{ |
413 | +// console.log("drop", drag.source) |
414 | + topicItem.selected = false |
415 | + drag.source.opacity = 0 |
416 | + console.log("dropped item feed id", drag.source.feedId) |
417 | + console.log("dropped item topic id", drag.source.topicId) |
418 | + DB.deleteFeedTag(drag.source.feedId, drag.source.topicId) |
419 | + DB.addFeedTag(drag.source.feedId, model.id) |
420 | + delegateRoot.isExpended = true |
421 | } |
422 | } |
423 | |
424 | - Connections |
425 | - { |
426 | + Connections{ |
427 | id: connTopicList |
428 | target: topicList |
429 | |
430 | onCollapseAllItem: |
431 | { |
432 | - delegateRoot.isExpended = false ; |
433 | + delegateRoot.isExpended = false |
434 | } |
435 | } |
436 | |
437 | - Connections |
438 | - { |
439 | + Connections{ |
440 | id: connEditFeed0 |
441 | target: editFeed |
442 | |
443 | - onApply: |
444 | - { |
445 | - if (model.id == newTopicId || model.id == previousTopicId) |
446 | - { |
447 | - topicItem.reloadFeed() ; |
448 | - topicItem.isExpended = true ; |
449 | + onApply:{ |
450 | + if (model.id == newTopicId || model.id == previousTopicId){ |
451 | + topicItem.reloadFeed() |
452 | + topicItem.isExpended = true |
453 | } |
454 | } |
455 | |
456 | - onDeleteFeed: |
457 | - { |
458 | - if (model.id == topicId) |
459 | - { |
460 | - topicItem.reloadFeed() ; |
461 | - topicItem.isExpended = true ; |
462 | + onDeleteFeed:{ |
463 | + if (model.id == topicId){ |
464 | + topicItem.reloadFeed() |
465 | + topicItem.isExpended = true |
466 | } |
467 | } |
468 | } |
469 | @@ -231,31 +197,25 @@ |
470 | } // column |
471 | } // flickable |
472 | |
473 | - Connections |
474 | - { |
475 | + Connections{ |
476 | id: connAddTopic |
477 | target: createTopicPage |
478 | |
479 | - onTopicAdded: |
480 | - { |
481 | - reloadTopics() ; |
482 | + onTopicAdded:{ |
483 | + reloadTopics() |
484 | } |
485 | } |
486 | |
487 | - Connections |
488 | - { |
489 | + Connections { |
490 | id: connAddFeed |
491 | target: chooseTopicPage |
492 | |
493 | - onFeedAdded: |
494 | - { |
495 | - reloadTopics() ; |
496 | - for (var i=0; i<topicModel.count; i++) |
497 | - { |
498 | - if (topicModel.get(i).id == topicId) |
499 | - { |
500 | - topicList.currentIndex = i ; |
501 | - topicList.currentItem.isExpended = true ; |
502 | + onFeedAdded:{ |
503 | + reloadTopics() |
504 | + for (var i=0; i<topicModel.count; i++){ |
505 | + if (topicModel.get(i).id == topicId){ |
506 | + topicList.currentIndex = i |
507 | + topicList.currentItem.isExpended = true |
508 | } |
509 | } |
510 | } |
FAILED: Continuous integration, rev:44 91.189. 93.70:8080/ job/ubuntu- rssreader- app-ci/ 120/ 91.189. 93.70:8080/ job/generic- mediumtests/ 409 91.189. 93.70:8080/ job/ubuntu- rssreader- app-precise- amd64-ci/ 115 91.189. 93.70:8080/ job/ubuntu- rssreader- app-quantal- amd64-ci/ 120 91.189. 93.70:8080/ job/ubuntu- rssreader- app-raring- amd64-ci/ 120 91.189. 93.70:8080/ job/ubuntu- rssreader- app-saucy- amd64-ci/ 115
http://
Executed test runs:
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: 91.189. 93.70:8080/ job/ubuntu- rssreader- app-ci/ 120/rebuild
http://