Commit 96c78eae authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

odt: Seems styles.xml and meta.xml are not mandatory

At least libreoffice opens the file from bug 324241 that has neither of them.
With this change we open it too, it looks crap when compared to libreoffice,
but that's just because our ooo generator needs to die in favour of a calligra one.

BUGS: 324241
FIXED-IN: 4.11.5
parent 5dfffec6
......@@ -585,4 +585,4 @@ bool Converter::convertAnnotation( QTextCursor *cursor, const QDomElement &eleme
emit addAnnotation( annotation, position, position + 3 );
return true;
}
\ No newline at end of file
}
......@@ -65,28 +65,22 @@ bool Document::open()
mContent = file->data();
}
if ( !entries.contains( "styles.xml" ) ) {
setError( i18n( "Invalid document structure (styles.xml is missing)" ) );
return false;
}
file = static_cast<const KArchiveFile*>( directory->entry( "styles.xml" ) );
if ( mManifest->testIfEncrypted( "styles.xml" ) ) {
mStyles = mManifest->decryptFile( "styles.xml", file->data() );
} else {
mStyles = file->data();
}
if ( !entries.contains( "meta.xml" ) ) {
setError( i18n( "Invalid document structure (meta.xml is missing)" ) );
return false;
if ( entries.contains( "styles.xml" ) ) {
file = static_cast<const KArchiveFile*>( directory->entry( "styles.xml" ) );
if ( mManifest->testIfEncrypted( "styles.xml" ) ) {
mStyles = mManifest->decryptFile( "styles.xml", file->data() );
} else {
mStyles = file->data();
}
}
file = static_cast<const KArchiveFile*>( directory->entry( "meta.xml" ) );
if ( mManifest->testIfEncrypted( "meta.xml" ) ) {
mMeta = mManifest->decryptFile( "meta.xml", file->data() );
} else {
mMeta = file->data();
if ( entries.contains( "meta.xml" ) ) {
file = static_cast<const KArchiveFile*>( directory->entry( "meta.xml" ) );
if ( mManifest->testIfEncrypted( "meta.xml" ) ) {
mMeta = mManifest->decryptFile( "meta.xml", file->data() );
} else {
mMeta = file->data();
}
}
if ( entries.contains( "Pictures" ) ) {
......
......@@ -70,6 +70,9 @@ bool StyleParser::parseContentFile()
bool StyleParser::parseStyleFile()
{
if ( mDocument->styles().isEmpty() )
return true;
QXmlSimpleReader reader;
QXmlInputSource source;
......@@ -106,6 +109,9 @@ bool StyleParser::parseStyleFile()
bool StyleParser::parseMetaFile()
{
if ( mDocument->meta().isEmpty() )
return true;
QXmlSimpleReader reader;
QXmlInputSource source;
......
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