From: Frederik Gladhorn Date: Fri, 14 Sep 2007 22:43:26 +0000 (+0000) Subject: When adding entries with a lesson set, add them to that lesson automatically. X-Git-Tag: v3.94.0~52 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=ff4ed7487fd81d0b869078054b609db31c9bf84f;p=libqmvoc.git When adding entries with a lesson set, add them to that lesson automatically. svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=712626 --- diff --git a/keduvocdocument/keduvocdocument.cpp b/keduvocdocument/keduvocdocument.cpp index 03ba47c..682225d 100644 --- a/keduvocdocument/keduvocdocument.cpp +++ b/keduvocdocument/keduvocdocument.cpp @@ -163,13 +163,16 @@ void KEduVocDocument::appendEntry( KEduVocExpression *expression ) 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(); } @@ -624,12 +627,12 @@ void KEduVocDocument::removeEntry( int index ) 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); - } + } } diff --git a/keduvocdocument/keduvoctranslation.cpp b/keduvocdocument/keduvoctranslation.cpp index 413b6b5..2580c0a 100644 --- a/keduvocdocument/keduvoctranslation.cpp +++ b/keduvocdocument/keduvoctranslation.cpp @@ -375,7 +375,7 @@ QString KEduVocTranslation::imageUrl() 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)