← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

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

 

Joey Chan has proposed merging lp:~qqworini/ubuntu-rssreader-app/fix-bug-1507271 into lp:ubuntu-rssreader-app.

Commit message:
fix bug 1507271: cannot delete a feed

Requested reviews:
  Jenkins Bot (ubuntu-core-apps-jenkins-bot): continuous-integration
  Ubuntu Shorts Developers (ubuntu-shorts-dev)
Related bugs:
  Bug #1507271 in Ubuntu Shorts App: "Shorts: Delete a feed is impossible"
  https://bugs.launchpad.net/ubuntu-rssreader-app/+bug/1507271

For more details, see:
https://code.launchpad.net/~qqworini/ubuntu-rssreader-app/fix-bug-1507271/+merge/279156

fix bug 1507271: cannot delete a feed
-- 
Your team Ubuntu Shorts Developers is requested to review the proposed merge of lp:~qqworini/ubuntu-rssreader-app/fix-bug-1507271 into lp:ubuntu-rssreader-app.
=== modified file 'shorts/po/com.ubuntu.shorts.pot'
--- shorts/po/com.ubuntu.shorts.pot	2015-10-24 07:06:24 +0000
+++ shorts/po/com.ubuntu.shorts.pot	2015-12-01 17:14:31 +0000
@@ -8,7 +8,7 @@
 msgstr ""
 "Project-Id-Version: \n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2015-10-23 22:15+0800\n"
+"POT-Creation-Date: 2015-12-01 17:27+0800\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
 "Language-Team: LANGUAGE <LL@xxxxxx>\n"

=== modified file 'shorts/qml/pages/TopicComponent.qml'
--- shorts/qml/pages/TopicComponent.qml	2015-10-24 07:06:24 +0000
+++ shorts/qml/pages/TopicComponent.qml	2015-12-01 17:14:31 +0000
@@ -4,10 +4,15 @@
 
 import "../utils/databasemodule_v2.js" as DB
 
-ListItem {
-    id: topicComponent
-
-    height: columnContent.height
+Column {
+    id: topicComponentRoot
+
+    anchors {
+        left: parent.left
+        right: parent.right
+    }
+
+    height: columnContent.height + feedList.height
 
     property bool isExpanded: false
     property string topicName
@@ -27,46 +32,6 @@
         }
     }
 
-    leadingActions: ListItemActions {
-        actions: [
-            Action {
-                iconName: "delete"
-                onTriggered: {
-                    console.log("item about to be removed: ", topicComponent.topicId)
-
-                    var result = DB.deleteFeedByTagId(topicComponent.topicId)
-                    if (!result.rowsAffected) {
-                        topicManagement.reloadTopics()
-                    }
-
-                    result = DB.deleteTag(topicComponent.topicId)
-                    if (result.rowsAffected == 1) {
-                        topicManagement.removeModelItem(topicComponent.modelIndex)
-                    } else {
-                        topicManagement.reloadTopics()
-                    }
-                }
-            }
-        ]
-    }
-
-    trailingActions: ListItemActions {
-        actions: [
-            Action {
-                iconName: "edit"
-                onTriggered: {
-                    rowTopicContent.isEditing = true
-                    topicComponent.edit()
-                    inputTopicName.focus = true
-                }
-            }
-        ]
-    }
-
-    Behavior on height {
-        NumberAnimation { duration: 150; easing.type: Easing.OutQuad }
-    }
-
     function reloadFeed (){
         feedModel.clear()
         var feedsTags =  DB.loadFeedsFromTag(topicId)
@@ -88,7 +53,7 @@
             inputTopicName.text = labelTopicName.text
         } else {
             /* Make first letter capital.
-             */
+         */
             topicNameLocal = topicNameLocal.charAt(0).toUpperCase() + topicNameLocal.slice(1)
 
             var result = DB.updateTag(topicComponent.topicId, topicNameLocal)
@@ -105,181 +70,198 @@
         cancelEdit()
     }
 
