Delegate "lastfile" management to ReadHistory (#6128)

Simplify (and avoid edge cases) in other code by having
ReadHistory manage the "lastfile" setting on add, remove,
rename...
Fixed a few other cases of things not updated.
This commit is contained in:
poire-z
2020-05-06 21:11:34 +02:00
committed by GitHub
parent 48727a984b
commit 46221985a6
9 changed files with 75 additions and 69 deletions

View File

@@ -198,11 +198,9 @@ function ReaderStatus:deleteFile(file, text_end_book)
ok_text = _("Delete"),
ok_callback = function()
local FileManager = require("apps/filemanager/filemanager")
local filemanagerutil = require("apps/filemanager/filemanagerutil")
self.ui:onClose()
FileManager:deleteFile(file)
filemanagerutil.removeFileFromHistoryIfWanted(file)
filemanagerutil.ensureLastFileExists()
require("readhistory"):fileDeleted(file) -- (will update "lastfile")
if FileManager.instance then
FileManager.instance.file_chooser:refreshPath()
else