ReaderUI: minor optimization (#10634)

This commit is contained in:
hius07
2023-07-03 17:43:13 +03:00
committed by GitHub
parent eb299c300d
commit dee1c902ec
7 changed files with 16 additions and 30 deletions

View File

@@ -656,7 +656,7 @@ function ReaderUI:doShowReader(file, provider, seamless)
document = document,
}
local title = reader.document:getProps().title
local title = reader.doc_settings:readSetting("doc_props").title
if title ~= "" then
Screen:setWindowTitle(title)
@@ -678,13 +678,6 @@ function ReaderUI:doShowReader(file, provider, seamless)
UIManager:show(reader, seamless and "ui" or "full")
end
-- NOTE: The instance reference used to be stored in a private module variable, hence the getter method.
-- We've since aligned behavior with FileManager, which uses a class member instead,
-- but kept the function to avoid changing existing code.
function ReaderUI:_getRunningInstance()
return ReaderUI.instance
end
function ReaderUI:unlockDocumentWithPassword(document, try_again)
logger.dbg("show input password dialog")
self.password_dialog = InputDialog:new{
@@ -695,7 +688,6 @@ function ReaderUI:unlockDocumentWithPassword(document, try_again)
{
text = _("Cancel"),
id = "close",
enabled = true,
callback = function()
self:closeDialog()
coroutine.resume(self._coroutine)
@@ -703,7 +695,6 @@ function ReaderUI:unlockDocumentWithPassword(document, try_again)
},
{
text = _("OK"),
enabled = true,
callback = function()
local success = self:onVerifyPassword(document)
self:closeDialog()
@@ -767,7 +758,7 @@ function ReaderUI:notifyCloseDocument()
self:closeDocument()
else
UIManager:show(ConfirmBox:new{
text = _("Write highlights into this PDF??"),
text = _("Write highlights into this PDF?"),
ok_text = _("Write"),
dismissable = false,
ok_callback = function()
@@ -889,11 +880,7 @@ function ReaderUI:onOpenLastDoc()
end
function ReaderUI:getCurrentPage()
if self.document.info.has_pages then
return self.paging.current_page
else
return self.document:getCurrentPage()
end
return self.paging and self.paging.current_page or self.document:getCurrentPage()
end
return ReaderUI