]> Git trees. - libqmvoc.git/commitdiff
adapt qmvocdocument.cpp for querymee
authorReto Zingg <g.d0b3rm4n@gmail.com>
Sat, 15 Dec 2012 17:28:48 +0000 (19:28 +0200)
committerReto Zingg <g.d0b3rm4n@gmail.com>
Sat, 15 Dec 2012 17:28:48 +0000 (19:28 +0200)
qmvocdocument.cpp

index 2ee65413de3b9ff585eff4d8d6b4ea8377c411c0..ba3985c092e02809f1c9a99987fbcb73d936372a 100644 (file)
@@ -1,3 +1,7 @@
+/***************************************************************************
+*   this file is from kdeedu project. Filename: keduvocdocument.cpp
+***************************************************************************/
+
 /***************************************************************************
                         Vocabulary Document for KDE Edu
     -----------------------------------------------------------------------
@@ -5,6 +9,8 @@
 
                      (C) 2005-2007 Peter Hedlund <peter.hedlund@kdemail.net>
                      (C) 2007 Frederik Gladhorn <frederik.gladhorn@kdemail.net>
+                     (C) 2010, 2012 Reto Zingg <g.d0b3rm4n@gmail.com>
+
  ***************************************************************************/
 
 /***************************************************************************
  *                                                                         *
  ***************************************************************************/
 
-#include "keduvocdocument.h"
+#include "qmvocdocument.h"
 
 #include <QtCore/QFileInfo>
-#include <QtCore/QTextStream>
+// #include <QtCore/QTextStream>
 #include <QtCore/QtAlgorithms>
 #include <QtCore/QIODevice>
-
-#include <klocale.h>
-#include <kdebug.h>
-#include <kio/netaccess.h>
-#include <krandomsequence.h>
-#include <kfilterdev.h>
-
-#include "keduvocexpression.h"
-#include "keduvoclesson.h"
-#include "keduvocleitnerbox.h"
-#include "keduvocwordtype.h"
-#include "keduvockvtmlwriter.h"
-#include "keduvockvtml2writer.h"
-#include "keduvoccsvreader.h"
-#include "keduvoccsvwriter.h"
-#include "keduvockvtml2reader.h"
-#include "keduvocwqlreader.h"
-#include "keduvocpaukerreader.h"
-#include "keduvocvokabelnreader.h"
-#include "keduvocxdxfreader.h"
+#include <QTextStream>
+#include <QFile>
+
+// #include <klocale.h>
+// #include <kdebug.h>
+#include <QDebug>
+// #include <kio/netaccess.h>
+// #include <krandomsequence.h>
+// #include <kfilterdev.h>
+
+#include "qmvocexpression.h"
+#include "qmvoclesson.h"
+#include "qmvocleitnerbox.h"
+#include "qmvocwordtype.h"
+#include "qmvockvtmlwriter.h"
+#include "qmvockvtml2writer.h"
+#include "qmvoccsvreader.h"
+#include "qmvoccsvwriter.h"
+#include "qmvockvtml2reader.h"
+#include "qmvocwqlreader.h"
+#include "qmvocpaukerreader.h"
+#include "qmvocvokabelnreader.h"
+#include "qmvocxdxfreader.h"
 
 #define WQL_IDENT      "WordQuiz"
 
 #define TXT_EXT          "txt"
 #define WQL_EXT          "wql"
 
-class KEduVocDocument::KEduVocDocumentPrivate
+class QmVocDocument::QmVocDocumentPrivate
 {
 public:
-    KEduVocDocumentPrivate( KEduVocDocument* qq )
+    QmVocDocumentPrivate( QmVocDocument* qq )
             : q( qq )
     {
         m_lessonContainer = 0;
@@ -62,17 +71,17 @@ public:
         init();
     }
 
-    ~KEduVocDocumentPrivate();
+    ~QmVocDocumentPrivate();
 
     void init();
 
-    KEduVocDocument* q;
+    QmVocDocument* q;
 
     bool                      m_dirty;
-    KUrl                      m_url;
+    QUrl                      m_url;
 
     // save these to document
-    QList<KEduVocIdentifier>  m_identifiers;
+    QList<QmVocIdentifier>  m_identifiers;
 
     QList<int>                m_extraSizeHints;
     QList<int>                m_sizeHints;
@@ -97,28 +106,28 @@ public:
       */
     QString                   m_category;
 
-    KEduVocLesson * m_lessonContainer;
-    KEduVocWordType * m_wordTypeContainer;
-    KEduVocLeitnerBox * m_leitnerContainer;
+    QmVocLesson * m_lessonContainer;
+    QmVocWordType * m_wordTypeContainer;
+    QmVocLeitnerBox * m_leitnerContainer;
 };
 
