return d->m_lessonDescriptions[idx-1];
}
-int KEduVocDocument::lessonIndex(const QString description) const
+int KEduVocDocument::lessonIndex(const QString &description) const
{
return d->m_lessonDescriptions.indexOf(description) +1;
}
+int KEduVocDocument::appendLesson(const QString &lessonName)
+{
+ d->m_lessonDescriptions.append(lessonName);
+ return d->m_lessonDescriptions.count(); // counting from 1
+}
+
+
+void KEduVocDocument::renameLesson(const int lessonIndex, const QString &lessonName)
+{
+ d->m_lessonDescriptions.replace(lessonIndex-1, lessonName); // counting from 1
+}
+
+
bool KEduVocDocument::lessonInQuery(int lessonIndex) const
{
if (d->m_lessonsInQuery.contains(lessonIndex))
* @returns the index of the lesson (from its name)
* -1 if the lesson does not exist
*/
- int lessonIndex(const QString description) const;
+ int lessonIndex(const QString &description) const;
+
+
+ /**
+ * Append a new lesson to the list of lessons.
+ * @param lessonName name for the new lesson
+ * @returns the index of the new lesson
+ */
+ int appendLesson(const QString &lessonName);
+
+
+ /**
+ * Rename a lesson.
+ * @param lessonIndex index of lesson
+ * @param lessonName new name for the lesson
+ */
+ void renameLesson(const int lessonIndex, const QString &lessonName);
+
/**
* Get list of ALL lessons that are selected for query.
void removeLessonFromQuery(int lessonIndex);
-
/**
+ * All lesson descriptions as stringlist.
* @returns a list of defined lessons
*/
QStringList lessonDescriptions() const;