[Merge] lp:~renatofilho/messaging-app/new-search-delegate into lp:messaging-app

Tiago Salem Herrmann tiago.herrmann at canonical.com
Mon Jul 14 20:40:19 UTC 2014


Review: Needs Fixing



Diff comments:

> === modified file 'src/qml/Messages.qml'
> --- src/qml/Messages.qml	2014-07-09 00:49:38 +0000
> +++ src/qml/Messages.qml	2014-07-14 19:58:22 +0000
> @@ -77,7 +77,7 @@
>              if (activeTransfer.state === ContentTransfer.Charged) {
>                  if (activeTransfer.items.length > 0) {
>                      addAttachmentsToModel(activeTransfer)
> -                    textEntry.forceActiveFocus() 
> +                    textEntry.forceActiveFocus()
>                  }
>              }
>          }
> @@ -298,13 +298,16 @@
>  
>      ContactListView {
>          id: contactSearch
> +
>          property bool searchEnabled: multiRecipient.searchString !== "" && multiRecipient.focus
> +
>          visible: searchEnabled
>          detailToPick: ContactDetail.PhoneNumber
>          clip: true
>          z: 1
>          autoUpdate: false
>          filterTerm: multiRecipient.searchString
> +        showSections: false
>  
>          states: [
>              State {
> @@ -319,6 +322,7 @@
>  
>          anchors {
>              top: parent.top
> +            topMargin: unist.gu(1)

there is a typo here

>              left: parent.left
>              right: parent.right
>              bottom: bottomPanel.top
> @@ -343,20 +347,89 @@
>              }
>          }
>  
> -        onDetailClicked: {
> -            if (action === "message" || action === "") {
> -                multiRecipient.addRecipient(detail.number)
> -                multiRecipient.clearSearch()
> -                multiRecipient.forceActiveFocus()
> -            } else if (action === "call") {
> -                Qt.inputMethod.hide()
> -                Qt.openUrlExternally("tel:///" + encodeURIComponent(detail.number))
> -            }
> +        ContactDetailPhoneNumberTypeModel {
> +            id: phoneTypeModel
>          }
>  
> -        onInfoRequested: {
> -            Qt.inputMethod.hide()
> -            Qt.openUrlExternally("addressbook:///contact?id=" + encodeURIComponent(contact.contactId))
> +        listDelegate: Item {
> +            anchors {
> +                left: parent.left
> +                right: parent.right
> +                margins: units.gu(2)
> +            }
> +            height: phoneRepeater.count * units.gu(6)
> +            Column {
> +                anchors.fill: parent
> +                spacing: units.gu(1)
> +
> +                Repeater {
> +                    id: phoneRepeater
> +
> +                    model: contact.phoneNumbers.length
> +
> +                    delegate: MouseArea {
> +                        anchors {
> +                            left: parent.left
> +                            right: parent.right
> +                        }
> +                        height: units.gu(5)
> +
> +                        onClicked: {
> +                            multiRecipient.addRecipient(contact.phoneNumbers[index].number)
> +                            multiRecipient.clearSearch()
> +                            multiRecipient.forceActiveFocus()
> +                        }
> +
> +                        Column {
> +                            anchors.fill: parent
> +
> +                            Label {
> +                                anchors {
> +                                    left: parent.left
> +                                    right: parent.right
> +                                }
> +                                height: units.gu(2)
> +                                text: {
> +                                    // this is necessary to keep the string in the original format
> +                                    var originalText = contact.displayLabel.label
> +                                    var lowerSearchText =  multiRecipient.searchString.toLowerCase()
> +                                    var lowerText = originalText.toLowerCase()
> +                                    var searchIndex = lowerText.indexOf(lowerSearchText)
> +                                    if (searchIndex !== -1) {
> +                                        var piece = originalText.substr(searchIndex, lowerSearchText.length)
> +                                        return originalText.replace(piece, "<b>" + piece + "</b>")
> +                                    } else {
> +                                        return originalText
> +                                    }
> +                                }
> +                                fontSize: "medium"
> +                                color: UbuntuColors.lightAubergine
> +                            }
> +                            Label {
> +                                anchors {
> +                                    left: parent.left
> +                                    right: parent.right
> +                                }
> +                                height: units.gu(2)
> +                                text: {
> +                                    var phoneDetail = contact.phoneNumbers[index]
> +                                    return ("%1 %2").arg(phoneTypeModel.get(phoneTypeModel.getTypeIndex(phoneDetail)).label)
> +                                                    .arg(phoneDetail.number)
> +                                }
> +                            }
> +                            Item {
> +                                anchors {
> +                                    left: parent.left
> +                                    right: parent.right
> +                                }
> +                                height: units.gu(1)
> +                            }
> +
> +                            ListItem.ThinDivider {}
> +                        }
> +                    }
> +                }
> +            }
>          }
>      }
>  
> @@ -431,7 +504,7 @@
>              }
>          }
>      }
> - 
> +
>      ToolbarItems {
>          id: messagesToolbarUnknownContact
>          visible: false
> 


-- 
https://code.launchpad.net/~renatofilho/messaging-app/new-search-delegate/+merge/226687
Your team Ubuntu Phablet Team is subscribed to branch lp:messaging-app.



More information about the Ubuntu-reviews mailing list