[Okular-devel] Review Request: Add undo/redo support for annotations

Jon Mease jon.mease at gmail.com
Mon Dec 31 03:12:12 UTC 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/107442/
-----------------------------------------------------------

(Updated Dec. 31, 2012, 3:12 a.m.)


Review request for Okular.


Changes
-------

Update incorporating Fabio's feedback (Thanks again!).  In addition, the following changes have been made

* Undo/Redo of annotation contents no longer relies on trying to sync up with the undo stack inside QTextEdit.  It has now been implemented from scratch and works much better.  The following simple edit actions may be merged together into a single undo action: Single character backspace, single character delete, and single character insertion.  All other text edit commands are treated as single actions for undo/redo.  Both the text cursor position and text selection states are restored upon undo.  We should be able to leverage this work to implement undo/redo of form text.

* Fixed bug when editing the properties of annotations in a PDF.  The problem was that the nativeID field and ExternallyDraw text interaction flag are not stored in the XML description of the annotation's properties and so these properties need to be restored manually (see Annotation::setAnnotationProperties()).  

* The implementations of Annotation::getAnnotationPropertiesDomNode() and Annotation::setAnnotationProperties() have been refactored so that no virtual functions are being called from annotation constructors.

Open Issues:
- Still no form support
- When you right click in the KTextEdit of an AnnotWindow the Undo and Redo actions are always disabled in the context menu (because we're not allowing the KTextEdit to handle undo/redo on it's own).  I would like to somehow hook these context menu actions up to the global undo/redo actions but I haven't looked into this yet


Description
-------

This patch is a first cut at adding undo/redo support to Okular.  This patch is not yet complete, however it is far enough along that I would like to begin incorporating feedback from the community.

Functionality:
The following actions can be undone and redone: creation and removal of annotations, editing arbitrary annotation properties, relocating annotations with Ctrl+drag, and editing the text contents of an annotation.

This patch does not yet include support for undoing and redoing editing actions on forms.  I plan to implement this form undo functionality before the functionality of this patch is included in Okular.

Known Issue:
When editing an annotation's properties in a .dvi file the annotation is altered and the action can be undone as expected.  However, when editing an annotation's properties in a .pdf file the image of the original annotation is not removed from the document when the altered annotation appears.  I would appreciate any possible leads on this issue.  
  


This addresses bug 177501.
    http://bugs.kde.org/show_bug.cgi?id=177501


Diffs (updated)
-----

  core/annotations.h 72abdff 
  core/annotations.cpp 49ab5bd 
  core/document.h 1d825e1 
  core/document.cpp 00e290d 
  core/document_p.h 4a20561 
  core/page.cpp 4df58e0 
  generators/poppler/annots.cpp b7fb9f7 
  part.rc 39c1571 
  ui/annotationpropertiesdialog.cpp 4b02258 
  ui/annotwindow.h f7df9f6 
  ui/annotwindow.cpp c1bafb9 
  ui/pageview.cpp 811a169 

Diff: http://git.reviewboard.kde.org/r/107442/diff/


Testing
-------

I have tested the undoing and redoing of the specified annotation actions using .dvi and .pdf documents.  The only known issue is the one described above when using .pdf files. 


Thanks,

Jon Mease

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20121231/d68a7e6a/attachment.html>


More information about the Okular-devel mailing list