Commit a5252a91 authored by Pino Toscano's avatar Pino Toscano

add flags to selectively choose the page parts to serialize

svn path=/trunk/KDE/kdegraphics/okular/; revision=884438
parent 3462b4f5
......@@ -770,7 +770,7 @@ void PagePrivate::restoreLocalContents( const QDomNode & pageNode )
}
}
void PagePrivate::saveLocalContents( QDomNode & parentNode, QDomDocument & document ) const
void PagePrivate::saveLocalContents( QDomNode & parentNode, QDomDocument & document, PageItems what ) const
{
// only add a node if there is some stuff to write into
if ( m_page->m_annotations.isEmpty() && formfields.isEmpty() )
......@@ -794,7 +794,7 @@ void PagePrivate::saveLocalContents( QDomNode & parentNode, QDomDocument & docum
#endif
// add annotations info if has got any
if ( !m_page->m_annotations.isEmpty() )
if ( ( what & AnnotationPageItems ) && !m_page->m_annotations.isEmpty() )
{
// create the annotationList
QDomElement annotListElement = document.createElement( "annotationList" );
......@@ -822,7 +822,7 @@ void PagePrivate::saveLocalContents( QDomNode & parentNode, QDomDocument & docum
}
// add forms info if has got any
if ( !formfields.isEmpty() )
if ( ( what & FormFieldPageItems ) && !formfields.isEmpty() )
{
// create the formList
QDomElement formListElement = document.createElement( "forms" );
......
......@@ -37,6 +37,15 @@ class PageTransition;
class RotationJob;
class TextPage;
enum PageItem
{
None = 0,
AnnotationPageItems = 0x01,
FormFieldPageItems = 0x02,
AllPageItems = 0xff
};
Q_DECLARE_FLAGS(PageItems, PageItem)
class PagePrivate
{
public:
......@@ -54,7 +63,7 @@ class PagePrivate
/**
* Saves the local contents (e.g. annotations) of the page.
*/
void saveLocalContents( QDomNode & parentNode, QDomDocument & document ) const;
void saveLocalContents( QDomNode & parentNode, QDomDocument & document, PageItems what = AllPageItems ) const;
/**
* Modifies an existing annotation by replacing it with a new @p annotation.
......@@ -126,4 +135,6 @@ class PagePrivate
}
Q_DECLARE_OPERATORS_FOR_FLAGS(Okular::PageItems)
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment