Bug 288042

Summary: Option to reset forms (PDF)
Product: [Applications] okular Reporter: Alvaro Aguilera <alvaro.aguilera>
Component: generalAssignee: Okular developers <okular-devel>
Status: REPORTED ---    
Severity: wishlist CC: aacid, ahmad.osama.moh, gassaf, m.weghorn, navarromoralesdev, oliver.sander, simon.eu, simonandric5, timgelvin
Priority: NOR Keywords: junior-jobs
Version: 0.5.81   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: The attachment contains a zip file with 3 patches containing the changes to 5 files: part.cpp/pageview.cpp/pageview.h/formwidget.cpp/formwidget.h
Implement the reset forms option using Okular::FormFields in a way similar to editformstest.cpp

Description Alvaro Aguilera 2011-12-02 10:32:39 UTC
Version:           0.5.81 (using KDE 4.7.3) 
OS:                Linux

It would be nice to have an option to reset a PDF form. 

Reproducible: Didn't try



Expected Results:  
For example, a reset button next to the "show/hide form" button that clears all the input fields the document has.

OS: Linux (x86_64) release 3.0.6-2-desktop
Compiler: gcc
Comment 1 Albert Astals Cid 2016-06-12 18:15:48 UTC
*** Bug 306292 has been marked as a duplicate of this bug. ***
Comment 2 Albert Astals Cid 2016-06-12 18:17:20 UTC
*** Bug 354970 has been marked as a duplicate of this bug. ***
Comment 3 francisco navarro morales 2017-08-30 13:58:32 UTC
working on it
Comment 4 Gilbert Assaf 2017-08-30 15:07:44 UTC
https://git.reviewboard.kde.org/r/130057/
Comment 5 Ahmad Osama 2018-02-13 17:21:41 UTC
Created attachment 110619 [details]
The attachment contains a zip file with 3 patches containing the changes to 5 files: part.cpp/pageview.cpp/pageview.h/formwidget.cpp/formwidget.h

These changes are done to add a button to Reset pdf forms when clicked.

Changes are to the following files:

* part.cpp: Just changing the text displayed to the user when the document has forms
* pageview.cpp/pageview.h: add an action to reset forms just like the Show Form/Hide form (aToggleForm QAction)
* formwidget.cpp/formwidger.h: add a virtual function 'clearWidgetContents()' to the parent class (FormWidgetIface) that clears the contents of the widget, then overriding this function in its children to clear the contents differently in each widget, ex. clearing the FormLineEditClass (that iherits from QLineEdit) is done by setting text to an empty string ("").

* the clearWidgetContents() is called when the QAction associated with it is triggered.
Comment 6 Oliver Sander 2018-02-13 18:54:40 UTC
Hi Ahmad, thanks for posting these patches.  Could you please get an account at

   https://phabricator.kde.org/

and post the patches there?  They are much easier to review that way.

Are your patches related to the patches posted by Gilbert Assaf in Comment 4?
Comment 7 Ahmad Osama 2018-02-14 12:32:13 UTC
I have posted it here: https://phabricator.kde.org/D10504

I saw the comment now, it sounds that I have implemented almost the same idea!
Comment 8 Ahmad Osama 2018-03-04 19:05:17 UTC
Created attachment 111183 [details]
Implement the reset forms option using Okular::FormFields in a way similar to editformstest.cpp

I uploaded the path here:
https://phabricator.kde.org/D10932

I am currently working on getting the auto test to work in a way other than creating a reset function in the document class.
Comment 9 Ahmad Osama 2018-03-13 13:00:36 UTC
I created an auto-test for this option that is working fine on the created test cases, the new test along with the implementation for this option are in this patch:

https://phabricator.kde.org/D10932