Merge pull request #1853 from koreader/houqp-master

add current page to goto input hint
pull/1856/head v2016.02.27-nightly
Frans de Jonge 8 years ago
commit 7b11491dcd

@ -30,6 +30,33 @@ travis_retry() {
return $result
}
retry_cmd() {
local result=0
local count=1
set +e
retry_cnt=$1
shift 1
while [ $count -le ${retry_cnt} ]; do
[ $result -ne 0 ] && {
echo -e "\n${ANSI_RED}The command \"$@\" failed. Retrying, $count of ${retry_cnt}${ANSI_RESET}\n" >&2
}
"$@"
result=$?
[ $result -eq 0 ] && break
count=$(($count + 1))
sleep 1
done
[ $count -gt ${retry_cnt} ] && {
echo -e "\n${ANSI_RED}The command \"$@\" failed ${retry_cnt} times.${ANSI_RESET}\n" >&2
}
set -e
return $result
}
export PATH=$PWD/bin:$PATH
export PATH=$PATH:${TRAVIS_BUILD_DIR}/install/bin
if [ -f ${TRAVIS_BUILD_DIR}/install/bin/luarocks ]; then

@ -5,7 +5,7 @@ source "${CI_DIR}/common.sh"
travis_retry make fetchthirdparty
make all
travis_retry make testfront
retry_cmd 6 make testfront
set +o pipefail
luajit $(which luacheck) --no-color -q frontend | tee ./luacheck.out
test $(grep Total ./luacheck.out | awk '{print $2}') -le 63

@ -3,12 +3,10 @@ local InputDialog = require("ui/widget/inputdialog")
local UIManager = require("ui/uimanager")
local Screen = require("device").screen
local Event = require("ui/event")
local DEBUG = require("dbg")
local _ = require("gettext")
local ReaderGoto = InputContainer:new{
goto_menu_title = _("Go to"),
goto_dialog_title = _("Go to Page or Location"),
}
function ReaderGoto:init()
@ -26,10 +24,26 @@ function ReaderGoto:addToMainMenu(tab_item_table)
end
function ReaderGoto:onShowGotoDialog()
DEBUG("show goto dialog")
local dialog_title, goto_btn, curr_page
if self.document.info.has_pages then
dialog_title = _("Go to Page")
goto_btn = {
text = _("Page"),
callback = function() self:gotoPage() end,
}
curr_page = self.ui.paging.current_page
else
dialog_title = _("Go to Location")
goto_btn = {
text = _("Location"),
callback = function() self:gotoPage() end,
}
-- only CreDocument has this method
curr_page = self.document:getCurrentPage()
end
self.goto_dialog = InputDialog:new{
title = self.goto_dialog_title,
input_hint = "(1 - "..self.document:getPageCount()..")",
title = dialog_title,
input_hint = "@"..curr_page.." (1 - "..self.document:getPageCount()..")",
buttons = {
{
{
@ -39,20 +53,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",

Loading…
Cancel
Save