| Summary: | The marker for the current section only shows up for the first page of a chapter | ||
|---|---|---|---|
| Product: | [Applications] okular | Reporter: | miklos <mtmkls> |
| Component: | general | Assignee: | Okular developers <okular-devel> |
| Status: | RESOLVED FIXED | ||
| Severity: | wishlist | CC: | aacid, oliver.sander |
| Priority: | NOR | ||
| Version First Reported In: | 0.20.2 | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | http://commits.kde.org/okular/1371ccfa28cf777dd04d3f67a1947e41b02dba0d | Version Fixed/Implemented In: | |
| Sentry Crash Report: | |||
| Attachments: | okular_marker.diff | ||
|
Description
miklos
2014-12-21 15:05:18 UTC
Please attach a file and to use and a screenshot showing your problem. In can confirm this with the current git master. To reproduce just pick any LaTeX-generated file with a toc, e.g.: http://arxiv.org/pdf/1301.2539 Set up okular so that it shows the toc in the left part. The green triangle appears when viewing page one (which contains the chapter heading "1. Introduction". It disappears when scrolling to page 2 (which does not contain a chapter heading). It reappears when scrolling to page 3 which contains the beginning of Chapter 2. Oliver's link is a good example. Ah, Oliver description is easier to understand, that's just how it was coded. Besides I don't think what you suggest can be done, nothing in the specification guarantees the Table Of Contents is sorted. What would you do when that happens? And what when the TOC has multiple sublevels? And multiple TOC items pointing to the same page? If you can generate the TOC tree, and you can jump to specific pages when a TOC element is clicked, you have a sorted representation of the document structure. You just need to find the TOC element that points to the highest page number that is lower or equal than the currently displayed page. Add the marker to that TOC element, if visible, to its parent, if not (use a recursion). If multiple TOC elements point to the same page, select the first one (deterministically). I disagree, and actually querying the whole TOC tree is quite a bad idea since on big documents it can be veeeeeeeeeeeeeeery slow. But if someone comes up with a patch we can discuss over it. Created attachment 97055 [details] okular_marker.diff (In reply to Albert Astals Cid from comment #6) > I disagree, and actually querying the whole TOC tree is quite a bad idea > since on big documents it can be veeeeeeeeeeeeeeery slow. > > But if someone comes up with a patch we can discuss over it. Today I noticed that this bug is still open, and I decided to take a look at the code. You worry about querying the whole TOC tree? The current code does exactly that to find the items matching the current page! I came up with the attached patch that half-solves the problem, and doesn't go over the entire TOC tree :) The remaining task is to teach TOCModel::data() to only set KIcon to nodes that either have no children or are not expanded. The latter is a bit difficult, as the model knows nothing about the treeview. I'm open to suggestions. Please use reviewboard for patches, it's much easier to review them in there (In reply to Albert Astals Cid from comment #8) > Please use reviewboard for patches, it's much easier to review them in there OK, I did that. Git commit 1371ccfa28cf777dd04d3f67a1947e41b02dba0d by Albert Astals Cid, on behalf of Miklós Máté. Committed on 21/03/2016 at 23:29. Pushed by aacid into branch 'Applications/16.04'. Show TOC marker for parents if the children is collapsed REVIEWS: 127013 M +59 -12 ui/tocmodel.cpp http://commits.kde.org/okular/1371ccfa28cf777dd04d3f67a1947e41b02dba0d |