Hi, a small patch to load text inside a dde connection.
Atm this is all it does, it does not resolve the connection or even preserve 
the declaration. This is *only* to not loose the text.

And, it comes with a unit test. (not in the diff)
-- 
Mvh.
Dag Andersen
diff --git a/libs/kotext/opendocument/KoTextLoader.cpp b/libs/kotext/opendocument/KoTextLoader.cpp
index 14af96b..cdc8c2c 100644
--- a/libs/kotext/opendocument/KoTextLoader.cpp
+++ b/libs/kotext/opendocument/KoTextLoader.cpp
@@ -1723,6 +1723,14 @@ void KoTextLoader::loadSpan(const KoXmlElement &element, QTextCursor &cursor, bo
             If a heading has a numbering applied, the text of the formatted number can be included in a
             <text:number> element. This text can be used by applications that do not support numbering of
             headings, but it will be ignored by applications that support numbering.                   */
+        } else if (isTextNS && localName == "dde-connection") {
+            // TODO: load actual connection (or at least preserve it)
+            // For now: just load the text
+            for (KoXmlNode n = ts.firstChild(); !n.isNull(); n = n.nextSibling()) {
+                if (n.isText()) {
+                    loadText(n.toText().data(), cursor, stripLeadingSpace, false);
+                }
+            }
         } else if ((isDrawNS) && localName == "a") { // draw:a
             loadShapeWithHyperLink(ts, cursor);
         } else if (isDrawNS) {
diff --git a/libs/kotext/opendocument/tests/TestLoading.cpp b/libs/kotext/opendocument/tests/TestLoading.cpp
index 7e1f305..c36deda 100644
--- a/libs/kotext/opendocument/tests/TestLoading.cpp
+++ b/libs/kotext/opendocument/tests/TestLoading.cpp
@@ -1007,6 +1007,8 @@ void TestLoading::addData(LoadSave loadSave)
 
     QTest::newRow("bookmark") << "ParagraphElements/bookmark";
     QTest::newRow("note") << "ParagraphElements/note";
+
+    QTest::newRow("dde") << "DDE/dde";
 }
 
 QTextDocument *TestLoading::documentFromScript(const QString &script)
_______________________________________________
calligra-devel mailing list
calligra-devel@kde.org
https://mail.kde.org/mailman/listinfo/calligra-devel

Reply via email to