|
|
@ -271,15 +271,11 @@ end
|
|
|
|
local exit_code
|
|
|
|
local exit_code
|
|
|
|
if file then
|
|
|
|
if file then
|
|
|
|
local ReaderUI = require("apps/reader/readerui")
|
|
|
|
local ReaderUI = require("apps/reader/readerui")
|
|
|
|
UIManager:nextTick(function()
|
|
|
|
|
|
|
|
ReaderUI:showReader(file)
|
|
|
|
ReaderUI:showReader(file)
|
|
|
|
end)
|
|
|
|
|
|
|
|
exit_code = UIManager:run()
|
|
|
|
exit_code = UIManager:run()
|
|
|
|
elseif directory then
|
|
|
|
elseif directory then
|
|
|
|
local FileManager = require("apps/filemanager/filemanager")
|
|
|
|
local FileManager = require("apps/filemanager/filemanager")
|
|
|
|
UIManager:nextTick(function()
|
|
|
|
|
|
|
|
FileManager:showFiles(directory)
|
|
|
|
FileManager:showFiles(directory)
|
|
|
|
end)
|
|
|
|
|
|
|
|
exit_code = UIManager:run()
|
|
|
|
exit_code = UIManager:run()
|
|
|
|
else
|
|
|
|
else
|
|
|
|
local QuickStart = require("ui/quickstart")
|
|
|
|
local QuickStart = require("ui/quickstart")
|
|
|
@ -290,47 +286,38 @@ else
|
|
|
|
|
|
|
|
|
|
|
|
if start_with == "last" and last_file and lfs.attributes(last_file, "mode") ~= "file" then
|
|
|
|
if start_with == "last" and last_file and lfs.attributes(last_file, "mode") ~= "file" then
|
|
|
|
UIManager:show(retryLastFile())
|
|
|
|
UIManager:show(retryLastFile())
|
|
|
|
-- no exit code as something else will be run after this.
|
|
|
|
-- We'll want to return from this without actually quitting,
|
|
|
|
UIManager:run()
|
|
|
|
-- so this is a slightly mangled UIManager:run() call to coerce the main loop into submission...
|
|
|
|
|
|
|
|
-- We'll call :run properly in either of the following branches once returning.
|
|
|
|
|
|
|
|
UIManager:runOnce()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if start_with == "last" and last_file then
|
|
|
|
if start_with == "last" and last_file then
|
|
|
|
local ReaderUI = require("apps/reader/readerui")
|
|
|
|
local ReaderUI = require("apps/reader/readerui")
|
|
|
|
UIManager:nextTick(function()
|
|
|
|
|
|
|
|
-- Instantiate RD
|
|
|
|
-- Instantiate RD
|
|
|
|
ReaderUI:showReader(last_file)
|
|
|
|
ReaderUI:showReader(last_file)
|
|
|
|
end)
|
|
|
|
|
|
|
|
exit_code = UIManager:run()
|
|
|
|
exit_code = UIManager:run()
|
|
|
|
else
|
|
|
|
else
|
|
|
|
local FileManager = require("apps/filemanager/filemanager")
|
|
|
|
local FileManager = require("apps/filemanager/filemanager")
|
|
|
|
local home_dir =
|
|
|
|
local home_dir = G_reader_settings:readSetting("home_dir") or Device.home_dir or lfs.currentdir()
|
|
|
|
G_reader_settings:readSetting("home_dir") or Device.home_dir or lfs.currentdir()
|
|
|
|
|
|
|
|
UIManager:nextTick(function()
|
|
|
|
|
|
|
|
-- Instantiate FM
|
|
|
|
-- Instantiate FM
|
|
|
|
FileManager:showFiles(home_dir)
|
|
|
|
FileManager:showFiles(home_dir)
|
|
|
|
end)
|
|
|
|
|
|
|
|
-- Always open FM modules on top of filemanager, so closing 'em doesn't result in an exit
|
|
|
|
-- Always open FM modules on top of filemanager, so closing 'em doesn't result in an exit
|
|
|
|
-- because of an empty widget stack, and so they can interact with the FM instance as expected.
|
|
|
|
-- because of an empty widget stack, and so they can interact with the FM instance as expected.
|
|
|
|
if start_with == "history" then
|
|
|
|
if start_with == "history" then
|
|
|
|
local FileManagerHistory = require("apps/filemanager/filemanagerhistory")
|
|
|
|
local FileManagerHistory = require("apps/filemanager/filemanagerhistory")
|
|
|
|
UIManager:nextTick(function()
|
|
|
|
|
|
|
|
FileManagerHistory:new{
|
|
|
|
FileManagerHistory:new{
|
|
|
|
ui = FileManager.instance,
|
|
|
|
ui = FileManager.instance,
|
|
|
|
}:onShowHist()
|
|
|
|
}:onShowHist()
|
|
|
|
end)
|
|
|
|
|
|
|
|
elseif start_with == "favorites" then
|
|
|
|
elseif start_with == "favorites" then
|
|
|
|
local FileManagerCollection = require("apps/filemanager/filemanagercollection")
|
|
|
|
local FileManagerCollection = require("apps/filemanager/filemanagercollection")
|
|
|
|
UIManager:nextTick(function()
|
|
|
|
|
|
|
|
FileManagerCollection:new{
|
|
|
|
FileManagerCollection:new{
|
|
|
|
ui = FileManager.instance,
|
|
|
|
ui = FileManager.instance,
|
|
|
|
}:onShowColl("favorites")
|
|
|
|
}:onShowColl("favorites")
|
|
|
|
end)
|
|
|
|
|
|
|
|
elseif start_with == "folder_shortcuts" then
|
|
|
|
elseif start_with == "folder_shortcuts" then
|
|
|
|
local FileManagerShortcuts = require("apps/filemanager/filemanagershortcuts")
|
|
|
|
local FileManagerShortcuts = require("apps/filemanager/filemanagershortcuts")
|
|
|
|
UIManager:nextTick(function()
|
|
|
|
|
|
|
|
FileManagerShortcuts:new{
|
|
|
|
FileManagerShortcuts:new{
|
|
|
|
ui = FileManager.instance,
|
|
|
|
ui = FileManager.instance,
|
|
|
|
}:onShowFolderShortcutsDialog()
|
|
|
|
}:onShowFolderShortcutsDialog()
|
|
|
|
end)
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
exit_code = UIManager:run()
|
|
|
|
exit_code = UIManager:run()
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -342,9 +329,11 @@ local function exitReader()
|
|
|
|
local ko_exit = os.getenv("KO_EXIT_CODE")
|
|
|
|
local ko_exit = os.getenv("KO_EXIT_CODE")
|
|
|
|
if ko_exit then
|
|
|
|
if ko_exit then
|
|
|
|
local fo = io.open(ko_exit, "w+")
|
|
|
|
local fo = io.open(ko_exit, "w+")
|
|
|
|
|
|
|
|
if fo then
|
|
|
|
fo:write(tostring(exit_code))
|
|
|
|
fo:write(tostring(exit_code))
|
|
|
|
fo:close()
|
|
|
|
fo:close()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local ReaderActivityIndicator =
|
|
|
|
local ReaderActivityIndicator =
|
|
|
|
require("apps/reader/modules/readeractivityindicator")
|
|
|
|
require("apps/reader/modules/readeractivityindicator")
|
|
|
|