From: Frederik Gladhorn Date: Tue, 6 Mar 2007 01:45:42 +0000 (+0000) Subject: Add lessonIndex to get the index from the name of the lesson. X-Git-Tag: v3.90.1~39 X-Git-Url: https://git.rmz.fi/?a=commitdiff_plain;h=ecaefa3288bac11a0706c971847fed1d3f471c46;p=libqmvoc.git Add lessonIndex to get the index from the name of the lesson. svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=639780 --- diff --git a/kdeeducore/keduvocdocument.cpp b/kdeeducore/keduvocdocument.cpp index cf94b3a..044fe0b 100644 --- a/kdeeducore/keduvocdocument.cpp +++ b/kdeeducore/keduvocdocument.cpp @@ -843,6 +843,11 @@ QString KEduVocDocument::lessonDescription(int idx) const return d->m_lessonDescriptions[idx-1]; } +int KEduVocDocument::lessonIndex(const QString description) const +{ + return d->m_lessonDescriptions.indexOf(description) +1; +} + QList KEduVocDocument::lessonsInQuery() const { diff --git a/kdeeducore/keduvocdocument.h b/kdeeducore/keduvocdocument.h index 55511ab..28c8b8c 100644 --- a/kdeeducore/keduvocdocument.h +++ b/kdeeducore/keduvocdocument.h @@ -78,7 +78,7 @@ public: void setModified(bool dirty = true); /** - * Sppends a new expression to the end of the vocabulary + * Appends a new expression to the end of the vocabulary * * @param expression expression to append */ @@ -449,6 +449,12 @@ public: */ QString lessonDescription(int index) const; + /** + * @returns the index of the lesson (from its name) + * -1 if the lesson does not exist + */ + int lessonIndex(const QString description) const; + /** * @returns a list with the lessons in the current query */