Also translation now contain pointers to their word types represented by lessons.
svn path=/branches/work/kdeedu_parley/libkdeedu/; revision=740298
else
currentRow += separator;
- currentRow += expression->translation( i ).text();
+ currentRow += expression->translation( i )->text();
}
if ( !currentRow.isEmpty() )
int cmp;
foreach( int i, exp->translationIndices() ) {
- s1 = exp->translation( i ).text();
- s2 = y.exp->translation( i ).text();
+ s1 = exp->translation( i )->text();
+ s2 = y.exp->translation( i )->text();
cmp = QString::compare( s1.toUpper(), s2.toUpper() );
if ( cmp != 0 )
return cmp < 0;
KEduVocExpressionPrivate( KEduVocExpression* qq )
: q( qq )
{
- init();
+ m_active = true;
}
-
- void init();
+ ~KEduVocExpressionPrivate();
bool operator== ( const KEduVocExpressionPrivate &p ) const;
QList<KEduVocLesson*> m_lessons;
bool m_active;
- QMap <int, KEduVocTranslation> m_translations;
+ QMap <int, KEduVocTranslation*> m_translations;
};
-void KEduVocExpression::KEduVocExpressionPrivate::init()
+KEduVocExpression::KEduVocExpressionPrivate::~ KEduVocExpressionPrivate()
{
- m_translations.clear();
- m_active = true;
+ qDeleteAll(m_translations);
}
void KEduVocExpression::removeTranslation( int index )
{
- d->m_translations.remove( index );
+ delete d->m_translations.take(index);
for ( int j = index; j < d->m_translations.count(); j++ ) {
- translation(j) = translation(j+1);
+ d->m_translations[j] = d->m_translations.value(j+1);
}
- kDebug() << "Checkme - removing last tranlation ?!!?";
- ///@todo - no idea if this works
d->m_translations.remove(d->m_translations.count() - 1);
}
return;
}
- d->m_translations[index] = expr.simplified();
+ d->m_translations[index] = new KEduVocTranslation(this, expr.simplified());
}
void KEduVocExpression::resetGrades( int index )
{
if ( index == -1 ) { // clear grades for all languages
- foreach( KEduVocTranslation trans, d->m_translations ) {
- trans.resetGrades();
+ foreach( KEduVocTranslation* trans, d->m_translations ) {
+ trans->resetGrades();
}
return;
}
// only language index
if ( d->m_translations.contains( index ) ) {
- d->m_translations[index].resetGrades();
+ d->m_translations[index]->resetGrades();
}
}
return ( *d == *expression.d );
}
-KEduVocTranslation& KEduVocExpression::translation( int index ) const
+KEduVocTranslation* KEduVocExpression::translation( int index )
{
- return d->m_translations[index];
+ if(d->m_translations.contains(index)) {
+ return d->m_translations[index];
+ }
+ d->m_translations[index] = new KEduVocTranslation(this);
}
QList< int > KEduVocExpression::translationIndices() const
d->m_lessons.removeAt(d->m_lessons.indexOf(l));
}
+
#include <QtCore/QDateTime>
+#include "keduvoclesson.h"
#include "keduvocgrammar.h"
#include "keduvocmultiplechoice.h"
#include "keduvoctranslation.h"
int sizeHint() const;
void setSizeHint( int sizeHint );
- /** returns this translation
- *
- * @return expression or "" if no translation available
- */
- QString translationString( int index ) const;
-
- void setTranslation( int index, const KEduVocTranslation & translation );
+ void setTranslation( int index, KEduVocTranslation* translation );
/**
* Add a translation to this expression
* @param index number of translation = the identifier
/**
- * Get a mutable reference to the translation
+ * Get a pointer to the translation
* @param index of the language identifier
* @return the translation
*/
- KEduVocTranslation & translation( int index ) const;
+ KEduVocTranslation* translation( int index );
QList<int> translationIndices() const;
{
QDomElement currentElement = translationElement.firstChildElement( KVTML_TEXT );
if ( !currentElement.isNull() ) {
- expr->translation( index ).setText( currentElement.text() );
+ expr->translation(index)->setText( currentElement.text() );
}
currentElement = translationElement.firstChildElement( KVTML_COMMENT );
if ( !currentElement.isNull() ) {
- expr->translation( index ).setComment( currentElement.text() );
+ expr->translation(index)->setComment( currentElement.text() );
}
currentElement = translationElement.firstChildElement( KVTML_WORDTYPE );
if ( !currentElement.isNull() ) {
QDomElement typeElement = currentElement.firstChildElement( KVTML_TYPENAME );
- expr->translation( index ).setType( typeElement.text() );
- // read subtype if the type is not empty
- typeElement = currentElement.firstChildElement( KVTML_SUBTYPENAME );
- if ( !typeElement.isNull() ) {
- expr->translation( index ).setSubType( typeElement.text() );
- }
+
+QString wordTypeString = typeElement.text();
+typeElement = currentElement.firstChildElement( KVTML_SUBTYPENAME );
+QString childWordTypeString = typeElement.text();
+
+KEduVocLesson* typeLesson = m_doc->wordTypeLesson()->childLesson(wordTypeString);
+if(!childWordTypeString.isEmpty()) {
+ typeLesson = typeLesson->childLesson(childWordTypeString);
+}
+
+
+expr->translation(index)->setWordType(typeLesson);
}
//<pronunciation></pronunciation>
currentElement = translationElement.firstChildElement( KVTML_PRONUNCIATION );
if ( !currentElement.isNull() ) {
- expr->translation( index ).setPronunciation( currentElement.text() );
+ expr->translation(index)->setPronunciation( currentElement.text() );
}
//<falsefriend fromid="1"></falsefriend>
currentElement = translationElement.firstChildElement( KVTML_FALSEFRIEND );
if ( !currentElement.isNull() ) {
int fromid = currentElement.attribute( KVTML_FROMID ).toInt();
- expr->translation( index ).setFalseFriend( fromid, currentElement.text() );
+ expr->translation(index)->setFalseFriend( fromid, currentElement.text() );
}
//<antonym></antonym>
currentElement = translationElement.firstChildElement( KVTML_ANTONYM );
if ( !currentElement.isNull() ) {
- expr->translation( index ).setAntonym( currentElement.text() );
+ expr->translation(index)->setAntonym( currentElement.text() );
}
//<synonym></synonym>
currentElement = translationElement.firstChildElement( KVTML_SYNONYM );
if ( !currentElement.isNull() ) {
- expr->translation( index ).setSynonym( currentElement.text() );
+ expr->translation(index)->setSynonym( currentElement.text() );
}
//<example></example>
currentElement = translationElement.firstChildElement( KVTML_EXAMPLE );
if ( !currentElement.isNull() ) {
- expr->translation( index ).setExample( currentElement.text() );
+ expr->translation(index)->setExample( currentElement.text() );
}
//<usage></usage> can be as often as there are usage labels
currentElement = translationElement.firstChildElement( KVTML_USAGE );
while ( !currentElement.isNull() ) {
- expr->translation( index ).usages().insert( currentElement.text() );
+ expr->translation(index)->usages().insert( currentElement.text() );
currentElement = currentElement.nextSiblingElement( KVTML_USAGE );
}
//<paraphrase></paraphrase>
currentElement = translationElement.firstChildElement( KVTML_PARAPHRASE );
if ( !currentElement.isNull() ) {
- expr->translation( index ).setParaphrase( currentElement.text() );
+ expr->translation(index)->setParaphrase( currentElement.text() );
}
// conjugations
QDomElement tenseElement = currentElement.firstChildElement( KVTML_TENSE );
QString tense = tenseElement.text();
- readConjugation( currentElement, expr->translation(index).conjugation(tense) );
+ readConjugation( currentElement, expr->translation(index)->conjugation(tense) );
currentElement = currentElement.nextSiblingElement( KVTML_CONJUGATION );
}
if ( !currentElement.isNull() ) {
KEduVocComparison comparison;
readComparison( currentElement, comparison );
- expr->translation( index ).setComparison( comparison );
+ expr->translation(index)->setComparison( comparison );
}
// multiple choice
currentElement = translationElement.firstChildElement( KVTML_MULTIPLECHOICE );
if ( !currentElement.isNull() ) {
- readMultipleChoice( currentElement, expr->translation( index ) );
+ readMultipleChoice( currentElement, expr->translation(index) );
}
// image
currentElement = translationElement.firstChildElement( KVTML_IMAGE );
if ( !currentElement.isNull() ) {
- expr->translation( index ).setImageUrl( KUrl( m_doc->url(), currentElement.text() ) );
+ expr->translation(index)->setImageUrl( KUrl( m_doc->url(), currentElement.text() ) );
}
// sound
currentElement = translationElement.firstChildElement( KVTML_SOUND );
if ( !currentElement.isNull() ) {
- expr->translation( index ).setSoundUrl( KUrl( m_doc->url(), currentElement.text() ) );
+ expr->translation(index)->setSoundUrl( KUrl( m_doc->url(), currentElement.text() ) );
}
return true;
}
-bool KEduVocKvtml2Reader::readMultipleChoice( QDomElement &multipleChoiceElement, KEduVocTranslation &translation )
+bool KEduVocKvtml2Reader::readMultipleChoice( QDomElement &multipleChoiceElement, KEduVocTranslation* translation )
/*
<multiplechoice>
<choice>good</choice>
{
currentElement = choiceNodes.item( i ).toElement();
if ( currentElement.parentNode() == multipleChoiceElement ) {
- translation.multipleChoice().append( currentElement.text() );
+ translation->multipleChoice().append( currentElement.text() );
}
}
return true;
QDomElement currentElement = gradeElement.firstChildElement( KVTML_CURRENTGRADE );
if ( !currentElement.isNull() ) {
int value = currentElement.text().toInt();
- expr->translation( index ).gradeFrom( id ).setGrade( value );
+ expr->translation(index)->gradeFrom( id ).setGrade( value );
}
currentElement = gradeElement.firstChildElement( KVTML_COUNT );
if ( !currentElement.isNull() ) {
int value = currentElement.text().toInt();
- expr->translation( index ).gradeFrom( id ).setPracticeCount( value );
+ expr->translation(index)->gradeFrom( id ).setPracticeCount( value );
}
currentElement = gradeElement.firstChildElement( KVTML_ERRORCOUNT );
if ( !currentElement.isNull() ) {
int value = currentElement.text().toInt();
- expr->translation( index ).gradeFrom( id ).setBadCount( value );
+ expr->translation(index)->gradeFrom( id ).setBadCount( value );
}
currentElement = gradeElement.firstChildElement( KVTML_DATE );
QString dateString = currentElement.text();
if ( !dateString.isEmpty() ) {
QDateTime value = QDateTime::fromString( dateString, Qt::ISODate );
- expr->translation( index ).gradeFrom( id ).setPracticeDate( value );
+ expr->translation(index)->gradeFrom( id ).setPracticeDate( value );
}
}
* @param multipleChoiceElement element to read from
* @param mc KEduVocMultipleChoice object to read to
*/
- bool readMultipleChoice( QDomElement &multipleChoiceElement, KEduVocTranslation &translation );
+ bool readMultipleChoice( QDomElement &multipleChoiceElement, KEduVocTranslation* translation );
/** read a grade
* @param gradeElement element to read from
// write inactive
entryElement.appendChild( newTextElement( KVTML_INACTIVE, thisEntry->isActive() ? KVTML_FALSE : KVTML_TRUE ) );
-// kvtml 1 relic no longer used
-// // write inquery
-// entryElement.appendChild( newTextElement( KVTML_INQUERY, thisEntry->isInQuery() ? KVTML_TRUE : KVTML_FALSE ) );
-
// loop through translations
foreach( int trans, thisEntry->translationIndices() ) {
// write translations
return true;
}
-bool KEduVocKvtml2Writer::writeTranslation( QDomElement &translationElement, KEduVocTranslation &translation )
+bool KEduVocKvtml2Writer::writeTranslation( QDomElement &translationElement, KEduVocTranslation* translation )
{
// <text>Kniebeugen</text>
- translationElement.appendChild( newTextElement( KVTML_TEXT, translation.text() ) );
+ translationElement.appendChild( newTextElement( KVTML_TEXT, translation->text() ) );
// <wordtype></wordtype>
- if ( !translation.type().isEmpty() ) {
+ if ( translation->wordType() ) {
QDomElement wordTypeElement = m_domDoc.createElement( KVTML_WORDTYPE );
translationElement.appendChild( wordTypeElement );
//<typename>noun</typename>
- wordTypeElement.appendChild( newTextElement( KVTML_TYPENAME, translation.type() ) );
- // <subwordtype>male</subwordtype>
- if ( !translation.subType().isEmpty() ) {
- wordTypeElement.appendChild( newTextElement( KVTML_SUBTYPENAME, translation.subType() ) );
+
+ if(translation->wordType()->parent() == m_doc->wordTypeLesson()) {
+ wordTypeElement.appendChild( newTextElement( KVTML_TYPENAME, translation->wordType()->name() ) );
+ } else {
+ if(translation->wordType()->parent()->parent() == m_doc->wordTypeLesson()) {
+ wordTypeElement.appendChild( newTextElement( KVTML_TYPENAME, translation->wordType()->parent()->name() ) );
+ // <subwordtype>male</subwordtype>
+ wordTypeElement.appendChild( newTextElement( KVTML_SUBTYPENAME, translation->wordType()->name() ) );
+ }
}
}
// <comment></comment>
- if ( !translation.comment().isEmpty() ) {
- translationElement.appendChild( newTextElement( KVTML_COMMENT, translation.comment() ) );
+ if ( !translation->comment().isEmpty() ) {
+ translationElement.appendChild( newTextElement( KVTML_COMMENT, translation->comment() ) );
}
// <pronunciation></pronunciation>
- if ( !translation.pronunciation().isEmpty() ) {
- translationElement.appendChild( newTextElement( KVTML_PRONUNCIATION, translation.pronunciation() ) );
+ if ( !translation->pronunciation().isEmpty() ) {
+ translationElement.appendChild( newTextElement( KVTML_PRONUNCIATION, translation->pronunciation() ) );
}
// <falsefriend fromid="0"></falsefriend>
// loop through the identifiers
for ( int i = 0; i < m_doc->identifierCount(); ++i ) {
// see if this identifier has a falsefriend in this translation
- QString thisFriend = translation.falseFriend( i );
+ QString thisFriend = translation->falseFriend( i );
if ( !thisFriend.isEmpty() ) {
// if so, create it, and set the fromid to i
QDomElement thisFriendElement = newTextElement( KVTML_FALSEFRIEND, thisFriend );
}
// <antonym></antonym>
- if ( !translation.antonym().isEmpty() ) {
- translationElement.appendChild( newTextElement( KVTML_ANTONYM, translation.antonym() ) );
+ if ( !translation->antonym().isEmpty() ) {
+ translationElement.appendChild( newTextElement( KVTML_ANTONYM, translation->antonym() ) );
}
// <synonym></synonym>
- if ( !translation.synonym().isEmpty() ) {
- translationElement.appendChild( newTextElement( KVTML_SYNONYM, translation.synonym() ) );
+ if ( !translation->synonym().isEmpty() ) {
+ translationElement.appendChild( newTextElement( KVTML_SYNONYM, translation->synonym() ) );
}
// <example></example>
- if ( !translation.example().isEmpty() ) {
- translationElement.appendChild( newTextElement( KVTML_EXAMPLE, translation.example() ) );
+ if ( !translation->example().isEmpty() ) {
+ translationElement.appendChild( newTextElement( KVTML_EXAMPLE, translation->example() ) );
}
// <usage></usage>
- foreach( QString usage, translation.usages() ) {
+ foreach( QString usage, translation->usages() ) {
translationElement.appendChild( newTextElement( KVTML_USAGE, usage ) );
}
// <paraphrase></paraphrase>
- if ( !translation.paraphrase().isEmpty() ) {
- translationElement.appendChild( newTextElement( KVTML_PARAPHRASE, translation.paraphrase() ) );
+ if ( !translation->paraphrase().isEmpty() ) {
+ translationElement.appendChild( newTextElement( KVTML_PARAPHRASE, translation->paraphrase() ) );
}
// grades
for ( int i = 0; i < m_doc->identifierCount(); ++i ) {
- KEduVocGrade thisGrade = translation.gradeFrom( i );
+ KEduVocGrade thisGrade = translation->gradeFrom( i );
if ( thisGrade.practiceCount() > 0 ) {
QDomElement gradeElement = m_domDoc.createElement( KVTML_GRADE );
gradeElement.setAttribute( KVTML_FROMID, QString::number( i ) );
}
// conjugation
- foreach ( QString tense, translation.conjugationTenses() ) {
+ foreach ( QString tense, translation->conjugationTenses() ) {
QDomElement thisElement = m_domDoc.createElement( KVTML_CONJUGATION );
- writeConjugation( thisElement, translation.conjugation(tense), tense );
+ writeConjugation( thisElement, translation->conjugation(tense), tense );
translationElement.appendChild( thisElement );
}
// comparison
- if ( !translation.comparison().isEmpty() ) {
+ if ( !translation->comparison().isEmpty() ) {
QDomElement comparisonElement = m_domDoc.createElement( KVTML_COMPARISON );
- writeComparison( comparisonElement, translation.comparison() );
+ writeComparison( comparisonElement, translation->comparison() );
translationElement.appendChild( comparisonElement );
}
// multiplechoice
- if ( !translation.multipleChoice().isEmpty() ) {
+ if ( !translation->multipleChoice().isEmpty() ) {
QDomElement multipleChoiceElement = m_domDoc.createElement( KVTML_MULTIPLECHOICE );
writeMultipleChoice( multipleChoiceElement, translation );
translationElement.appendChild( multipleChoiceElement );
}
// image
- if ( !translation.imageUrl().isEmpty() ) {
+ if ( !translation->imageUrl().isEmpty() ) {
QString urlString;
- if ( translation.imageUrl().url().startsWith(m_doc->url().upUrl().url()) ) {
+ if ( translation->imageUrl().url().startsWith(m_doc->url().upUrl().url()) ) {
// try to save as relative url
- urlString = KUrl::relativeUrl( m_doc->url() , translation.imageUrl() );
+ urlString = KUrl::relativeUrl( m_doc->url() , translation->imageUrl() );
} else {
- urlString = translation.imageUrl().url();
+ urlString = translation->imageUrl().url();
}
translationElement.appendChild( newTextElement( KVTML_IMAGE, urlString ) );
}
// sound
- if ( !translation.soundUrl().isEmpty() ) {
+ if ( !translation->soundUrl().isEmpty() ) {
QString urlString;
- if ( translation.soundUrl().url().startsWith(m_doc->url().upUrl().url()) ) {
+ if ( translation->soundUrl().url().startsWith(m_doc->url().upUrl().url()) ) {
// try to save as relative url
- urlString = KUrl::relativeUrl( m_doc->url() , translation.soundUrl() );
+ urlString = KUrl::relativeUrl( m_doc->url() , translation->soundUrl() );
} else {
- urlString = translation.soundUrl().url();
+ urlString = translation->soundUrl().url();
}
translationElement.appendChild( newTextElement( KVTML_SOUND, urlString ) );
}
}
-bool KEduVocKvtml2Writer::writeMultipleChoice( QDomElement &multipleChoiceElement, KEduVocTranslation &translation )
+bool KEduVocKvtml2Writer::writeMultipleChoice( QDomElement &multipleChoiceElement, KEduVocTranslation* translation )
/*
<multiplechoice>
<choice>good</choice>
</multiplechoice>
*/
{
- foreach ( QString choice, translation.multipleChoice() ) {
+ foreach ( QString choice, translation->multipleChoice() ) {
multipleChoiceElement.appendChild( newTextElement( KVTML_CHOICE, choice ) );
}
return true;
* @param translationElement QDomElement translation to write to, with id pre-set
* @param translation object to write
*/
- bool writeTranslation( QDomElement &translationElement, KEduVocTranslation &translation );
+ bool writeTranslation( QDomElement &translationElement, KEduVocTranslation* translation );
/** write the lesson group
* @param parentLesson the parent lesson of the current lesson
* @param multipleChoiceElement QDomElement multiplechoice to write to
* @returns success
*/
- bool writeMultipleChoice( QDomElement &multipleChoiceElement, KEduVocTranslation &translation );
+ bool writeMultipleChoice( QDomElement &multipleChoiceElement, KEduVocTranslation* translation );
private:
QDomElement newTextElement( const QString &elementName, const QString &text );
return d->m_parentLesson;
}
+KEduVocLesson * KEduVocLesson::childLesson(const QString & name)
+{
+ for(int i = 0; i<d->m_childLessons.count(); i++){
+ if(d->m_childLessons.value(i)->name() == name) {
+ return d->m_childLessons.value(i);
+ }
+ }
+ return 0;
+}
+
QList<KEduVocLesson *> childLessons();
KEduVocLesson *childLesson(int row);
+ KEduVocLesson *childLesson(const QString& name);
int childLessonCount() const;
int row() const;
#include <KDebug>
#include "keduvocgrade.h"
-// #include "keduvocdeclination.h"
+#include "keduvocdeclination.h"
#include "keduvoclesson.h"
class KEduVocTranslation::KEduVocTranslationPrivate
{
public:
+ KEduVocTranslationPrivate(KEduVocExpression* parent);
+
+ KEduVocExpression* m_entry;
+
/// This is the word itself. The vocabulary. This is what it is all about.
QString m_translation;
- /// Type of a word noun, verb, adjective etc
- QString m_type;
- /// Subtype of a word: male/female or regular/irregular...
- QString m_subType;
-
/// Type of a word noun, verb, adjective etc
KEduVocLesson* m_wordType;
-
/// A comment giving additional information.
QString m_comment;
/// A hint, to make guessing the word easier.
/// The comparison forms of adjectives and adverbs: fast, faster, fastest
KEduVocComparison m_comparison;
-// KEduVocDeclination* m_declination;
+ KEduVocDeclination* m_declination;
// Here come all int indexFrom grades. (If you want, imagine the TO grades as int indexFrom of the other translation. That is where they belong. )
// User is asked to give THIS here as answer, than the grades go here.
};
-KEduVocTranslation::KEduVocTranslation() : d( new KEduVocTranslationPrivate )
+KEduVocTranslation::KEduVocTranslationPrivate::KEduVocTranslationPrivate(KEduVocExpression* parent)
+{
+ m_entry = parent;
+ m_wordType = 0;
+ m_declination = 0;
+}
+
+KEduVocTranslation::KEduVocTranslation(KEduVocExpression* entry) : d( new KEduVocTranslationPrivate(entry) )
{}
-KEduVocTranslation::KEduVocTranslation( const QString &translation ) : d( new KEduVocTranslationPrivate )
+KEduVocTranslation::KEduVocTranslation(KEduVocExpression* entry, const QString &translation ) : d( new KEduVocTranslationPrivate(entry) )
{
d->m_translation = translation.simplified();
}
-KEduVocTranslation::KEduVocTranslation( const KEduVocTranslation &other ) : d( new KEduVocTranslationPrivate )
+KEduVocTranslation::KEduVocTranslation( const KEduVocTranslation &other ) : d( new KEduVocTranslationPrivate(other.d->m_entry) )
{
+// d->m_entry = other.d->m_entry;
d->m_translation = other.d->m_translation;
- d->m_type = other.d->m_type;
- d->m_subType = other.d->m_subType;
+ d->m_wordType = other.d->m_wordType;
d->m_usages = other.d->m_usages;
d->m_comment = other.d->m_comment;
d->m_paraphrase = other.d->m_paraphrase;
bool KEduVocTranslation::operator == ( const KEduVocTranslation & translation ) const
{
- return d->m_translation == translation.d->m_translation &&
- d->m_type == translation.d->m_type &&
- d->m_subType == translation.d->m_subType &&
+ return d->m_entry == translation.d->m_entry &&
+ d->m_translation == translation.d->m_translation &&
+ d->m_wordType == translation.d->m_wordType &&
d->m_usages == translation.d->m_usages &&
d->m_comment == translation.d->m_comment &&
d->m_paraphrase == translation.d->m_paraphrase &&
KEduVocTranslation & KEduVocTranslation::operator = ( const KEduVocTranslation & translation )
{
+ d->m_entry = translation.d->m_entry;
d->m_translation = translation.d->m_translation;
- d->m_type = translation.d->m_type;
- d->m_subType = translation.d->m_subType;
+ d->m_wordType = translation.d->m_wordType;
d->m_usages = translation.d->m_usages;
d->m_comment = translation.d->m_comment;
d->m_paraphrase = translation.d->m_paraphrase;
d->m_pronunciation = expr.simplified();
}
-
-QString KEduVocTranslation::type() const
-{
- return d->m_type;
-}
-
-
-void KEduVocTranslation::setType( const QString &type )
-{
- d->m_type = type;
-}
-
-QString KEduVocTranslation::subType() const
-{
- return d->m_subType;
-}
-
-
-void KEduVocTranslation::setSubType( const QString &type )
-{
- d->m_subType = type;
-}
-
void KEduVocTranslation::resetGrades()
{
d->m_grades.clear();
{
d->m_imageUrl = url;
}
+
+KEduVocLesson * KEduVocTranslation::wordType() const
+{
+ return d->m_wordType;
+}
+
+void KEduVocTranslation::setWordType(KEduVocLesson * wordType)
+{
+ if ( d->m_wordType ) {
+ d->m_wordType->removeEntry(d->m_entry);
+ }
+
+}
+
#include <KDE/KUrl>
#include <QtCore/QString>
-
+class KEduVocExpression;
class KEduVocGrade;
+class KEduVocLesson;
/**
@author Frederik Gladhorn <frederik.gladhorn@kdemail.net>
/**
* Default constructor for an empty translation.
*/
- KEduVocTranslation();
+ KEduVocTranslation(KEduVocExpression* entry);
/**
* Constructor
* @param translation is used as translation
*/
- KEduVocTranslation( const QString &translation );
+ KEduVocTranslation(KEduVocExpression* entry, const QString &translation );
/** copy constructor for d-pointer safet */
KEduVocTranslation( const KEduVocTranslation &other );
*/
QString irregularPlural() const;
- /** returns type of this expression
+ /** returns the word type of this expression
*
* @return type or "" if no type available
*/
- QString type() const;
+ KEduVocLesson* wordType() const;
- /** sets type of this expression
+ /** sets the word type of this expression
* @param type type of this expression ("" = none)
*/
- void setType( const QString &type );
+ void setWordType( KEduVocLesson* wordType );
- /** returns subtype of this expression
- *
- * @return type or "" if no type available
- */
- QString subType() const;
-
- /** sets subtype of this expression
- * @param type type of this expression ("" = none)
- */
- void setSubType( const QString &type );
/** reset the grades for this translation */
void resetGrades();
QString specialTypeAdverb() const;
private:
-
-
QString mainTypeName( int index ) const;
int mainTypeIndex( const QString& name ) const;
int subTypeIndex( const QString& mainTypeName, const QString& subTypeName ) const;