]> Git trees. - libqmvoc.git/commitdiff
Add lessonIndex to get the index from the name of the lesson.
authorFrederik Gladhorn <gladhorn@kde.org>
Tue, 6 Mar 2007 01:45:42 +0000 (01:45 +0000)
committerFrederik Gladhorn <gladhorn@kde.org>
Tue, 6 Mar 2007 01:45:42 +0000 (01:45 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=639780

kdeeducore/keduvocdocument.cpp
kdeeducore/keduvocdocument.h

index cf94b3a019e01128ec52b7123fa074e0a6a81d15..044fe0b562968cdf0f3ac8ec18cde672449c930e 100644 (file)
@@ -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<int> KEduVocDocument::lessonsInQuery() const
 {
index 55511abd6235491f264c58c1d398e1698cd010d2..28c8b8c641a8fea5cbb899acfbefb904c8e46449 100644 (file)
@@ -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
    */