[poppler] [qt4] Question on the use of the FormFieldChoice class

Fabio D'Urso fabiodurso at hotmail.it
Fri Nov 2 16:49:03 PDT 2012


On Wednesday, October 17, 2012 08:45:05 PM Fabio D'Urso wrote:
> On Wednesday, October 17, 2012 08:51:37 AM Adam Reichold wrote:
> > Just noticed something odd: When I save a modified copy of a PDF file
> > with a custom text entered into a combo box form field and reload it,
> > the new file still shows the custom text but
> > FormWidgetChoice::getEditChoice returns a null string...
> >
> > Could this be a problem with the parsing in FormFieldChoice?
>
> Seems like it's not been implemented.
>
> In FormFieldChoice::FormFieldChoice (poppler/Form.cc), editedChoice is
> initially assigned NULL and never changed.
> I think it should be given the value in /V if /V is a string and doesn't
> match any of the predefined choices. Note that the piece of code that
> parses /V is one of the things that I'm working on (thread: "Patches for
> form choice fields").
>
> By the way, I noticed that FormFieldChoice::setEditChoice internally calls 
> unselectAll to deselect predefined options. Maybe select/selectAll/etc.. 
> should similarly set editedChoice to NULL?

Patches attached, to be applied on top those from that thread (these ones: 
http://lists.freedesktop.org/archives/poppler/2012-November/009729.html ).

In detail:

== 0001-FormFieldChoice-ctor-Stop-scanning-if-V-is-a-string-.patch ==

Pretty straightforward patch that prepares FormFieldChoice::FormFieldChoice 
for the next patch. It also adds a break that avoids unnecessary loop 
iterations.

== 0002-FormFieldChoice-ctor-Added-support-to-recognize-user.patch ==

This patch fixes the problem reported by Adam
( http://lists.freedesktop.org/archives/poppler/2012-October/009688.html )
by doing exactly what I've described in the previous message (the "I think it 
should be given" part).

== 0003-Editable-FormFieldChoice-Clear-editedChoice-when-one.patch ==

This patch fixes the issue I've described in the previous message (the "By the 
way" part). Without it, it's impossible to select a predefined option after a 
custom value has been entered.

Once again, these three patches must be applied on top of the ones from the 
other thread, which are currently waiting for Carlos' review.

In the meantime, please let me know if there's any other issue you've noticed.

Thank you,
Fabio
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-FormFieldChoice-ctor-Stop-scanning-if-V-is-a-string-.patch
Type: text/x-patch
Size: 1581 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20121103/10eab781/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-FormFieldChoice-ctor-Added-support-to-recognize-user.patch
Type: text/x-patch
Size: 1102 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20121103/10eab781/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Editable-FormFieldChoice-Clear-editedChoice-when-one.patch
Type: text/x-patch
Size: 1135 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20121103/10eab781/attachment-0002.bin>


More information about the poppler mailing list