[Calligra] 664cfaa Fix: converting from SVG to ODG using koconverter

Cyrille Berger <[email protected]> Sat, 11 Dec 2010 20:02:53 +0100 (CET)
Newsgroups gmane.comp.kde.devel.koffice
Message-ID <[email protected]>
commit 664cfaa967730d5dc0e6aa0043f95abd331856b0
branch master
Author: Cyrille Berger <[email protected]>
Date:   Sat Dec 11 19:59:44 2010 +0100

    Fix: converting from SVG to ODG using koconverter
    
    Details: when no mimetype is specified, saveNativeFormat save using the 1.x file format, setOutputMimeType ensure the mimetype selected by the user is used
    
    Please review for inclusion in branch/koffice/2.3
    
    CCMAIL: [email protected]

diff --git a/libs/main/KoDocument.cpp b/libs/main/KoDocument.cpp
index dc524ab..634db01 100644
--- a/libs/main/KoDocument.cpp
+++ b/libs/main/KoDocument.cpp
@@ -854,6 +854,7 @@ bool KoDocument::saveNativeFormat(const QString & file)
     // OLD: bool oasis = d->specialOutputFlag == SaveAsOASIS;
     // OLD: QCString mimeType = oasis ? nativeOasisMimeType() : nativeFormatMimeType();
     QByteArray mimeType = d->outputMimeType;
+    kDebug(30003) << "KoDocument::savingTo mimeType=" << mimeType;
     QByteArray nativeOasisMime = nativeOasisMimeType();
     bool oasis = !mimeType.isEmpty() && (mimeType == nativeOasisMime || mimeType == nativeOasisMime + "-template" || mimeType.startsWith("application/vnd.oasis.opendocument"));
 
diff --git a/libs/main/KoFilterChain.cpp b/libs/main/KoFilterChain.cpp
index 5c21c39..f091a54 100644
--- a/libs/main/KoFilterChain.cpp
+++ b/libs/main/KoFilterChain.cpp
@@ -345,7 +345,8 @@ void KoFilterChain::finalizeIO()
     // Note: m_*input*Document as we already called manageIO()
     if (m_inputDocument &&
             static_cast<KoFilterManager::Direction>(filterManagerDirection()) == KoFilterManager::Export) {
-        kDebug(30500) << "Saving the output document to the export file";
+        kDebug(30500) << "Saving the output document to the export file " << m_chainLinks.current()->to();
+        m_inputDocument->setOutputMimeType(m_chainLinks.current()->to());
         m_inputDocument->saveNativeFormat(filterManagerExportFile());
         m_inputFile = filterManagerExportFile();
     }