From 847837c5c18ef629f00dd6f044ff256e4a8c85cc Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Thu, 25 Feb 2016 23:50:12 -0800 Subject: [PATCH] readergoto: use the term page and location based on doc type --- frontend/apps/reader/modules/readergoto.lua | 33 ++++++++++----------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/frontend/apps/reader/modules/readergoto.lua b/frontend/apps/reader/modules/readergoto.lua index 5ec541160..dd378bb34 100644 --- a/frontend/apps/reader/modules/readergoto.lua +++ b/frontend/apps/reader/modules/readergoto.lua @@ -8,7 +8,6 @@ local _ = require("gettext") local ReaderGoto = InputContainer:new{ goto_menu_title = _("Go to"), - goto_dialog_title = _("Go to Page or Location"), } function ReaderGoto:init() @@ -26,9 +25,22 @@ function ReaderGoto:addToMainMenu(tab_item_table) end function ReaderGoto:onShowGotoDialog() - DEBUG("show goto dialog") + local dialog_title, goto_btn + if self.document.info.has_pages then + dialog_title = _("Go to Page") + goto_btn = { + text = _("Page"), + callback = function() self:gotoPage() end, + } + else + dialog_title = _("Go to Location") + goto_btn = { + text = _("Location"), + callback = function() self:gotoPage() end, + } + end self.goto_dialog = InputDialog:new{ - title = self.goto_dialog_title, + title = dialog_title, input_hint = "(1 - "..self.document:getPageCount()..")", buttons = { { @@ -39,20 +51,7 @@ function ReaderGoto:onShowGotoDialog() self:close() end, }, - { - text = _("Page"), - enabled = self.document.info.has_pages, - callback = function() - self:gotoPage() - end, - }, - { - text = _("Location"), - enabled = not self.document.info.has_pages, - callback = function() - self:gotoPage() - end, - }, + goto_btn, }, }, input_type = "number",