mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Add a setting to disable save document (#2138)
* Add a setting to disable save document * Add UI elements to control save-document settings
This commit is contained in:
@@ -465,18 +465,26 @@ end
|
||||
function ReaderUI:notifyCloseDocument()
|
||||
self:handleEvent(Event:new("CloseDocument"))
|
||||
if self.document:isEdited() then
|
||||
UIManager:show(ConfirmBox:new{
|
||||
text = _("Do you want to save this document?"),
|
||||
ok_text = _("Yes"),
|
||||
cancel_text = _("No"),
|
||||
ok_callback = function()
|
||||
self:closeDocument()
|
||||
end,
|
||||
cancel_callback = function()
|
||||
self.document:discardChange()
|
||||
self:closeDocument()
|
||||
end,
|
||||
})
|
||||
local setting = G_reader_settings:readSetting("save_document")
|
||||
if setting == "always" then
|
||||
self:closeDocument()
|
||||
elseif setting == "disable" then
|
||||
self.document:discardChange()
|
||||
self:closeDocument()
|
||||
else
|
||||
UIManager:show(ConfirmBox:new{
|
||||
text = _("Do you want to save this document?"),
|
||||
ok_text = _("Yes"),
|
||||
cancel_text = _("No"),
|
||||
ok_callback = function()
|
||||
self:closeDocument()
|
||||
end,
|
||||
cancel_callback = function()
|
||||
self.document:discardChange()
|
||||
self:closeDocument()
|
||||
end,
|
||||
})
|
||||
end
|
||||
else
|
||||
self:closeDocument()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user