]> Git trees. - libqmvoc.git/commitdiff
document class, readers use new lesson class
authorJeremy Paul Whiting <jpwhiting@kde.org>
Sun, 19 Aug 2007 12:53:07 +0000 (12:53 +0000)
committerJeremy Paul Whiting <jpwhiting@kde.org>
Sun, 19 Aug 2007 12:53:07 +0000 (12:53 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=701814

keduvocdocument/keduvoccsvwriter.cpp
keduvocdocument/keduvocdocument.cpp
keduvocdocument/keduvocdocument.h
keduvocdocument/keduvockvtml2reader.cpp
keduvocdocument/keduvockvtml2writer.cpp
keduvocdocument/keduvockvtmlreader.cpp
keduvocdocument/keduvockvtmlwriter.cpp
keduvocdocument/keduvocvokabelnreader.cpp
keduvocdocument/keduvocxdxfreader.cpp

index 4e0deac7d58be0ad453fae24c92097d5e17c06fa..ccfff0c446ed27993cc335dcdac0c8419b5a5ef5 100644 (file)
@@ -44,8 +44,8 @@ bool KEduVocCsvWriter::writeDoc(KEduVocDocument *doc, const QString &generator)
   outputStream.setDevice(m_outputFile);
   outputStream.setCodec("UTF-8");
 
-  outputStream << i18n("! Title:")  << separator << m_doc->title() << "\n";
-  outputStream << i18n("! Author:") << separator << m_doc->author() << "\n";
+  outputStream << i18nc("@item:intable the title of the document will be written here", "! Title:")  << separator << m_doc->title() << "\n";
+  outputStream << i18nc("@item:intable the author will be written here", "! Author:") << separator << m_doc->author() << "\n";
 
   KEduVocExpression *expression;
   int idCount = m_doc->identifierCount();
index 19683b881f7bf83470a698976f4f035bd956cfe3..8443ee5713e770af37d795273b306e8a82ec689e 100644 (file)
@@ -30,6 +30,7 @@
 #include <kfilterdev.h>
 
 #include "keduvocexpression.h"
+#include "keduvoclesson.h"
 #include "keduvockvtmlwriter.h"
 #include "keduvockvtml2writer.h"
 #include "keduvoccsvreader.h"
@@ -72,7 +73,7 @@ public:
   QString                   m_querytrans;
   QList<KEduVocExpression>  m_vocabulary;
   QList<int>                m_lessonsInQuery;
-  QStringList               m_lessonDescriptions;
+  //QStringList               m_lessonDescriptions;
   QStringList               m_typeDescriptions;
   QStringList               m_tenseDescriptions;
   QStringList               m_usageDescriptions;
@@ -85,6 +86,9 @@ public:
 
   QList<KEduVocArticle>     m_articles;
   QList<KEduVocConjugation> m_conjugations;
+  
+  // make this a map so removals don't require renumbering :)
+  QMap<int, KEduVocLesson*>            m_lessons;
 
   LeitnerSystem*            m_leitnerSystem;
   bool                      m_activeLeitnerSystem;
@@ -93,7 +97,7 @@ public:
 
 void KEduVocDocument::KEduVocDocumentPrivate::init()
 {
-  m_lessonDescriptions.clear();
+  m_lessons.clear();
   m_articles.clear();
   m_typeDescriptions.clear();
   m_tenseDescriptions.clear();
@@ -956,43 +960,67 @@ int KEduVocDocument::identifierCount() const
   return d->m_identifiers.count();  // number of translations
 }
 
-
 int KEduVocDocument::appendIdentifier(const QString & id)
 {
   d->m_identifiers.append(id);
   return d->m_identifiers.size() - 1;
 }
 
+//QString KEduVocDocument::lessonDescription(int idx) const
+//{
+//  if (idx == 0)
+//    return i18nc("@label:listbox","<placeholder>no lesson</placeholder>");
 
-QString KEduVocDocument::lessonDescription(int idx) const
-{
-  if (idx == 0)
-    return i18n("<no lesson>");
+//  if (idx <= 0 || idx > d->m_lessons.size() )
+//    return "";
 
-  if (idx <= 0 || idx > d->m_lessonDescriptions.size() )
-    return "";
+//  return d->m_lessons[idx-1].description();
+//}
 
-  return d->m_lessonDescriptions[idx-1];
-}
+//int KEduVocDocument::lessonIndex(const QString &description) const
+//{
+//  return d->m_lessonDescriptions.indexOf(description) +1;
+//}
 
-int KEduVocDocument::lessonIndex(const QString &description) const
+
+int KEduVocDocument::addLesson(const QString &lessonName, int position)
 {
-  return d->m_lessonDescriptions.indexOf(description) +1;
+  if (position == -1)
+  {
+    // no position was specified, so put it wherever there's a slot
+    position = 1;
+    while (d->m_lessons.contains(position))
+    {
+      ++position;
+    }
+  }
+  
+  KEduVocLesson *lesson = new KEduVocLesson;
+  lesson->setDescription(lessonName);
+  d->m_lessons.insert(position, lesson);
+  return position;
 }
 
-
-int KEduVocDocument::appendLesson(const QString &lessonName)
+const QMap<int, KEduVocLesson *> &KEduVocDocument::lessons() const
 {
-  d->m_lessonDescriptions.append(lessonName);
-  return d->m_lessonDescriptions.count(); // counting from 1
+  return d->m_lessons;
 }
 
-
-void KEduVocDocument::renameLesson(const int lessonIndex, const QString &lessonName)
+KEduVocLesson * KEduVocDocument::lesson(int index)
 {
-  d->m_lessonDescriptions.replace(lessonIndex-1, lessonName); // counting from 1
+  KEduVocLesson * retval(NULL);
+  if (d->m_lessons.contains(index))
+  {
+     retval = d->m_lessons[index];
+  }
+  return retval;
 }
 
+//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
 {
@@ -1140,13 +1168,19 @@ void KEduVocDocument::setCurrentLesson(int lesson)
 
 QStringList KEduVocDocument::lessonDescriptions() const
 {
-  return d->m_lessonDescriptions;
+  QStringList descriptions;
+  QList<KEduVocLesson*> lessonObjects = lessons().values();
+  for (int i = 0; i < lessonObjects.count(); ++i)
+  {
+    descriptions.append(lessonObjects[i]->description());
+  }
+  return descriptions;
 }
 
 
 int KEduVocDocument::lessonCount() const
 {
-  return d->m_lessonDescriptions.count();
+  return d->m_lessons.count();
 }
 
 bool KEduVocDocument::deleteLesson(int lessonIndex, int deleteMode)
@@ -1170,7 +1204,7 @@ bool KEduVocDocument::deleteLesson(int lessonIndex, int deleteMode)
   } // reduce lesson
 
   // finally just remove the lesson name
-  d->m_lessonDescriptions.removeAt(lessonIndex-1); // because of the damned 0 arghh
+  //d->m_lessonDescriptions.removeAt(lessonIndex-1); // because of the damned 0 arghh
 
   int currentInQuery = d->m_lessonsInQuery.indexOf(lessonIndex);
   if(currentInQuery != -1)
@@ -1186,43 +1220,43 @@ bool KEduVocDocument::deleteLesson(int lessonIndex, int deleteMode)
 }
 
 
