filechooser: optimize file selection

reviewable/pr11476/r1
hius07 4 months ago committed by GitHub
parent 5939c82bcf
commit 0e3ac9c7c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -571,7 +571,7 @@ function FileChooser:onMenuSelect(item)
-- parent directory of dir without permission get nil mode -- parent directory of dir without permission get nil mode
-- we need to change to parent path in this case -- we need to change to parent path in this case
if item.is_file then if item.is_file then
self:onFileSelect(item.path) self:onFileSelect(item)
else else
self:changeToPath(item.path, item.is_go_up and self.path) self:changeToPath(item.path, item.is_go_up and self.path)
end end
@ -583,7 +583,7 @@ function FileChooser:onMenuHold(item)
return true return true
end end
function FileChooser:onFileSelect(file) function FileChooser:onFileSelect(item)
UIManager:close(self) UIManager:close(self)
return true return true
end end
@ -620,12 +620,18 @@ end
-- Used in file manager select mode to select all files in a folder, -- Used in file manager select mode to select all files in a folder,
-- that are visible in all file browser pages, without subfolders. -- 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 for _, item in ipairs(self.item_table) do
if item.is_file then 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
end end
self:updateItems()
end end
return FileChooser return FileChooser

Loading…
Cancel
Save