|
|
@ -75,52 +75,65 @@ function FileManager:init()
|
|
|
|
|
|
|
|
|
|
|
|
function file_chooser:onFileHold(file)
|
|
|
|
function file_chooser:onFileHold(file)
|
|
|
|
--DEBUG("hold file", file)
|
|
|
|
--DEBUG("hold file", file)
|
|
|
|
self.file_dialog = ButtonDialog:new{
|
|
|
|
local buttons = {
|
|
|
|
buttons = {
|
|
|
|
{
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
text = _("Copy"),
|
|
|
|
|
|
|
|
callback = function()
|
|
|
|
|
|
|
|
copyFile(file)
|
|
|
|
|
|
|
|
UIManager:close(self.file_dialog)
|
|
|
|
|
|
|
|
end,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
text = _("Paste"),
|
|
|
|
|
|
|
|
enabled = fileManager.clipboard and true or false,
|
|
|
|
|
|
|
|
callback = function()
|
|
|
|
|
|
|
|
pasteHere(file)
|
|
|
|
|
|
|
|
self:refreshPath()
|
|
|
|
|
|
|
|
UIManager:close(self.file_dialog)
|
|
|
|
|
|
|
|
end,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
text = _("Cut"),
|
|
|
|
text = _("Copy"),
|
|
|
|
callback = function()
|
|
|
|
callback = function()
|
|
|
|
cutFile(file)
|
|
|
|
copyFile(file)
|
|
|
|
UIManager:close(self.file_dialog)
|
|
|
|
UIManager:close(self.file_dialog)
|
|
|
|
end,
|
|
|
|
end,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
text = _("Paste"),
|
|
|
|
|
|
|
|
enabled = fileManager.clipboard and true or false,
|
|
|
|
|
|
|
|
callback = function()
|
|
|
|
|
|
|
|
pasteHere(file)
|
|
|
|
|
|
|
|
self:refreshPath()
|
|
|
|
|
|
|
|
UIManager:close(self.file_dialog)
|
|
|
|
|
|
|
|
end,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
{
|
|
|
|
text = _("Delete"),
|
|
|
|
text = _("Cut"),
|
|
|
|
callback = function()
|
|
|
|
callback = function()
|
|
|
|
local path = util.realpath(file)
|
|
|
|
cutFile(file)
|
|
|
|
local ConfirmBox = require("ui/widget/confirmbox")
|
|
|
|
UIManager:close(self.file_dialog)
|
|
|
|
UIManager:close(self.file_dialog)
|
|
|
|
end,
|
|
|
|
UIManager:show(ConfirmBox:new{
|
|
|
|
},
|
|
|
|
text = _("Are you sure that you want to delete this file?\n") .. file .. ("\n") .. _("If you delete a file, it is permanently lost."),
|
|
|
|
{
|
|
|
|
ok_callback = function()
|
|
|
|
text = _("Delete"),
|
|
|
|
deleteFile(file)
|
|
|
|
callback = function()
|
|
|
|
self:refreshPath()
|
|
|
|
local path = util.realpath(file)
|
|
|
|
end,
|
|
|
|
local ConfirmBox = require("ui/widget/confirmbox")
|
|
|
|
})
|
|
|
|
UIManager:close(self.file_dialog)
|
|
|
|
end,
|
|
|
|
UIManager:show(ConfirmBox:new{
|
|
|
|
|
|
|
|
text = _("Are you sure that you want to delete this file?\n") .. file .. ("\n") .. _("If you delete a file, it is permanently lost."),
|
|
|
|
|
|
|
|
ok_callback = function()
|
|
|
|
|
|
|
|
deleteFile(file)
|
|
|
|
|
|
|
|
self:refreshPath()
|
|
|
|
|
|
|
|
end,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
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)
|
|
|
|
UIManager:show(self.file_dialog)
|
|
|
|
return true
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
end
|
|
|
|