-void KEduVocDocument::setLessonDescriptions(const QStringList &names)
-{
-  d->m_lessonDescriptions = names;
-}
-
-void KEduVocDocument::moveLesson(int from, int to)
-{
-///@todo move in query as well!
-  // still counting from 1
-  d->m_lessonDescriptions.move(from -1, to -1);
-
-  /*
-  to > from?
-    lesson >= from && lesson < to: lesson++
-  to < from?
-    lesson >= to && lesson < from: lesson++
-  */
-  for (int ent = 0; ent < entryCount(); ent++) {
-    // put from directly to to
-    if (entry(ent)->lesson() == from) {
-      entry(ent)->setLesson(to);
-    }
-    else
-    {
-      if(to > from)
-      {
-        if(entry(ent)->lesson() >= from && entry(ent)->lesson() < to)
-          entry(ent)->setLesson(entry(ent)->lesson()-1);
-      }
-      else
-      {
-        if(entry(ent)->lesson() >= to && entry(ent)->lesson() < from)
-          entry(ent)->setLesson(entry(ent)->lesson()+1);
-      }
-    }
-  }
-}
+//void KEduVocDocument::setLessonDescriptions(const QStringList &names)
+//{
+//  d->m_lessonDescriptions = names;
+//}
+
+//void KEduVocDocument::moveLesson(int from, int to)
+//{
+/////@todo move in query as well!
+//  // still counting from 1
+//  d->m_lessonDescriptions.move(from -1, to -1);
+
+//  /*
+//  to > from?
+//    lesson >= from && lesson < to: lesson++
+//  to < from?
+//    lesson >= to && lesson < from: lesson++
+//  */
+//  for (int ent = 0; ent < entryCount(); ent++) {
+//    // put from directly to to
+//    if (entry(ent)->lesson() == from) {
+//      entry(ent)->setLesson(to);
+//    }
+//    else
+//    {
+//      if(to > from)
+//      {
+//        if(entry(ent)->lesson() >= from && entry(ent)->lesson() < to)
+//          entry(ent)->setLesson(entry(ent)->lesson()-1);
+//      }
+//      else
+//      {
+//        if(entry(ent)->lesson() >= to && entry(ent)->lesson() < from)
+//          entry(ent)->setLesson(entry(ent)->lesson()+1);
+//      }
+//    }
+//  }
+//}
 
 int KEduVocDocument::search(const QString &substr, int id, int first, int last, bool word_start)
 {
index b162326dda25b221cffaf881addb5be168e93fea..6658cea5e9632c50dbdf1af84cbc5c8d7ec173b9 100644 (file)
@@ -38,6 +38,7 @@
 
 class QStringList;
 class KEduVocExpression;
+class KEduVocLesson;
 class LeitnerSystem;
 
 /**
@@ -429,34 +430,20 @@ public:
    */
   void setCurrentLesson(int lesson);
 
-  /**
-   * Get the real name of a lesson from it's index as QString.
-   * @param index lesson index
-   * @returns the description (Name) of the lesson with index @p index .
-   */
-  QString lessonDescription(int index) const;
-
-  /**
-   * Get the index from the long name of a lesson.
-   * @param description lesson name
-   * @returns the index of the lesson (from its name)
-   * -1 if the lesson does not exist
+  /** get a lesson object
+   * @returns a pointer to the lesson object at the specified index or NULL if there isn't one
    */
-  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
+  KEduVocLesson *lesson(int index);
+  
+  /** get all lesson objects
+   * @returns a map of pointers to lesson objects
    */
-  int appendLesson(const QString &lessonName);
+  const QMap<int, KEduVocLesson *> &lessons() const;
 
   /**
-   * Rename a lesson.
-   * @param lessonIndex index of lesson
-   * @param lessonName new name for the lesson
+   * @returns                the number of lessons defined
    */
-  void renameLesson(const int lessonIndex, const QString &lessonName);
+  int lessonCount() const;
 
   /**
    * Get list of ALL lessons that are selected for query.
@@ -489,15 +476,12 @@ public:
   void removeLessonFromQuery(int lessonIndex);
 
   /**
-   * All lesson descriptions as stringlist.
-   * @returns                a list of defined lessons
-   */
-  QStringList lessonDescriptions() const;
-
-  /**
-   * @returns                the number of lessons defined
+   * Append a new lesson to the list of lessons.
+   * @param lessonName name for the new lesson
+   * @param position lesson number to use (-1 to find the next hole to put it in)
+   * @returns the index of the new lesson
    */
-  int lessonCount() const;
+  int addLesson(const QString &lessonName, int position = -1);
 
   /**
    * Delete a lesson.
@@ -507,18 +491,46 @@ public:
    */
   bool deleteLesson(int lessonIndex, int deleteMode);
 
+  ///**
+  // * Get the real name of a lesson from it's index as QString.
+  // * @param index lesson index
+  // * @returns the description (Name) of the lesson with index @p index .
+  // */
+  //QString lessonDescription(int index) const;
+
+  /**
+   * Get the index from the long name of a lesson.
+   * @param description lesson name
+   * @returns the index of the lesson (from its name)
+   * -1 if the lesson does not exist
+   */
+  //int lessonIndex(const QString &description) const;
+
+  /**
+   * Rename a lesson.
+   * @param lessonIndex index of lesson
+   * @param lessonName new name for the lesson
+   */
+  //void renameLesson(const int lessonIndex, const QString &lessonName);
+
+  /**
+   * All lesson descriptions as stringlist.
+   * @returns a list of defined lessons
+   */
+  QStringList lessonDescriptions() const;
+
   /**
    * Sets the description of the lesson
    * @param names list of all names of the lessons
    */
-  void setLessonDescriptions(const QStringList &names);
+  //void setLessonDescriptions(const QStringList &names);
 
   /**
    * Moves the lesson at index position from to index position to.
    * @param from the lesson to be moved
    * @param to the new position
    */
-  void moveLesson(int from, int to);
+  //void moveLesson(int from, int to);
 
   // *** conjugation methods ***
 
index bfea5630603eb10f83567d939c11aabedf51c6d1..90dd72dfbe32f51f2d2d8c20c654352334bb0ca1 100644 (file)
@@ -25,6 +25,7 @@
 #include <klocale.h>
 
 #include "keduvocdocument.h"
+#include "keduvoclesson.h"
 #include "kvtml2defs.h"
 #include "kvtmldefs.h"
 #include "keduvockvtmlreader.h"
@@ -354,6 +355,7 @@ bool KEduVocKvtml2Reader::readEntry(QDomElement &entryElement)
   }
   
   // TODO: probably should insert at id position with a check to see if it exists
