Allow picking multiple files to upload
This commit is contained in:
parent
6953239bc3
commit
4a6f634f7a
9
TODO.md
9
TODO.md
|
@ -1,11 +1,9 @@
|
|||
- Media
|
||||
- Downloading
|
||||
- Bottom/top bar
|
||||
- Verify things work with chat.privacytools.io (subdomain weirdness)
|
||||
- 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
|
||||
- Confirmation box after picking file to upload
|
||||
- Handle upload errors: non existent path, path is a dir, file too big, etc
|
||||
- Show real progression for mxc thumbnail loadings, uploads and downloads
|
||||
|
||||
- Support m.file thumbnails
|
||||
- Generate video thumbnails
|
||||
|
@ -16,6 +14,7 @@
|
|||
- Video: missing buttons and small size problems
|
||||
- Audio: online playback is buggy, must download+play file
|
||||
- EventLink
|
||||
- Downloading (right click on media > save as...)
|
||||
|
||||
- RoomMessageNotice
|
||||
|
||||
|
|
|
@ -6,7 +6,8 @@ Item {
|
|||
anchors.fill: fill ? parent : undefined
|
||||
|
||||
|
||||
signal filePicked()
|
||||
signal filePicked(string file)
|
||||
signal filesPicked(var files)
|
||||
signal cancelled()
|
||||
|
||||
|
||||
|
@ -15,6 +16,8 @@ Item {
|
|||
property alias dialog: fileDialog
|
||||
property string selectedFile: ""
|
||||
property string file: ""
|
||||
property var selectedFiles: []
|
||||
property var files: []
|
||||
|
||||
property string selectSubject:
|
||||
dialog.fileMode === FileDialog.SaveFile ? qsTr("file") : qsTr("open")
|
||||
|
@ -59,17 +62,28 @@ Item {
|
|||
modality: Qt.NonModal
|
||||
|
||||
onVisibleChanged: if (visible) {
|
||||
opener.selectedFile = Qt.binding(() => Qt.resolvedUrl(currentFile))
|
||||
opener.file = Qt.binding(() => Qt.resolvedUrl(file))
|
||||
opener.selectedFile = Qt.binding(() => Qt.resolvedUrl(currentFile))
|
||||
opener.file = Qt.binding(() => Qt.resolvedUrl(file))
|
||||
opener.files = Qt.binding(() => Qt.resolvedUrl(files))
|
||||
opener.selectedFiles =
|
||||
Qt.binding(() => Qt.resolvedUrl(currentFiles))
|
||||
}
|
||||
|
||||
onAccepted: {
|
||||
opener.selectedFile = currentFile
|
||||
opener.file = file
|
||||
opener.selectedFile = currentFile
|
||||
opener.selectedFiles = currentFiles
|
||||
opener.file = file
|
||||
opener.files = files
|
||||
|
||||
opener.filePicked(file)
|
||||
opener.filesPicked(files)
|
||||
}
|
||||
|
||||
onRejected: {
|
||||
selectedFile = ""
|
||||
file = ""
|
||||
selectedFile = ""
|
||||
file = ""
|
||||
selectedFiles = ""
|
||||
files = ""
|
||||
cancelled()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
import QtQuick 2.12
|
||||
import Qt.labs.platform 1.1
|
||||
import "../utils.js" as Utils
|
||||
|
||||
HFileDialogOpener {
|
||||
fill: false
|
||||
dialog.title: qsTr("Select a file to send")
|
||||
dialog.fileMode: FileDialog.OpenFiles
|
||||
|
||||
onFilePicked: {
|
||||
let path = Qt.resolvedUrl(file).replace(/^file:/, "")
|
||||
onFilesPicked: {
|
||||
for (let file of files) {
|
||||
let path = Qt.resolvedUrl(file).replace(/^file:/, "")
|
||||
|
||||
Utils.sendFile(userId, roomId, path, () => {
|
||||
if (destroyWhenDone) destroy()
|
||||
},
|
||||
(type, args, error, traceback) => {
|
||||
console.error("python:\n" + traceback)
|
||||
if (destroyWhenDone) destroy()
|
||||
})
|
||||
Utils.sendFile(userId, roomId, path, () => {
|
||||
if (destroyWhenDone) destroy()
|
||||
},
|
||||
(type, args, error, traceback) => {
|
||||
console.error("python:\n" + traceback)
|
||||
if (destroyWhenDone) destroy()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
onCancelled: if (destroyWhenDone) destroy()
|
||||
|
|
Loading…
Reference in New Issue
Block a user