-//    Rectangle {
-//        id: bg
-//        anchors.fill: parent
-//        color: "white"
-//        opacity: isSelected ? 0.4 : 0
-//    }
-
-    Column {
-        id: columnContent
-        anchors{ left: parent.left; right: parent.right }
-
-        /*
-          topic item
-        */
-        Item {
+
+    ListItem {
+        id: topicComponent
+
+        height: columnContent.height
+
+        leadingActions: ListItemActions {
+            actions: [
+                Action {
+                    iconName: "delete"
+                    onTriggered: {
+                        console.log("item about to be removed: ", topicComponent.topicId)
+
+                        var result = DB.deleteFeedByTagId(topicComponent.topicId)
+                        if (!result.rowsAffected) {
+                            topicManagement.reloadTopics()
+                        }
+
+                        result = DB.deleteTag(topicComponent.topicId)
+                        if (result.rowsAffected == 1) {
+                            topicManagement.removeModelItem(topicComponent.modelIndex)
+                        } else {
+                            topicManagement.reloadTopics()
+                        }
+                    }
+                }
+            ]
+        }
+
+        trailingActions: ListItemActions {
+            actions: [
+                Action {
+                    iconName: "edit"
+                    onTriggered: {
+                        rowTopicContent.isEditing = true
+                        topicComponent.edit()
+                        inputTopicName.focus = true
+                    }
+                }
+            ]
+        }
+
+        Behavior on height {
+            NumberAnimation { duration: 150; easing.type: Easing.OutQuad }
+        }
+
+        Column {
+            id: columnContent
             anchors{ left: parent.left; right: parent.right }
-            height: units.gu(5)
 
             /*
+          topic item
+        */
+            Item {
+                anchors{ left: parent.left; right: parent.right }
+                height: units.gu(5)
+
+                /*
               enable if edit mode active
             */
-            Row {
-                id: rowTopicContent
-                anchors {
-                    top: parent.top; bottom: parent.bottom; left: parent.left;
-                    leftMargin: units.gu(1); topMargin: units.gu(0.7); bottomMargin: units.gu(1);
-                }
-                spacing: units.gu(2)
-
-                property bool isEditing: false
-
-                Label {
-                    id: labelTopicName
-                    objectName: "labelTopicName"
-                    anchors.verticalCenter: parent.verticalCenter
-                    text: topicName
-                    width: rowTopicContent.isEditing ? 0 : paintedWidth
-                    opacity: rowTopicContent.isEditing ? 0 : 1
-
-                }
-
-                TextField {
-                    id: inputTopicName
-                    anchors.verticalCenter: parent.verticalCenter
-                    text: topicName
-                    width: rowTopicContent.isEditing ? topicComponent.width - units.gu(11) : 0
-                    opacity: rowTopicContent.isEditing ? 1 : 0
-                    hasClearButton: true
-                    activeFocusOnPress: true
-
-                    Behavior on width { UbuntuNumberAnimation{} }
-
-                    onAccepted: {
-                        console.log("accepted?")
-                        Qt.inputMethod.hide()
-                    }
-
-                    Keys.enabled: rowTopicContent.isEditing
-                    Keys.onPressed: {
-                        event.accepted = false
-                        if (event.key == Qt.Key_Return) {
+                Row {
+                    id: rowTopicContent
+                    anchors {
+                        top: parent.top; bottom: parent.bottom; left: parent.left;
+                        leftMargin: units.gu(1); topMargin: units.gu(0.7); bottomMargin: units.gu(1);
+                    }
+                    spacing: units.gu(2)
+
+                    property bool isEditing: false
+
+                    Label {
+                        id: labelTopicName
+                        objectName: "labelTopicName"
+                        anchors.verticalCenter: parent.verticalCenter
+                        text: topicName
+                        width: rowTopicContent.isEditing ? 0 : paintedWidth
+                        opacity: rowTopicContent.isEditing ? 0 : 1
+
+                    }
+
+                    TextField {
+                        id: inputTopicName
+                        anchors.verticalCenter: parent.verticalCenter
+                        text: topicName
+                        width: rowTopicContent.isEditing ? topicComponent.width - units.gu(11) : 0
+                        opacity: rowTopicContent.isEditing ? 1 : 0
+                        hasClearButton: true
+                        activeFocusOnPress: true
+
+                        Behavior on width { UbuntuNumberAnimation{} }
+
+                        onAccepted: {
+                            console.log("accepted?")
                             Qt.inputMethod.hide()
                         }
-                    }
-                }
-            } // Row
-
-            Icon {
-                id: imgArrow
-                anchors {
-                    right: parent.right; top: parent.top; bottom: parent.bottom;
-                    topMargin: units.gu(1.5); bottomMargin: units.gu(1.5); rightMargin: units.gu(2)
-                }
-                name: "go-to"
-                rotation: topicComponent.isExpanded ? 90 : 0
-
-                Behavior on rotation { UbuntuNumberAnimation{} }
-            } // Image
-
-
-        }
-
-        /*
-          feeds listview
-        */
-        ListView {
-            id: feedList
-            anchors {
-                left: parent.left
-                right: parent.right
-            }
-            height: 0
-            opacity: 0
-            interactive: false
-            clip: true
-
-            property int transitionDuration: 250
-
-            Behavior on opacity {
-                PropertyAnimation { duration: 150; easing.type: Easing.OutQuad }
-            }
-
-            model: ListModel {
-                id: feedModel
-            }
-
-            delegate: Item {
-                id: delegateFeed
-
-                width: feedList.width
-                height: feedItem.height
-
-                property int feedId: model.id
-                property int topicId: topicComponent.topicId
-                property var topicItem
-
-                FeedComponent {
-                    id: feedItem
-                    text: model.title
-                    feedId: model.id
-                    topicId: delegateFeed.topicId
-                    width: topicList.width
-                    height: units.gu(6)
-
-                    onClicked: {
-                        mainView.editFeed(model.id, model.title, model.source, delegateFeed.topicId) ;
-                    }
-
-//                    states: [
-//                        State {
-//                            name: "draging"
-//                            when: topicList.flickState == "reorder"
-//                            ParentChange {
-//                                target: feedItem
-//                                parent: topicList
-//                            }
-
-//                            PropertyChanges {
-//                                target: feedItem
-//                                opacity: 0
-//                            }
-//                        },
-
-//                        State {
-//                            name: ""
-//                            ParentChange {
-//                                target: feedItem
-//                                parent: delegateFeed
-//                            }
-
-//                            PropertyChanges {
-//                                target: feedItem
-//                                opacity: 1
-//                            }
-//                        }
-//                    ]
-                } // FeedComponent
-            }
-
-        } // ListView
-    }
-
-    onClicked: {
-        isExpanded = !isExpanded
-        editCanceled()
-    }
-
-    /* When item is expanded, "delete" icon is too big, so we should
+
+                        Keys.enabled: rowTopicContent.isEditing
+                        Keys.onPressed: {
+                            event.accepted = false
+                            if (event.key == Qt.Key_Return) {
+                                Qt.inputMethod.hide()
+                            }
+                        }
+                    }
+                } // Row
+
+                Icon {
+                    id: imgArrow
+                    anchors {
+                        right: parent.right; top: parent.top; bottom: parent.bottom;
+                        topMargin: units.gu(1.5); bottomMargin: units.gu(1.5); rightMargin: units.gu(2)
+                    }
+                    name: "go-to"
+                    rotation: topicComponent.isExpanded ? 90 : 0
+
+                    Behavior on rotation { UbuntuNumberAnimation{} }
+                } // Image
+
+
+            }
+
+
+        }
+
+        onClicked: {
+            isExpanded = !isExpanded
+            editCanceled()
+        }
+
+        /* When item is expanded, "delete" icon is too big, so we should
      * collapse it first.
      */
-    onContentMovementStarted: {
-        isExpanded = false
-        editCanceled()
+        onContentMovementStarted: {
+//            isExpanded = false
+            editCanceled()
+        }
     }
 
+
+    /*
+  feeds listview
+*/
+    ListView {
+        id: feedList
+        anchors {
+            left: parent.left
+            right: parent.right
+        }
+        height: 0
+        opacity: 0
+        interactive: false
+        clip: true
+
+        property int transitionDuration: 250
+
+        Behavior on opacity {
+            PropertyAnimation { duration: 150; easing.type: Easing.OutQuad }
+        }
+
+        model: ListModel {
+            id: feedModel
+        }
+
+        delegate: Item {
+            id: delegateFeed
+
+            width: feedList.width
+            height: feedItem.height
+
+            property int feedId: model.id
+            property int topicId: topicComponentRoot.topicId
+            property var topicItem
+
+            FeedComponent {
+                id: feedItem
+                text: model.title
+                feedId: model.id
+                topicId: delegateFeed.topicId
+                width: topicList.width
+                height: units.gu(6)
+
+                onClicked: {
+                    mainView.editFeed(model.id, model.title, model.source, delegateFeed.topicId) ;
+                }
+
+
+            } // FeedComponent
+        }
+
+    } // ListView
+
+
     states: [
         State {
             name: "expanded"