Add GUI check box control whether to retainn kpdf metadata.

This resolves bug report 1215.
pull/1/head
Darrell Anderson 12 years ago
parent d2151830b9
commit 194cf519e4

@ -41,11 +41,16 @@
<whatsthis></whatsthis>
<default>true</default>
</entry>
<entry name="WatchFile" type="Bool">
<label>Watch File</label>
<whatsthis>If this is on, then the file will be reloaded whenever it changes on disk</whatsthis>
<default>false</default>
</entry>
<entry name="WatchFile" type="Bool">
<label>Watch File</label>
<whatsthis>If this is on, then the file will be reloaded whenever it changes on disk</whatsthis>
<default>false</default>
</entry>
<entry name="RetainDocumentData" type="Bool">
<label>Retain document viewing data</label>
<whatsthis>If this is on, then document viewing options are retained</whatsthis>
<default>true</default>
</entry>
</group>
<group name="Ghostscript">
<entry name="Interpreter" type="String">

@ -85,12 +85,20 @@
</property>
</widget>
<widget class="TQCheckBox">
<property name="name">
<cstring>kcfg_WatchFile</cstring>
</property>
<property name="text">
<string>&amp;Watch file</string>
</property>
<property name="name">
<cstring>kcfg_WatchFile</cstring>
</property>
<property name="text">
<string>&amp;Watch file</string>
</property>
</widget>
<widget class="TQCheckBox">
<property name="name">
<cstring>kcfg_RetainDocumentData</cstring>
</property>
<property name="text">
<string>&amp;Retain document viewing data</string>
</property>
</widget>
</vbox>
</widget>

@ -54,7 +54,10 @@
<default>true</default>
</entry>
<entry key="ObeyDRM" type="Bool" >
<default>true</default>
<default>true</default>
</entry>
<entry key="RetainDocumentData" type="Bool" >
<default>true</default>
</entry>
</group>
<group name="MainView" >

@ -1404,65 +1404,68 @@ void KPDFDocument::saveDocumentInfo() const
if ( d->docFileName.isNull() )
return;
TQFile infoFile( d->xmlFileName );
if (infoFile.open( IO_WriteOnly | IO_Truncate) )
if ( KpdfSettings::retainDocumentData() )
{
// Create DOM
TQDomDocument doc( "documentInfo" );
TQDomElement root = doc.createElement( "documentInfo" );
doc.appendChild( root );
// Add bookmark list to DOM
TQDomElement bookmarkList = doc.createElement( "bookmarkList" );
root.appendChild( bookmarkList );
for ( uint i = 0; i < pages_vector.count() ; i++ )
{
if ( pages_vector[i]->hasBookmark() )
{
TQDomElement page = doc.createElement( "page" );
page.appendChild( doc.createTextNode( TQString::number(i) ) );
bookmarkList.appendChild( page );
}
}
// Add general info to DOM
TQDomElement generalInfo = doc.createElement( "generalInfo" );
root.appendChild( generalInfo );
// <general info><history> ... </history> saves history up to 10 viewports
TQValueList< DocumentViewport >::iterator backIterator = d->viewportIterator;
if ( backIterator != d->viewportHistory.end() )
{
// go back up to 10 steps from the current viewportIterator
int backSteps = 10;
while ( backSteps-- && backIterator != d->viewportHistory.begin() )
--backIterator;
// create history root node
TQDomElement historyNode = doc.createElement( "history" );
generalInfo.appendChild( historyNode );
// add old[backIterator] and present[viewportIterator] items
TQValueList< DocumentViewport >::iterator endIt = d->viewportIterator;
++endIt;
while ( backIterator != endIt )
{
TQString name = (backIterator == d->viewportIterator) ? "current" : "oldPage";
TQDomElement historyEntry = doc.createElement( name );
historyEntry.setAttribute( "viewport", (*backIterator).toString() );
historyNode.appendChild( historyEntry );
++backIterator;
}
}
// Save DOM to XML file
TQString xml = doc.toString();
TQTextStream os( &infoFile );
os << xml;
TQFile infoFile( d->xmlFileName );
if (infoFile.open( IO_WriteOnly | IO_Truncate) )
{
// Create DOM
TQDomDocument doc( "documentInfo" );
TQDomElement root = doc.createElement( "documentInfo" );
doc.appendChild( root );
// Add bookmark list to DOM
TQDomElement bookmarkList = doc.createElement( "bookmarkList" );
root.appendChild( bookmarkList );
for ( uint i = 0; i < pages_vector.count() ; i++ )
{
if ( pages_vector[i]->hasBookmark() )
{
TQDomElement page = doc.createElement( "page" );
page.appendChild( doc.createTextNode( TQString::number(i) ) );
bookmarkList.appendChild( page );
}
}
// Add general info to DOM
TQDomElement generalInfo = doc.createElement( "generalInfo" );
root.appendChild( generalInfo );
// <general info><history> ... </history> saves history up to 10 viewports
TQValueList< DocumentViewport >::iterator backIterator = d->viewportIterator;
if ( backIterator != d->viewportHistory.end() )
{
// go back up to 10 steps from the current viewportIterator
int backSteps = 10;
while ( backSteps-- && backIterator != d->viewportHistory.begin() )
--backIterator;
// create history root node
TQDomElement historyNode = doc.createElement( "history" );
generalInfo.appendChild( historyNode );
// add old[backIterator] and present[viewportIterator] items
TQValueList< DocumentViewport >::iterator endIt = d->viewportIterator;
++endIt;
while ( backIterator != endIt )
{
TQString name = (backIterator == d->viewportIterator) ? "current" : "oldPage";
TQDomElement historyEntry = doc.createElement( name );
historyEntry.setAttribute( "viewport", (*backIterator).toString() );
historyNode.appendChild( historyEntry );
++backIterator;
}
}
// Save DOM to XML file
TQString xml = doc.toString();
TQTextStream os( &infoFile );
os << xml;
}
infoFile.close();
}
infoFile.close();
}
void KPDFDocument::slotTimedMemoryCheck()

@ -11,6 +11,9 @@
<entry key="WatchFile" type="Bool">
<default>true</default>
</entry>
<entry key="RetainDocumentData" type="Bool">
<default>true</default>
</entry>
<entry key="Zoom" type="Double">
<default>1.0</default>
</entry>

Loading…
Cancel
Save