Auto identify file type as m.image.

This commit is contained in:
Black Hat
2018-07-17 16:18:50 +08:00
parent cf84320794
commit c10c3b1d1d
4 changed files with 32 additions and 11 deletions

View File

@@ -20,7 +20,7 @@ AvatarContainer {
Image {
id: messageImage
source: "image://mxc/" + content.url
source: "image://mxc/" + (content.thumbnail_url ? content.thumbnail_url : content.url)
MouseArea {
anchors.fill: parent

View File

@@ -150,12 +150,12 @@ Item {
folder: shortcuts.home
selectMultiple: false
onAccepted: {
currentRoom.uploadFile(fileDialog.fileUrl, fileDialog.fileUrl)
currentRoom.uploadFile(fileUrl, fileUrl, matriqueController.getMIME(fileUrl))
var fileTransferProgressCallback = function(id, sent, total) {
if (id == fileDialog.fileUrl) { inputField.progress = sent / total }
if (id == fileUrl) { inputField.progress = sent / total }
}
var completedCallback = function(id, localFile, mxcUrl) {
if (id == fileDialog.fileUrl) {
if (id == fileUrl) {
matriqueController.postFile(currentRoom, localFile, mxcUrl)
inputField.progress = 0
currentRoom.fileTransferCompleted.disconnect(fileTransferProgressCallback)