Instead, directly use KEduVocConjugation::tenses() to get a list of tenses (that correspond to conjugations).
Cleanup.
KEduVocKvtmlCompability::oldTense() to enable writing of old tenses. Still to do: the user defined tenses are not written correctly I assume.
Rename type to tense in VerbQueryDlg.
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=707320
bool KEduVocConjugation::operator == ( const KEduVocConjugation& a ) const
{
-///@todo conjugations: rewrite operator==
-kDebug() <<"Implement KEduVocConjugation::operator==";
-// return d->m_conjugations[0].type == a.d->m_conjugations[0].type;
return d->m_conjugations == a.d->m_conjugations;
}
}
-QString KEduVocConjugation::getType( int idx )
-{
- kDebug() << "KEduVocConjugation::getType()" << idx;
- if ( idx >= d->m_conjugations.count() )
- return QString();
-
- return d->m_conjugations.keys().value(idx);
-}
-
-
-
-
bool KEduVocConjugation::pers3SingularCommon( const QString &type ) const
{
return d->m_conjugations.value(type).s3common;
int entryCount() const;
- QString getType( int index );
QStringList tenses() const;
QString pers1Singular( const QString &type ) const;
// conjugation
if ( translation.conjugation().entryCount() > 0 ) {
-kDebug() << "Writing conjugations: " << translation.text();
KEduVocConjugation conjugation = translation.conjugation();
- for ( int i = 0; i < conjugation.entryCount(); ++i ) {
+ foreach ( QString tense, conjugation.tenses() ) {
QDomElement thisElement = m_domDoc.createElement( KVTML_CONJUGATION );
- writeConjugation( thisElement, conjugation, conjugation.getType( i ) );
+ writeConjugation( thisElement, conjugation, tense );
translationElement.appendChild( thisElement );
}
}
return m_tenses.values();
}
+
+QString KEduVocKvtmlCompability::oldTense(const QString & tense)
+{
+///@todo writing of the user defined tenses is probably messed up
+ if ( !m_oldTenses.values().contains(tense) ) {
+ m_userdefinedTenseCounter++;
+ m_oldTenses[KVTML_1_USER_DEFINED + QString::number( m_userdefinedTenseCounter )] = tense;
+ }
+ return m_oldTenses.key(tense);
+}
\ No newline at end of file
void addUserdefinedTense( const QString& tense );
QString tenseFromKvtml1( const QString & oldTense );
QStringList documentTenses() const;
+ QString oldTense( const QString& tense );
private:
/**
}
QDomElement domElementConjug = domDoc.createElement( KV_CONJUG_GRP );
- QString type;
- for ( int lfn = 0; lfn < curr_conjug.entryCount(); lfn++ )
- {
+ foreach ( QString tense, curr_conjug.tenses() ) {
QDomElement domElementType = domDoc.createElement( KV_CON_TYPE );
- type = curr_conjug.getType( lfn );
- domElementType.setAttribute( KV_CON_NAME, type );
+ domElementType.setAttribute( KV_CON_NAME, m_compability.oldTense(tense) );
- if ( !writeConjug( domDoc, domElementType, curr_conjug, curr_conjug.getType( lfn ) ) )
+ if ( !writeConjug( domDoc, domElementType, curr_conjug, m_compability.oldTense(tense) ) )
return false;
domElementConjug.appendChild( domElementType );