]> Git trees. - libqmvoc.git/commitdiff
fix readIdentifier so it works
authorJeremy Paul Whiting <jpwhiting@kde.org>
Wed, 25 Jul 2007 17:51:06 +0000 (17:51 +0000)
committerJeremy Paul Whiting <jpwhiting@kde.org>
Wed, 25 Jul 2007 17:51:06 +0000 (17:51 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=692494

kdeeducore/keduvocdocument.cpp
kdeeducore/keduvocdocument.h
kdeeducore/keduvockvtml2reader.cpp

index 5fa0a99c5152814b93b3d89d7cdf3020871d9285..28907115bb7ba0c49f6c003241d204504ca0a95d 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "keduvocexpression.h"
 #include "keduvockvtmlwriter.h"
+#include "keduvockvtml2writer.h"
 #include "keduvoccsvreader.h"
 #include "keduvoccsvwriter.h"
 #include "keduvockvtml2reader.h"
@@ -957,9 +958,11 @@ int KEduVocDocument::identifierCount() const
 }
 
 
-void KEduVocDocument::appendIdentifier(const QString & id)
+int KEduVocDocument::appendIdentifier(const QString & id)
 {
   d->m_identifiers.append(id);
+  kDebug() << "appending identifier" << id;
+  return d->m_identifiers.size() - 1;
 }
 
 
@@ -995,10 +998,7 @@ void KEduVocDocument::renameLesson(const int lessonIndex, const QString &lessonN
 
 bool KEduVocDocument::lessonInQuery(int lessonIndex) const
 {
-  if (d->m_lessonsInQuery.contains(lessonIndex))
-    return true;
-  else
-    return false;
+  return d->m_lessonsInQuery.contains(lessonIndex);
 }
 
 
index b48c2ee17abebba33d590826a64e498d1e59c6a8..60c3bbe786dc513f3f6dcdac5ccc33fbd082d996 100644 (file)
@@ -297,8 +297,9 @@ public:
    * Appends a new identifier (usually a language)
    *
    * @param id         the identifier to append
+   * @returns the identifier number
    */
-  void appendIdentifier(const QString & id);
+  int appendIdentifier(const QString & id);
 
   /**
    * Returns pointer to expression object @p index
index c5e2dbce8087b9fc69b89f66bd36e0b730fd6c17..193529291048174d135a83d93809fcb021c15c9a 100644 (file)
@@ -248,7 +248,12 @@ bool KEduVocKvtml2Reader::readIdentifier(QDomElement &identifierElement)
   if (!currentElement.isNull())
   {
     // TODO: do we want to use this for the identifier, or the name?
-    m_doc->setIdentifier(id, currentElement.text());
+    int index = m_doc->appendIdentifier(currentElement.text());
+    if (index != id)
+    {
+      m_errorMessage = i18n("identifiers out of order");
+      return false;
+    }
   }
   
   currentElement = identifierElement.firstChildElement(KVTML_NAME);