mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
History: add confirmation before cleaning (#8016)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
local BD = require("ui/bidi")
|
||||
local ButtonDialogTitle = require("ui/widget/buttondialogtitle")
|
||||
local ConfirmBox = require("ui/widget/confirmbox")
|
||||
local DocSettings = require("docsettings")
|
||||
local FileManagerBookInfo = require("apps/filemanager/filemanagerbookinfo")
|
||||
local InputContainer = require("ui/widget/container/inputcontainer")
|
||||
@@ -52,7 +53,6 @@ function FileManagerHistory:onMenuHold(item)
|
||||
text = _("Purge .sdr"),
|
||||
enabled = item.file ~= currently_opened_file and DocSettings:hasSidecarFile(util.realpath(item.file)),
|
||||
callback = function()
|
||||
local ConfirmBox = require("ui/widget/confirmbox")
|
||||
UIManager:show(ConfirmBox:new{
|
||||
text = util.template(_("Purge .sdr to reset settings for this document?\n\n%1"), BD.filename(item.text)),
|
||||
ok_text = _("Purge"),
|
||||
@@ -79,7 +79,6 @@ function FileManagerHistory:onMenuHold(item)
|
||||
text = _("Delete"),
|
||||
enabled = (item.file ~= currently_opened_file and lfs.attributes(item.file, "mode")) and true or false,
|
||||
callback = function()
|
||||
local ConfirmBox = require("ui/widget/confirmbox")
|
||||
UIManager:show(ConfirmBox:new{
|
||||
text = _("Are you sure that you want to delete this file?\n") .. BD.filepath(item.file) .. ("\n") .. _("If you delete a file, it is permanently lost."),
|
||||
ok_text = _("Delete"),
|
||||
@@ -107,9 +106,15 @@ function FileManagerHistory:onMenuHold(item)
|
||||
{
|
||||
text = _("Clear history of deleted files"),
|
||||
callback = function()
|
||||
require("readhistory"):clearMissing()
|
||||
self._manager:updateItemTable()
|
||||
UIManager:close(self.histfile_dialog)
|
||||
UIManager:show(ConfirmBox:new{
|
||||
text = _("Clear history of deleted files?"),
|
||||
ok_text = _("Clear"),
|
||||
ok_callback = function()
|
||||
require("readhistory"):clearMissing()
|
||||
self._manager:updateItemTable()
|
||||
UIManager:close(self.histfile_dialog)
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user