+  // may be useful for detecting corrupt documents
   m_doc->insertEntry(&expr, id);
   return result;
 }
@@ -498,7 +500,7 @@ bool KEduVocKvtml2Reader::readLesson(QDomElement &lessonElement)
   QDomElement currentElement = lessonElement.firstChildElement(KVTML_NAME);
   if (!currentElement.isNull())
   {
-    lessonId = m_doc->appendLesson(currentElement.text());
+    lessonId = m_doc->addLesson(currentElement.text());
   }
   else
   {
@@ -534,6 +536,7 @@ bool KEduVocKvtml2Reader::readLesson(QDomElement &lessonElement)
     // TODO: once we have a lesson class, add each of these entryids to the lesson
     // set this lesson for the given enty
     m_doc->entry(entryId)->setLesson(lessonId);
+    m_doc->lesson(lessonId)->addEntry(entryId);
     currentElement = currentElement.nextSiblingElement(KVTML_ENTRYID);
   }
   
index 668326aaf412cc29a1e6d17d2a365f3b23f7960b..2342da15ecec3ce7afd69662978390026749f2ce 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "keduvocdocument.h"
 #include "keduvocexpression.h"
+#include "keduvoclesson.h"
 #include "kvtmldefs.h"
 #include "kvtml2defs.h"
 
