mirror of
https://github.com/koreader/koreader.git
synced 2025-12-13 20:36:53 +01:00
Fix/exit dir (#6163)
This commit is contained in:
@@ -428,7 +428,16 @@ function ReaderUI:init()
|
||||
-- end
|
||||
end
|
||||
|
||||
function ReaderUI:getLastDirFile()
|
||||
function ReaderUI:setLastDirForFileBrowser(dir)
|
||||
self.last_dir_for_file_browser = dir
|
||||
end
|
||||
|
||||
function ReaderUI:getLastDirFile(to_file_browser)
|
||||
if to_file_browser and self.last_dir_for_file_browser then
|
||||
local dir = self.last_dir_for_file_browser
|
||||
self.last_dir_for_file_browser = nil
|
||||
return dir
|
||||
end
|
||||
local QuickStart = require("ui/quickstart")
|
||||
local last_dir
|
||||
local last_file = G_reader_settings:readSetting("lastfile")
|
||||
@@ -447,7 +456,7 @@ function ReaderUI:showFileManager(file)
|
||||
last_dir, last_file = util.splitFilePathName(file)
|
||||
last_dir = last_dir:match("(.*)/")
|
||||
else
|
||||
last_dir, last_file = self:getLastDirFile()
|
||||
last_dir, last_file = self:getLastDirFile(true)
|
||||
end
|
||||
if FileManager.instance then
|
||||
FileManager.instance:reinit(last_dir, last_file)
|
||||
|
||||
@@ -467,6 +467,8 @@ function NewsDownloader:onCloseDocument()
|
||||
logger.dbg("NewsDownloader: news_download_dir_path:", news_download_dir_path)
|
||||
logger.dbg("NewsDownloader: removing NewsDownloader file from history.")
|
||||
ReadHistory:removeItemByPath(document_full_path)
|
||||
local doc_dir = util.splitFilePathName(document_full_path)
|
||||
self.ui:setLastDirForFileBrowser(doc_dir)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -227,6 +227,7 @@ function Send2Ebook:onCloseDocument()
|
||||
logger.dbg("Send2Ebook: download_dir_path:", download_dir_path)
|
||||
logger.dbg("Send2Ebook: removing Send2Ebook file from history.")
|
||||
ReadHistory:removeItemByPath(document_full_path)
|
||||
self.ui:setLastDirForFileBrowser(download_dir_path)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1047,6 +1047,7 @@ function Wallabag:onCloseDocument()
|
||||
local document_full_path = self.ui.document.file
|
||||
if document_full_path and self.directory and self:getLastPercent() == 1 and self.directory == string.sub(document_full_path, 1, string.len(self.directory)) then
|
||||
ReadHistory:removeItemByPath(document_full_path)
|
||||
self.ui:setLastDirForFileBrowser(self.directory)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user