pino added inline comments.
INLINE COMMENTS
> kjs_document.cpp:275-286
> + for ( Page * pIt : doc->m_pagesVector )
> + {
> + const QLinkedList< Okular::FormField * > pageFields =
> pIt->formFields();
> + for( Okular::FormField *ffIt : pageFields )
> + {
> + if(numField == 0)
> + {
This convoluted for loop basically get the i-th element of a QLinkedList, which
is not designed for index accessing (and that is why there is no at(int)
method).
IMHO a better way is:
- get the list of form fields
- compare the wanted index with the count of the form fields: if it is out of
boundaries, return KJSUndefined directly
- otherwise, create an iterator fromthe begin, and increment it by the wanted
index to get to the wanted element
REPOSITORY
R223 Okular
REVISION DETAIL
https://phabricator.kde.org/D21202
To: joaonetto, aacid, #okular
Cc: pino, anthonyfieroni, sander, okular-devel, joaonetto, tfella, ngraham,
darcyshen, aacid