Dialog when reopening book at start (#2259) (#2603)

pull/2616/head
Robert 7 years ago committed by Qingping Hou
parent ce8f568486
commit b4462da1b6

@ -93,6 +93,24 @@ local lfs = require("libs/libkoreader-lfs")
local UIManager = require("ui/uimanager") local UIManager = require("ui/uimanager")
local Device = require("device") local Device = require("device")
local Font = require("ui/font") local Font = require("ui/font")
local ConfirmBox = require("ui/widget/confirmbox")
local function retryLastFile()
return ConfirmBox:new{
text = _("Cannot open last file.\nThis could be because it was deleted or because external storage is still being mounted.\nDo you want to retry?"),
ok_callback = function()
local last_file = G_reader_settings:readSetting("lastfile")
if lfs.attributes(last_file, "mode") == "file" then
local ReaderUI = require("apps/reader/readerui")
UIManager:nextTick(function()
ReaderUI:showReader(last_file)
end)
else
UIManager:show(retryLastFile())
end
end,
}
end
-- read some global reader setting here: -- read some global reader setting here:
-- font -- font
@ -105,6 +123,7 @@ end
-- last file -- last file
local last_file = G_reader_settings:readSetting("lastfile") local last_file = G_reader_settings:readSetting("lastfile")
if last_file and lfs.attributes(last_file, "mode") ~= "file" then if last_file and lfs.attributes(last_file, "mode") ~= "file" then
UIManager:show(retryLastFile())
last_file = nil last_file = nil
end end
-- load last opened file -- load last opened file

Loading…
Cancel
Save