]> Git trees. - libqmvoc.git/commitdiff
Fixed bug which multiplied conjugations when saving document v4.8.80 v4.8.90 v4.8.95 v4.8.97 v4.9.0 v4.9.1
authorChristian Muschick <cmusch@gmx.at>
Thu, 17 May 2012 19:52:40 +0000 (21:52 +0200)
committerChristian Muschick <cmusch@gmx.at>
Mon, 21 May 2012 18:49:45 +0000 (20:49 +0200)
keduvocdocument/keduvocconjugation.cpp
keduvocdocument/keduvocconjugation.h

index bb55e779e03e8d550a6141c78f85b33d4e8c3cc2..eb2382bbfa75446bb4999ee67fd9e47fef077f37 100644 (file)
@@ -118,10 +118,12 @@ void KEduVocConjugation::toKVTML2(QDomElement & parent, const QString &tense)
     for ( int num = 0; num <= 2; ++num) {
         QDomElement numberElement = domDoc.createElement( KVTML_GRAMMATICAL_NUMBER[num] );
         for ( int person = 0; person < 5; ++person) {
-            if (!conjugation(numbers[num] | persons[person]).isEmpty()) {
+            KEduVocWordFlags curFlags = numbers[num] | persons[person];
+
+            if (keys().contains(curFlags) && !conjugation(curFlags).isEmpty()) {
                 QDomElement personElement = domDoc.createElement( KVTML_GRAMMATICAL_PERSON[person] );
                 numberElement.appendChild(personElement);
-                conjugation(persons[person] | numbers[num]).toKVTML2(personElement);
+                conjugation(curFlags).toKVTML2(personElement);
             }
         }
         if (numberElement.hasChildNodes()) {
index 8777e86622c838172fad9fc52d613e173bc4d703..d301953e444e68db85850e6b2f72bfb78eff3497 100644 (file)
@@ -50,7 +50,19 @@ public:
     KEduVocConjugation& operator = ( const KEduVocConjugation& a );
     bool operator == ( const KEduVocConjugation& a ) const;
 
+    /**
+     *  Returns an existing conjugation object. It is an error and leads to undefined behaviour
+     *  to call this method with flags which are not in the list returned by keys().
+     *
+     *  BCI: return a pointer instead of a reference.
+     *
+     *  @param  flags Flags obtained by a previous call to keys()
+     *  @return The existing conjugation object with the specified properties
+     */
     KEduVocText& conjugation(KEduVocWordFlags flags) const;
+    /**
+     *  Updates or creates the conjugation object for the given word flags.
+     */
     void setConjugation(const KEduVocText& conjugation, KEduVocWordFlags flags);
 
     QList<KEduVocWordFlags> keys();