mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Disable Purge .sdr and Delete for currently opened book (#3500)
This commit is contained in:
@@ -42,12 +42,14 @@ function FileManagerHistory:onSetDimensions(dimen)
|
||||
end
|
||||
|
||||
function FileManagerHistory:onMenuHold(item)
|
||||
local readerui_instance = require("apps/reader/readerui"):_getRunningInstance()
|
||||
local currently_opened_file = readerui_instance and readerui_instance.document.file
|
||||
self.histfile_dialog = nil
|
||||
local buttons = {
|
||||
{
|
||||
{
|
||||
text = _("Purge .sdr"),
|
||||
enabled = DocSettings:hasSidecarFile(util.realpath(item.file)),
|
||||
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{
|
||||
@@ -74,7 +76,7 @@ function FileManagerHistory:onMenuHold(item)
|
||||
{
|
||||
{
|
||||
text = _("Delete"),
|
||||
enabled = lfs.attributes(item.file, "mode") and true or false,
|
||||
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{
|
||||
|
||||
Reference in New Issue
Block a user