@ -96,6 +96,7 @@ function FileManager:init()
local file_chooser = FileChooser : new {
local file_chooser = FileChooser : new {
-- remeber to adjust the height when new item is added to the group
-- remeber to adjust the height when new item is added to the group
path = self.root_path ,
path = self.root_path ,
focused_path = self.focused_file ,
collate = G_reader_settings : readSetting ( " collate " ) or " strcoll " ,
collate = G_reader_settings : readSetting ( " collate " ) or " strcoll " ,
show_parent = self.show_parent ,
show_parent = self.show_parent ,
show_hidden = show_hidden ,
show_hidden = show_hidden ,
@ -112,6 +113,7 @@ function FileManager:init()
close_callback = function ( ) return self : onClose ( ) end ,
close_callback = function ( ) return self : onClose ( ) end ,
}
}
self.file_chooser = file_chooser
self.file_chooser = file_chooser
self.focused_file = nil -- use it only once
function file_chooser : onPathChanged ( path ) -- luacheck: ignore
function file_chooser : onPathChanged ( path ) -- luacheck: ignore
FileManager.instance . path_text : setText ( filemanagerutil.abbreviate ( path ) )
FileManager.instance . path_text : setText ( filemanagerutil.abbreviate ( path ) )
@ -326,12 +328,13 @@ function FileManager:reinit(path, focused_file)
path_items_backup [ k ] = v
path_items_backup [ k ] = v
end
end
-- reinit filemanager
-- reinit filemanager
self.focused_file = focused_file
self : init ( )
self : init ( )
self.file_chooser . path_items = path_items_backup
self.file_chooser . path_items = path_items_backup
self : onRefresh ( )
-- self:init() has already done file_chooser:refreshPath(), so this one
if focused_file then
-- looks like not necessary (cheap with classic mode, less cheap with
self.file_chooser : changePageToPath ( focused_file )
-- CoverBrowser plugin's cover image renderings )
end
-- self:onRefresh()
end
end
function FileManager : toggleHiddenFiles ( )
function FileManager : toggleHiddenFiles ( )
@ -557,13 +560,11 @@ function FileManager:showFiles(path, focused_file)
local file_manager = FileManager : new {
local file_manager = FileManager : new {
dimen = Screen : getSize ( ) ,
dimen = Screen : getSize ( ) ,
root_path = path ,
root_path = path ,
focused_file = focused_file ,
onExit = function ( )
onExit = function ( )
self.instance = nil
self.instance = nil
end
end
}
}
if focused_file then
file_manager.file_chooser : changePageToPath ( focused_file )
end
UIManager : show ( file_manager )
UIManager : show ( file_manager )
self.instance = file_manager
self.instance = file_manager
end
end