Commit 179cbedd authored by Ronan Abhamon's avatar Ronan Abhamon

feat(Linphone/Contact/Contact): supports uri as contact attr

parent 328a451a
......@@ -4,6 +4,7 @@ import QtQuick.Layouts 1.3
import Common 1.0
import Linphone 1.0
import Linphone.Styles 1.0
import Utils 1.0
// ===================================================================
......@@ -12,6 +13,7 @@ Rectangle {
property alias sipAddressColor: description.sipAddressColor
property alias usernameColor: description.usernameColor
// Can be a contact object or just a sip address.
property var contact
color: 'transparent' // No color by default.
......@@ -30,9 +32,11 @@ Rectangle {
Layout.preferredHeight: ContactStyle.contentHeight
Layout.preferredWidth: ContactStyle.contentHeight
image: contact.avatar
presenceLevel: contact.presenceLevel
username: contact.username
image: contact.avatar || ''
presenceLevel: contact.presenceLevel || Presence.White
username: Utils.isString(contact)
? contact.substring(4, contact.indexOf('@')) // 4 = length("sip:")
: contact.username
}
ContactDescription {
......@@ -40,7 +44,9 @@ Rectangle {
Layout.fillHeight: true
Layout.fillWidth: true
sipAddress: contact.sipAddress
sipAddress: Utils.isString(contact)
? contact
: contact.sipAddress
username: avatar.username
}
......
......@@ -4,6 +4,7 @@ import QtQuick.Layouts 1.3
import Common 1.0
import Linphone 1.0
import Linphone.Styles 1.0
import Utils 1.0
// ===================================================================
......@@ -12,7 +13,7 @@ ColumnLayout {
property alias model: view.model
signal contactSelected (var contact)
signal entrySelected (var entry)
// -----------------------------------------------------------------
......@@ -63,9 +64,16 @@ ColumnLayout {
currentIndex: -1
delegate: Item {
property var contact: ContactsListModel.mapSipAddressToContact(
$timelineEntry.sipAddresses
)
property var contact: {
Utils.assert(
!Utils.isArray($timelineEntry.sipAddresses),
'Conferences are not supported at this moment.'
)
return ContactsListModel.mapSipAddressToContact(
$timelineEntry.sipAddresses
) || $timelineEntry.sipAddresses
}
height: TimelineStyle.contact.height
width: parent.width
......@@ -97,7 +105,7 @@ ColumnLayout {
onClicked: {
view.currentIndex = index
timeline.contactSelected(parent.contact)
timeline.entrySelected(parent.contact)
}
}
}
......
......@@ -160,9 +160,9 @@ ApplicationWindow {
Layout.fillWidth: true
model: TimelineModel
onContactSelected: {
onEntrySelected: {
menu.resetSelectedEntry()
setView('Conversation', { contact: contact })
setView('Conversation', { contact: entry })
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment