Fix Qml errors on contacts.

This commit is contained in:
Julien Wadel 2022-06-28 09:21:23 +02:00
parent 4b4243901e
commit 4a7118d57c
3 changed files with 8 additions and 7 deletions

View file

@ -29,9 +29,10 @@ function setData (data) {
var model = values.model
model.clear()
data.forEach(function (data) {
model.append({ $value: data, $isInvalid: false })
})
if(data)
data.forEach(function (data) {
model.append({ $value: data, $isInvalid: false })
})
}
function setInvalid (index, status) {

View file

@ -172,7 +172,7 @@ function handleUrlChanged () {
// -----------------------------------------------------------------------------
function buildAddressFields () {
if(!contactEdit._vcard) return []
var address = contactEdit._vcard.address
return [{

View file

@ -112,8 +112,8 @@ ColumnLayout {
id: avatar
anchors.fill: parent
image: _vcard.avatar
username: _vcard.username
image: _vcard ? _vcard.avatar : ''
username: _vcard ? _vcard.username : ''
presenceLevel: _contact ? _contact.presenceLevel : -1
visible: (isLoaded() && !parent.hovered) || !_edition
}
@ -408,7 +408,7 @@ ColumnLayout {
}
TextButtonB {
enabled: usernameInput.text.length > 0 && _vcard.sipAddresses.length > 0
enabled: usernameInput.text.length > 0 && _vcard && _vcard.sipAddresses.length > 0
text: qsTr('save')
onClicked: Logic.save()
}