Add restart koreader function and ensure FlushSettings event can be delivered to all widgets (#2772)

This commit is contained in:
Hzj_jie
2017-05-16 02:11:11 -07:00
committed by Qingping Hou
parent 3492b8b117
commit 30378eb2a8
25 changed files with 279 additions and 104 deletions

View File

@@ -11,7 +11,6 @@ io.stdout:write([[
[*] Current time: ]], os.date("%x-%X"), "\n\n")
io.stdout:flush()
-- load default settings
require("defaults")
local DataStorage = require("datastorage")
@@ -165,6 +164,8 @@ if Device:needsTouchScreenProbe() then
Device:touchScreenProbe()
end
local exit_code = nil
if ARGV[argidx] and ARGV[argidx] ~= "" then
local file = nil
if lfs.attributes(ARGV[argidx], "mode") == "file" then
@@ -189,13 +190,13 @@ if ARGV[argidx] and ARGV[argidx] ~= "" then
FileManager:showFiles(home_dir)
end)
end
UIManager:run()
exit_code = UIManager:run()
elseif last_file then
local ReaderUI = require("apps/reader/readerui")
UIManager:nextTick(function()
ReaderUI:showReader(last_file)
end)
UIManager:run()
exit_code = UIManager:run()
else
return showusage()
end
@@ -213,7 +214,12 @@ local function exitReader()
Device:exit()
if Profiler then Profiler.stop() end
os.exit(0)
if type(exit_code) == "number" then
os.exit(exit_code)
else
os.exit(0)
end
end
exitReader()