Remember last used folder in save dialogs

BUG: 460166
This commit is contained in:
Tobias Fella
2022-11-27 19:03:17 +01:00
parent a734be5f9e
commit fda433706b
4 changed files with 18 additions and 7 deletions

View File

@@ -62,6 +62,9 @@
<label>Enable developer tools</label> <label>Enable developer tools</label>
<default>false</default> <default>false</default>
</entry> </entry>
<entry name="LastSaveDirectory" type="String">
<label>Directory last used for saving a file</label>
</entry>
</group> </group>
<group name="Timeline"> <group name="Timeline">
<entry name="ShowAvatarInTimeline" type="bool"> <entry name="ShowAvatarInTimeline" type="bool">

View File

@@ -293,8 +293,10 @@ QQC2.Popup {
id: saveAsDialog id: saveAsDialog
FileDialog { FileDialog {
fileMode: FileDialog.SaveFile fileMode: FileDialog.SaveFile
folder: StandardPaths.writableLocation(StandardPaths.DownloadLocation) folder: Config.lastSaveDirectory.length > 0 ? Config.lastSaveDirectory : StandardPaths.writableLocation(StandardPaths.DownloadLocation)
onAccepted: { onAccepted: {
Config.lastSaveDirectory = folder
Config.save()
if (!currentFile) { if (!currentFile) {
return; return;
} }

View File

@@ -159,11 +159,15 @@ TimelineContainer {
FileDialog { FileDialog {
fileMode: FileDialog.SaveFile fileMode: FileDialog.SaveFile
folder: StandardPaths.writableLocation(StandardPaths.DownloadLocation) folder: Config.lastSaveDirectory.length > 0 ? Config.lastSaveDirectory : StandardPaths.writableLocation(StandardPaths.DownloadLocation)
onAccepted: if (autoOpenFile) { onAccepted: {
UrlHelper.copyTo(progressInfo.localPath, file) Config.lastSaveDirectory = folder
} else { Config.save()
currentRoom.download(eventId, file); if (autoOpenFile) {
UrlHelper.copyTo(progressInfo.localPath, file)
} else {
currentRoom.download(eventId, file);
}
} }
} }
} }

View File

@@ -113,11 +113,13 @@ MessageDelegateContextMenu {
id: saveAsDialog id: saveAsDialog
FileDialog { FileDialog {
fileMode: FileDialog.SaveFile fileMode: FileDialog.SaveFile
folder: StandardPaths.writableLocation(StandardPaths.DownloadLocation) folder: Config.lastSaveDirectory.length > 0 ? Config.lastSaveDirectory : StandardPaths.writableLocation(StandardPaths.DownloadLocation)
onAccepted: { onAccepted: {
if (!currentFile) { if (!currentFile) {
return; return;
} }
Config.lastSaveDirectory = folder
Config.save()
currentRoom.downloadFile(eventId, currentFile) currentRoom.downloadFile(eventId, currentFile)
} }
} }