|
|
|
@ -238,10 +238,6 @@ function FileManager:setupLayout()
|
|
|
|
|
callback = function()
|
|
|
|
|
copyFile(file)
|
|
|
|
|
UIManager:close(self.file_dialog)
|
|
|
|
|
UIManager:show(InfoMessage:new{
|
|
|
|
|
text = T(_("Copied to clipboard:\n%1"), BD.filepath(file)),
|
|
|
|
|
timeout = 2,
|
|
|
|
|
})
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
@ -276,10 +272,6 @@ function FileManager:setupLayout()
|
|
|
|
|
callback = function()
|
|
|
|
|
cutFile(file)
|
|
|
|
|
UIManager:close(self.file_dialog)
|
|
|
|
|
UIManager:show(InfoMessage:new{
|
|
|
|
|
text = T(_("Cut to clipboard:\n%1"), BD.filepath(file)),
|
|
|
|
|
timeout = 2,
|
|
|
|
|
})
|
|
|
|
|
end,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
@ -887,12 +879,7 @@ function FileManager:pasteHere(file)
|
|
|
|
|
if DocSettings:hasSidecarFile(orig) then
|
|
|
|
|
BaseUtil.execute(self.cp_bin, "-r", DocSettings:getSidecarDir(orig), dest)
|
|
|
|
|
end
|
|
|
|
|
if BaseUtil.execute(self.cp_bin, "-r", orig, dest) == 0 then
|
|
|
|
|
UIManager:show(InfoMessage:new {
|
|
|
|
|
text = T(_("Copied:\n%1\nto:\n%2"), BD.filepath(orig_basename), BD.dirpath(dest)),
|
|
|
|
|
timeout = 2,
|
|
|
|
|
})
|
|
|
|
|
else
|
|
|
|
|
if BaseUtil.execute(self.cp_bin, "-r", orig, dest) ~= 0 then
|
|
|
|
|
UIManager:show(InfoMessage:new {
|
|
|
|
|
text = T(_("Failed to copy:\n%1\nto:\n%2"), BD.filepath(orig_basename), BD.dirpath(dest)),
|
|
|
|
|
icon = "notice-warning",
|
|
|
|
@ -910,10 +897,6 @@ function FileManager:pasteHere(file)
|
|
|
|
|
local dest_file = string.format("%s/%s", dest, BaseUtil.basename(orig))
|
|
|
|
|
require("readhistory"):updateItemByPath(orig, dest_file) -- (will update "lastfile" if needed)
|
|
|
|
|
ReadCollection:updateItemByPath(orig, dest_file)
|
|
|
|
|
UIManager:show(InfoMessage:new {
|
|
|
|
|
text = T(_("Moved:\n%1\nto:\n%2"), BD.filepath(orig_basename), BD.dirpath(dest)),
|
|
|
|
|
timeout = 2,
|
|
|
|
|
})
|
|
|
|
|
else
|
|
|
|
|
UIManager:show(InfoMessage:new {
|
|
|
|
|
text = T(_("Failed to move:\n%1\nto:\n%2"), BD.filepath(orig_basename), BD.dirpath(dest)),
|
|
|
|
@ -960,10 +943,6 @@ function FileManager:createFolder(curr_folder, new_folder)
|
|
|
|
|
local code = BaseUtil.execute(self.mkdir_bin, folder)
|
|
|
|
|
if code == 0 then
|
|
|
|
|
self:onRefresh()
|
|
|
|
|
UIManager:show(InfoMessage:new{
|
|
|
|
|
text = T(_("Created folder:\n%1"), BD.directory(new_folder)),
|
|
|
|
|
timeout = 2,
|
|
|
|
|
})
|
|
|
|
|
else
|
|
|
|
|
UIManager:show(InfoMessage:new{
|
|
|
|
|
text = T(_("Failed to create folder:\n%1"), BD.directory(new_folder)),
|
|
|
|
@ -1001,11 +980,6 @@ function FileManager:deleteFile(file)
|
|
|
|
|
doc_settings:purge()
|
|
|
|
|
end
|
|
|
|
|
ReadCollection:removeItemByPath(file, is_dir)
|
|
|
|
|
UIManager:show(InfoMessage:new{
|
|
|
|
|
text = is_dir and T(_("Deleted folder:\n%1"), BD.filepath(file)) or
|
|
|
|
|
T(_("Deleted file:\n%1"), BD.filepath(file)),
|
|
|
|
|
timeout = 2,
|
|
|
|
|
})
|
|
|
|
|
else
|
|
|
|
|
UIManager:show(InfoMessage:new{
|
|
|
|
|
text = T(_("Failed to delete:\n%1"), BD.filepath(file)),
|
|
|
|
@ -1033,23 +1007,13 @@ function FileManager:renameFile(file)
|
|
|
|
|
not self:moveFile(doc:getSidecarDir(file), doc:getSidecarDir(dest)) then
|
|
|
|
|
move_history = false
|
|
|
|
|
end
|
|
|
|
|
if move_history then
|
|
|
|
|
UIManager:show(InfoMessage:new{
|
|
|
|
|
text = T(_("Renamed file:\n%1\nto:\n%2"), BD.filepath(file), BD.filepath(dest)),
|
|
|
|
|
timeout = 2,
|
|
|
|
|
})
|
|
|
|
|
else
|
|
|
|
|
if not move_history then
|
|
|
|
|
UIManager:show(InfoMessage:new{
|
|
|
|
|
text = T(_("Renamed file:\n%1\nto:\n%2\n\nFailed to move history data.\nThe reading history may be lost."),
|
|
|
|
|
BD.filepath(file), BD.filepath(dest)),
|
|
|
|
|
icon = "notice-warning",
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
UIManager:show(InfoMessage:new{
|
|
|
|
|
text = T(_("Renamed folder:\n%1\nto:\n%2"), BD.filepath(file), BD.filepath(dest)),
|
|
|
|
|
timeout = 2,
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
UIManager:show(InfoMessage:new{
|
|
|
|
@ -1242,10 +1206,6 @@ end
|
|
|
|
|
|
|
|
|
|
function FileManager:onRefreshContent()
|
|
|
|
|
self:onRefresh()
|
|
|
|
|
UIManager:show(InfoMessage:new{
|
|
|
|
|
text = _("Content refreshed."),
|
|
|
|
|
timeout = 2,
|
|
|
|
|
})
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return FileManager
|
|
|
|
|