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

This commit is contained in:
Robert
2017-03-05 03:54:23 +01:00
committed by Qingping Hou
parent ce8f568486
commit b4462da1b6

View File

@@ -93,6 +93,24 @@ local lfs = require("libs/libkoreader-lfs")
local UIManager = require("ui/uimanager")
local Device = require("device")
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:
-- font
@@ -105,6 +123,7 @@ end
-- last file
local last_file = G_reader_settings:readSetting("lastfile")
if last_file and lfs.attributes(last_file, "mode") ~= "file" then
UIManager:show(retryLastFile())
last_file = nil
end
-- load last opened file