Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit cebe8d65 authored by Fabio D'Urso's avatar Fabio D'Urso

Merge remote-tracking branch 'origin/KDE/4.13'

parents 7b7fef0b f7ec9df0
......@@ -109,7 +109,7 @@ struct ArchiveData
}
KTemporaryFile document;
QString metadataFileName;
KTemporaryFile metadataFile;
};
struct RunningSearch
......@@ -613,12 +613,12 @@ void DocumentPrivate::loadDocumentInfo()
if ( m_xmlFileName.isEmpty() )
return;
loadDocumentInfo( m_xmlFileName );
QFile infoFile( m_xmlFileName );
loadDocumentInfo( infoFile );
}
void DocumentPrivate::loadDocumentInfo( const QString &fileName )
void DocumentPrivate::loadDocumentInfo( QFile &infoFile )
{
QFile infoFile( fileName );
if ( !infoFile.exists() || !infoFile.open( QIODevice::ReadOnly ) )
return;
......@@ -2258,7 +2258,7 @@ Document::OpenResult Document::openDocument( const QString & docFile, const KUrl
// 2. load Additional Data (bookmarks, local annotations and metadata) about the document
if ( d->m_archiveData )
{
d->loadDocumentInfo( d->m_archiveData->metadataFileName );
d->loadDocumentInfo( d->m_archiveData->metadataFile );
d->m_annotationsNeedSaveAs = true;
}
else
......@@ -4157,19 +4157,15 @@ Document::OpenResult Document::openDocumentArchive( const QString & docFile, con
archiveData->document.close();
}
std::auto_ptr< KTemporaryFile > tempMetadataFileName;
const KArchiveEntry * metadataEntry = mainDir->entry( metadataFileName );
if ( metadataEntry && metadataEntry->isFile() )
{
std::auto_ptr< QIODevice > metadataEntryDevice( static_cast< const KZipFileEntry * >( metadataEntry )->createDevice() );
tempMetadataFileName.reset( new KTemporaryFile() );
tempMetadataFileName->setSuffix( ".xml" );
tempMetadataFileName->setAutoRemove( false );
if ( tempMetadataFileName->open() )
archiveData->metadataFile.setSuffix( ".xml" );
if ( archiveData->metadataFile.open() )
{
copyQIODevice( metadataEntryDevice.get(), tempMetadataFileName.get() );
archiveData->metadataFileName = tempMetadataFileName->fileName();
tempMetadataFileName->close();
copyQIODevice( metadataEntryDevice.get(), &archiveData->metadataFile );
archiveData->metadataFile.close();
}
}
......
......@@ -29,6 +29,7 @@
class QUndoStack;
class QEventLoop;
class QFile;
class QTimer;
class KTemporaryFile;
......@@ -114,7 +115,7 @@ class DocumentPrivate
qulonglong getTotalMemory();
qulonglong getFreeMemory( qulonglong *freeSwap = 0 );
void loadDocumentInfo();
void loadDocumentInfo( const QString &fileName );
void loadDocumentInfo( QFile &infoFile );
void loadViewsInfo( View *view, const QDomElement &e );
void saveViewsInfo( View *view, QDomElement &e ) const;
QString giveAbsolutePath( const QString & fileName ) const;
......
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