hold on directory in filemanager can set the it as HOME directory

and this "HOME" directory will override the command line option passed to
koreader.

This patch implements #1434.
pull/1448/head
chrox 9 years ago
parent 3224eb1797
commit 69e6b6b9cb

@ -75,8 +75,7 @@ function FileManager:init()
function file_chooser:onFileHold(file)
--DEBUG("hold file", file)
self.file_dialog = ButtonDialog:new{
buttons = {
local buttons = {
{
{
text = _("Copy"),
@ -119,7 +118,21 @@ function FileManager:init()
end,
},
},
},
}
if lfs.attributes(file, "mode") == "directory" then
local realpath = util.realpath(file)
table.insert(buttons, {
{
text = _("Set as HOME directory"),
callback = function()
G_reader_settings:saveSetting("home_dir", realpath)
UIManager:close(self.file_dialog)
end
}
})
end
self.file_dialog = ButtonDialog:new{
buttons = buttons,
}
UIManager:show(self.file_dialog)
return true

@ -138,7 +138,8 @@ if ARGV[argidx] and ARGV[argidx] ~= "" then
-- the filemanger will show the files in that path
else
local FileManager = require("apps/filemanager/filemanager")
FileManager:showFiles(ARGV[argidx])
local home_dir = G_reader_settings:readSetting("home_dir") or ARGV[argidx]
FileManager:showFiles(home_dir)
end
UIManager:run()
elseif last_file then

Loading…
Cancel
Save