mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
History: avoid opening non-existent files
Mostly just so we don't get the History closed when erroneously tapping on a deleted file.
This commit is contained in:
@@ -39,6 +39,9 @@ local function buildEntry(input_time, input_file)
|
||||
end
|
||||
return util.secondsToDate(last_read_ts, G_reader_settings:isTrue("twelve_hour_clock"))
|
||||
end,
|
||||
select_enabled_func = function()
|
||||
return lfs.attributes(file_path, "mode") == "file"
|
||||
end,
|
||||
callback = function()
|
||||
local ReaderUI = require("apps/reader/readerui")
|
||||
ReaderUI:showReader(input_file)
|
||||
|
||||
@@ -1173,6 +1173,14 @@ override this function to process the item selected in a different manner
|
||||
]]--
|
||||
function Menu:onMenuSelect(item)
|
||||
if item.sub_item_table == nil then
|
||||
if item.select_enabled == false then
|
||||
return true
|
||||
end
|
||||
if item.select_enabled_func then
|
||||
if not item.select_enabled_func() then
|
||||
return true
|
||||
end
|
||||
end
|
||||
if self.close_callback then
|
||||
self.close_callback()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user