]> Git trees. - libqmvoc.git/commitdiff
Improvements to the WordQuiz import filter. Now activated also for KVocTrain.
authorPeter Hedlund <peter@peterandlinda.com>
Tue, 20 Feb 2007 02:04:37 +0000 (02:04 +0000)
committerPeter Hedlund <peter@peterandlinda.com>
Tue, 20 Feb 2007 02:04:37 +0000 (02:04 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=635451

kdeeducore/CMakeLists.txt
kdeeducore/keduvocdocument.cpp
kdeeducore/keduvocdocument.h
kdeeducore/keduvocwqlreader.cpp
kdeeducore/keduvocwqlreader.h
kdeeducore/keduvocwqlwriter.cpp
kdeeducore/keduvowqlreader.cpp [deleted file]
kdeeducore/keduvowqlreader.h [deleted file]
kdeeducore/keduvowqlwriter.cpp [deleted file]
kdeeducore/keduvowqlwriter.h [deleted file]

index 99467dd5907bbb65f4732b845c9e0a4c3bab426b..55cc383a572f5ea8622bb40a3a8e914ce2af13ee 100644 (file)
@@ -8,8 +8,8 @@ set(kdeeducore_LIB_SRCS
    keduvockvtmlreader.cpp
    keduvockvtmlwriter.cpp
    keduvocmultiplechoice.cpp
-   keduvowqlreader.cpp
-   keduvowqlwriter.cpp
+   keduvocwqlreader.cpp
+   keduvocwqlwriter.cpp
    leitnerbox.cpp
    leitnersystem.cpp
    leitnersystemview.cpp
@@ -39,8 +39,8 @@ install(FILES
    keduvockvtmlreader.h
    keduvockvtmlwriter.h
    keduvocmultiplechoice.h
-   keduvowqlreader.h
-   keduvowqlwriter.h
+   keduvocwqlreader.h
+   keduvocwqlwriter.h
    leitnerbox.h
    leitnersystem.h
    leitnersystemview.h
index 7720964401903d60dcea7ba960df53e106338d4a..eaf32733b14514bc60a39c9534b1f4d98352293a 100644 (file)
@@ -119,6 +119,50 @@ void KEduVocDocument::Init ()
 }
 
 
+KEduVocDocument::FileType KEduVocDocument::detectFileType(const QString &fileName)
+{
+  QFile f(fileName);
+  if (!f.open(QIODevice::ReadOnly))
+    return csv;
+
+  QDataStream is(&f);
+
+  qint8 c1, c2, c3, c4, c5;
+  is >> c1
+    >> c2
+    >> c3
+    >> c4
+    >> c5;  // guess filetype by first x bytes
+
+  QTextStream ts(&f);
+  QString line;
+  line = ts.readLine();
+  line.prepend(c5);
+  line.prepend(c4);
+  line.prepend(c3);
+  line.prepend(c2);
+  line.prepend(c1);
+
+  if (!is.device()->isOpen())
+    return kvd_none;
+
+  f.close();
+  if (c1 == '<' && c2 == '?' && c3 == 'x' && c4 == 'm' && c5 == 'l')
+    return kvtml;
+
+  if (line == WQL_IDENT)
+    return wql;
+
+  if (line.indexOf(VCB_SEPARATOR) >= 0)
+    return vt_vcb;
+
+  if (line == LEX_IDENT_50)
+    return vt_lex;
+
+  return csv;
+}
+
+
 bool KEduVocDocument::open(const KUrl& url, bool /*append*/)
 {
   Init();
@@ -127,13 +171,14 @@ bool KEduVocDocument::open(const KUrl& url, bool /*append*/)
 
   // TODO EPT  connect( this, SIGNAL(progressChanged(KEduVocDocument*,int)), parent, SLOT(slotProgress(KEduVocDocument*,int)) );
 
-  QString tmpfile;
-  if (KIO::NetAccess::download( url, tmpfile, 0 ))
+  QString errorMessage = i18n("<qt>Cannot open file<br><b>%1</b></qt>", url.path());
+  QString temporaryFile;
+  if (KIO::NetAccess::download(url, temporaryFile, 0))
   {
-    QFile f(tmpfile);
+    QFile f(temporaryFile);
     if (!f.open(QIODevice::ReadOnly))
     {
-      KMessageBox::error(0, i18n("<qt>Cannot open file<br><b>%1</b></qt>", url.path()));
+      KMessageBox::error(0, errorMessage);
       return false;
     }
 
@@ -141,8 +186,7 @@ bool KEduVocDocument::open(const KUrl& url, bool /*append*/)
 
     bool read = false;
     while (!read) {
-
-      QApplication::setOverrideCursor( Qt::WaitCursor );
+      QApplication::setOverrideCursor(Qt::WaitCursor);
       switch (ft) {
         case kvtml:
         {
@@ -155,6 +199,8 @@ bool KEduVocDocument::open(const KUrl& url, bool /*append*/)
         {
           KEduVocWqlReader wqlReader(&f);
           read = wqlReader.readDoc(this);
+          if (!read)
+            errorMessage = wqlReader.errorMessage();
         }
         break;
 
@@ -193,20 +239,16 @@ bool KEduVocDocument::open(const KUrl& url, bool /*append*/)
           Init();
           return false;
         }
-        // TODO new readers provide an explicite error message
-        // the two messages should be merged
-        QString msg = i18n("Could not load \"%1\"\nDo you want to try again?", url.path());
-        int result = KMessageBox::warningContinueCancel(0, msg,
-                                                        i18n("I/O Failure"),
-                                                        KGuiItem(i18n("&Retry")));
-        if ( result == KMessageBox::Cancel ) {
+        QString msg = i18n("Could not open \"%1\"\nDo you want to try again?\n(Error reported: %2)", url.path(), errorMessage);
+        int result = KMessageBox::warningContinueCancel(0, msg, i18n("Error Opening File"), KGuiItem(i18n("&Retry")));
+        if (result == KMessageBox::Cancel) {
           Init();
           return false;
         }
       }
     }
     f.close();
-    KIO::NetAccess::removeTempFile( tmpfile );
+    KIO::NetAccess::removeTempFile(temporaryFile);
   }
   return true;
 }
@@ -795,49 +837,6 @@ int KEduVocDocument::search(const QString &substr, int id, int first, int last,
 }
 
 
-KEduVocDocument::FileType KEduVocDocument::detectFileType(const QString &filename)
-{
-   QFile f( filename );
-   if (!f.open( QIODevice::ReadOnly ))
-     return csv;
-
-   QDataStream is( &f );
-
-   qint8 c1, c2, c3, c4, c5;
-   is >> c1
-      >> c2
-      >> c3
-      >> c4
-      >> c5;  // guess filetype by first x bytes
-
-   QTextStream ts (&f);
-   QString line;
-   line = ts.readLine();
-   line.insert (0, c5);
-   line.insert (0, c4);
-   line.insert (0, c3);
-   line.insert (0, c2);
-   line.insert (0, c1);
-   f.close();
-
-   if (!is.device()->isOpen())
-     return kvd_none;
-   if (c1 == '<' && c2 == '?' && c3 == 'x' && c4 == 'm' && c5 == 'l')
-     return kvtml;
-
-   if (line == WQL_IDENT)
-     return wql;
-
-   if (line.indexOf(VCB_SEPARATOR) >= 0)
-     return vt_vcb;
-
-   if (line == LEX_IDENT_50)
-     return vt_lex;
-
-   return csv;
-}
-
-
 class ExpRef {
 
 public:
index cffbb103dd6b1126bfb979d47c38231f8385d251..15c3240729d3e51aa293bf325cba1e8d938bc996 100644 (file)
@@ -734,7 +734,7 @@ class KDEEDUCORE_EXPORT KEduVocDocument : public QObject
 
   void errorCsv(int line, const QString &text );
 
-  FileType detectFileType(const QString &filename);
+  FileType detectFileType(const QString &fileName);
 
 signals:
   void progressChanged (KEduVocDocument *, int curr_percent);
index 57be9ece7eee8d938a325b4d807706cebe7845bb..4f7d971b5b4e21ad2b9d72634d0ca831d76215b0 100644 (file)
@@ -1,9 +1,9 @@
 /***************************************************************************
                      read a KEduVocDocument from a WQL file
     -----------------------------------------------------------------------
-    copyright            : (C) 2004 Peter Hedlund
-                           (C) 2005 Eric Pignet
-    email                : peter.hedlund@kdemail.net
+    copyright     : (C) 2004, 2007 Peter Hedlund <peter.hedlund@kdemail.net>
+                    (C) 2005 Eric Pignet
+
  ***************************************************************************/
 
 /***************************************************************************
  *                                                                         *
  ***************************************************************************/
 
-#include <QDom>
 #include <QTextStream>
 
-#include <kapplication.h>
-#include <kdebug.h>
 #include <klocale.h>
-#include <kmessagebox.h>
 
 #include "keduvocwqlreader.h"
 #include "keduvocdocument.h"
@@ -30,24 +26,24 @@ KEduVocWqlReader::KEduVocWqlReader(QFile *file)
 {
   // the file must be already open
   m_inputFile = file;
+  m_errorMessage = "";
 }
 
-KEduVocWqlReader::~KEduVocWqlReader()
-{
-}
 
 bool KEduVocWqlReader::readDoc(KEduVocDocument *doc)
 {
   m_doc = doc;
 
   QTextStream inputStream(m_inputFile);
-  inputStream.setEncoding(QTextStream::Latin1);
+  inputStream.setCodec("ISO-8851-1");
+  inputStream.setAutoDetectUnicode(false);
+  inputStream.seek(0);
 
   QString s = "";
   s=inputStream.readLine();
   if (s != "WordQuiz")
   {
-    KMessageBox::error(0, i18n("This does not appear to be a (K)WordQuiz file") + s);
+    m_errorMessage = i18n("This does not appear to be a (K)WordQuiz file");
     return false;
   }
   s = inputStream.readLine();
@@ -55,24 +51,27 @@ bool KEduVocWqlReader::readDoc(KEduVocDocument *doc)
   int iFV = s.toInt(0);
   if (iFV != 5)
   {
-    KMessageBox::error(0, i18n("KWordQuiz can only open files created by WordQuiz 5.x"));
+    m_errorMessage = i18n("Only files created by WordQuiz 5.x or later can be opened");
     return false;
   }
-  // TODO these loops cause crashes if the input file is invalid !
-  while (inputStream.readLine() != "[Font Info]");
+
+  m_errorMessage = i18n("Error while reading file");
+
+  while (!inputStream.atEnd() && inputStream.readLine() != "[Font Info]");
+  if (inputStream.atEnd())
+    return false;
   s = inputStream.readLine();
-  int p = s.find("=", 0);
+  int p = s.indexOf("=", 0);
   QString fam = s.right(s.length() - (p + 1));
   fam = fam.mid(1, fam.length() - 2);
-  //g->font().setFamily(s);
 
   s = inputStream.readLine();
-  p = s.find("=", 0);
+  p = s.indexOf("=", 0);
   s = s.right(s.length() - (p + 1));
   int ps = s.toInt(0);
 
   s = inputStream.readLine();
-  p = s.find("=", 0);
+  p = s.indexOf("=", 0);
   s = s.right(s.length() - (p + 1));
   int b = 0;
   if (s == "1")
@@ -81,7 +80,7 @@ bool KEduVocWqlReader::readDoc(KEduVocDocument *doc)
   }
 
   s = inputStream.readLine();
-  p = s.find("=", 0);
+  p = s.indexOf("=", 0);
   s = s.right(s.length() - (p + 1));
   bool it = (s == "1");
 
@@ -93,16 +92,18 @@ bool KEduVocWqlReader::readDoc(KEduVocDocument *doc)
   p = s.find("=", 0);
   m_specialCharacters = s.right(s.length() - (p + 1));
 */
-  while (inputStream.readLine() != "[Grid Info]");
+  while (!inputStream.atEnd() && inputStream.readLine() != "[Grid Info]");
+  if (inputStream.atEnd())
+    return false;
   inputStream.readLine(); //skip value for width of row headers
 
   s = inputStream.readLine();
-  p = s.find("=", 0);
+  p = s.indexOf("=", 0);
   s = s.right(s.length() - (p + 1));
   m_doc->setSizeHint(0, s.toInt());
 
   s = inputStream.readLine();
-  p = s.find("=", 0);
+  p = s.indexOf("=", 0);
   s = s.right(s.length() - (p + 1));
   m_doc->setSizeHint(1, s.toInt());
 
@@ -132,23 +133,24 @@ bool KEduVocWqlReader::readDoc(KEduVocDocument *doc)
   s = s.right(s.length() - (p + 1));
   m_bottomRight =s.toInt(0, 10) - 1 ;
 */
-  while ((inputStream.readLine() != "[Vocabulary]"));
-
+  while (!inputStream.atEnd() && inputStream.readLine() != "[Vocabulary]");
+  if (inputStream.atEnd())
+    return false;
   s = inputStream.readLine();
-  p = s.find("   [", 0);
+  p = s.indexOf("   [", 0);
   s = s.left(p);
-  s = s.trimmed();
-  m_doc->m_identifiers.push_back(s);
-  m_doc->m_identifiers.push_back(inputStream.readLine());
+  s = s.simplified();
+  m_doc->m_identifiers.append(s);
+  m_doc->m_identifiers.append(inputStream.readLine());
 
   while (!s.isNull())
   {
     s = inputStream.readLine();
-    p = s.find("[", 0);
+    p = s.indexOf("[", 0);
     QString r = s.mid(p + 1, 10);
     int h = r.toInt();
     s = s.left(p);
-    s = s.trimmed();
+    s = s.simplified();
 
     QString b;
     b = inputStream.readLine();
index e1592aaa2a91fab21c0b5f36f179e26342ebaff2..a7a47cdd80dc2f4cf3c887bfe93b57eae38506f6 100644 (file)
@@ -1,9 +1,9 @@
 /***************************************************************************
                      read a KEduVocDocument from a WQL file
     -----------------------------------------------------------------------
-    copyright            : (C) 2004 Peter Hedlund
-                         : (c) 2005 Eric Pignet
-    email                : peter.hedlund@kdemail.net
+    copyright     : (C) 2004, 2007 Peter Hedlund <peter.hedlund@kdemail.net>
+                  : (c) 2005 Eric Pignet
+
  ***************************************************************************/
 
 /***************************************************************************
 
 #include <QFile>
 
-#include "keduvocdocument.h"
-
 class KEduVocDocument;
 
 class KDEEDUCORE_EXPORT KEduVocWqlReader : public QObject
 {
 public:
-       KEduVocWqlReader(QFile *file);
-       ~KEduVocWqlReader();
+  KEduVocWqlReader(QFile *file);
 
-       bool readDoc(KEduVocDocument *doc);
+  bool readDoc(KEduVocDocument *doc);
 
+  QString errorMessage() const {return m_errorMessage;};
 private:
   QFile *m_inputFile;
   KEduVocDocument *m_doc;
+  QString m_errorMessage;
 };
 
 #endif
index 545bbcd4c1402b0d9bf4490dbfbbc1d1ab273020..d7188bb297870fa4d01c4f8129a0a5c9f18dbf89 100644 (file)
@@ -15,7 +15,7 @@
  *                                                                         *
  ***************************************************************************/
 
-#include <QDom>
+#include <QtXml>
 #include <QTextStream>
 #include <QFont>
 
@@ -41,7 +41,7 @@ bool KEduVocWqlWriter::writeDoc(KEduVocDocument *doc)
   m_doc = doc;
 
   m_outputStream.setDevice(m_outputFile);
-  m_outputStream.setEncoding(QTextStream::Latin1);
+  m_outputStream.setCodec("ISO-8851-1");
 
   m_outputStream << "WordQuiz" << winendl;
   m_outputStream << "5.9.0" << winendl << winendl;
diff --git a/kdeeducore/keduvowqlreader.cpp b/kdeeducore/keduvowqlreader.cpp
deleted file mode 100644 (file)
index 51a0bf7..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-/***************************************************************************
-                     read a KEduVocDocument from a WQL file
-    -----------------------------------------------------------------------
-    copyright            : (C) 2004 Peter Hedlund
-                           (C) 2005 Eric Pignet
-    email                : peter.hedlund@kdemail.net
- ***************************************************************************/
-
-/***************************************************************************
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#include <QtXml>
-#include <QTextStream>
-
-#include <kapplication.h>
-#include <kdebug.h>
-#include <klocale.h>
-#include <kmessagebox.h>
-
-#include "keduvocwqlreader.h"
-#include "keduvocdocument.h"
-
-KEduVocWqlReader::KEduVocWqlReader(QFile *file)
-{
-  // the file must be already open
-  m_inputFile = file;
-}
-
-KEduVocWqlReader::~KEduVocWqlReader()
-{
-}
-
-bool KEduVocWqlReader::readDoc(KEduVocDocument *doc)
-{
-  m_doc = doc;
-
-  QTextStream inputStream(m_inputFile);
-  inputStream.setCodec("ISO-8851-1");
-  inputStream.setAutoDetectUnicode(false);
-
-  QString s = "";
-  s=inputStream.readLine();
-  if (s != "WordQuiz")
-  {
-    KMessageBox::error(0, i18n("This does not appear to be a (K)WordQuiz file") + s);
-    return false;
-  }
-  s = inputStream.readLine();
-  s = s.left(1);
-  int iFV = s.toInt(0);
-  if (iFV != 5)
-  {
-    KMessageBox::error(0, i18n("KWordQuiz can only open files created by WordQuiz 5.x"));
-    return false;
-  }
-  // TODO these loops cause crashes if the input file is invalid !
-  while (inputStream.readLine() != "[Font Info]");
-  s = inputStream.readLine();
-  int p = s.indexOf("=", 0);
-  QString fam = s.right(s.length() - (p + 1));
-  fam = fam.mid(1, fam.length() - 2);
-  //g->font().setFamily(s);
-
-  s = inputStream.readLine();
-  p = s.indexOf("=", 0);
-  s = s.right(s.length() - (p + 1));
-  int ps = s.toInt(0);
-
-  s = inputStream.readLine();
-  p = s.indexOf("=", 0);
-  s = s.right(s.length() - (p + 1));
-  int b = 0;
-  if (s == "1")
-  {
-    b = QFont::Bold;
-  }
-
-  s = inputStream.readLine();
-  p = s.indexOf("=", 0);
-  s = s.right(s.length() - (p + 1));
-  bool it = (s == "1");
-
-  m_doc->setFont(new QFont(fam, ps, b, it));
-
-/* TODO
-  while (inputStream.readLine() != "[Character Info]");
-  s = inputStream.readLine();
-  p = s.find("=", 0);
-  m_specialCharacters = s.right(s.length() - (p + 1));
-*/
-  while (inputStream.readLine() != "[Grid Info]");
-  inputStream.readLine(); //skip value for width of row headers
-
-  s = inputStream.readLine();
-  p = s.indexOf("=", 0);
-  s = s.right(s.length() - (p + 1));
-  m_doc->setSizeHint(0, s.toInt());
-
-  s = inputStream.readLine();
-  p = s.indexOf("=", 0);
-  s = s.right(s.length() - (p + 1));
-  m_doc->setSizeHint(1, s.toInt());
-
-/* TODO
-  s = inputStream.readLine();
-  p = s.find("=", 0);
-  s = s.right(s.length() - (p + 1));
-  m_numRows = (s.toInt() - 1); //We need to reduce by one since the header is not included
-  // Selection
-  s = inputStream.readLine();
-  p = s.find("=", 0);
-  s = s.right(s.length() - (p + 1));
-  m_topLeft =s.toInt(0, 10) - 1;
-
-  s = inputStream.readLine();
-  p = s.find("=", 0);
-  s = s.right(s.length() - (p + 1));
-  m_topRight =s.toInt(0, 10) - 1;
-
-  s = inputStream.readLine();
-  p = s.find("=", 0);
-  s = s.right(s.length() - (p + 1));
-  m_bottomLeft =s.toInt(0, 10) - 1;
-
-  s = inputStream.readLine();
-  p = s.find("=", 0);
-  s = s.right(s.length() - (p + 1));
-  m_bottomRight =s.toInt(0, 10) - 1 ;
-*/
-  while ((inputStream.readLine() != "[Vocabulary]"));
-
-  s = inputStream.readLine();
-  p = s.indexOf("   [", 0);
-  s = s.left(p);
-  s = s.simplified();
-  m_doc->m_identifiers.push_back(s);
-  m_doc->m_identifiers.push_back(inputStream.readLine());
-
-  while (!s.isNull())
-  {
-    s = inputStream.readLine();
-    p = s.indexOf("[", 0);
-    QString r = s.mid(p + 1, 10);
-    int h = r.toInt();
-    s = s.left(p);
-    s = s.simplified();
-
-    QString b;
-    b = inputStream.readLine();
-
-    KEduVocExpression expr = KEduVocExpression(s);
-    expr.setTranslation(1, b);
-    m_doc->appendEntry(&expr);
-  }
-  return true;
-}
diff --git a/kdeeducore/keduvowqlreader.h b/kdeeducore/keduvowqlreader.h
deleted file mode 100644 (file)
index f7ad04b..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/***************************************************************************
-                     read a KEduVocDocument from a WQL file
-    -----------------------------------------------------------------------
-    copyright            : (C) 2004 Peter Hedlund
-                         : (c) 2005 Eric Pignet
-    email                : peter.hedlund@kdemail.net
- ***************************************************************************/
-
-/***************************************************************************
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#ifndef KEDUVOCWQLREADER_H
-#define KEDUVOCWQLREADER_H
-
-#include <kdeedu_core_export.h>
-
-#include <QFile>
-
-#include "keduvocdocument.h"
-
-class KEduVocDocument;
-
-class KDEEDUCORE_EXPORT KEduVocWqlReader : public QObject
-{
-public:
-       KEduVocWqlReader(QFile *file);
-       ~KEduVocWqlReader();
-
-       bool readDoc(KEduVocDocument *doc);
-
-private:
-  QFile *m_inputFile;
-  KEduVocDocument *m_doc;
-};
-
-#endif
diff --git a/kdeeducore/keduvowqlwriter.cpp b/kdeeducore/keduvowqlwriter.cpp
deleted file mode 100644 (file)
index 842ae77..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/***************************************************************************
-                   export a KEduVocDocument to a WQL file
-    -----------------------------------------------------------------------
-    copyright            : (C) 2004 Peter Hedlund
-                           (C) 2005 Eric Pignet
-    email                : peter.hedlund@kdemail.net
- ***************************************************************************/
-
-/***************************************************************************
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#include <QtXml>
-#include <QTextStream>
-#include <QFont>
-
-#include <kdebug.h>
-
-#include "keduvocwqlwriter.h"
-#include "keduvocdocument.h"
-
-#define winendl "\r\n"
-
-KEduVocWqlWriter::KEduVocWqlWriter(QFile *file)
-{
-  // the file must be already open
-  m_outputFile = file;
-}
-
-KEduVocWqlWriter::~KEduVocWqlWriter()
-{
-}
-
-bool KEduVocWqlWriter::writeDoc(KEduVocDocument *doc)
-{
-  m_doc = doc;
-
-  m_outputStream.setDevice(m_outputFile);
-  m_outputStream.setCodec("ISO-8851-1");
-  m_outputStream.setAutoDetectUnicode(false);
-
-  m_outputStream << "WordQuiz" << winendl;
-  m_outputStream << "5.9.0" << winendl << winendl;
-
-  if (doc->font() != NULL)
-    writeFont(*(doc->font()));
-  // TODO writeCharacters(Prefs::specialCharacters());
-  // TODO Find the vertical header width, handle the case where there are not exactly two languages
-  writeGridInfo(10, m_doc->sizeHint(0), m_doc->sizeHint(1), m_doc->numEntries());
-  /* TODO Find the selected cells
-  if (g->numSelections() > 0)
-  {
-    QTableSelection qts = g->selection(0);
-    writeSelection(qts.leftCol(), qts.topRow(), qts.rightCol(), qts.bottomRow());
-  }
-  else
-  {
-    writeSelection(g->currentColumn(), g->currentRow(), g->currentColumn(), g->currentRow());
-  }*/
-  writeFirstItem(m_doc->originalIdentifier(), m_doc->identifier(1));
-  int r = m_doc->numEntries();
-  for (int w=0; w < r; w++)
-  {
-    // TODO Find the row height (g->rowHeight(w))
-    writeItem(m_doc->entry(w)->original(), m_doc->entry(w)->translation(1), 30);
-  }
-  return true;
-}
-
-void KEduVocWqlWriter::writeFont( const QFont & font )
-{
-  m_outputStream << "[Font Info]" << winendl;
-  m_outputStream << "FontName1=\"" << font.family() << "\"" << winendl;
-  m_outputStream << "FontSize1=" << QString::number(font.pointSize()) << winendl;
-  m_outputStream << QString("FontBold1=%1").arg(font.bold() ? "1" : "0") <<winendl;
-  m_outputStream << QString("FontItalic1=%1").arg(font.italic() ? "1" : "0") <<winendl;
-  m_outputStream << "FontColor1=0" << winendl;
-  m_outputStream << "CharSet1=0" << winendl;
-  m_outputStream << "Layout1=0" << winendl;
-
-  m_outputStream << "FontName2=\"" << font.family() << "\"" << winendl;
-  m_outputStream << "FontSize2=" << QString::number(font.pointSize()) << winendl;
-  m_outputStream << QString("FontBold2=%1").arg(font.bold() ? "1" : "0") <<winendl;
-  m_outputStream << QString("FontItalic2=%1").arg(font.italic() ? "1" : "0") <<winendl;
-  m_outputStream << "FontColor2=0" << winendl;
-  m_outputStream << "CharSet2=0" << winendl;
-  m_outputStream << "Layout2=0" << winendl << winendl;
-}
-
-void KEduVocWqlWriter::writeCharacters( const QString & s )
-{
-  m_outputStream << "[Character Info]" << winendl;
-  m_outputStream << "Characters1=" << s << winendl;
-  m_outputStream << "Characters2=" << s << winendl << winendl;
-}
-
-void KEduVocWqlWriter::writeGridInfo( int col0, int col1, int col2, int numRows )
-{
-  m_outputStream << "[Grid Info]" << winendl;
-  m_outputStream << "ColWidth0=" << QString::number(col0) << winendl;
-  m_outputStream << "ColWidth1=" << QString::number(col1) << winendl;
-  m_outputStream << "ColWidth2=" << QString::number(col2) << winendl;
-  m_outputStream << "RowCount=" << QString::number(numRows + 1) << winendl; //Add one for the header
-}
-
-void KEduVocWqlWriter::writeSelection( int lc, int tr, int rc, int br ) //part of [Grid Info]
-{
-  m_outputStream << "SelLeft=" << QString::number(lc + 1) << winendl;
-  m_outputStream << "SelTop=" << QString::number(tr + 1) << winendl;
-  m_outputStream << "SelRight=" << QString::number(rc + 1) << winendl;
-  m_outputStream << "SelBottom=" << QString::number(br + 1) << winendl << winendl;
-}
-
-void KEduVocWqlWriter::writeFirstItem( const QString & ll, const QString & rl )
-{
-  m_outputStream << "[Vocabulary]" << winendl;
-  m_outputStream << ll  << "   [0000000300]" << winendl;
-  m_outputStream << rl  << winendl;
-}
-
-void KEduVocWqlWriter::writeItem( const QString & left, const QString & right, int rh )
-{
-  m_outputStream << left  << QString( "   [%1]").arg(rh * 15, 10, 10 ) << winendl ;
-  m_outputStream << right << winendl;
-}
diff --git a/kdeeducore/keduvowqlwriter.h b/kdeeducore/keduvowqlwriter.h
deleted file mode 100644 (file)
index 2fdb993..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/***************************************************************************
-                   export a KEduVocDocument to a WQL file
-    -----------------------------------------------------------------------
-    copyright            : (C) 2004 Peter Hedlund
-                           (C) 2005 Eric Pignet
-    email                : peter.hedlund@kdemail.net
- ***************************************************************************/
-
-/***************************************************************************
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#ifndef KEDUVOCWQLWRITER_H
-#define KEDUVOCWQLWRITER_H
-
-#include <kdeedu_core_export.h>
-
-#include <QFile>
-#include <QFont>
-#include <QTextStream>
-
-class KEduVocDocument;
-
-class KDEEDUCORE_EXPORT KEduVocWqlWriter
-{
-public:
-  KEduVocWqlWriter(QFile *file);
-  ~KEduVocWqlWriter();
-
-  bool writeDoc(KEduVocDocument *doc);
-
-  void writeFont(const QFont & font);
-  void writeCharacters(const QString & s);
-  void writeGridInfo(int col0, int col1, int col2, int numRows);
-  void writeSelection(int lc, int tr, int rc, int br);
-  void writeFirstItem(const QString &ll, const QString &rl);
-  void writeItem(const QString &left, const QString &right, int rh);
-
-private:
-  QFile *m_outputFile;
-  QTextStream m_outputStream;
-  KEduVocDocument *m_doc;
-};
-
-#endif