bool result = readGroups( domElementKvtml ); // read sub-groups
+ int defaultLessonNumber = m_doc->addLesson(i18n("Default Lesson"));
+
+ // now make sure we don't have any orphan entries (lesson 0)
+ for (int i = 0; i < m_doc->entryCount(); ++i)
+ {
+ if (m_doc->entry(i)->lesson() == 0)
+ {
+ m_doc->entry(i)->setLesson(defaultLessonNumber);
+ m_doc->lesson(defaultLessonNumber).addEntry(i);
+ }
+ }
+
+ if (m_doc->lesson(defaultLessonNumber).entries().size() == 0)
+ {
+ m_doc->deleteLesson(defaultLessonNumber, KEduVocDocument::DeleteEmptyLesson);
+ }
+
return result;
}
// image
currentElement = translationElement.firstChildElement( KVTML_IMAGE );
if ( !currentElement.isNull() ) {
- // TODO: do something with the image
+ expr.translation( index ).setImageUrl( currentElement.text() );
}
// sound
currentElement = translationElement.firstChildElement( KVTML_SOUND );
if ( !currentElement.isNull() ) {
- // TODO: do something with the sound
+ expr.translation( index ).setSoundUrl( currentElement.text() );
}
return true;
QString m_antonym;
/// Pronunciation
QString m_pronunciation;
+ /// Image url
+ QString m_imageUrl;
+ /// Sound url
+ QString m_soundUrl;
/// Usages give a context (eg. this word is usually used in [biology])
QSet<QString> m_usages;
/// Conjugations of a word (I go, you go, he goes... boring in english)
d->m_multipleChoice = other.d->m_multipleChoice;
d->m_grades = other.d->m_grades;
d->m_falseFriends = other.d->m_falseFriends;
+ d->m_imageUrl = other.d->m_imageUrl;
+ d->m_soundUrl = other.d->m_soundUrl;
}
KEduVocTranslation::~KEduVocTranslation()
d->m_example == translation.d->m_example &&
d->m_antonym == translation.d->m_antonym &&
d->m_pronunciation == translation.d->m_pronunciation &&
+ d->m_imageUrl == translation.d->m_imageUrl &&
+ d->m_soundUrl == translation.d->m_soundUrl &&
d->m_comparison == translation.d->m_comparison &&
d->m_multipleChoice == translation.d->m_multipleChoice &&
d->m_falseFriends == translation.d->m_falseFriends &&
d->m_example = translation.d->m_example;
d->m_antonym = translation.d->m_antonym;
d->m_pronunciation = translation.d->m_pronunciation;
+ d->m_imageUrl = translation.d->m_imageUrl;
+ d->m_soundUrl = translation.d->m_soundUrl;
d->m_comparison = translation.d->m_comparison;
d->m_multipleChoice = translation.d->m_multipleChoice;
d->m_falseFriends = translation.d->m_falseFriends;
return d->m_irregularPlural;
}
+/** get the sound url for this translation if it exists */
+QString KEduVocTranslation::soundUrl()
+{
+ return d->m_soundUrl;
+}
+
+/** set the sound url for this translation
+ * @param url url of the sound file */
+void KEduVocTranslation::setSoundUrl(const QString &url)
+{
+ d->m_soundUrl = url;
+}
+
+/** get the image url for this translation if it exists */
+QString KEduVocTranslation::imageUrl()
+{
+ return d->m_imageUrl;
+}
+
+/** set the image url for this translation
+ * @param url url of the image
+ */
+void KEduVocTranslation::setImageUrl(const QString &url)
+{
+ d->m_imageUrl = url;
+}
*/
void setMultipleChoice( const KEduVocMultipleChoice &mc );
+ /** get the sound url for this translation if it exists */
+ QString soundUrl();
+
+ /** set the sound url for this translation
+ * @param url url of the sound file */
+ void setSoundUrl(const QString &url);
+
+ /** get the image url for this translation if it exists */
+ QString imageUrl();
+
+ /** set the image url for this translation
+ * @param url url of the image
+ */
+ void setImageUrl(const QString &url);
/**
* Equal operator to assing a translation to another one.
* @return reference to the new translation
*/
KEduVocTranslation& operator= ( const KEduVocTranslation &translation );
+
/**
* Compare two translations, including word type etc.
* @param translation