add onGotoPage handler in readerpaging

pull/190/head
chrox 11 years ago
parent b774c1468f
commit 196f72a053

@ -17,21 +17,21 @@ function ReaderGoto:init()
text = _("Cancel"), text = _("Cancel"),
enabled = true, enabled = true,
callback = function() callback = function()
self:onClose() self:close()
end, end,
}, },
{ {
text = _("Page"), text = _("Page"),
enabled = self.document.info.has_pages, enabled = self.document.info.has_pages,
callback = function() callback = function()
self:onGotoPage() self:gotoPage()
end, end,
}, },
{ {
text = _("Location"), text = _("Location"),
enabled = not self.document.info.has_pages, enabled = not self.document.info.has_pages,
callback = function() callback = function()
self:onGotoLocation() self:gotoLocation()
end, end,
}, },
}, },
@ -59,22 +59,21 @@ function ReaderGoto:onShowGotoDialog()
UIManager:show(self.goto_dialog) UIManager:show(self.goto_dialog)
end end
function ReaderGoto:onClose() function ReaderGoto:close()
self.goto_dialog:onClose() self.goto_dialog:onClose()
UIManager:close(self.goto_dialog) UIManager:close(self.goto_dialog)
end end
function ReaderGoto:onGotoPage() function ReaderGoto:gotoPage()
local number = tonumber(self.goto_dialog:getInputText()) local number = tonumber(self.goto_dialog:getInputText())
if number then if number then
DEBUG("go to page", number) self.ui:handleEvent(Event:new("GotoPage", number))
self.ui:handleEvent(Event:new("PageUpdate", number))
end end
self:onClose() self:close()
return true return true
end end
function ReaderGoto:onGotoLocation() function ReaderGoto:gotoLocation()
-- TODO: implement go to location -- TODO: implement go to location
self:onClose() self:close()
end end

@ -670,4 +670,7 @@ function ReaderPaging:gotoPage(number, orig)
return true return true
end end
function ReaderPaging:onGotoPage(number)
self:gotoPage(number)
return true
end

Loading…
Cancel
Save