From 0e3ac9c7c1db0d5dd8380ec8703e0f2740b9308f Mon Sep 17 00:00:00 2001 From: hius07 <62179190+hius07@users.noreply.github.com> Date: Sun, 18 Feb 2024 10:43:39 +0200 Subject: [PATCH] filechooser: optimize file selection --- frontend/ui/widget/filechooser.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/frontend/ui/widget/filechooser.lua b/frontend/ui/widget/filechooser.lua index 15a296bce..443947f98 100644 --- a/frontend/ui/widget/filechooser.lua +++ b/frontend/ui/widget/filechooser.lua @@ -571,7 +571,7 @@ function FileChooser:onMenuSelect(item) -- parent directory of dir without permission get nil mode -- we need to change to parent path in this case if item.is_file then - self:onFileSelect(item.path) + self:onFileSelect(item) else self:changeToPath(item.path, item.is_go_up and self.path) end @@ -583,7 +583,7 @@ function FileChooser:onMenuHold(item) return true end -function FileChooser:onFileSelect(file) +function FileChooser:onFileSelect(item) UIManager:close(self) return true end @@ -620,12 +620,18 @@ end -- Used in file manager select mode to select all files in a folder, -- that are visible in all file browser pages, without subfolders. -function FileChooser:selectAllFilesInFolder() +function FileChooser:selectAllFilesInFolder(do_select) for _, item in ipairs(self.item_table) do if item.is_file then - self.filemanager.selected_files[item.path] = true + if do_select then + self.filemanager.selected_files[item.path] = true + item.dim = true + else + item.dim = nil + end end end + self:updateItems() end return FileChooser