BookShortcuts: fix folders handling (#8795)

reviewable/pr8806/r3^2
hius07 3 years ago committed by GitHub
parent 4ccdbc90a5
commit c9fc9496aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -36,16 +36,27 @@ function BookShortcuts:onBookShortcut(path)
local file local file
if lfs.attributes(path, "mode") ~= "file" then if lfs.attributes(path, "mode") ~= "file" then
if G_reader_settings:readSetting("BookShortcuts_directory_action") == "FM" then if G_reader_settings:readSetting("BookShortcuts_directory_action") == "FM" then
local FileManager = require("apps/filemanager/filemanager") if self.ui.file_chooser then
FileManager:showFiles(path) self.ui.file_chooser:changeToPath(path)
else -- called from Reader
self.ui:onClose()
local FileManager = require("apps/filemanager/filemanager")
if FileManager.instance then
FileManager.instance:reinit(path)
else
FileManager:showFiles(path)
end
end
else else
file = ReadHistory:getFileByDirectory(path) file = ReadHistory:getFileByDirectory(path)
end end
else else
file = path file = path
end end
local ReaderUI = require("apps/reader/readerui") if file then
ReaderUI:showReader(file) local ReaderUI = require("apps/reader/readerui")
ReaderUI:showReader(file)
end
end end
end end
@ -96,7 +107,7 @@ function BookShortcuts:getSubMenuItems()
end, end,
}, },
{ {
text_func = function() return T(_("Directory action: %1"), G_reader_settings:readSetting("BookShortcuts_directory_action", "FM") == "FM" and FM_text or last_text) end, text_func = function() return T(_("Folder action: %1"), G_reader_settings:readSetting("BookShortcuts_directory_action", "FM") == "FM" and FM_text or last_text) end,
keep_menu_open = true, keep_menu_open = true,
sub_item_table = { sub_item_table = {
{ {

Loading…
Cancel
Save