Support the '#page=<pagenum>' fragment to specify which page
to open the document at, in addition to the existing '#<pagenum>'
syntax.
For PDF, the '#page=<pagenum>' fragment is specified in RFC 8118,
section 3.
BUG: 406831
Support the '#page=<pagenum>' fragment to specify which page
to open the document at, in addition to the existing '#<pagenum>'
syntax.
For PDF, the '#page=<pagenum>' fragment is specified in RFC 8118,
section 3.
BUG: 406831
No Linters Available |
No Unit Test Coverage |
Buildable 11300 | |
Build 11318: arc lint + arc unit |
How about the following approach (not tested)? This way, other parameters (like nameddest) wouldn’t break it and can be added later.
const QString fragment = url.fragment(QUrl::EncodeDelimiters); bool gotOpenPageNumber = false; int openPageNumber = fragment.toInt(&gotOpenPageNumber); for ( QString parameter : fragment.split(QChar('&') ) { if ( parameter.startsWith("page=", Qt::CaseInsensitive) ) { bool ok = false; int page = parameter.mid(5).toInt(&ok); if ( ok ) { openPageNumber = page; gotOpenPageNumber = true; } } }
I`m not sure whether QUrl::EncodeDelimiters is optimal.
Please move as a Merge Request in https://invent.kde.org/kde/okular
We have pre-commit CI and lots of checks including clazy and clang-tidy there so it's a much better place for doing the review/approval/merge of the code.
Finally moved there: https://invent.kde.org/graphics/okular/-/merge_requests/265
Sorry for the extreme delay!