mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-04 13:19:36 +00:00
feat(Linphone/Contact/Contact): supports uri as contact attr
This commit is contained in:
parent
328a451aab
commit
179cbeddf3
3 changed files with 25 additions and 11 deletions
|
|
@ -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 })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue