return d->m_declensions.isEmpty();
}
-void KEduVocDeclension::toXML(QDomElement & parent)
+void KEduVocDeclension::toKVTML2(QDomElement & parent)
{
if (isEmpty()) {
return;
QDomElement numberElement = domDoc.createElement( KVTML_GRAMMATICAL_NUMBER[num] );
for ( KEduVocDeclension::DeclensionCase dcase = KEduVocDeclension::Nominative; dcase < KEduVocDeclension::DeclensionCaseMAX; dcase = KEduVocDeclension::DeclensionCase(dcase +1) ) {
QDomElement caseElement = domDoc.createElement( KVTML_DECLENSION_CASE[dcase] );
- declension(num, dcase).toXML(caseElement);
+ declension(num, dcase).toKVTML2(caseElement);
if (caseElement.hasChildNodes()) {
numberElement.appendChild(caseElement);
bool isEmpty();
- void toXML(QDomElement& parent);
+ void fromKVTML2(QDomElement& parent);
+ void toKVTML2(QDomElement& parent);
static int indexOf(DeclensionNumber number, DeclensionCase decCase);
bool KEduVocKvtml2Reader::readTranslation( QDomElement &translationElement,
KEduVocExpression *expr, int index )
{
- QDomElement currentElement = translationElement.firstChildElement( KVTML_TEXT );
- if ( !currentElement.isNull() ) {
- expr->translation(index)->setText( currentElement.text() );
- }
+ expr->translation(index)->fromKVTML2(translationElement);
- currentElement = translationElement.firstChildElement( KVTML_COMMENT );
+ QDomElement currentElement = translationElement.firstChildElement( KVTML_COMMENT );
if ( !currentElement.isNull() ) {
expr->translation(index)->setComment( currentElement.text() );
}
bool KEduVocKvtml2Writer::writeTranslation( QDomElement &translationElement, KEduVocTranslation* translation )
{
// so far only for KEduVocWord - text and grades
- translation->toXML(translationElement);
+ translation->toKVTML2(translationElement);
///@todo move into translation->toXML()
d->m_practiceDate == other.d->m_practiceDate;
}
-void KEduVocText::toXML(QDomElement& parent)
+void KEduVocText::toKVTML2(QDomElement& parent)
{
QDomDocument domDoc = parent.ownerDocument();
if (text().isEmpty()) {
parent.appendChild( gradeElement );
}
}
+
+void KEduVocText::fromKVTML2(QDomElement & parent)
+{
+ setText( parent.firstChildElement( KVTML_TEXT ).text() );
+}
*/
void setPracticeDate( const QDateTime & date );
- void toXML(QDomElement& parent);
+ void fromKVTML2(QDomElement& parent);
+ void toKVTML2(QDomElement& parent);
private:
class KEduVocTextPrivate;
}
KEduVocTranslation::KEduVocTranslation( const KEduVocTranslation &other )
- : d( new KEduVocTranslationPrivate(other.d->m_entry) ),
- KEduVocText(other)
+ : KEduVocText(other),
+ d( new KEduVocTranslationPrivate(other.d->m_entry) )
{
d->m_wordType = other.d->m_wordType;
d->m_comment = other.d->m_comment;
d->m_declension = declension;
}
-void KEduVocTranslation::toXML(QDomElement & parent)
+void KEduVocTranslation::toKVTML2(QDomElement & parent)
{
kDebug() << "Write translation xml.";
- KEduVocText::toXML(parent);
+ KEduVocText::toKVTML2(parent);
if (d->m_declension) {
- d->m_declension->toXML(parent);
+ d->m_declension->toKVTML2(parent);
}
}
*/
bool operator== ( const KEduVocTranslation &translation ) const;
- void toXML(QDomElement& parent);
+// void fromKVTML2(QDomElement& parent);
+ void toKVTML2(QDomElement& parent);
private:
class KEduVocTranslationPrivate;