void KEduVocDocument::insertEntry( KEduVocExpression *expression, int index )
{
d->m_vocabulary.insert( index, *expression );
-
+
// now we need to go fix the entryids that are greater than index in the lessons
for (int i = 0; i < d->m_lessons.size(); ++i)
{
d->m_lessons[i].incrementEntriesAbove(index);
}
-
+ // if the expression is added and the lesson already exists (not at doc loading time, but added later) make sure it ends up in the lesson as well.
+ if ( expression->lesson() > 0 && expression->lesson() < d->m_lessons.count() ) {
+ d->m_lessons[expression->lesson()].addEntry(index);
+ }
setModified();
}
if ( index >= 0 && index < d->m_vocabulary.size() ) {
d->m_vocabulary.removeAt( index );
}
-
+
// now we need to go fix the entryids that are greater than index in the lessons
for (int i = 0; i < d->m_lessons.size(); ++i)
{
d->m_lessons[i].decrementEntriesAbove(index);
- }
+ }
}
return d->m_imageUrl;
}
-/** set the image url for this translation
+/** set the image url for this translation
* @param url url of the image
*/
void KEduVocTranslation::setImageUrl(const QString &url)