From fda433706b2c3c1f2b44f851defc422d8c1bda1c Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Sun, 27 Nov 2022 19:03:17 +0100 Subject: [PATCH] Remember last used folder in save dialogs BUG: 460166 --- src/neochatconfig.kcfg | 3 +++ src/qml/Component/FullScreenImage.qml | 4 +++- src/qml/Component/Timeline/FileDelegate.qml | 14 +++++++++----- src/qml/Menu/Timeline/FileDelegateContextMenu.qml | 4 +++- 4 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/neochatconfig.kcfg b/src/neochatconfig.kcfg index 620d9cb17..26e768635 100644 --- a/src/neochatconfig.kcfg +++ b/src/neochatconfig.kcfg @@ -62,6 +62,9 @@ false + + + diff --git a/src/qml/Component/FullScreenImage.qml b/src/qml/Component/FullScreenImage.qml index 534009a25..652df47e0 100644 --- a/src/qml/Component/FullScreenImage.qml +++ b/src/qml/Component/FullScreenImage.qml @@ -293,8 +293,10 @@ QQC2.Popup { id: saveAsDialog FileDialog { fileMode: FileDialog.SaveFile - folder: StandardPaths.writableLocation(StandardPaths.DownloadLocation) + folder: Config.lastSaveDirectory.length > 0 ? Config.lastSaveDirectory : StandardPaths.writableLocation(StandardPaths.DownloadLocation) onAccepted: { + Config.lastSaveDirectory = folder + Config.save() if (!currentFile) { return; } diff --git a/src/qml/Component/Timeline/FileDelegate.qml b/src/qml/Component/Timeline/FileDelegate.qml index 86dd37190..721804110 100644 --- a/src/qml/Component/Timeline/FileDelegate.qml +++ b/src/qml/Component/Timeline/FileDelegate.qml @@ -159,11 +159,15 @@ TimelineContainer { FileDialog { fileMode: FileDialog.SaveFile - folder: StandardPaths.writableLocation(StandardPaths.DownloadLocation) - onAccepted: if (autoOpenFile) { - UrlHelper.copyTo(progressInfo.localPath, file) - } else { - currentRoom.download(eventId, file); + folder: Config.lastSaveDirectory.length > 0 ? Config.lastSaveDirectory : StandardPaths.writableLocation(StandardPaths.DownloadLocation) + onAccepted: { + Config.lastSaveDirectory = folder + Config.save() + if (autoOpenFile) { + UrlHelper.copyTo(progressInfo.localPath, file) + } else { + currentRoom.download(eventId, file); + } } } } diff --git a/src/qml/Menu/Timeline/FileDelegateContextMenu.qml b/src/qml/Menu/Timeline/FileDelegateContextMenu.qml index 3e97a05b4..b299eed9f 100644 --- a/src/qml/Menu/Timeline/FileDelegateContextMenu.qml +++ b/src/qml/Menu/Timeline/FileDelegateContextMenu.qml @@ -113,11 +113,13 @@ MessageDelegateContextMenu { id: saveAsDialog FileDialog { fileMode: FileDialog.SaveFile - folder: StandardPaths.writableLocation(StandardPaths.DownloadLocation) + folder: Config.lastSaveDirectory.length > 0 ? Config.lastSaveDirectory : StandardPaths.writableLocation(StandardPaths.DownloadLocation) onAccepted: { if (!currentFile) { return; } + Config.lastSaveDirectory = folder + Config.save() currentRoom.downloadFile(eventId, currentFile) } }