[Merge] lp:~boiko/messaging-app/compose_bar into lp:messaging-app

Tiago Salem Herrmann tiago.herrmann at canonical.com
Mon Nov 30 21:09:24 UTC 2015


Review: Needs Fixing



Diff comments:

> 
> === added file 'src/qml/ThumbnailContact.qml'
> --- src/qml/ThumbnailContact.qml	1970-01-01 00:00:00 +0000
> +++ src/qml/ThumbnailContact.qml	2015-11-26 20:04:45 +0000
> @@ -0,0 +1,106 @@
> +/*
> + * Copyright 2012-2015 Canonical Ltd.
> + *
> + * This file is part of messaging-app.
> + *
> + * messaging-app is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; version 3.
> + *
> + * messaging-app is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program.  If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +import QtQuick 2.0
> +import Ubuntu.Components 1.3
> +import Ubuntu.Contacts 0.1
> +
> +Item {
> +    id: attachment
> +
> +    readonly property int contactsCount:vcardParser.contacts ? vcardParser.contacts.length : 0
> +    property int index
> +    property string filePath
> +    property alias vcard: vcardParser
> +    property string contactDisplayName: {

We have to specify signal pressAndHold() here and emit the signal to make the "remove" popup work, just like in the other Thumbnail files.

> +        if (contactsCount > 0)  {
> +            var contact = vcard.contacts[0]
> +            if (contact.displayLabel.label && (contact.displayLabel.label != "")) {
> +                return contact.displayLabel.label
> +            } else if (contact.name) {
> +                var contacFullName  = contact.name.firstName
> +                if (contact.name.midleName) {
> +                    contacFullName += " " + contact.name.midleName
> +                }
> +                if (contact.name.lastName) {
> +                    contacFullName += " " + contact.name.lastName
> +                }
> +                return contacFullName
> +            }
> +            return i18n.tr("Unknown contact")
> +        }
> +        return ""
> +    }
> +    property string title: {
> +        var result = attachment.contactDisplayName
> +        if (attachment.contactsCount > 1) {
> +            return result + " (+%1)".arg(attachment.contactsCount-1)
> +        } else {
> +            return result
> +        }
> +    }
> +
> +    height: units.gu(6)
> +    width: textEntry.width
> +
> +    ContactAvatar {
> +        id: avatar
> +
> +        anchors {
> +            top: parent.top
> +            bottom: parent.bottom
> +            left: parent.left
> +        }
> +        contactElement: attachment.contactsCount === 1 ? attachment.vcard.contacts[0] : null
> +        fallbackAvatarUrl: attachment.contactsCount === 1 ? "image://theme/contact" : "image://theme/contact-group"
> +        fallbackDisplayName: attachment.contactsCount === 1 ? attachment.contactDisplayName : ""
> +        width: height
> +    }
> +    Label {
> +        id: label
> +
> +        anchors {
> +            left: avatar.right
> +            leftMargin: units.gu(1)
> +            top: avatar.top
> +            bottom: avatar.bottom
> +            right: parent.right
> +            rightMargin: units.gu(1)
> +        }
> +
> +        verticalAlignment: Text.AlignVCenter
> +        text: attachment.title
> +        elide: Text.ElideMiddle
> +        color: UbuntuColors.lightAubergine
> +    }
> +    MouseArea {
> +        anchors.fill: parent
> +        onPressAndHold: {
> +            mouse.accept = true
> +            Qt.inputMethod.hide()
> +            activeAttachmentIndex = index
> +            PopupUtils.open(attachmentPopover, parent)
> +        }
> +    }
> +    VCardParser {
> +        id: vcardParser
> +
> +        vCardUrl: attachment ? Qt.resolvedUrl(attachment.filePath) : ""
> +    }
> +}
> +


-- 
https://code.launchpad.net/~boiko/messaging-app/compose_bar/+merge/278208
Your team Ubuntu Phablet Team is subscribed to branch lp:messaging-app.



More information about the Ubuntu-reviews mailing list