-KEduVocDocument::KEduVocDocumentPrivate::~KEduVocDocumentPrivate()
+QmVocDocument::QmVocDocumentPrivate::~QmVocDocumentPrivate()
 {
     delete m_lessonContainer;
     delete m_wordTypeContainer;
     delete m_leitnerContainer;
 }
 
-void KEduVocDocument::KEduVocDocumentPrivate::init()
+void QmVocDocument::QmVocDocumentPrivate::init()
 {
     delete m_lessonContainer;
-    m_lessonContainer = new KEduVocLesson(i18nc("The top level lesson which contains all other lessons of the document.", "Document Lesson"));
-    m_lessonContainer->setContainerType(KEduVocLesson::Lesson);
+    m_lessonContainer = new QmVocLesson( "Document Lesson");
+    m_lessonContainer->setContainerType(QmVocLesson::Lesson);
     delete m_wordTypeContainer;
-    m_wordTypeContainer = new KEduVocWordType(i18n( "Word types" ));
+    m_wordTypeContainer = new QmVocWordType( "Word types" );
 
     delete m_leitnerContainer;
-    m_leitnerContainer = new KEduVocLeitnerBox(i18n( "Leitner Box" ));
+    m_leitnerContainer = new QmVocLeitnerBox( "Leitner Box" );
 
     m_tenseDescriptions.clear();
     m_identifiers.clear();
@@ -127,7 +136,9 @@ void KEduVocDocument::KEduVocDocumentPrivate::init()
     m_dirty = false;
     m_queryorg = "";
     m_querytrans = "";
-    m_url.setFileName( i18n( "Untitled" ) );
+//    m_url.setFileName( "Untitled" );
+    // FIXME: is this what we need?
+    m_url.setPath( "Untitled" );
     m_author = "";
     m_title = "";
     m_comment = "";
@@ -140,36 +151,38 @@ void KEduVocDocument::KEduVocDocumentPrivate::init()
 }
 
 
-KEduVocDocument::KEduVocDocument( QObject *parent )
-        : QObject( parent ), d( new KEduVocDocumentPrivate( this ) )
+QmVocDocument::QmVocDocument( QObject *parent )
+        : QObject( parent ), d( new QmVocDocumentPrivate( this ) )
 {
-    kDebug() << "constructor done";
+    qDebug() << "constructor done";
 }
 
 
-KEduVocDocument::~KEduVocDocument()
+QmVocDocument::~QmVocDocument()
 {
     delete d;
 }
 
 
-void KEduVocDocument::setModified( bool dirty )
+void QmVocDocument::setModified( bool dirty )
 {
     d->m_dirty = dirty;
     emit docModified( d->m_dirty );
 }
 
 
