mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
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:
@@ -72,16 +72,7 @@ function ReaderMenu:init()
|
||||
end
|
||||
|
||||
function ReaderMenu:getPreviousFile()
|
||||
local previous_file = nil
|
||||
local readhistory = require("readhistory")
|
||||
for i=2, #readhistory.hist do -- skip first one which is current book
|
||||
-- skip deleted items kept in history
|
||||
if lfs.attributes(readhistory.hist[i].file, "mode") == "file" then
|
||||
previous_file = readhistory.hist[i].file
|
||||
break
|
||||
end
|
||||
end
|
||||
return previous_file
|
||||
return require("readhistory"):getPreviousFile(self.ui.document.file)
|
||||
end
|
||||
|
||||
function ReaderMenu:onReaderReady()
|
||||
|
||||
Reference in New Issue
Block a user