From d7765f0f0a8b1400614db24495ce9fa229df7faa Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Sun, 6 Dec 2020 23:08:10 +0100 Subject: [PATCH] Fix file saving --- .../Component/Timeline/FileDelegate.qml | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/imports/NeoChat/Component/Timeline/FileDelegate.qml b/imports/NeoChat/Component/Timeline/FileDelegate.qml index 8056d1347..f8ff62e2e 100644 --- a/imports/NeoChat/Component/Timeline/FileDelegate.qml +++ b/imports/NeoChat/Component/Timeline/FileDelegate.qml @@ -8,7 +8,7 @@ import QtQuick.Controls 2.12 import QtQuick.Layouts 1.12 import QtQuick.Controls.Material 2.12 import QtGraphicalEffects 1.0 -import Qt.labs.platform 1.0 as Platform +import Qt.labs.platform 1.0 import org.kde.kirigami 2.13 as Kirigami import org.kde.neochat 1.0 @@ -84,9 +84,15 @@ RowLayout { } Component { - id: openFolderDialog + id: fileDialog - OpenFolderDialog {} + FileDialog { + fileMode: FileDialog.SaveFile + folder: StandardPaths.writableLocation(StandardPaths.DownloadLocation) + onAccepted: { + currentRoom.downloadFile(eventId, file) + } + } } Component { @@ -99,15 +105,8 @@ RowLayout { } function saveFileAs() { - var folderDialog = openFolderDialog.createObject(ApplicationWindow.overlay) - - folderDialog.chosen.connect(function(path) { - if (!path) return - - currentRoom.downloadFile(eventId, path + "/" + currentRoom.fileNameToDownload(eventId)) - }) - - folderDialog.open() + var dialog = fileDialog.createObject(ApplicationWindow.overlay) + dialog.open() } function downloadAndOpen()