From 8fd5e72ecade4db667f0a4a11a911f69a7a076c4 Mon Sep 17 00:00:00 2001 From: AmirHossein Abdolmotallebi Date: Fri, 27 Dec 2024 22:27:36 +0330 Subject: [PATCH] fix add multiple download page bug that when save mode is set to SameLocation not works as expected (#326) --- .../addDownload/multiple/AddMultiDownloadComponent.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/desktop/app/src/main/kotlin/com/abdownloadmanager/desktop/pages/addDownload/multiple/AddMultiDownloadComponent.kt b/desktop/app/src/main/kotlin/com/abdownloadmanager/desktop/pages/addDownload/multiple/AddMultiDownloadComponent.kt index 90cc31d0..1008d454 100644 --- a/desktop/app/src/main/kotlin/com/abdownloadmanager/desktop/pages/addDownload/multiple/AddMultiDownloadComponent.kt +++ b/desktop/app/src/main/kotlin/com/abdownloadmanager/desktop/pages/addDownload/multiple/AddMultiDownloadComponent.kt @@ -180,10 +180,12 @@ class AddMultiDownloadComponent( private fun getFolderForItem( categorySelectionMode: CategorySelectionMode?, + allInSameLocation: Boolean, url: String, fleName: String, defaultFolder: String, ): String { + if (allInSameLocation) return defaultFolder return when (categorySelectionMode) { CategorySelectionMode.Auto -> { downloadSystem.categoryManager @@ -209,7 +211,8 @@ class AddMultiDownloadComponent( fun requestAddDownloads( queueId: Long?, ) { - val categorySelectionMode = when (saveMode.value) { + val saveMode = saveMode.value + val categorySelectionMode = when (saveMode) { EachFileInTheirOwnCategory -> CategorySelectionMode.Auto AllInOneCategory -> selectedCategory.value?.let { CategorySelectionMode.Fixed(it.id) @@ -233,7 +236,8 @@ class AddMultiDownloadComponent( categorySelectionMode = categorySelectionMode, url = it.credentials.value.link, fleName = it.name.value, - defaultFolder = it.folder.value + defaultFolder = it.folder.value, + allInSameLocation = saveMode == InSameLocation ), name = it.name.value, link = it.credentials.value.link, @@ -248,7 +252,7 @@ class AddMultiDownloadComponent( categorySelectionMode = categorySelectionMode ) val folder = folder.value - if (saveMode.value == InSameLocation) { + if (this.saveMode.value == InSameLocation) { addToLastUsedLocations(folder) } requestClose()