mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
bug fix in readertoc
* typo in fillToc method * handle xpointer in getTocTitleByPage * return true in onShowToc
This commit is contained in:
@@ -21,20 +21,24 @@ function ReaderToc:onSetDimensions(dimen)
|
||||
self.dimen = dimen
|
||||
end
|
||||
|
||||
--function ReaderToc:fillToc()
|
||||
--self.toc = self.doc:getToc()
|
||||
--end
|
||||
function ReaderToc:fillToc()
|
||||
self.toc = self.ui.document:getToc()
|
||||
end
|
||||
|
||||
-- getTocTitleByPage wrapper, so specific reader
|
||||
-- _getTocTitleByPage wrapper, so specific reader
|
||||
-- can tranform pageno according its need
|
||||
function ReaderToc:getTocTitleByPage(pageno)
|
||||
return self:_getTocTitleByPage(pageno)
|
||||
function ReaderToc:getTocTitleByPage(pn_or_xp)
|
||||
local page = pn_or_xp
|
||||
if type(pn_or_xp) == "string" then
|
||||
page = self.ui.document:getPageFromXPointer(pn_or_xp)
|
||||
end
|
||||
return self:_getTocTitleByPage(page)
|
||||
end
|
||||
|
||||
function ReaderToc:_getTocTitleByPage(pageno)
|
||||
if not self.toc then
|
||||
-- build toc when needed.
|
||||
self:fillToc()
|
||||
-- build toc when needed.
|
||||
self:fillToc()
|
||||
end
|
||||
|
||||
-- no table of content
|
||||
@@ -83,6 +87,7 @@ function ReaderToc:onShowToc()
|
||||
end
|
||||
|
||||
UIManager:show(menu_container)
|
||||
return true
|
||||
end
|
||||
|
||||
function ReaderToc:addToMainMenu(item_table)
|
||||
|
||||
Reference in New Issue
Block a user