Skip to content

Conversation

@gonwan
Copy link
Contributor

@gonwan gonwan commented Jan 23, 2026

Fixes #37.

Use attachment for testing. There are 3 TOC and 10 pages in the file. Use previous/next button in toolbar to view 'hidden' pages. The file in #37 also works.

To make things easy, 'hidden' pages are associated with a last known TOC entry. When click previous/next button, first check 'hidden' pages before/after the current one, then pages in TOC before/after it.

Two pass to construct the TOC data structure for epub files: In first pass, construct TOC using toc.ncx. In second pass, associate pages in content.opf but not in toc.ncx to TOC data structure.

testepub.zip

@gonwan
Copy link
Contributor Author

gonwan commented Jan 23, 2026

Caching in Webkit is disabled, since some pages do not refresh. Even loadFinished() is emitted and source of the new page is loaded. A manual refresh is needed. See screen record. The WebEngine version works fine by default.

2026-01-23.13-41-35.mp4

@u-235
Copy link
Member

u-235 commented Jan 24, 2026

I have a slightly different vision for the solution, which revolves around the idea that the eBook interface should provide methods for similar navigation. This will simplify the app's code and make it easier to support other eBook formats. I've created a draft, which you can view here. I'm interested in your opinions and any criticism.

@gonwan
Copy link
Contributor Author

gonwan commented Jan 24, 2026

You idea is setting navigator to TOC entries for chm files, and to spine entries for epub files. The TOC entries is completely ignored. I am not sure whether it is 100% correct. That's why I tried to merge these 2 list in my PR. But it may work for 99% of epub files, and that is navigation by content.opf. I think it is better than mine.

There are cases that your current implementation does not cover:

  1. In epub files, if we have 1.htm#a, 1.htm#b, 2.htm in TOC, the next page of 1.htm#a will be 2.htm. One TOC entry is skipped, a bit strange.
  2. In chm files, navigation stops working when moving to a folder item. Though the function seems to be 'broken' in previous versions.
  3. The WebKit cache issue mentioned in my previous comment. Better disable it.
  4. Adjust tooltip and whatsthis of navigation buttons.

Some coding suggestion:

  1. EBook::loadNaigation():
  • It can access m_navigator directly, and m_navigatorLoaded should be set there.
  • Typos in the function name.
  1. Can we just merge loadNaigation() and setNavigator(), and use an override function for epub file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

EPUB: Previous/Next buttons should follow content.opf, not toc.ncx

2 participants