2019-11-07 07:31:38 +11:00
|
|
|
import QtQuick 2.12
|
2019-11-07 08:03:34 +11:00
|
|
|
import "../utils.js" as Utils
|
2019-11-07 07:31:38 +11:00
|
|
|
|
|
|
|
HFileDialogOpener {
|
|
|
|
fill: false
|
|
|
|
dialog.title: qsTr("Select a file to send")
|
|
|
|
|
|
|
|
onFilePicked: {
|
|
|
|
let path = Qt.resolvedUrl(file).replace(/^file:/, "")
|
2019-11-07 08:03:34 +11:00
|
|
|
|
|
|
|
Utils.sendFile(userId, roomId, path, () => {
|
|
|
|
if (destroyWhenDone) destroy()
|
|
|
|
},
|
|
|
|
(type, args, error, traceback) => {
|
|
|
|
console.error("python:\n" + traceback)
|
2019-11-07 07:31:38 +11:00
|
|
|
if (destroyWhenDone) destroy()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
onCancelled: if (destroyWhenDone) destroy()
|
|
|
|
|
|
|
|
|
|
|
|
property string userId
|
|
|
|
property string roomId
|
|
|
|
property bool destroyWhenDone: false
|
|
|
|
}
|