]> Git trees. - libqmvoc.git/commitdiff
Read plural pronouns correctly from old docs.
authorFrederik Gladhorn <gladhorn@kde.org>
Sun, 7 Oct 2007 14:42:07 +0000 (14:42 +0000)
committerFrederik Gladhorn <gladhorn@kde.org>
Sun, 7 Oct 2007 14:42:07 +0000 (14:42 +0000)
Add isEmpty() to conjugations.
Attempt to make conjugations a little less broken:
  - empty conjugations are ignored
  - a stringlist contains possible tenses to practice
  - for now only the first not empty tense is practiced

svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=722531

keduvocdocument/keduvocconjugation.cpp
keduvocdocument/keduvocconjugation.h
keduvocdocument/keduvockvtmlreader.cpp
keduvocdocument/keduvockvtmlwriter.cpp

index 786390a14102834dbce3fde34a51a5358e906178..9439f546d8b3e16c3c7466244e0cf293bbdac8fb 100644 (file)
@@ -96,7 +96,14 @@ QString KEduVocConjugation::conjugation(ConjugationPerson person, ConjugationNum
 
 void KEduVocConjugation::setConjugation(const QString & conjugation, ConjugationPerson person, ConjugationNumber number)
 {
-    d->m_conjugations[indexOf(person, number)] = conjugation;
+    if ( !conjugation.isEmpty() ) {
+        d->m_conjugations[indexOf(person, number)] = conjugation;
+    } else {
+        // if we received an empty string, remove the element.
+        if ( d->m_conjugations.contains(indexOf(person, number)) ) {
+            d->m_conjugations.remove(indexOf(person, number));
+        }
+    }
 }
 
 
@@ -105,3 +112,9 @@ int KEduVocConjugation::indexOf(ConjugationPerson person, ConjugationNumber numb
     return person + PersonMAX * number;
 }
 
+
+bool KEduVocConjugation::isEmpty()
+{
+    return d->m_conjugations.count() == 0;
+}
+
index 56e17e290296fe122e7ca3b63cd67b91934cfaca..789dff788b789ac022a6abc691b8e13cd3511413 100644 (file)
@@ -69,6 +69,8 @@ public:
     QString conjugation(ConjugationPerson person, ConjugationNumber number) const;
     void setConjugation(const QString& conjugation, ConjugationPerson person, ConjugationNumber number);
 
+    bool isEmpty();
+
 private:
     class Private;
     Private* const d;
index c8ae91bdcf44d39934ae6dbfc9a7acff99f3555f..cd10a82156c7e1974b502153fb3d98f873000d28 100644 (file)
@@ -604,8 +604,8 @@ bool KEduVocKvtmlReader::readPersonalPronouns( QDomElement &domElementParent, KE
 
     const KEduVocConjugation::ConjugationNumber numP = KEduVocConjugation::Plural;
 
-    pronouns.setPersonalPronoun( pers1_sing, KEduVocConjugation::First, numP );
-    pronouns.setPersonalPronoun( pers2_sing, KEduVocConjugation::Second, numP );
+    pronouns.setPersonalPronoun( pers1_plur, KEduVocConjugation::First, numP );
+    pronouns.setPersonalPronoun( pers2_plur, KEduVocConjugation::Second, numP );
     if ( p3_common ) {
         pronouns.setPersonalPronoun( pers3_f_plur, KEduVocConjugation::ThirdNeutralCommon, numP );
     } else  {
index 249365026182e0b009c629594cfa818f134ae9d8..04e0584e2ddefb511cd8c632b6f478c0d0b1840e 100644 (file)
@@ -411,7 +411,8 @@ bool KEduVocKvtmlWriter::writeArticle( QDomElement &domElementParent )
 
 bool KEduVocKvtmlWriter::writeType( QDomElement &domElementParent )
 {
-    /** @todo port to new type handling
+    /** @todo port to new type handling */
+    /*
       if (m_doc->typeDescriptions().count() == 0)
         return true;