}
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);
}
}
}
return d->m_conjugations.keys();
}
+
+
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<int> keys();
// 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);
{
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;
}