]> Git trees. - libqmvoc.git/commitdiff
backport 1113642 upstream/KDE/4.4 v4.4.3 v4.4.4 v4.4.5
authorBenjamin Schleinzer <ben-kde@schleinzer.eu>
Sun, 11 Apr 2010 11:28:53 +0000 (11:28 +0000)
committerBenjamin Schleinzer <ben-kde@schleinzer.eu>
Sun, 11 Apr 2010 11:28:53 +0000 (11:28 +0000)
fixed kvtml file writer bug for pairs

svn path=/branches/KDE/4.4/kdeedu/libkdeedu/; revision=1113643

keduvocdocument/keduvockvtml2writer.cpp

index d8dab2e6f231c8c3d0713cf367c65009dbc9e64b..2822cf1521dd9fbe66a917751c0cea90d87d7b81 100644 (file)
@@ -251,21 +251,8 @@ void KEduVocKvtml2Writer::writeSynonymAntonymFalseFriend(QDomElement & parentEle
 
         while (!currentList.isEmpty()) {
             // after writing a translation, remove it from the list
-            KEduVocTranslation* translation = currentList.takeAt(0);
-
-            // fill the entry element but only add later if it is valid
-            QDomElement entryElement = m_domDoc.createElement( KVTML_ENTRY );
-            entryElement.setAttribute( KVTML_ID, QString::number(m_allEntries.indexOf(translation->entry())) );
-            // find out which id that is... silly
-            foreach(int index, translation->entry()->translationIndices()) {
-                if (translation->entry()->translation(index) == translation) {
-                    // create <translation id="123">
-                    QDomElement translationElement = m_domDoc.createElement( KVTML_TRANSLATION );
-                    translationElement.setAttribute( KVTML_ID, QString::number(index) );
-                    entryElement.appendChild(translationElement);
-                    break;
-                }
-            }
+            KEduVocTranslation* translation = currentList.takeFirst();
+           
 
             QDomElement relatedElement;
             QList <KEduVocTranslation*> list;
@@ -284,13 +271,26 @@ void KEduVocKvtml2Writer::writeSynonymAntonymFalseFriend(QDomElement & parentEle
                 // if it is not in the list it has already been written and we can move on
                 if (currentList.contains(synonym)) {
                     relatedElement = m_domDoc.createElement( KVTML_PAIR );
-                    synonymElement.appendChild(relatedElement);
+
+                   // fill the entry element but only add later if it is valid
+                   QDomElement entryElement = m_domDoc.createElement( KVTML_ENTRY );
+                   entryElement.setAttribute( KVTML_ID, QString::number(m_allEntries.indexOf(translation->entry())) );
+                   // find out which id that is... silly
+                   foreach(int index, translation->entry()->translationIndices()) {
+                       if (translation->entry()->translation(index) == translation) {
+                           // create <translation id="123">
+                           QDomElement translationElement = m_domDoc.createElement( KVTML_TRANSLATION );
+                           translationElement.setAttribute( KVTML_ID, QString::number(index) );
+                           entryElement.appendChild(translationElement);
+                           break;
+                       }
+                   }
+                   
                     relatedElement.appendChild(entryElement);
 
 
                     QDomElement partnerElement = m_domDoc.createElement( KVTML_ENTRY );
                     partnerElement.setAttribute( KVTML_ID, QString::number(m_allEntries.indexOf(synonym->entry())) );
-
                     // find out which id that is
                     foreach(int index, synonym->entry()->translationIndices()) {
                         if (synonym->entry()->translation(index) == synonym) {
@@ -302,11 +302,10 @@ void KEduVocKvtml2Writer::writeSynonymAntonymFalseFriend(QDomElement & parentEle
                         }
                     }
                     relatedElement.appendChild( partnerElement );
+                   synonymElement.appendChild(relatedElement);
                 }
             }
-            if (relatedElement.hasChildNodes()) {
-                synonymElement.appendChild( relatedElement );
-            }
+            
         }
         if (synonymElement.hasChildNodes()) {
             parentElement.appendChild( synonymElement );