FileBrowser: change page to show last file or previous subdir (#3351)

When going from reader to filemanager, we are in the directory
containing the last_file. With this, we will also be on the page
showing this file.
When in filemanager and going up (".."), we will also be on the
page containing the directory we came from.
This commit is contained in:
poire-z
2017-10-13 18:43:02 +02:00
committed by Frans de Jonge
parent 532c850cbd
commit 29707bd664
3 changed files with 32 additions and 9 deletions

View File

@@ -365,16 +365,16 @@ end
function ReaderUI:showFileManager()
local FileManager = require("apps/filemanager/filemanager")
local QuickStart = require("ui/quickstart")
local lastdir
local last_dir
local last_file = G_reader_settings:readSetting("lastfile")
-- ignore quickstart guide as last_file so we can go back to home dir
if last_file and last_file ~= QuickStart.quickstart_filename then
lastdir = last_file:match("(.*)/")
last_dir = last_file:match("(.*)/")
end
if FileManager.instance then
FileManager.instance:reinit(lastdir)
FileManager.instance:reinit(last_dir, last_file)
else
FileManager:showFiles(lastdir)
FileManager:showFiles(last_dir, last_file)
end
end