@@ -402,36 +403,37 @@ bool KEduVocKvtml2Writer::writeIdentifiers(QDomElement &identifiersElement)
 
 bool KEduVocKvtml2Writer::writeLessons(QDomElement &lessonsElement)
 {
-  if (m_doc->lessonDescriptions().count() == 0)
+  if (m_doc->lessonCount() == 0)
     return true;
 
-  int count = 1; // this starts at 1 because appendLesson returns the count of the lessondescriptions
-  // instead of the index the lesson was appended at (size() - 1)
-  foreach(QString lesson, m_doc->lessonDescriptions())
+  QMap<int, KEduVocLesson*> lessons = m_doc->lessons();
+  
+  foreach(int lessonid, lessons.keys())
   {
+    KEduVocLesson * thisLesson = lessons[lessonid];
+
     // make lesson element
-    QDomElement thisLesson = m_domDoc.createElement(KVTML_LESSON);
-    
+    QDomElement thisLessonElement = m_domDoc.createElement(KVTML_LESSON);
+
     // add a name
-    thisLesson.appendChild(newTextElement(KVTML_NAME, lesson));
+    thisLessonElement.appendChild(newTextElement(KVTML_NAME, thisLesson->description()));
     
     // add a inquery tag
-    thisLesson.appendChild(newTextElement(KVTML_QUERY, m_doc->lessonInQuery(count) ? KVTML_TRUE : KVTML_FALSE));
+    thisLessonElement.appendChild(newTextElement(KVTML_QUERY, m_doc->lessonInQuery(lessonid) ? KVTML_TRUE : KVTML_FALSE));
     
     // add a current tag
-    thisLesson.appendChild(newTextElement(KVTML_CURRENT, m_doc->currentLesson() == count ? KVTML_TRUE : KVTML_FALSE));
+    thisLessonElement.appendChild(newTextElement(KVTML_CURRENT, m_doc->currentLesson() == lessonid ? KVTML_TRUE : KVTML_FALSE));
     
     // TODO: add the entryids...
     for (int i = 0; i < m_doc->entryCount(); ++i)
     {
-      if (m_doc->entry(i)->lesson() == count)
+      if (m_doc->entry(i)->lesson() == lessonid)
       {
-        thisLesson.appendChild(newTextElement(KVTML_ENTRYID, QString::number(i)));
+        thisLessonElement.appendChild(newTextElement(KVTML_ENTRYID, QString::number(i)));
       }
     }
     
-    lessonsElement.appendChild(thisLesson);
-    ++count;
+    lessonsElement.appendChild(thisLessonElement);
   }
 
   return true;
index d3a67cd47d0110eb1d34cf47dd03bcc443d5d4dd..1651907604575e540c41fafe43d0040678b374b7 100644 (file)
@@ -26,6 +26,7 @@
 #include <klocale.h>
 
 #include "keduvocdocument.h"
+#include "keduvoclesson.h"
 #include "kvtmldefs.h"
 
 KEduVocKvtmlReader::KEduVocKvtmlReader(QIODevice *file)
@@ -192,7 +193,6 @@ bool KEduVocKvtmlReader::readBody(QDomElement &domElementParent)
 bool KEduVocKvtmlReader::readLesson(QDomElement &domElementParent)
 {
   QString s;
-  QStringList descriptions;
   QDomAttr attribute;
   QDomElement currentElement;
 
@@ -212,9 +212,7 @@ bool KEduVocKvtmlReader::readLesson(QDomElement &domElementParent)
   if (entryList.length() <= 0)
     return false;
 
-  descriptions.clear();
   QList<int> inQueryList;
-  inQueryList.clear();
 
   for (int i = 0; i < entryList.count(); ++i) {
     currentElement = entryList.item(i).toElement();
@@ -241,13 +239,12 @@ bool KEduVocKvtmlReader::readLesson(QDomElement &domElementParent)
       s = currentElement.text();
       if (s.isNull())
         s = "";
-      descriptions.append(s);
+      m_doc->addLesson(s, no);
     }
   }
 
   if (inQueryList.count() > 0)
     m_doc->setLessonsInQuery(inQueryList);
-  m_doc->setLessonDescriptions(descriptions);
 
   return true;
 }
@@ -1054,22 +1051,17 @@ bool KEduVocKvtmlReader::readExpression(QDomElement &domElementParent)
 
   attribute = domElementParent.attributeNode(KV_LESS_MEMBER);
   if (!attribute.isNull())
+  {
     lesson = attribute.value().toInt();
+  }
 
-  if (lesson && lesson > m_doc->lessonDescriptions().count())
+  if (lesson && lesson > m_doc->lessonCount())
   {
-    // description missing ?
-    QString s;
-    QStringList sl = m_doc->lessonDescriptions();
-    for (int i = m_doc->lessonDescriptions().count(); i < lesson; i++)
-    {
-      s.setNum(i + 1);
-      s.prepend("#"); //create descriptions from number
-      sl.append(s);
-    }
-    m_doc->setLessonDescriptions(sl);
+    // it's from a lesson that hasn't been added yet
+    // so make sure this lesson is in the document
+    m_doc->addLesson(QString("#") + QString::number(lesson), lesson);
   }
-
+  
   attribute = domElementParent.attributeNode(KV_SELECTED);
   if (!attribute.isNull())
     inquery = attribute.value() == "1" ? true : false;
@@ -1270,7 +1262,6 @@ bool KEduVocKvtmlReader::readExpression(QDomElement &domElementParent)
         expr.translation(i).gradeFrom(0).setQueryDate(qdate);
         expr.translation(0).gradeFrom(i).setQueryDate(r_qdate);
       }
-//kDebug() << "KEduVocKvtmlReader::readExpression(): id: " << i << " translation: " << textstr;
 
       // Next translation
       currentElement = currentElement.nextSiblingElement(KV_TRANS);
@@ -1281,6 +1272,9 @@ bool KEduVocKvtmlReader::readExpression(QDomElement &domElementParent)
     m_doc->setQueryIdentifier(q_org, q_trans);
   m_doc->appendEntry(&expr);
 
+  // also add this entryid to the lesson it's part of
+  m_doc->lesson(lesson)->addEntry(m_doc->entryCount());
+  
   return true;
 }
 
index 7b751b78531301553de64d7eeb3d32fa47bbc4c7..461937793e2162ef8e6b59dfaa1f8722d96cb7dc 100644 (file)
@@ -24,6 +24,7 @@
 #include <kdebug.h>
 
 #include "keduvocdocument.h"
+#include "keduvoclesson.h"
 #include "keduvocexpression.h"
 #include "kvtmldefs.h"
 
@@ -101,7 +102,7 @@ bool KEduVocKvtmlWriter::writeDoc(KEduVocDocument *doc, const QString &generator
     if (entry->lesson() != 0)
     {
       int lm = entry->lesson();
-      if (lm > m_doc->lessonDescriptions().count())
+      if (lm > m_doc->lessonCount())
       {
         // should not be
         kError() << "index of lesson member too high: " << lm << endl;
@@ -301,30 +302,28 @@ bool KEduVocKvtmlWriter::writeDoc(KEduVocDocument *doc, const QString &generator
 
 bool KEduVocKvtmlWriter::writeLesson(QDomDocument &domDoc, QDomElement &domElementParent)
 {
-  if (m_doc->lessonDescriptions().count() == 0)
+  if (m_doc->lessonCount() == 0)
     return true;
 
   QDomElement domElementLesson = domDoc.createElement(KV_LESS_GRP);
   domElementLesson.setAttribute(KV_SIZEHINT, m_doc->sizeHint(-1));
-  int count = 1;
 
-  foreach(QString lesson, m_doc->lessonDescriptions())
+  const QMap<int, KEduVocLesson*> lessons = m_doc->lessons();
+  QList<int> keys = lessons.keys();
+  for (int i = 0; i < keys.size(); ++i)
   {
-    if (!lesson.isNull())
-    {
-      QDomElement domElementDesc = domDoc.createElement(KV_LESS_DESC);
-      QDomText domTextDesc = domDoc.createTextNode(lesson);
-
-      domElementDesc.setAttribute(KV_LESS_NO, count);
-      if (m_doc->currentLesson() == count)
-        domElementDesc.setAttribute(KV_LESS_CURR, 1);
-      if (m_doc->lessonInQuery(count))
-        domElementDesc.setAttribute(KV_LESS_QUERY, 1);
-
-      domElementDesc.appendChild(domTextDesc);
-      domElementLesson.appendChild(domElementDesc);
-      count++;
-    }
+    int thiskey = keys[i];
+    QDomElement domElementDesc = domDoc.createElement(KV_LESS_DESC);
+    QDomText domTextDesc = domDoc.createTextNode(lessons[thiskey]->description());
+
+    domElementDesc.setAttribute(KV_LESS_NO, thiskey);
+    if (m_doc->currentLesson() == thiskey)
+      domElementDesc.setAttribute(KV_LESS_CURR, 1);
+    if (m_doc->lessonInQuery(thiskey))
+      domElementDesc.setAttribute(KV_LESS_QUERY, 1);
+
+    domElementDesc.appendChild(domTextDesc);
+    domElementLesson.appendChild(domElementDesc);
   }
 
   domElementParent.appendChild(domElementLesson);
index df169f8eddeb66fb33f763a803fafb36ccba8f16..12a9c1f3f987d4dcb1864d3d8082e2daf1becf49 100644 (file)
@@ -67,8 +67,7 @@ bool KEduVocVokabelnReader::readDoc(KEduVocDocument *doc)
 
   QStringList titles,
               languages,
-              words,
-              lessonDescriptions;
+              words;
 
   bool keepGoing = true;
 
@@ -142,14 +141,11 @@ bool KEduVocVokabelnReader::readDoc(KEduVocDocument *doc)
     lessonDescr = inputStream.readLine();
     lessonDescr = lessonDescr.mid(1, lessonDescr.length() - 2);
     if (!lessonDescr.isEmpty())
-      lessonDescriptions.append(lessonDescr);
+      m_doc->addLesson(lessonDescr);
     else
       break;
     inputStream.readLine();
   }
 
-  if (lessonDescriptions.count() > 0)
-    m_doc->setLessonDescriptions(lessonDescriptions);
-
   return true;
 }
index 5e69f3083460a5f108b35571d06356cd8c03247f..9829a38fa8315eeca5934e269ecce75959ef0464 100644 (file)
@@ -69,13 +69,13 @@ void KEduVocXdxfReader::readXdxf()
     if(!id1.isNull())
         m_doc->appendIdentifier(id1.toString().toLower());
     else
-        m_doc->appendIdentifier(i18n("Original"));
+        m_doc->appendIdentifier(i18nc("@title:column the original language column", "Original"));
 
     QStringRef id2 = attributes().value("lang_to");
     if(!id2.isNull())
         m_doc->appendIdentifier(id2.toString().toLower());
     else
-        m_doc->appendIdentifier(i18n("Translation"));
+        m_doc->appendIdentifier(i18nc("@title:column one of the translation columns", "Translation"));
 
     while (!atEnd()) {
         readNext();