From: Frederik Gladhorn Date: Sun, 6 Jan 2008 19:07:28 +0000 (+0000) Subject: allow set conjugation by int index. minor cleanup. X-Git-Tag: v4.0.71~90 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=986b7b785344437f46093dbb7970f2484d838154;p=libqmvoc.git allow set conjugation by int index. minor cleanup. svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=758023 --- diff --git a/keduvocdocument/keduvocconjugation.cpp b/keduvocdocument/keduvocconjugation.cpp index d0181f7..0c145d8 100644 --- a/keduvocdocument/keduvocconjugation.cpp +++ b/keduvocdocument/keduvocconjugation.cpp @@ -82,13 +82,19 @@ QString KEduVocConjugation::conjugation(ConjugationPerson person, ConjugationNum } void KEduVocConjugation::setConjugation(const QString & conjugation, ConjugationPerson person, ConjugationNumber number) +{ + setConjugation(conjugation, indexOf(person, number)); +} + + +void KEduVocConjugation::setConjugation(const QString & conjugation, int index) { if ( !conjugation.isEmpty() ) { - d->m_conjugations[indexOf(person, number)] = conjugation; + d->m_conjugations[index] = 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)); + if ( d->m_conjugations.contains(index) ) { + d->m_conjugations.remove(index); } } } @@ -116,3 +122,5 @@ QList< int > KEduVocConjugation::keys() return d->m_conjugations.keys(); } + + diff --git a/keduvocdocument/keduvocconjugation.h b/keduvocdocument/keduvocconjugation.h index d93c5d8..69726aa 100644 --- a/keduvocdocument/keduvocconjugation.h +++ b/keduvocdocument/keduvocconjugation.h @@ -70,6 +70,7 @@ public: QString conjugation(ConjugationPerson person, ConjugationNumber number) const; QString conjugation(int index) const; void setConjugation(const QString& conjugation, ConjugationPerson person, ConjugationNumber number); + void setConjugation(const QString& conjugation, int index); QList keys(); diff --git a/keduvocdocument/keduvockvtmlcompability.cpp b/keduvocdocument/keduvockvtmlcompability.cpp index 4f5f679..54dd549 100644 --- a/keduvocdocument/keduvockvtmlcompability.cpp +++ b/keduvocdocument/keduvockvtmlcompability.cpp @@ -198,7 +198,7 @@ QString KEduVocKvtmlCompability::tenseFromKvtml1(const QString & oldTense) // in case the document got chaged, at least make up something as tense if (!m_oldTenses.keys().contains(oldTense)) { m_oldTenses[oldTense] = oldTense; - kDebug() << "Warning, tense not found in document!"; + kDebug() << "Warning, tense " << oldTense << " not found in document!"; } m_tenses.insert(m_oldTenses.value(oldTense)); return m_oldTenses.value(oldTense); diff --git a/keduvocdocument/keduvockvtmlreader.cpp b/keduvocdocument/keduvockvtmlreader.cpp index 00fa726..ffeffc2 100644 --- a/keduvocdocument/keduvockvtmlreader.cpp +++ b/keduvocdocument/keduvockvtmlreader.cpp @@ -637,17 +637,12 @@ bool KEduVocKvtmlReader::readTense( QDomElement &domElementParent ) { QDomElement currentElement; - QDomNodeList entryList = domElementParent.elementsByTagName( KV_TENSE_DESC ); - if ( entryList.length() <= 0 ) - return false; - - for ( int i = 0; i < entryList.count(); ++i ) { - currentElement = entryList.item( i ).toElement(); - if ( currentElement.parentNode() == domElementParent ) { - m_compability.addUserdefinedTense( currentElement.text() ); - } + currentElement = domElementParent.firstChildElement( KV_TENSE_DESC ); + while ( !currentElement.isNull() ) { + kDebug() << "Reading user defined tense description: " << currentElement.text(); + m_compability.addUserdefinedTense( currentElement.text() ); + currentElement = currentElement.nextSiblingElement( KV_TENSE_DESC ); } - return true; }