-KEduVocDocument::FileType KEduVocDocument::detectFileType( const QString &fileName )
+QmVocDocument::FileType QmVocDocument::detectFileType( const QString &fileName )
 {
-    QIODevice * f = KFilterDev::deviceForFile( fileName );
-    if ( !f->open( QIODevice::ReadOnly ) ) {
-        kDebug(1100) << "Warning, could not open QIODevice for file: " << fileName;
-        delete f;
+//     QIODevice * f = KFilterDev::deviceForFile( fileName );
+    QFile f(fileName);
+    if ( !f.open( QIODevice::ReadOnly ) ) {
+        qDebug() << "Warning, could not open QIODevice for file: " << fileName;
+        // FIXME: do we need to delete f????
+        // delete f;
         return Csv;
     }
 
-    QTextStream ts( f );
+    QTextStream ts( &f );
     QString line1;
     QString line2;
 
@@ -205,16 +218,18 @@ KEduVocDocument::FileType KEduVocDocument::detectFileType( const QString &fileNa
             if (tmp.contains( "\"," )) {
                 tmp = ts.readLine();
                 if (tmp.endsWith('0')) {
-                    f->close();
-                    delete f;
+                    f.close();
+                    // FIXME: delete f ???
+                    // delete f;
                     return Vokabeln;
                 }
             }
             tmp = ts.readLine();
         }
     }
-    f->close();
-    delete f;
+    f.close();
+    // FIXME: delete f ???
+    // delete f;
 
 
     if ( line1.startsWith(QString::fromLatin1("<?xml")) ) {
@@ -224,6 +239,7 @@ KEduVocDocument::FileType KEduVocDocument::detectFileType( const QString &fileNa
         if ( line2.indexOf( "xdxf", 0 ) >  0 ) {
             return Xdxf;
         } else {
+            qDebug("assuming this is a kvtml file...");
             return Kvtml;
         }
     }
@@ -232,12 +248,15 @@ KEduVocDocument::FileType KEduVocDocument::detectFileType( const QString &fileNa
         return Wql;
     }
 
-    return Csv;
+     return Csv;
 }
 
 
-int KEduVocDocument::open( const KUrl& url )
+int QmVocDocument::open( const QUrl& url )
 {
+    // temp solution for KUrl -> QString
+    QString myFile = url.path();
+    
     // save csv delimiter to preserve it in case this is a csv document
     QString csv = d->m_csvDelimiter;
     // clear all other properties
@@ -248,23 +267,28 @@ int KEduVocDocument::open( const KUrl& url )
     d->m_csvDelimiter = csv;
 
     bool read = false;
-    QString errorMessage = i18n( "<qt>Cannot open file<br /><b>%1</b></qt>", url.path() );
-    QString temporaryFile;
-    if ( KIO::NetAccess::download( url, temporaryFile, 0 ) ) {
-        QIODevice * f = KFilterDev::deviceForFile( temporaryFile );
+    QString errorMessage = QString("<qt>Cannot open file<br /><b>%1</b></qt>").arg(url.path()) ;
+
+//    QString temporaryFile;
+//     if ( KIO::NetAccess::download( url, temporaryFile, 0 ) ) {
 
-        if ( !f->open( QIODevice::ReadOnly ) ) {
-            kError() << errorMessage;
-            delete f;
-            return FileCannotRead;
-        }
 
-        FileType ft = detectFileType( temporaryFile );
+//         QIODevice * f = KFilterDev::deviceForFile( temporaryFile );
+// 
+    QFile *f = new QFile(myFile);
+    if ( !f->open( QIODevice::ReadOnly ) ) {
+        qCritical() << errorMessage;
+        delete f;
+        return FileCannotRead;
+    }
+// 
+//         FileType ft = detectFileType( temporaryFile );
+    FileType ft = detectFileType(myFile);
 
         switch ( ft ) {
             case Kvtml: {
-                kDebug(1100) << "Reading KVTML document...";
-                KEduVocKvtml2Reader kvtmlReader( f );
+                qDebug() << "Reading KVTML document...";
+                QmVocKvtml2Reader kvtmlReader( f );
                 read = kvtmlReader.readDoc( this );
                 if ( !read ) {
                     errorMessage = kvtmlReader.errorMessage();
@@ -272,63 +296,75 @@ int KEduVocDocument::open( const KUrl& url )
             }
             break;
 
+            // FIXME: maybe we enable them later
+            
             case Wql: {
-                kDebug(1100) << "Reading WordQuiz (WQL) document...";
-                KEduVocWqlReader wqlReader( f );
-                d->m_url.setFileName( i18n( "Untitled" ) );
-                read = wqlReader.readDoc( this );
-                if ( !read ) {
-                    errorMessage = wqlReader.errorMessage();
-                }
+                qDebug() << "Reading WordQuiz (WQL) document...";
+                qCritical ("WordQuiz (WQL) document not yet supported...");
+                errorMessage = "WordQuiz (WQL) document not yet supported...";
+//                 QmVocWqlReader wqlReader( f );
+//                 d->m_url.setFileName( "Untitled" );
+//                 read = wqlReader.readDoc( this );
+//                 if ( !read ) {
+//                     errorMessage = wqlReader.errorMessage();
+//                 }
             }
             break;
 
             case Pauker: {
-                kDebug(1100) << "Reading Pauker document...";
-                KEduVocPaukerReader paukerReader( this );
-                d->m_url.setFileName( i18n( "Untitled" ) );
-                read = paukerReader.read( f );
-                if ( !read ) {
-                    errorMessage = i18n( "Parse error at line %1, column %2:\n%3", paukerReader.lineNumber(), paukerReader.columnNumber(), paukerReader.errorString() );
-                }
+                qDebug() << "Reading Pauker document...";
+                qCritical ("Pauker document not yet supported...");
+                errorMessage = "Pauker document not yet supported...";
+//                 QmVocPaukerReader paukerReader( this );
+//                 d->m_url.setFileName( "Untitled" );
+//                 read = paukerReader.read( f );
+//                 if ( !read ) {
+//                     errorMessage = "Parse error at line %1, column %2:\n%3", paukerReader.lineNumber(), paukerReader.columnNumber(), paukerReader.errorString();
+//                 }
             }
             break;
 
             case Vokabeln: {
-                kDebug(1100) << "Reading Vokabeln document...";
-                KEduVocVokabelnReader vokabelnReader( f );
-                d->m_url.setFileName( i18n( "Untitled" ) );
-                read = vokabelnReader.readDoc( this );
-                if ( !read ) {
-                    errorMessage = vokabelnReader.errorMessage();
-                }
+                qDebug() << "Reading Vokabeln document...";
+                qCritical ("Vokabeln document not yet supported...");
+                errorMessage = "Vokabeln document not yet supported...";
+//                 QmVocVokabelnReader vokabelnReader( f );
+//                 d->m_url.setFileName( "Untitled" );
+//                 read = vokabelnReader.readDoc( this );
+//                 if ( !read ) {
+//                     errorMessage = vokabelnReader.errorMessage();
+//                 }
             }
             break;
 
             case Csv: {
-                kDebug(1100) << "Reading CVS document...";
-                KEduVocCsvReader csvReader( f );
-                read = csvReader.readDoc( this );
-                if ( !read ) {
-                    errorMessage = csvReader.errorMessage();
-                }
+                qDebug() << "Reading CVS document...";
+                qCritical ("CVS document not yet supported...");
+                errorMessage = "CVS document not yet supported...";
+//                 QmVocCsvReader csvReader( f );
+//                 read = csvReader.readDoc( this );
+//                 if ( !read ) {
+//                     errorMessage = csvReader.errorMessage();
+//                 }
             }
             break;
 
             case Xdxf: {
-                kDebug(1100) << "Reading XDXF document...";
-                KEduVocXdxfReader xdxfReader( this );
-                d->m_url.setFileName( i18n( "Untitled" ) );
-                read = xdxfReader.read( f );
-                if ( !read ) {
-                    errorMessage = i18n( "Parse error at line %1, column %2:\n%3", xdxfReader.lineNumber(), xdxfReader.columnNumber(), xdxfReader.errorString() );
-                }
+                qDebug() << "Reading XDXF document...";
+                qCritical ("XDXF document not yet supported...");
+                errorMessage = "XDXF document not yet supported...";
+//                 QmVocXdxfReader xdxfReader( this );
+//                 d->m_url.setFileName(  "Untitled"  );
+//                 read = xdxfReader.read( f );
+//                 if ( !read ) {
+//                     errorMessage = "Parse error at line %1, column %2:\n%3", xdxfReader.lineNumber(), xdxfReader.columnNumber(), xdxfReader.errorString() ;
+//                 }
             }
             break;
 
             default: {
-                kDebug(1100) << "Reading KVTML document (fallback)...";
-                KEduVocKvtml2Reader kvtmlReader( f );
+                qDebug() << "Reading KVTML document (fallback)...";
+                QmVocKvtml2Reader kvtmlReader( f );
                 read = kvtmlReader.readDoc( this );
                 if ( !read ) {
                     errorMessage = kvtmlReader.errorMessage();
@@ -337,8 +373,8 @@ int KEduVocDocument::open( const KUrl& url )
         }
 
         if ( !read ) {
-            QString msg = i18n( "Could not open or properly read \"%1\"\n(Error reported: %2)", url.path(), errorMessage );
-            kError() << msg << i18n( "Error Opening File" );
+            QString msg =  QString("Could not open or properly read \"%1\"\n(Error reported: %2)").arg(url.path()).arg(errorMessage);
+            qCritical() << msg <<  "Error Opening File" ;
             ///@todo make the readers return int, pass on the error message properly
             delete f;
             return FileReaderFailed;
@@ -346,8 +382,11 @@ int KEduVocDocument::open( const KUrl& url )
 
         f->close();
         delete f;
-        KIO::NetAccess::removeTempFile( temporaryFile );
-    }
+        
+//         KIO::NetAccess::removeTempFile( temporaryFile );
+
+
+//     } // close if
 
     if ( !read ) {
         return FileReaderFailed;
@@ -358,9 +397,9 @@ int KEduVocDocument::open( const KUrl& url )
 }
 
 
-int KEduVocDocument::saveAs( const KUrl & url, FileType ft, const QString & generator )
+int QmVocDocument::saveAs( const QUrl & url, FileType ft, const QString & generator )
 {
-    KUrl tmp( url );
+    QUrl tmp( url );
 
     if ( ft == Automatic ) {
         if ( tmp.path().right( strlen( "." KVTML_EXT ) ) == "." KVTML_EXT )
@@ -375,7 +414,7 @@ int KEduVocDocument::saveAs( const KUrl & url, FileType ft, const QString & gene
     QFile f( tmp.path() );
 
     if ( !f.open( QIODevice::WriteOnly ) ) {
-        kError() << i18n( "Cannot write to file %1", tmp.path() );
+        qCritical() <<  QString("Cannot write to file %1").arg(tmp.path()) ;
         return FileCannotWrite;
     }
 
@@ -384,24 +423,24 @@ int KEduVocDocument::saveAs( const KUrl & url, FileType ft, const QString & gene
     switch ( ft ) {
         case Kvtml: {
             // write version 2 file
-            KEduVocKvtml2Writer kvtmlWriter( &f );
+            QmVocKvtml2Writer kvtmlWriter( &f );
             saved = kvtmlWriter.writeDoc( this, generator );
         }
         break;
         ///@todo port me
 //         case Kvtml1: {
 //             // write old version 1 file
-//             KEduVocKvtmlWriter kvtmlWriter( &f );
+//             QmVocKvtmlWriter kvtmlWriter( &f );
 //             saved = kvtmlWriter.writeDoc( this, generator );
 //         }
 //         break;
         case Csv: {
-            KEduVocCsvWriter csvWriter( &f );
+            QmVocCsvWriter csvWriter( &f );
             saved = csvWriter.writeDoc( this, generator );
         }
         break;
         default: {
-            kError() << "kvcotrainDoc::saveAs(): unknown filetype" << endl;
+            qCritical() << "kvcotrainDoc::saveAs(): unknown filetype" << endl;
         }
         break;
     } // switch
@@ -409,7 +448,7 @@ int KEduVocDocument::saveAs( const KUrl & url, FileType ft, const QString & gene
     f.close();
 
     if ( !saved ) {
-        kError() << "Error Saving File" << tmp.path();
+        qCritical() << "Error Saving File" << tmp.path();
         return FileWriterFailed;
     }
 
@@ -418,18 +457,18 @@ int KEduVocDocument::saveAs( const KUrl & url, FileType ft, const QString & gene
     return 0;
 }
 
-QByteArray KEduVocDocument::toByteArray(const QString &generator)
+QByteArray QmVocDocument::toByteArray(const QString &generator)
 {
     // no file needed
-    KEduVocKvtml2Writer kvtmlWriter(0);
+    QmVocKvtml2Writer kvtmlWriter(0);
     return kvtmlWriter.toByteArray( this, generator );
 }
 
-void KEduVocDocument::merge( KEduVocDocument *docToMerge, bool matchIdentifiers )
+void QmVocDocument::merge( QmVocDocument *docToMerge, bool matchIdentifiers )
 {
     Q_UNUSED(docToMerge)
     Q_UNUSED(matchIdentifiers)
-    kDebug(1100) << "Merging of docs is not implemented"; /// @todo IMPLEMENT ME
+    qDebug() << "Merging of docs is not implemented"; /// @todo IMPLEMENT ME
     // This code was really horribly broken.
     // Now with the new classes we could attempt to reactivate it.
     // A rewrite might be easier.
@@ -485,7 +524,7 @@ void KEduVocDocument::merge( KEduVocDocument *docToMerge, bool matchIdentifiers
         if (equal) {   // easy way: same language codes, just append
 
           for (int i = 0; i < docToMerge->entryCount(); i++) {
-            KEduVocExpression *expr = docToMerge->entry(i);
+            QmVocExpression *expr = docToMerge->entry(i);
 
             expr->setLesson(expr->lesson() + lesson_offset);
 
@@ -534,7 +573,7 @@ void KEduVocDocument::merge( KEduVocDocument *docToMerge, bool matchIdentifiers
                 expr->translation(lang).setUsageLabel (tg);
               }
 
-              KEduVocConjugation conj = expr->translation(lang).conjugation();
+              QmVocConjugation conj = expr->translation(lang).conjugation();
               bool condirty = false;
               for (int ci = 0; ci < conj.entryCount(); ci++) {
                 t = conj.getType(ci);
@@ -568,8 +607,8 @@ void KEduVocDocument::merge( KEduVocDocument *docToMerge, bool matchIdentifiers
             move_matrix.append(docToMerge->indexOfIdentifier(identifier(i)));
 
           for (int j = 0; j < docToMerge->entryCount(); j++) {
-            KEduVocExpression new_expr;
-            KEduVocExpression *expr = docToMerge->entry(j);
+            QmVocExpression new_expr;
+            QmVocExpression *expr = docToMerge->entry(j);
             new_expr.setLesson(expr->lesson()+lesson_offset);
 
             for (int i = 0; i < move_matrix.count(); i++) {
@@ -611,7 +650,7 @@ void KEduVocDocument::merge( KEduVocDocument *docToMerge, bool matchIdentifiers
                   new_expr.setUsageLabel(i, t2);
                 }
 
-                KEduVocConjugation conj = expr->conjugation(lpos);
+                QmVocConjugation conj = expr->conjugation(lpos);
                 for (int ci = 0; ci < conj.entryCount(); ci++) {
                   t = conj.getType(ci);
                   if (!t.isEmpty() && t.left(1) == QM_USER_TYPE) {
@@ -641,23 +680,23 @@ void KEduVocDocument::merge( KEduVocDocument *docToMerge, bool matchIdentifiers
     */
 }
 
-const KEduVocIdentifier& KEduVocDocument::identifier( int index ) const
+const QmVocIdentifier& QmVocDocument::identifier( int index ) const
 {
     if ( index < 0 || index >= d->m_identifiers.size() ) {
-        kError() << " Error: Invalid identifier index: " << index;
+        qCritical() << " Error: Invalid identifier index: " << index;
     }
     return d->m_identifiers[index];
 }
 
-KEduVocIdentifier& KEduVocDocument::identifier( int index )
+QmVocIdentifier& QmVocDocument::identifier( int index )
 {
     if ( index < 0 || index >= d->m_identifiers.size() ) {
-        kError() << " Error: Invalid identifier index: " << index;
+        qCritical() << " Error: Invalid identifier index: " << index;
     }
     return d->m_identifiers[index];
 }
 
-void KEduVocDocument::setIdentifier( int idx, const KEduVocIdentifier &id )
+void QmVocDocument::setIdentifier( int idx, const QmVocIdentifier &id )
 {
     if ( idx >= 0 && idx < d->m_identifiers.size() ) {
         d->m_identifiers[idx] = id;
@@ -666,7 +705,7 @@ void KEduVocDocument::setIdentifier( int idx, const KEduVocIdentifier &id )
 }
 
 // works if const is removed
-int KEduVocDocument::indexOfIdentifier( const QString &name ) const
+int QmVocDocument::indexOfIdentifier( const QString &name ) const
 {
     for (int i = 0; i < identifierCount(); i++)
         if (identifier(i).locale() == name)
@@ -674,7 +713,7 @@ int KEduVocDocument::indexOfIdentifier( const QString &name ) const
     return -1;
 }
 
-void KEduVocDocument::removeIdentifier( int index )
+void QmVocDocument::removeIdentifier( int index )
 {
     if ( index < d->m_identifiers.size() && index >= 0 ) {
         d->m_identifiers.removeAt( index );
@@ -683,27 +722,27 @@ void KEduVocDocument::removeIdentifier( int index )
 }
 
 
-bool KEduVocDocument::isModified() const
+bool QmVocDocument::isModified() const
 {
     return d->m_dirty;
 }
 
 
-int KEduVocDocument::identifierCount() const
+int QmVocDocument::identifierCount() const
 {
     return d->m_identifiers.count();  // number of translations
 }
 
-int KEduVocDocument::appendIdentifier( const KEduVocIdentifier& id )
+int QmVocDocument::appendIdentifier( const QmVocIdentifier& id )
 {
     int i = d->m_identifiers.size();
-//kDebug(1100) << "appendIdentifier: " << i << id.name() << id.locale();
+    qDebug() << "appendIdentifier: " << i << id.name() << id.locale();
     d->m_identifiers.append( id );
     if ( id.name().isEmpty() ) {
         if ( i == 0 ) {
-            identifier(i).setName(i18nc("The name of the first language/column of vocabulary, if we have to guess it.", "Original"));
+            identifier(i).setName( "Original");
         } else {
-            identifier(i).setName(i18nc( "The name of the second, third ... language/column of vocabulary, if we have to guess it.", "Translation %1", i ) );
+            identifier(i).setName( QString("Translation %1").arg(i) );
         }
     }
 
@@ -711,150 +750,150 @@ int KEduVocDocument::appendIdentifier( const KEduVocIdentifier& id )
     return i;
 }
 
-KEduVocLesson * KEduVocDocument::lesson()
+QmVocLesson * QmVocDocument::lesson()
 {
     return d->m_lessonContainer;
 }
 
-KEduVocWordType * KEduVocDocument::wordTypeContainer()
+QmVocWordType * QmVocDocument::wordTypeContainer()
 {
     return d->m_wordTypeContainer;
 }
 
-KEduVocLeitnerBox * KEduVocDocument::leitnerContainer()
+QmVocLeitnerBox * QmVocDocument::leitnerContainer()
 {
     return d->m_leitnerContainer;
 }
 
-KUrl KEduVocDocument::url() const
+QUrl QmVocDocument::url() const
 {
     return d->m_url;
 }
 
-void KEduVocDocument::setUrl( const KUrl& url )
+void QmVocDocument::setUrl( const QUrl& url )
 {
     d->m_url = url;
 }
 
-QString KEduVocDocument::title() const
+QString QmVocDocument::title() const
 {
     if ( d->m_title.isEmpty() )
-        return d->m_url.fileName();
+        return d->m_url.path();
     else
         return d->m_title;
 }
 
-void KEduVocDocument::setTitle( const QString & title )
+void QmVocDocument::setTitle( const QString & title )
 {
     d->m_title = title;
     d->m_lessonContainer->setName(title);
     setModified(true);
 }
 
-QString KEduVocDocument::author() const
+QString QmVocDocument::author() const
 {
     return d->m_author;
 }
 
-void KEduVocDocument::setAuthor( const QString & s )
+void QmVocDocument::setAuthor( const QString & s )
 {
     d->m_author = s.simplified();
     setModified(true);
 }
 
-QString KEduVocDocument::authorContact() const
+QString QmVocDocument::authorContact() const
 {
     return d->m_authorContact;
 }
 
-void KEduVocDocument::setAuthorContact( const QString & s )
+void QmVocDocument::setAuthorContact( const QString & s )
 {
     d->m_authorContact = s.simplified();
     setModified(true);
 }
 
-QString KEduVocDocument::license() const
+QString QmVocDocument::license() const
 {
     return d->m_license;
 }
 
-QString KEduVocDocument::documentComment() const
+QString QmVocDocument::documentComment() const
 {
     return d->m_comment;
 }
 
-void KEduVocDocument::setCategory( const QString & category )
+void QmVocDocument::setCategory( const QString & category )
 {
     d->m_category = category;
     setModified(true);
 }
 
-QString KEduVocDocument::category() const
+QString QmVocDocument::category() const
 {
     return d->m_category;
     ///@todo make writer/reader use this
 }
 
-void KEduVocDocument::queryIdentifier( QString &org, QString &trans ) const
+void QmVocDocument::queryIdentifier( QString &org, QString &trans ) const
 {
     org = d->m_queryorg;
     trans = d->m_querytrans;
 }
 
-void KEduVocDocument::setQueryIdentifier( const QString &org, const QString &trans )
+void QmVocDocument::setQueryIdentifier( const QString &org, const QString &trans )
 {
     d->m_queryorg = org;
     d->m_querytrans = trans;
     setModified(true);
 }
 
-void KEduVocDocument::setLicense( const QString & s )
+void QmVocDocument::setLicense( const QString & s )
 {
     d->m_license = s.simplified();
     setModified(true);
 }
 
-void KEduVocDocument::setDocumentComment( const QString & s )
+void QmVocDocument::setDocumentComment( const QString & s )
 {
     d->m_comment = s.trimmed();
     setModified(true);
 }
 
-void KEduVocDocument::setGenerator( const QString & generator )
+void QmVocDocument::setGenerator( const QString & generator )
 {
     d->m_generator = generator;
     setModified(true);
 }
 
-QString KEduVocDocument::generator() const
+QString QmVocDocument::generator() const
 {
     return d->m_generator;
 }
 
-QString KEduVocDocument::version() const
+QString QmVocDocument::version() const
 {
     return d->m_version;
 }
 
-void KEduVocDocument::setVersion( const QString & vers )
+void QmVocDocument::setVersion( const QString & vers )
 {
     d->m_version = vers;
     setModified(true);
 }
 
-QString KEduVocDocument::csvDelimiter() const
+QString QmVocDocument::csvDelimiter() const
 {
     return d->m_csvDelimiter;
 }
 
-void KEduVocDocument::setCsvDelimiter( const QString &delimiter )
+void QmVocDocument::setCsvDelimiter( const QString &delimiter )
 {
     d->m_csvDelimiter = delimiter;
     setModified(true);
 }
 
 
-QString KEduVocDocument::pattern( FileDialogMode mode )
+QString QmVocDocument::pattern( FileDialogMode mode )
 {
     static const struct SupportedFilter {
         bool reading;
@@ -863,12 +902,12 @@ QString KEduVocDocument::pattern( FileDialogMode mode )
         const char* description;
     }
     filters[] = {
-                    { true, true, "*.kvtml", I18N_NOOP( "KDE Vocabulary Document" ) },
-                    { true, false, "*.wql", I18N_NOOP( "KWordQuiz Document" ) },
-                    { true, false, "*.xml.qz *.pau.gz", I18N_NOOP( "Pauker Lesson" ) },
-                    { true, false, "*.voc", I18N_NOOP( "Vokabeltrainer" ) },
-                    { true, false, "*.xdxf", I18N_NOOP( "XML Dictionary Exchange Format" ) },
-                    { true, true, "*.csv", I18N_NOOP( "Comma Separated Values (CSV)" ) },
+                    { true, true, "*.kvtml", "KDE Vocabulary Document" },
+                    { true, false, "*.wql", "KWordQuiz Document"  },
+                    { true, false, "*.xml.qz *.pau.gz", "Pauker Lesson" },
+                    { true, false, "*.voc", "Vokabeltrainer" },
+                    { true, false, "*.xdxf", "XML Dictionary Exchange Format" },
+                    { true, true, "*.csv", "Comma Separated Values (CSV)" },
                     // last is marker for the end, do not remove it
                     { false, false, 0, 0 }
                 };
@@ -877,41 +916,40 @@ QString KEduVocDocument::pattern( FileDialogMode mode )
     for ( int i = 0; filters[i].extensions; ++i ) {
         if (( mode == Reading && filters[i].reading ) ||
                 ( mode == Writing && filters[i].writing ) ) {
-            newfilters.append( QLatin1String( filters[i].extensions ) + '|' + i18n( filters[i].description ) );
+            newfilters.append( QLatin1String( filters[i].extensions ) + '|' +  filters[i].description );
             allext.append( QLatin1String( filters[i].extensions ) );
         }
     }
     if ( mode == Reading ) {
-        newfilters.prepend( allext.join( " " ) + '|' + i18n( "All supported documents" ) );
+        newfilters.prepend( allext.join( " " ) + '|' +  "All supported documents" );
     }
     return newfilters.join( "\n" );
 }
 
-QString KEduVocDocument::errorDescription( int errorCode )
+QString QmVocDocument::errorDescription( int errorCode )
 {
     switch (errorCode) {
     case NoError:
-        return i18n("No error found.");
+        return "No error found.";
 
     case InvalidXml:
-        return i18n("Invalid XML in document.");
+        return "Invalid XML in document.";
     case FileTypeUnknown:
-        return i18n("Unknown file type.");
+        return "Unknown file type.";
     case FileCannotWrite:
-        return i18n("File is not writeable.");
+        return "File is not writeable.";
     case FileWriterFailed:
-        return i18n("File writer failed.");
+        return "File writer failed.";
     case FileCannotRead:
-        return i18n("File is not readable.");
+        return "File is not readable.";
     case FileReaderFailed:
-        return i18n("The file reader failed.");
+        return "The file reader failed.";
     case FileDoesNotExist:
-        return i18n("The file does not exist.");
+        return "The file does not exist.";
     case Unknown:
     default:
-        return i18n("Unknown error.");
+        return "Unknown error.";
     }
 }
 
-#include "keduvocdocument.moc"