mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Add restart koreader function and ensure FlushSettings event can be delivered to all widgets (#2772)
This commit is contained in:
14
reader.lua
14
reader.lua
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user