[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [calligra/export-epub-moji] filters/words/epub: Clean up a little and simplify the code.
From:       Inge Wallin <inge () lysator ! liu ! se>
Date:       2012-07-31 19:56:20
Message-ID: 20120731195620.82DD5A6094 () git ! kde ! org
[Download RAW message or body]

Git commit 3022b321330843e49f3f87a821180010dbbde494 by Inge Wallin.
Committed on 31/07/2012 at 20:27.
Pushed by ingwa into branch 'export-epub-moji'.

Clean up a little and simplify the code.

M  +13   -13   filters/words/epub/exportepub2.cpp

http://commits.kde.org/calligra/3022b321330843e49f3f87a821180010dbbde494

diff --git a/filters/words/epub/exportepub2.cpp b/filters/words/epub/exportepub2.cpp
index d51c1af..72da396 100644
--- a/filters/words/epub/exportepub2.cpp
+++ b/filters/words/epub/exportepub2.cpp
@@ -115,26 +115,26 @@ KoFilter::ConversionStatus ExportEpub2::convert(const \
QByteArray &from, const QB  int startNode = 0;
     int id = 1;
     bool moreFiles = false;
+    QString prefix = "body";    // FIXME: Change to "chapter". Beware of hardcoded \
"body" here and there.  while (1) {
-        QPair<KoFilter::ConversionStatus, bool> pair = convertContent(odfStore, \
                m_meta, &epub, htmlContent
-                                                                      , \
m_pBreakStylesList, startNode, moreFiles); +        QPair<KoFilter::ConversionStatus, \
bool> pair +            = convertContent(odfStore, m_meta, &epub, htmlContent
+                             , m_pBreakStylesList, startNode, moreFiles);
+
         if (pair.first != KoFilter::OK) {
             delete odfStore;
             return status;
         }
-        if (pair.second) {
-            QString fileId = "body" + QString::number(id);
-            QString src = "OEBPS/" + fileId + ".html";
-            epub.addContentFile(fileId, src, "application/xhtml+xml", htmlContent);
-            htmlContent.clear();
-            moreFiles = true;
-        }
-        if (!pair.second) {
-            QString fileId = "body" + QString::number(id);
-            QString src = "OEBPS/" + fileId + ".html";
-            epub.addContentFile(fileId, src, "application/xhtml+xml", htmlContent);
+
+        QString fileId = prefix + QString::number(id);
+        QString fileName = "OEBPS/" + fileId + ".html";
+        epub.addContentFile(fileId, fileName, "application/xhtml+xml", htmlContent);
+        if (!pair.second) { 
             break;
         }
+
+        htmlContent.clear();
+        moreFiles = true;
         id++;
     }
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic