mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
ReaderUI: minor optimization (#10634)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user