Have a dedicated SendFilePicker component
This commit is contained in:
parent
c6bb41573f
commit
5c6b6ef68a
3
TODO.md
3
TODO.md
|
@ -3,6 +3,9 @@
|
||||||
- Bottom/top bar
|
- Bottom/top bar
|
||||||
- Verify things work with chat.privacytools.io (subdomain weirdness)
|
- Verify things work with chat.privacytools.io (subdomain weirdness)
|
||||||
- Show real progression for mxc thumbnail loadings, uploads and downloads
|
- Show real progression for mxc thumbnail loadings, uploads and downloads
|
||||||
|
- Confirmation box after picking file to upload
|
||||||
|
- Handle upload errors, file too big, etc
|
||||||
|
- Allow multiple file selection
|
||||||
|
|
||||||
- Support m.file thumbnails
|
- Support m.file thumbnails
|
||||||
- Generate video thumbnails
|
- Generate video thumbnails
|
||||||
|
|
|
@ -210,16 +210,13 @@ Rectangle {
|
||||||
icon.name: "upload-file"
|
icon.name: "upload-file"
|
||||||
backgroundColor: theme.chat.composer.uploadButton.background
|
backgroundColor: theme.chat.composer.uploadButton.background
|
||||||
toolTip.text: qsTr("Send files")
|
toolTip.text: qsTr("Send files")
|
||||||
|
onClicked: sendFilePicker.dialog.open()
|
||||||
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
||||||
HFileDialogOpener {
|
SendFilePicker {
|
||||||
dialog.title: qsTr("Select files to upload")
|
id: sendFilePicker
|
||||||
onFilePicked: {
|
roomId: chatPage.roomId
|
||||||
let path = Qt.resolvedUrl(file).replace(/^file:/, "")
|
|
||||||
let args = [chatPage.roomId, path]
|
|
||||||
py.callClientCoro(chatPage.userId, "send_file", args)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
20
src/qml/Dialogs/SendFilePicker.qml
Normal file
20
src/qml/Dialogs/SendFilePicker.qml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import QtQuick 2.12
|
||||||
|
|
||||||
|
HFileDialogOpener {
|
||||||
|
fill: false
|
||||||
|
dialog.title: qsTr("Select a file to send")
|
||||||
|
|
||||||
|
onFilePicked: {
|
||||||
|
let path = Qt.resolvedUrl(file).replace(/^file:/, "")
|
||||||
|
py.callClientCoro(userId, "send_file", [roomId, path], () => {
|
||||||
|
if (destroyWhenDone) destroy()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
onCancelled: if (destroyWhenDone) destroy()
|
||||||
|
|
||||||
|
|
||||||
|
property string userId
|
||||||
|
property string roomId
|
||||||
|
property bool destroyWhenDone: false
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user