linphone-desktop/linphone-app/ui/modules/Linphone/Notifications/NotificationReceivedMessage.qml
Julien Wadel 59ea9c69e5 Make an option for displaying only usernames instead of the whole SIP address.
Move options button in waiting room because of readability.
Add a confirmation before calling a group from conversation.
Make an option to set RLS URI.
Avoid to close smart search bar when changing focus. It will now close only on empty text, esc keybutton or by manually closing it (cross icon when text has been entered)
Hide "adding contact" if search box is empty.
Add a switch in accounts selection to easily register them.
Update SDK to 5.2.81

# Conflicts:
#	linphone-app/src/components/search/SearchSipAddressesModel.cpp
#	linphone-sdk
2023-07-26 16:49:02 +02:00

109 lines
3.6 KiB
QML

import QtQuick 2.7
import QtQuick.Layouts 1.3
import Common 1.0
import Linphone 1.0
import Linphone.Styles 1.0
import UtilsCpp 1.0
import Units 1.0
import 'qrc:/ui/scripts/Utils/utils.js' as Utils
// =============================================================================
Notification {
id: notification
icon: 'message_sign'
// ---------------------------------------------------------------------------
readonly property TimelineModel timelineModel: notificationData && notificationData.timelineModel
readonly property string peerAddress: notificationData && notificationData.peerAddress || ''
readonly property string localAddress: notificationData && notificationData.localAddress || ''
readonly property string fullPeerAddress: notificationData && notificationData.fullPeerAddress || ''
readonly property string fullLocalAddress: notificationData && notificationData.fullLocalAddress || ''
// ---------------------------------------------------------------------------
Loader {
active: timelineModel//Boolean(notification.peerAddress) && Boolean(notification.localAddress)
anchors {
fill: parent
leftMargin: NotificationReceivedMessageStyle.leftMargin
rightMargin: NotificationReceivedMessageStyle.rightMargin
bottomMargin: NotificationReceivedMessageStyle.bottomMargin
}
sourceComponent: ColumnLayout {
spacing: NotificationReceivedMessageStyle.spacing
Contact {
Layout.fillWidth: true
property ChatRoomModel chatRoomModel : notification.timelineModel.getChatRoomModel()
property var sipObserver: SipAddressesModel.getSipAddressObserver(notification.fullPeerAddress, notification.fullLocalAddress)
subtitle: chatRoomModel.isOneToOne
? UtilsCpp.toDisplayString(SipAddressesModel.cleanSipAddress(notification.fullPeerAddress), SettingsModel.sipDisplayMode)
: UtilsCpp.getDisplayName(notification.fullPeerAddress)
entry: chatRoomModel ? chatRoomModel : sipObserver
Component.onDestruction: sipObserver=null// Need to set it to null because of not calling destructor if not.
}
Rectangle {
Layout.fillHeight: true
Layout.fillWidth: true
color: NotificationReceivedMessageStyle.messageContainer.colorModel.color
radius: NotificationReceivedMessageStyle.messageContainer.radius
TextEdit {
id: messageText
property font customFont : SettingsModel.textMessageFont
property string fullText: notification.notificationData.message
anchors {
fill: parent
margins: NotificationReceivedMessageStyle.messageContainer.margins
}
color: NotificationReceivedMessageStyle.messageContainer.text.colorModel.color
font {
italic: true
family: customFont.family
pointSize: Units.dp * (customFont.pointSize - 1)
}
verticalAlignment: Text.AlignVCenter
text: UtilsCpp.encodeTextToQmlRichFormat(metrics.elidedText)
textFormat: Text.RichText
wrapMode: Text.Wrap
TextMetrics {
id: metrics
font: messageText.font
text: messageText.fullText
elideWidth: messageText.width
elide: Qt.ElideRight
}
}
}
}
}
MouseArea {
anchors.fill: parent
onClicked: notification._close(function () {
AccountSettingsModel.setDefaultAccountFromSipAddress(notification.localAddress)
var chatroom = notification.timelineModel.getChatRoomModel()
console.debug("Load conversation from notification: "+chatroom)
//notification.notificationData.window.setView('Conversation', {
// chatRoomModel: chatroom
// })
notification.timelineModel.selected = true
App.smartShowWindow(notification.notificationData.window)
})
}
}