Merge lp:~qqworini/ubuntu-rssreader-app/fix-bug-1507271 into lp:ubuntu-rssreader-app

Proposed by Joey Chan
Status: Merged
Approved by: Joey Chan
Approved revision: 413
Merged at revision: 413
Proposed branch: lp:~qqworini/ubuntu-rssreader-app/fix-bug-1507271
Merge into: lp:ubuntu-rssreader-app
Diff against target: 455 lines (+192/-210)
2 files modified
shorts/po/com.ubuntu.shorts.pot (+1/-1)
shorts/qml/pages/TopicComponent.qml (+191/-209)
To merge this branch: bzr merge lp:~qqworini/ubuntu-rssreader-app/fix-bug-1507271
Reviewer Review Type Date Requested Status
Roman Shchekin Approve
Jenkins Bot continuous-integration Approve
Review via email: mp+279156@code.launchpad.net

Commit message

fix bug 1507271: cannot delete a feed

Description of the change

fix bug 1507271: cannot delete a feed

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
Roman Shchekin (mrqtros) wrote :

Looks ok for me! Feel free to "top-approve".

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'shorts/po/com.ubuntu.shorts.pot'
2--- shorts/po/com.ubuntu.shorts.pot 2015-10-24 07:06:24 +0000
3+++ shorts/po/com.ubuntu.shorts.pot 2015-12-01 17:14:31 +0000
4@@ -8,7 +8,7 @@
5 msgstr ""
6 "Project-Id-Version: \n"
7 "Report-Msgid-Bugs-To: \n"
8-"POT-Creation-Date: 2015-10-23 22:15+0800\n"
9+"POT-Creation-Date: 2015-12-01 17:27+0800\n"
10 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
11 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12 "Language-Team: LANGUAGE <LL@li.org>\n"
13
14=== modified file 'shorts/qml/pages/TopicComponent.qml'
15--- shorts/qml/pages/TopicComponent.qml 2015-10-24 07:06:24 +0000
16+++ shorts/qml/pages/TopicComponent.qml 2015-12-01 17:14:31 +0000
17@@ -4,10 +4,15 @@
18
19 import "../utils/databasemodule_v2.js" as DB
20
21-ListItem {
22- id: topicComponent
23-
24- height: columnContent.height
25+Column {
26+ id: topicComponentRoot
27+
28+ anchors {
29+ left: parent.left
30+ right: parent.right
31+ }
32+
33+ height: columnContent.height + feedList.height
34
35 property bool isExpanded: false
36 property string topicName
37@@ -27,46 +32,6 @@
38 }
39 }
40
41- leadingActions: ListItemActions {
42- actions: [
43- Action {
44- iconName: "delete"
45- onTriggered: {
46- console.log("item about to be removed: ", topicComponent.topicId)
47-
48- var result = DB.deleteFeedByTagId(topicComponent.topicId)
49- if (!result.rowsAffected) {
50- topicManagement.reloadTopics()
51- }
52-
53- result = DB.deleteTag(topicComponent.topicId)
54- if (result.rowsAffected == 1) {
55- topicManagement.removeModelItem(topicComponent.modelIndex)
56- } else {
57- topicManagement.reloadTopics()
58- }
59- }
60- }
61- ]
62- }
63-
64- trailingActions: ListItemActions {
65- actions: [
66- Action {
67- iconName: "edit"
68- onTriggered: {
69- rowTopicContent.isEditing = true
70- topicComponent.edit()
71- inputTopicName.focus = true
72- }
73- }
74- ]
75- }
76-
77- Behavior on height {
78- NumberAnimation { duration: 150; easing.type: Easing.OutQuad }
79- }
80-
81 function reloadFeed (){
82 feedModel.clear()
83 var feedsTags = DB.loadFeedsFromTag(topicId)
84@@ -88,7 +53,7 @@
85 inputTopicName.text = labelTopicName.text
86 } else {
87 /* Make first letter capital.
88- */
89+ */
90 topicNameLocal = topicNameLocal.charAt(0).toUpperCase() + topicNameLocal.slice(1)
91
92 var result = DB.updateTag(topicComponent.topicId, topicNameLocal)
93@@ -105,181 +70,198 @@
94 cancelEdit()
95 }
96
97-// Rectangle {
98-// id: bg
99-// anchors.fill: parent
100-// color: "white"
101-// opacity: isSelected ? 0.4 : 0
102-// }
103-
104- Column {
105- id: columnContent
106- anchors{ left: parent.left; right: parent.right }
107-
108- /*
109- topic item
110- */
111- Item {
112+
113+ ListItem {
114+ id: topicComponent
115+
116+ height: columnContent.height
117+
118+ leadingActions: ListItemActions {
119+ actions: [
120+ Action {
121+ iconName: "delete"
122+ onTriggered: {
123+ console.log("item about to be removed: ", topicComponent.topicId)
124+
125+ var result = DB.deleteFeedByTagId(topicComponent.topicId)
126+ if (!result.rowsAffected) {
127+ topicManagement.reloadTopics()
128+ }
129+
130+ result = DB.deleteTag(topicComponent.topicId)
131+ if (result.rowsAffected == 1) {
132+ topicManagement.removeModelItem(topicComponent.modelIndex)
133+ } else {
134+ topicManagement.reloadTopics()
135+ }
136+ }
137+ }
138+ ]
139+ }
140+
141+ trailingActions: ListItemActions {
142+ actions: [
143+ Action {
144+ iconName: "edit"
145+ onTriggered: {
146+ rowTopicContent.isEditing = true
147+ topicComponent.edit()
148+ inputTopicName.focus = true
149+ }
150+ }
151+ ]
152+ }
153+
154+ Behavior on height {
155+ NumberAnimation { duration: 150; easing.type: Easing.OutQuad }
156+ }
157+
158+ Column {
159+ id: columnContent
160 anchors{ left: parent.left; right: parent.right }
161- height: units.gu(5)
162
163 /*
164+ topic item
165+ */
166+ Item {
167+ anchors{ left: parent.left; right: parent.right }
168+ height: units.gu(5)
169+
170+ /*
171 enable if edit mode active
172 */
173- Row {
174- id: rowTopicContent
175- anchors {
176- top: parent.top; bottom: parent.bottom; left: parent.left;
177- leftMargin: units.gu(1); topMargin: units.gu(0.7); bottomMargin: units.gu(1);
178- }
179- spacing: units.gu(2)
180-
181- property bool isEditing: false
182-
183- Label {
184- id: labelTopicName
185- objectName: "labelTopicName"
186- anchors.verticalCenter: parent.verticalCenter
187- text: topicName
188- width: rowTopicContent.isEditing ? 0 : paintedWidth
189- opacity: rowTopicContent.isEditing ? 0 : 1
190-
191- }
192-
193- TextField {
194- id: inputTopicName
195- anchors.verticalCenter: parent.verticalCenter
196- text: topicName
197- width: rowTopicContent.isEditing ? topicComponent.width - units.gu(11) : 0
198- opacity: rowTopicContent.isEditing ? 1 : 0
199- hasClearButton: true
200- activeFocusOnPress: true
201-
202- Behavior on width { UbuntuNumberAnimation{} }
203-
204- onAccepted: {
205- console.log("accepted?")
206- Qt.inputMethod.hide()
207- }
208-
209- Keys.enabled: rowTopicContent.isEditing
210- Keys.onPressed: {
211- event.accepted = false
212- if (event.key == Qt.Key_Return) {
213+ Row {
214+ id: rowTopicContent
215+ anchors {
216+ top: parent.top; bottom: parent.bottom; left: parent.left;
217+ leftMargin: units.gu(1); topMargin: units.gu(0.7); bottomMargin: units.gu(1);
218+ }
219+ spacing: units.gu(2)
220+
221+ property bool isEditing: false
222+
223+ Label {
224+ id: labelTopicName
225+ objectName: "labelTopicName"
226+ anchors.verticalCenter: parent.verticalCenter
227+ text: topicName
228+ width: rowTopicContent.isEditing ? 0 : paintedWidth
229+ opacity: rowTopicContent.isEditing ? 0 : 1
230+
231+ }
232+
233+ TextField {
234+ id: inputTopicName
235+ anchors.verticalCenter: parent.verticalCenter
236+ text: topicName
237+ width: rowTopicContent.isEditing ? topicComponent.width - units.gu(11) : 0
238+ opacity: rowTopicContent.isEditing ? 1 : 0
239+ hasClearButton: true
240+ activeFocusOnPress: true
241+
242+ Behavior on width { UbuntuNumberAnimation{} }
243+
244+ onAccepted: {
245+ console.log("accepted?")
246 Qt.inputMethod.hide()
247 }
248- }
249- }
250- } // Row
251-
252- Icon {
253- id: imgArrow
254- anchors {
255- right: parent.right; top: parent.top; bottom: parent.bottom;
256- topMargin: units.gu(1.5); bottomMargin: units.gu(1.5); rightMargin: units.gu(2)
257- }
258- name: "go-to"
259- rotation: topicComponent.isExpanded ? 90 : 0
260-
261- Behavior on rotation { UbuntuNumberAnimation{} }
262- } // Image
263-
264-
265- }
266-
267- /*
268- feeds listview
269- */
270- ListView {
271- id: feedList
272- anchors {
273- left: parent.left
274- right: parent.right
275- }
276- height: 0
277- opacity: 0
278- interactive: false
279- clip: true
280-
281- property int transitionDuration: 250
282-
283- Behavior on opacity {
284- PropertyAnimation { duration: 150; easing.type: Easing.OutQuad }
285- }
286-
287- model: ListModel {
288- id: feedModel
289- }
290-
291- delegate: Item {
292- id: delegateFeed
293-
294- width: feedList.width
295- height: feedItem.height
296-
297- property int feedId: model.id
298- property int topicId: topicComponent.topicId
299- property var topicItem
300-
301- FeedComponent {
302- id: feedItem
303- text: model.title
304- feedId: model.id
305- topicId: delegateFeed.topicId
306- width: topicList.width
307- height: units.gu(6)
308-
309- onClicked: {
310- mainView.editFeed(model.id, model.title, model.source, delegateFeed.topicId) ;
311- }
312-
313-// states: [
314-// State {
315-// name: "draging"
316-// when: topicList.flickState == "reorder"
317-// ParentChange {
318-// target: feedItem
319-// parent: topicList
320-// }
321-
322-// PropertyChanges {
323-// target: feedItem
324-// opacity: 0
325-// }
326-// },
327-
328-// State {
329-// name: ""
330-// ParentChange {
331-// target: feedItem
332-// parent: delegateFeed
333-// }
334-
335-// PropertyChanges {
336-// target: feedItem
337-// opacity: 1
338-// }
339-// }
340-// ]
341- } // FeedComponent
342- }
343-
344- } // ListView
345- }
346-
347- onClicked: {
348- isExpanded = !isExpanded
349- editCanceled()
350- }
351-
352- /* When item is expanded, "delete" icon is too big, so we should
353+
354+ Keys.enabled: rowTopicContent.isEditing
355+ Keys.onPressed: {
356+ event.accepted = false
357+ if (event.key == Qt.Key_Return) {
358+ Qt.inputMethod.hide()
359+ }
360+ }
361+ }
362+ } // Row
363+
364+ Icon {
365+ id: imgArrow
366+ anchors {
367+ right: parent.right; top: parent.top; bottom: parent.bottom;
368+ topMargin: units.gu(1.5); bottomMargin: units.gu(1.5); rightMargin: units.gu(2)
369+ }
370+ name: "go-to"
371+ rotation: topicComponent.isExpanded ? 90 : 0
372+
373+ Behavior on rotation { UbuntuNumberAnimation{} }
374+ } // Image
375+
376+
377+ }
378+
379+
380+ }
381+
382+ onClicked: {
383+ isExpanded = !isExpanded
384+ editCanceled()
385+ }
386+
387+ /* When item is expanded, "delete" icon is too big, so we should
388 * collapse it first.
389 */
390- onContentMovementStarted: {
391- isExpanded = false
392- editCanceled()
393+ onContentMovementStarted: {
394+// isExpanded = false
395+ editCanceled()
396+ }
397 }
398
399+
400+ /*
401+ feeds listview
402+*/
403+ ListView {
404+ id: feedList
405+ anchors {
406+ left: parent.left
407+ right: parent.right
408+ }
409+ height: 0
410+ opacity: 0
411+ interactive: false
412+ clip: true
413+
414+ property int transitionDuration: 250
415+
416+ Behavior on opacity {
417+ PropertyAnimation { duration: 150; easing.type: Easing.OutQuad }
418+ }
419+
420+ model: ListModel {
421+ id: feedModel
422+ }
423+
424+ delegate: Item {
425+ id: delegateFeed
426+
427+ width: feedList.width
428+ height: feedItem.height
429+
430+ property int feedId: model.id
431+ property int topicId: topicComponentRoot.topicId
432+ property var topicItem
433+
434+ FeedComponent {
435+ id: feedItem
436+ text: model.title
437+ feedId: model.id
438+ topicId: delegateFeed.topicId
439+ width: topicList.width
440+ height: units.gu(6)
441+
442+ onClicked: {
443+ mainView.editFeed(model.id, model.title, model.source, delegateFeed.topicId) ;
444+ }
445+
446+
447+ } // FeedComponent
448+ }
449+
450+ } // ListView
451+
452+
453 states: [
454 State {
455 name: "expanded"

Subscribers

People subscribed via source and target branches