linphone-desktop/linphone-app/ui/modules/Linphone/Chat/OutgoingMessage.qml
Julien Wadel d6f5a7f0ce Fix file transfert and notification behaviour
- Add External Image Provider to avoid having error message when we try to show a file that is not an image (used to show an attachment where it can be a regular file).
- When creating an image, try to read the headers of a file when the extension is not consistent with contents.
- Build if not exists, a thumbnail image if the file has been displayed when filling a message
- When trying to open the file, test if it was downloaded by reading the flag
- Add a status for File Transfert In Progress
- Use non-deprecated function to get file path from ChatMessage
- Use FileSize in addtion of content Size to get the full size of a message
- Show a progressbar when downloading a file
- Show the image in notification when downloaded or the file name if it is not an image
2020-05-05 00:35:55 +02:00

98 lines
2.6 KiB
QML

import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3
import Common 1.0
import Linphone 1.0
import Linphone.Styles 1.0
import Utils 1.0
// =============================================================================
Item {
implicitHeight: message.height
width: parent.width
Message {
id: message
anchors {
left: parent.left
leftMargin: ChatStyle.entry.metaWidth
right: parent.right
}
backgroundColor: ChatStyle.entry.message.outgoing.backgroundColor
color: ChatStyle.entry.message.outgoing.text.color
pointSize: ChatStyle.entry.message.outgoing.text.pointSize
width: parent.width
Row {
spacing: ChatStyle.entry.message.extraContent.spacing
Component {
id: icon
Icon {
readonly property bool isNotDelivered: Utils.includes([
ChatModel.MessageStatusFileTransferError,
ChatModel.MessageStatusIdle,
ChatModel.MessageStatusInProgress,
ChatModel.MessageStatusNotDelivered
], $chatEntry.status)
readonly property bool isRead: $chatEntry.status === ChatModel.MessageStatusDisplayed
readonly property bool isDeliveredToUser: $chatEntry.status === ChatModel.MessageStatusDeliveredToUser
icon: isNotDelivered
? 'chat_error'
: (isRead ? 'chat_read' : (isDeliveredToUser ? 'chat_delivered' : ''))
iconSize: ChatStyle.entry.message.outgoing.sendIconSize
MouseArea {
anchors.fill: parent
onClicked: isNotDelivered && proxyModel.resendMessage(index)
}
TooltipArea {
text: isNotDelivered
? qsTr('messageError')
: (isRead ? qsTr('messageRead') : qsTr('messageDelivered'))
}
}
}
Component {
id: indicator
Item {
anchors.fill: parent
BusyIndicator {
anchors.centerIn: parent
height: ChatStyle.entry.message.outgoing.busyIndicatorSize
width: ChatStyle.entry.message.outgoing.busyIndicatorSize
}
}
}
Loader {
height: ChatStyle.entry.lineHeight
width: ChatStyle.entry.message.outgoing.areaSize
sourceComponent: $chatEntry.status === ChatModel.MessageStatusInProgress || $chatEntry.status === ChatModel.MessageStatusFileTransferInProgress
? indicator
: icon
}
ActionButton {
height: ChatStyle.entry.lineHeight
icon: 'delete'
iconSize: ChatStyle.entry.deleteIconSize
visible: isHoverEntry()
onClicked: removeEntry()
}
}
}
}