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
|
- Media
|
||||||
- Downloading
|
|
||||||
- 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
|
|
||||||
- Confirmation box after picking file to upload
|
|
||||||
- Handle upload errors, file too big, etc
|
|
||||||
- Allow multiple file selection
|
- 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
|
- Support m.file thumbnails
|
||||||
- Generate video thumbnails
|
- Generate video thumbnails
|
||||||
|
@ -16,6 +14,7 @@
|
||||||
- Video: missing buttons and small size problems
|
- Video: missing buttons and small size problems
|
||||||
- Audio: online playback is buggy, must download+play file
|
- Audio: online playback is buggy, must download+play file
|
||||||
- EventLink
|
- EventLink
|
||||||
|
- Downloading (right click on media > save as...)
|
||||||
|
|
||||||
- RoomMessageNotice
|
- RoomMessageNotice
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@ Item {
|
||||||
anchors.fill: fill ? parent : undefined
|
anchors.fill: fill ? parent : undefined
|
||||||
|
|
||||||
|
|
||||||
signal filePicked()
|
signal filePicked(string file)
|
||||||
|
signal filesPicked(var files)
|
||||||
signal cancelled()
|
signal cancelled()
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,6 +16,8 @@ Item {
|
||||||
property alias dialog: fileDialog
|
property alias dialog: fileDialog
|
||||||
property string selectedFile: ""
|
property string selectedFile: ""
|
||||||
property string file: ""
|
property string file: ""
|
||||||
|
property var selectedFiles: []
|
||||||
|
property var files: []
|
||||||
|
|
||||||
property string selectSubject:
|
property string selectSubject:
|
||||||
dialog.fileMode === FileDialog.SaveFile ? qsTr("file") : qsTr("open")
|
dialog.fileMode === FileDialog.SaveFile ? qsTr("file") : qsTr("open")
|
||||||
|
@ -61,15 +64,26 @@ Item {
|
||||||
onVisibleChanged: if (visible) {
|
onVisibleChanged: if (visible) {
|
||||||
opener.selectedFile = Qt.binding(() => Qt.resolvedUrl(currentFile))
|
opener.selectedFile = Qt.binding(() => Qt.resolvedUrl(currentFile))
|
||||||
opener.file = Qt.binding(() => Qt.resolvedUrl(file))
|
opener.file = Qt.binding(() => Qt.resolvedUrl(file))
|
||||||
|
opener.files = Qt.binding(() => Qt.resolvedUrl(files))
|
||||||
|
opener.selectedFiles =
|
||||||
|
Qt.binding(() => Qt.resolvedUrl(currentFiles))
|
||||||
}
|
}
|
||||||
|
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
opener.selectedFile = currentFile
|
opener.selectedFile = currentFile
|
||||||
|
opener.selectedFiles = currentFiles
|
||||||
opener.file = file
|
opener.file = file
|
||||||
|
opener.files = files
|
||||||
|
|
||||||
opener.filePicked(file)
|
opener.filePicked(file)
|
||||||
|
opener.filesPicked(files)
|
||||||
}
|
}
|
||||||
|
|
||||||
onRejected: {
|
onRejected: {
|
||||||
selectedFile = ""
|
selectedFile = ""
|
||||||
file = ""
|
file = ""
|
||||||
|
selectedFiles = ""
|
||||||
|
files = ""
|
||||||
cancelled()
|
cancelled()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
import QtQuick 2.12
|
import QtQuick 2.12
|
||||||
|
import Qt.labs.platform 1.1
|
||||||
import "../utils.js" as Utils
|
import "../utils.js" as Utils
|
||||||
|
|
||||||
HFileDialogOpener {
|
HFileDialogOpener {
|
||||||
fill: false
|
fill: false
|
||||||
dialog.title: qsTr("Select a file to send")
|
dialog.title: qsTr("Select a file to send")
|
||||||
|
dialog.fileMode: FileDialog.OpenFiles
|
||||||
|
|
||||||
onFilePicked: {
|
onFilesPicked: {
|
||||||
|
for (let file of files) {
|
||||||
let path = Qt.resolvedUrl(file).replace(/^file:/, "")
|
let path = Qt.resolvedUrl(file).replace(/^file:/, "")
|
||||||
|
|
||||||
Utils.sendFile(userId, roomId, path, () => {
|
Utils.sendFile(userId, roomId, path, () => {
|
||||||
|
@ -16,6 +19,7 @@ HFileDialogOpener {
|
||||||
if (destroyWhenDone) destroy()
|
if (destroyWhenDone) destroy()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onCancelled: if (destroyWhenDone) destroy()
|
onCancelled: if (destroyWhenDone) destroy()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user