diff --git a/include/libqmatrixclient b/include/libqmatrixclient
index 496e10608..56480bc96 160000
--- a/include/libqmatrixclient
+++ b/include/libqmatrixclient
@@ -1 +1 @@
-Subproject commit 496e106083f3740d44716b96ed1b098d61df19eb
+Subproject commit 56480bc96b28356c44547cc3d9ea1afbda9f04f9
diff --git a/qml/component/AudioBubble.qml b/qml/component/AudioBubble.qml
new file mode 100644
index 000000000..c72728d00
--- /dev/null
+++ b/qml/component/AudioBubble.qml
@@ -0,0 +1,19 @@
+import QtQuick 2.9
+import QtQuick.Controls 2.2
+import QtMultimedia 5.8
+
+AvatarContainer {
+ Button {
+ id: downloadButton
+
+ text: content.body
+ highlighted: !sentByMe
+ flat: true
+
+ onClicked: downloadable.downloadAndOpen()
+
+ Audio {
+ audioRole: Audio.VoiceCommunicationRole
+ }
+ }
+}
diff --git a/qml/form/RoomForm.qml b/qml/form/RoomForm.qml
index 5d7f30185..bcf718d06 100644
--- a/qml/form/RoomForm.qml
+++ b/qml/form/RoomForm.qml
@@ -154,6 +154,7 @@ Item {
currentRoom.uploadFile(fileDialog.fileUrl, fileDialog.fileUrl)
currentRoom.fileTransferCompleted.connect(function(id, localFile, mxcUrl) {
console.log("File transferred: " + id + ":" + mxcUrl)
+ matriqueController.postFile(currentRoom, localFile, mxcUrl)
})
}
}
diff --git a/res.qrc b/res.qrc
index ce52fb9b3..1f2d6824b 100644
--- a/res.qrc
+++ b/res.qrc
@@ -24,5 +24,6 @@
qml/component/FileBubble.qml
qml/component/AvatarContainer.qml
qml/form/RoomListForm.qml
+ qml/component/AudioBubble.qml
diff --git a/src/controller.cpp b/src/controller.cpp
index abb57db19..ce11df49d 100644
--- a/src/controller.cpp
+++ b/src/controller.cpp
@@ -79,8 +79,12 @@ void Controller::reconnect() {
m_connection->connectWithToken(userID, token, "");
}
-void Controller::postFile(QMatrixClient::Room* room,
- const QUrl& localFilename) {
-// auto job = m_connection->uploadFile(localFilename.toLocalFile());
-// room->fileTransferInfo(localFilename.fileName())
+void Controller::postFile(QMatrixClient::Room* room, const QUrl& localFile,
+ const QUrl& mxcUrl) {
+ QJsonObject json{{"body", localFile.fileName()},
+ {"filename", localFile.fileName()},
+ {"url", mxcUrl.url()}};
+ room->postMessage(QMatrixClient::RoomMessageEvent{
+ localFile.fileName(), "m.file",
+ new QMatrixClient::EventContent::FileContent(json)});
}
diff --git a/src/controller.h b/src/controller.h
index fb44720a4..ef388a2c5 100644
--- a/src/controller.h
+++ b/src/controller.h
@@ -97,7 +97,8 @@ class Controller : public QObject {
void errorOccured();
public slots:
- void postFile(QMatrixClient::Room* room, const QUrl& localFilename);
+ void postFile(QMatrixClient::Room* room, const QUrl& localFile,
+ const QUrl& mxcUrl);
};
#endif // CONTROLLER_H
diff --git a/src/messageeventmodel.cpp b/src/messageeventmodel.cpp
index e4e2edf8a..55dd1bd28 100644
--- a/src/messageeventmodel.cpp
+++ b/src/messageeventmodel.cpp
@@ -273,8 +273,9 @@ QVariant MessageEventModel::data(const QModelIndex& index, int role) const {
return "notice";
case MessageEventType::Image:
return "image";
- case MessageEventType::File:
case MessageEventType::Audio:
+// return "audio";
+ case MessageEventType::File:
case MessageEventType::Video:
return "file";
default: