D20868: Support '#page=<pagenum>' fragment to open at page <pagenum>
David Hurka
noreply at phabricator.kde.org
Sun Apr 28 13:24:08 BST 2019
davidhurka added a comment.
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.
REPOSITORY
R223 Okular
REVISION DETAIL
https://phabricator.kde.org/D20868
To: michaelweghorn, #okular
Cc: davidhurka, okular-devel, joaonetto, tfella, ngraham, darcyshen, aacid
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20190428/5de0ad2f/attachment.html>
More information about the Okular-devel
mailing list