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