]> Git trees. - libqmvoc.git/commitdiff
Finally change formatting to FOUR SPACES.
authorFrederik Gladhorn <gladhorn@kde.org>
Wed, 29 Aug 2007 13:36:39 +0000 (13:36 +0000)
committerFrederik Gladhorn <gladhorn@kde.org>
Wed, 29 Aug 2007 13:36:39 +0000 (13:36 +0000)
svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=706119

54 files changed:
keduvocdocument/keduvocconjugation.cpp
keduvocdocument/keduvocconjugation.h
keduvocdocument/keduvoccsvreader.cpp
keduvocdocument/keduvoccsvreader.h
keduvocdocument/keduvoccsvwriter.cpp
keduvocdocument/keduvoccsvwriter.h
keduvocdocument/keduvocdocument.cpp
keduvocdocument/keduvocdocument.h
keduvocdocument/keduvocexpression.cpp
keduvocdocument/keduvocexpression.h
keduvocdocument/keduvocgrade.cpp
keduvocdocument/keduvocgrade.h
keduvocdocument/keduvocgrammar.cpp
keduvocdocument/keduvocgrammar.h
keduvocdocument/keduvockvtml2reader.cpp
keduvocdocument/keduvockvtml2reader.h
keduvocdocument/keduvockvtml2writer.cpp
keduvocdocument/keduvockvtml2writer.h
keduvocdocument/keduvockvtmlcompability.cpp
keduvocdocument/keduvockvtmlcompability.h
keduvocdocument/keduvockvtmlreader.cpp
keduvocdocument/keduvockvtmlreader.h
keduvocdocument/keduvockvtmlwriter.cpp
keduvocdocument/keduvockvtmlwriter.h
keduvocdocument/keduvoclesson.cpp
keduvocdocument/keduvoclesson.h
keduvocdocument/keduvocmultiplechoice.cpp
keduvocdocument/keduvocmultiplechoice.h
keduvocdocument/keduvocpaukerreader.cpp
keduvocdocument/keduvocpaukerreader.h
keduvocdocument/keduvoctranslation.cpp
keduvocdocument/keduvoctranslation.h
keduvocdocument/keduvocvokabelnreader.cpp
keduvocdocument/keduvocvokabelnreader.h
keduvocdocument/keduvocwordtype.cpp
keduvocdocument/keduvocwordtype.h
keduvocdocument/keduvocwqlreader.cpp
keduvocdocument/keduvocwqlreader.h
keduvocdocument/keduvocxdxfreader.cpp
keduvocdocument/keduvocxdxfreader.h
keduvocdocument/kvtmldefs.h
keduvocdocument/leitnerbox.cpp
keduvocdocument/leitnerbox.h
keduvocdocument/leitnersystem.cpp
keduvocdocument/leitnersystem.h
keduvocdocument/leitnersystemview.cpp
keduvocdocument/leitnersystemview.h
keduvocdocument/libkeduvocdocument_export.h
keduvocdocument/prefleitner.cpp
keduvocdocument/prefleitner.h
keduvocdocument/sharedkvtmlfiles.cpp
keduvocdocument/sharedkvtmlfiles.h
keduvocdocument/tests/converter.cpp
keduvocdocument/tests/loader.cpp

index 7d8a3ebdfdb8eca74030e1e26f296338ee0df739..ee9d05a3c0c833ff92f6aa895de4f73f2f4c43ab 100644 (file)
 class KEduVocConjugation::Private
 {
 public:
-  Private()
-  {
-  }
-
-  QString verbName; // added to have something to compare in operator ==, assumes that there is always only one
-                    // KEduVocConjugation per verb
-
-  struct conjug_name_t
-  {
-    const char *abbrev;
-    const char *name;
-  };
-
-  struct conjug_t
-  {
-     conjug_t() {
-        p3common = false;
-        s3common = false;
-     }
-
-     QString type;
-     bool    p3common;
-     bool    s3common;
-     QString pers1_sing;
-     QString pers2_sing;
-     QString pers3_m_sing;
-     QString pers3_f_sing;
-     QString pers3_n_sing;
-     QString pers1_plur;
-     QString pers2_plur;
-     QString pers3_m_plur;
-     QString pers3_f_plur;
-     QString pers3_n_plur;
-  };
-
-  typedef QList<conjug_t> conjug_tList;
-  conjug_tList conjugations;
-
-  static conjug_name_t names[];
-  static QStringList userTenses;
+    Private()
+    {}
+
+    QString verbName; // added to have something to compare in operator ==, assumes that there is always only one
+    // KEduVocConjugation per verb
+
+    struct conjug_name_t
+    {
+        const char *abbrev;
+        const char *name;
+    };
+
+    struct conjug_t
+    {
+        conjug_t()
+        {
+            p3common = false;
+            s3common = false;
+        }
+
+        QString type;
+        bool    p3common;
+        bool    s3common;
+        QString pers1_sing;
+        QString pers2_sing;
+        QString pers3_m_sing;
+        QString pers3_f_sing;
+        QString pers3_n_sing;
+        QString pers1_plur;
+        QString pers2_plur;
+        QString pers3_m_plur;
+        QString pers3_f_plur;
+        QString pers3_n_plur;
+    };
+
+    typedef QList<conjug_t> conjug_tList;
+    conjug_tList conjugations;
+
+    static conjug_name_t names[];
+    static QStringList userTenses;
 };
 
 
 KEduVocConjugation::Private::conjug_name_t
 
 KEduVocConjugation::Private::names [] =
-{
-  { CONJ_SIMPLE_PRESENT,    I18N_NOOP("Simple Present") },
-  { CONJ_PRESENT_PROGR,     I18N_NOOP("Present Progressive") },
-  { CONJ_PRESENT_PERFECT,   I18N_NOOP("Present Perfect") },
+    {
+        { CONJ_SIMPLE_PRESENT,    I18N_NOOP( "Simple Present" ) },
+        { CONJ_PRESENT_PROGR,     I18N_NOOP( "Present Progressive" ) },
+        { CONJ_PRESENT_PERFECT,   I18N_NOOP( "Present Perfect" ) },
 
-  { CONJ_SIMPLE_PAST,       I18N_NOOP("Simple Past") },
-  { CONJ_PAST_PROGR,        I18N_NOOP("Past Progressive") },
-  { CONJ_PAST_PARTICIPLE,   I18N_NOOP("Past Participle") },
+        { CONJ_SIMPLE_PAST,       I18N_NOOP( "Simple Past" ) },
+        { CONJ_PAST_PROGR,        I18N_NOOP( "Past Progressive" ) },
+        { CONJ_PAST_PARTICIPLE,   I18N_NOOP( "Past Participle" ) },
 
-  { CONJ_FUTURE,            I18N_NOOP("Future") }
-};
+        { CONJ_FUTURE,            I18N_NOOP( "Future" ) }
+    };
 
 
 QStringList KEduVocConjugation::Private::userTenses;
@@ -93,49 +93,47 @@ QStringList KEduVocConjugation::Private::userTenses;
 
 
 KEduVocConjugation::KEduVocConjugation()
-  : d(new Private)
-{
-}
+        : d( new Private )
+{}
 
 
-KEduVocConjugation::KEduVocConjugation(const KEduVocConjugation& rhs)
-  : d(new Private(*rhs.d))
-{
-}
+KEduVocConjugation::KEduVocConjugation( const KEduVocConjugation& rhs )
+        : d( new Private( *rhs.d ) )
+{}
 
 
 KEduVocConjugation::~KEduVocConjugation()
 {
-if (d->conjugations.count() > 0) {
-    kDebug() << "Killing Conjugation d->verbName: " << d->verbName << " conjugations.count(): " << d->conjugations.count() <<
+    if ( d->conjugations.count() > 0 ) {
+        kDebug() << "Killing Conjugation d->verbName: " << d->verbName << " conjugations.count(): " << d->conjugations.count() <<
 
-    " getType(0): " << getType(0) << " getAbbrev(0): " << getAbbrev(0) << " getName(0): " << getName(0);
-}
-  delete d;
+        " getType(0): " << getType( 0 ) << " getAbbrev(0): " << getAbbrev( 0 ) << " getName(0): " << getName( 0 );
+    }
+    delete d;
 }
 
 
-KEduVocConjugation& KEduVocConjugation::operator =(const KEduVocConjugation& a)
+KEduVocConjugation& KEduVocConjugation::operator = ( const KEduVocConjugation& a )
 {
-  *d = *a.d;
-  return *this;
+    *d = *a.d;
+    return *this;
 }
 
 
-bool KEduVocConjugation::operator ==(const KEduVocConjugation& a) const
+bool KEduVocConjugation::operator == ( const KEduVocConjugation& a ) const
 {
-  return d->verbName == a.getVerbName();
+    return d->verbName == a.getVerbName();
 }
 
 
 QString KEduVocConjugation::getVerbName() const
 {
-  return d->verbName;
+    return d->verbName;
 }
 
 int KEduVocConjugation::entryCount() const
 {
-  return d->conjugations.count();
+    return d->conjugations.count();
 }
 
 
@@ -158,149 +156,146 @@ int KEduVocConjugation::entryCount() const
 // }
 
 
-void KEduVocConjugation::setTenseNames(const QStringList& names)
+void KEduVocConjugation::setTenseNames( const QStringList& names )
 {
-  Private::userTenses = names;
+    Private::userTenses = names;
 }
 
 
-QString KEduVocConjugation::getName(const QString &abbrev)
+QString KEduVocConjugation::getName( const QString &abbrev )
 {
-  if (abbrev.length() >= 2 && QString(abbrev[0]) == QString(UL_USER_TENSE)) {
-    QString s = abbrev;
-    s.remove(0, 1);
-    int i = s.toInt() - 1;
+    if ( abbrev.length() >= 2 && QString( abbrev[0] ) == QString( UL_USER_TENSE ) ) {
+        QString s = abbrev;
+        s.remove( 0, 1 );
+        int i = s.toInt() - 1;
 
-    if (i < Private::userTenses.count() )
-      return Private::userTenses[i];
-    else
-      return "";
-  }
-  else {
-    for (int i = 0; i < numInternalNames(); i++)
-      if (Private::names[i].abbrev == abbrev) {
-        return i18n(Private::names[i].name);
-      }
-  }
+        if ( i < Private::userTenses.count() )
+            return Private::userTenses[i];
+        else
+            return "";
+    } else {
+        for ( int i = 0; i < numInternalNames(); i++ )
+            if ( Private::names[i].abbrev == abbrev ) {
+                return i18n( Private::names[i].name );
+            }
+    }
 
-  return "";
+    return "";
 }
 
 
-QString KEduVocConjugation::getName(int idx)
+QString KEduVocConjugation::getName( int idx )
 {
-  if (idx < numInternalNames())
-    return i18n(Private::names[idx].name);
-  else if (idx < tenseCount())
-    return Private::userTenses[idx-numInternalNames()];
-  else
-    return "";
+    if ( idx < numInternalNames() )
+        return i18n( Private::names[idx].name );
+    else if ( idx < tenseCount() )
+        return Private::userTenses[idx-numInternalNames()];
+    else
+        return "";
 }
 
 
-QString KEduVocConjugation::getAbbrev(const QString &name)
+QString KEduVocConjugation::getAbbrev( const QString &name )
 {
-  for (int i = 0; i < Private::userTenses.count(); i++)
-    if (Private::userTenses[i] == name) {
-      QString s;
-      s.setNum(i + 1);
-      s.prepend(UL_USER_TENSE);
-      return s;
-    }
+    for ( int i = 0; i < Private::userTenses.count(); i++ )
+        if ( Private::userTenses[i] == name ) {
+            QString s;
+            s.setNum( i + 1 );
+            s.prepend( UL_USER_TENSE );
+            return s;
+        }
 
-  for (int i = 0; i < numInternalNames(); i++)
-    if (Private::names[i].name == name)
-      return Private::names[i].abbrev;
+    for ( int i = 0; i < numInternalNames(); i++ )
+        if ( Private::names[i].name == name )
+            return Private::names[i].abbrev;
 
-  return "";
+    return "";
 }
 
 
-QString KEduVocConjugation::getAbbrev(int idx)
+QString KEduVocConjugation::getAbbrev( int idx )
 {
-  if (idx < numInternalNames() )
-    return Private::names[idx].abbrev;
-
-  else if (idx < tenseCount()) {
-    QString s;
-    s.setNum(idx - numInternalNames() + 1);
-    s.prepend(UL_USER_TENSE);
-    return s;
-  }
+    if ( idx < numInternalNames() )
+        return Private::names[idx].abbrev;
 
-  else
-    return "";
+    else if ( idx < tenseCount() ) {
+        QString s;
+        s.setNum( idx - numInternalNames() + 1 );
+        s.prepend( UL_USER_TENSE );
+        return s;
+    } else
+        return "";
 }
 
 
 int KEduVocConjugation::numInternalNames()
 {
-  return sizeof(Private::names) / sizeof(Private::names[0]);
+    return sizeof( Private::names ) / sizeof( Private::names[0] );
 }
 
 
 int KEduVocConjugation::tenseCount()
 {
-  return numInternalNames() + Private::userTenses.size();
+    return numInternalNames() + Private::userTenses.size();
 }
 
 
-QString KEduVocConjugation::getType(int idx)
+QString KEduVocConjugation::getType( int idx )
 {
 
-kDebug() << "KEduVocConjugation::getType()" << idx;
-  if (idx >= d->conjugations.count())
-    return "";
+    kDebug() << "KEduVocConjugation::getType()" << idx;
+    if ( idx >= d->conjugations.count() )
+        return "";
 
-  return d->conjugations[idx].type;
+    return d->conjugations[idx].type;
 }
 
 
-void KEduVocConjugation::setType(int idx, const QString & type)
+void KEduVocConjugation::setType( int idx, const QString & type )
 {
-  if (idx >= d->conjugations.size())
-    return;
+    if ( idx >= d->conjugations.size() )
+        return;
 
-  d->conjugations[idx].type = type;
+    d->conjugations[idx].type = type;
 }
 
 
 void KEduVocConjugation::cleanUp()
 {
-  for (int i = d->conjugations.count() - 1; i >= 0; i--) {
-    const Private::conjug_t *ctp = &d->conjugations[i];
-    if (   ctp->pers1_sing.simplified().isEmpty()
-        && ctp->pers2_sing.simplified().isEmpty()
-        && ctp->pers3_m_sing.simplified().isEmpty()
-        && ctp->pers3_f_sing.simplified().isEmpty()
-        && ctp->pers3_n_sing.simplified().isEmpty()
-        && ctp->pers1_plur.simplified().isEmpty()
-        && ctp->pers2_plur.simplified().isEmpty()
-        && ctp->pers3_m_plur.simplified().isEmpty()
-        && ctp->pers3_f_plur.simplified().isEmpty()
-        && ctp->pers3_n_plur.simplified().isEmpty()
-       )
-     d->conjugations.removeAt(i);
-  }
-}
-
-
-bool KEduVocConjugation::isEmpty(int idx)
-{
-  if (idx < d->conjugations.count()) {
-    const Private::conjug_t *ctp = &d->conjugations[idx];
-    return ctp->pers1_sing.simplified().isEmpty()
-        && ctp->pers2_sing.simplified().isEmpty()
-        && ctp->pers3_m_sing.simplified().isEmpty()
-        && ctp->pers3_f_sing.simplified().isEmpty()
-        && ctp->pers3_n_sing.simplified().isEmpty()
-        && ctp->pers1_plur.simplified().isEmpty()
-        && ctp->pers2_plur.simplified().isEmpty()
-        && ctp->pers3_m_plur.simplified().isEmpty()
-        && ctp->pers3_f_plur.simplified().isEmpty()
-        && ctp->pers3_n_plur.simplified().isEmpty();
-  }
-  return true;
+    for ( int i = d->conjugations.count() - 1; i >= 0; i-- ) {
+        const Private::conjug_t *ctp = &d->conjugations[i];
+        if ( ctp->pers1_sing.simplified().isEmpty()
+                && ctp->pers2_sing.simplified().isEmpty()
+                && ctp->pers3_m_sing.simplified().isEmpty()
+                && ctp->pers3_f_sing.simplified().isEmpty()
+                && ctp->pers3_n_sing.simplified().isEmpty()
+                && ctp->pers1_plur.simplified().isEmpty()
+                && ctp->pers2_plur.simplified().isEmpty()
+                && ctp->pers3_m_plur.simplified().isEmpty()
+                && ctp->pers3_f_plur.simplified().isEmpty()
+                && ctp->pers3_n_plur.simplified().isEmpty()
+           )
+            d->conjugations.removeAt( i );
+    }
+}
+
+
+bool KEduVocConjugation::isEmpty( int idx )
+{
+    if ( idx < d->conjugations.count() ) {
+        const Private::conjug_t *ctp = &d->conjugations[idx];
+        return ctp->pers1_sing.simplified().isEmpty()
+               && ctp->pers2_sing.simplified().isEmpty()
+               && ctp->pers3_m_sing.simplified().isEmpty()
+               && ctp->pers3_f_sing.simplified().isEmpty()
+               && ctp->pers3_n_sing.simplified().isEmpty()
+               && ctp->pers1_plur.simplified().isEmpty()
+               && ctp->pers2_plur.simplified().isEmpty()
+               && ctp->pers3_m_plur.simplified().isEmpty()
+               && ctp->pers3_f_plur.simplified().isEmpty()
+               && ctp->pers3_n_plur.simplified().isEmpty();
+    }
+    return true;
 }
 
 
@@ -311,75 +306,75 @@ bool KEduVocConjugation::isEmpty(int idx)
    return default;
 
 
-bool KEduVocConjugation::pers3SingularCommon(const QString &type) const
+bool KEduVocConjugation::pers3SingularCommon( const QString &type ) const
 {
-  _GET_CON_(s3common, type, false);
+    _GET_CON_( s3common, type, false );
 }
 
 
-bool KEduVocConjugation::pers3PluralCommon(const QString &type) const
+bool KEduVocConjugation::pers3PluralCommon( const QString &type ) const
 {
-  _GET_CON_(p3common, type, false);
+    _GET_CON_( p3common, type, false );
 }
 
 
-QString KEduVocConjugation::pers1Singular(const QString &type) const
+QString KEduVocConjugation::pers1Singular( const QString &type ) const
 {
-  _GET_CON_(pers1_sing, type, "");
+    _GET_CON_( pers1_sing, type, "" );
 }
 
 
-QString KEduVocConjugation::pers2Singular(const QString &type) const
+QString KEduVocConjugation::pers2Singular( const QString &type ) const
 {
-  _GET_CON_(pers2_sing, type, "");
+    _GET_CON_( pers2_sing, type, "" );
 }
 
 
-QString KEduVocConjugation::pers3FemaleSingular(const QString &type) const
+QString KEduVocConjugation::pers3FemaleSingular( const QString &type ) const
 {
-  _GET_CON_(pers3_f_sing, type, "");
+    _GET_CON_( pers3_f_sing, type, "" );
 }
 
 
-QString KEduVocConjugation::pers3MaleSingular(const QString &type) const
+QString KEduVocConjugation::pers3MaleSingular( const QString &type ) const
 {
-  _GET_CON_(pers3_m_sing, type, "");
+    _GET_CON_( pers3_m_sing, type, "" );
 }
 
 
-QString KEduVocConjugation::pers3NaturalSingular(const QString &type) const
+QString KEduVocConjugation::pers3NaturalSingular( const QString &type ) const
 {
-  _GET_CON_(pers3_n_sing, type, "");
+    _GET_CON_( pers3_n_sing, type, "" );
 }
 
 
-QString KEduVocConjugation::pers1Plural(const QString &type) const
+QString KEduVocConjugation::pers1Plural( const QString &type ) const
 {
-  _GET_CON_(pers1_plur, type, "");
+    _GET_CON_( pers1_plur, type, "" );
 }
 
 
-QString KEduVocConjugation::pers2Plural(const QString &type) const
+QString KEduVocConjugation::pers2Plural( const QString &type ) const
 {
-  _GET_CON_(pers2_plur, type, "");
+    _GET_CON_( pers2_plur, type, "" );
 }
 
 
-QString KEduVocConjugation::pers3FemalePlural(const QString &type) const
+QString KEduVocConjugation::pers3FemalePlural( const QString &type ) const
 {
-  _GET_CON_(pers3_f_plur, type, "");
+    _GET_CON_( pers3_f_plur, type, "" );
 }
 
 
-QString KEduVocConjugation::pers3MalePlural(const QString &type) const
+QString KEduVocConjugation::pers3MalePlural( const QString &type ) const
 {
-  _GET_CON_(pers3_m_plur, type, "");
+    _GET_CON_( pers3_m_plur, type, "" );
 }
 
 
-QString KEduVocConjugation::pers3NaturalPlural(const QString &type) const
+QString KEduVocConjugation::pers3NaturalPlural( const QString &type ) const
 {
-  _GET_CON_(pers3_n_plur, type, "");
+    _GET_CON_( pers3_n_plur, type, "" );
 }
 
 
@@ -398,75 +393,75 @@ QString KEduVocConjugation::pers3NaturalPlural(const QString &type) const
    d->conjugations.append(ct);
 
 
-void KEduVocConjugation::setPers3PluralCommon(const QString &type, bool f)
+void KEduVocConjugation::setPers3PluralCommon( const QString &type, bool f )
 {
-  _SET_CON_(p3common, type, f);
+    _SET_CON_( p3common, type, f );
 }
 
 
-void KEduVocConjugation::setPers3SingularCommon(const QString &type, bool f)
+void KEduVocConjugation::setPers3SingularCommon( const QString &type, bool f )
 {
-  _SET_CON_(s3common, type, f);
+    _SET_CON_( s3common, type, f );
 }
 
 
-void KEduVocConjugation::setPers1Singular(const QString &type, const QString &str)
+void KEduVocConjugation::setPers1Singular( const QString &type, const QString &str )
 {
-  _SET_CON_(pers1_sing, type, str);
+    _SET_CON_( pers1_sing, type, str );
 }
 
 
-void KEduVocConjugation::setPers2Singular(const QString &type, const QString &str)
+void KEduVocConjugation::setPers2Singular( const QString &type, const QString &str )
 {
-  _SET_CON_(pers2_sing, type, str);
+    _SET_CON_( pers2_sing, type, str );
 }
 
 
-void KEduVocConjugation::setPers3FemaleSingular(const QString &type, const QString &str)
+void KEduVocConjugation::setPers3FemaleSingular( const QString &type, const QString &str )
 {
-  _SET_CON_(pers3_f_sing, type, str);
+    _SET_CON_( pers3_f_sing, type, str );
 }
 
 
-void KEduVocConjugation::setPers3MaleSingular(const QString &type, const QString &str)
+void KEduVocConjugation::setPers3MaleSingular( const QString &type, const QString &str )
 {
-  _SET_CON_(pers3_m_sing, type, str);
+    _SET_CON_( pers3_m_sing, type, str );
 }
 
 
-void KEduVocConjugation::setPers3NaturalSingular(const QString &type, const QString &str)
+void KEduVocConjugation::setPers3NaturalSingular( const QString &type, const QString &str )
 {
-  _SET_CON_(pers3_n_sing, type, str);
+    _SET_CON_( pers3_n_sing, type, str );
 }
 
 
-void KEduVocConjugation::setPers1Plural(const QString &type, const QString &str)
+void KEduVocConjugation::setPers1Plural( const QString &type, const QString &str )
 {
-  _SET_CON_(pers1_plur, type, str);
+    _SET_CON_( pers1_plur, type, str );
 }
 
 
-void KEduVocConjugation::setPers2Plural(const QString &type, const QString &str)
+void KEduVocConjugation::setPers2Plural( const QString &type, const QString &str )
 {
-  _SET_CON_(pers2_plur, type, str);
+    _SET_CON_( pers2_plur, type, str );
 }
 
 
-void KEduVocConjugation::setPers3FemalePlural(const QString &type, const QString &str)
+void KEduVocConjugation::setPers3FemalePlural( const QString &type, const QString &str )
 {
-  _SET_CON_(pers3_f_plur, type, str);
+    _SET_CON_( pers3_f_plur, type, str );
 }
 
 
-void KEduVocConjugation::setPers3MalePlural(const QString &type, const QString &str)
+void KEduVocConjugation::setPers3MalePlural( const QString &type, const QString &str )
 {
-  _SET_CON_(pers3_m_plur, type, str);
+    _SET_CON_( pers3_m_plur, type, str );
 }
 
 
-void KEduVocConjugation::setPers3NaturalPlural(const QString &type, const QString &str)
+void KEduVocConjugation::setPers3NaturalPlural( const QString &type, const QString &str )
 {
-  _SET_CON_(pers3_n_plur, type, str);
+    _SET_CON_( pers3_n_plur, type, str );
 }
 
 #undef _SET_CON_
@@ -475,42 +470,41 @@ void KEduVocConjugation::setPers3NaturalPlural(const QString &type, const QStrin
 //==============================================================
 class KEduVocTenseRelation::Private
 {
-  public:
+public:
     QString shortId;
     QString longId;
 };
 
 KEduVocTenseRelation::KEduVocTenseRelation()
-: d(new Private)
-{
-}
+        : d( new Private )
+{}
 
-KEduVocTenseRelation::KEduVocTenseRelation (const QString & _short, const QString & _long)
-: d(new Private)
+KEduVocTenseRelation::KEduVocTenseRelation( const QString & _short, const QString & _long )
+        : d( new Private )
 {
-  d->shortId = _short;
-  d->longId = _long;
+    d->shortId = _short;
+    d->longId = _long;
 }
 
 KEduVocTenseRelation::~KEduVocTenseRelation()
 {
-  delete d;
+    delete d;
 }
 
-KEduVocTenseRelation &KEduVocTenseRelation::operator=(const KEduVocTenseRelation &other)
+KEduVocTenseRelation &KEduVocTenseRelation::operator= ( const KEduVocTenseRelation &other )
 {
-  d->shortId = other.shortStr();
-  d->longId = other.longStr();
-  return *this;
+    d->shortId = other.shortStr();
+    d->longId = other.longStr();
+    return *this;
 }
 
 QString KEduVocTenseRelation::shortStr() const
 {
-  return d->shortId;
+    return d->shortId;
 }
 
 QString KEduVocTenseRelation::longStr()  const
 {
-  return d->longId;
+    return d->longId;
 }
 
index b4490ad05f5392987da2e69dd34a1c5be62d63b2..92caa9a4e57e877a6c1f9fb8a0e379175ec27cfc 100644 (file)
 class KEDUVOCDOCUMENT_EXPORT KEduVocTenseRelation
 {
 public:
-  /** default constructor */
-  KEduVocTenseRelation();
-  KEduVocTenseRelation (const QString & _short, const QString & _long);
+    /** default constructor */
+    KEduVocTenseRelation();
+    KEduVocTenseRelation( const QString & _short, const QString & _long );
 
-  /** default destructor, deletes the d-pointer */
-  ~KEduVocTenseRelation();
+    /** default destructor, deletes the d-pointer */
+    ~KEduVocTenseRelation();
 
-  QString shortStr() const;
-  QString longStr()  const;
+    QString shortStr() const;
+    QString longStr()  const;
 
-  KEduVocTenseRelation &operator=(const KEduVocTenseRelation &other);
+    KEduVocTenseRelation &operator= ( const KEduVocTenseRelation &other );
 
 private:
-  class Private;
-  Private * const d;
+    class Private;
+    Private * const d;
 };
 
 
@@ -63,78 +63,78 @@ class KEDUVOCDOCUMENT_EXPORT KEduVocConjugation
 {
 public:
 
-  /**
-   * The constructor
-   */
-  explicit KEduVocConjugation();
+    /**
+     * The constructor
+     */
+    explicit KEduVocConjugation();
 
-  KEduVocConjugation(const KEduVocConjugation& rhs);
+    KEduVocConjugation( const KEduVocConjugation& rhs );
 
-  ~KEduVocConjugation();
+    ~KEduVocConjugation();
 
-  /**
-   * @return
-   */
-  int entryCount() const;
+    /**
+     * @return
+     */
+    int entryCount() const;
 
-  /**
-   * @return
-   */
+    /**
+     * @return
+     */
 //  static QList<KEduVocTenseRelation> getRelation();
 
-  /**
-   * @param names
-   */
-  static void setTenseNames(const QStringList& names);
-
-  static QString getName(const QString &abbrev);
-  static QString getName(int index);
-  static QString getAbbrev(const QString &name);
-  static QString getAbbrev(int index);
-  static int numInternalNames();
-  static int tenseCount();
-
-  QString getVerbName() const;
-
-  QString getType(int index);
-  void setType(int index, const QString & type);
-  void cleanUp();
-  bool isEmpty(int idx);
-
-  QString pers1Singular(const QString &type) const;
-  QString pers2Singular(const QString &type) const;
-  bool    pers3SingularCommon(const QString &type) const;
-  QString pers3FemaleSingular(const QString &type) const;
-  QString pers3MaleSingular(const QString &type) const;
-  QString pers3NaturalSingular(const QString &type) const;
-
-  QString pers1Plural(const QString &type) const;
-  QString pers2Plural(const QString &type) const;
-  bool    pers3PluralCommon(const QString &type) const;
-  QString pers3FemalePlural(const QString &type) const;
-  QString pers3MalePlural(const QString &type) const;
-  QString pers3NaturalPlural(const QString &type) const;
-
-  void setPers1Singular(const QString &type, const QString &str);
-  void setPers2Singular(const QString &type, const QString &str);
-  void setPers3SingularCommon(const QString &type, bool f);
-  void setPers3FemaleSingular(const QString &type, const QString &str);
-  void setPers3MaleSingular(const QString &type, const QString &str);
-  void setPers3NaturalSingular(const QString &type, const QString &str);
-
-  void setPers1Plural(const QString &type, const QString &str);
-  void setPers2Plural(const QString &type, const QString &str);
-  void setPers3PluralCommon(const QString &type, bool f);
-  void setPers3FemalePlural(const QString &type, const QString &str);
-  void setPers3MalePlural(const QString &type, const QString &str);
-  void setPers3NaturalPlural(const QString &type, const QString &str);
-
-  KEduVocConjugation& operator = (const KEduVocConjugation& a);
-  bool operator == (const KEduVocConjugation& a) const;
+    /**
+     * @param names
+     */
+    static void setTenseNames( const QStringList& names );
+
+    static QString getName( const QString &abbrev );
+    static QString getName( int index );
+    static QString getAbbrev( const QString &name );
+    static QString getAbbrev( int index );
+    static int numInternalNames();
+    static int tenseCount();
+
+    QString getVerbName() const;
+
+    QString getType( int index );
+    void setType( int index, const QString & type );
+    void cleanUp();
+    bool isEmpty( int idx );
+
+    QString pers1Singular( const QString &type ) const;
+    QString pers2Singular( const QString &type ) const;
+    bool    pers3SingularCommon( const QString &type ) const;
+    QString pers3FemaleSingular( const QString &type ) const;
+    QString pers3MaleSingular( const QString &type ) const;
+    QString pers3NaturalSingular( const QString &type ) const;
+
+    QString pers1Plural( const QString &type ) const;
+    QString pers2Plural( const QString &type ) const;
+    bool    pers3PluralCommon( const QString &type ) const;
+    QString pers3FemalePlural( const QString &type ) const;
+    QString pers3MalePlural( const QString &type ) const;
+    QString pers3NaturalPlural( const QString &type ) const;
+
+    void setPers1Singular( const QString &type, const QString &str );
+    void setPers2Singular( const QString &type, const QString &str );
+    void setPers3SingularCommon( const QString &type, bool f );
+    void setPers3FemaleSingular( const QString &type, const QString &str );
+    void setPers3MaleSingular( const QString &type, const QString &str );
+    void setPers3NaturalSingular( const QString &type, const QString &str );
+
+    void setPers1Plural( const QString &type, const QString &str );
+    void setPers2Plural( const QString &type, const QString &str );
+    void setPers3PluralCommon( const QString &type, bool f );
+    void setPers3FemalePlural( const QString &type, const QString &str );
+    void setPers3MalePlural( const QString &type, const QString &str );
+    void setPers3NaturalPlural( const QString &type, const QString &str );
+
+    KEduVocConjugation& operator = ( const KEduVocConjugation& a );
+    bool operator == ( const KEduVocConjugation& a ) const;
 
 private:
-  class Private;
-  Private* const d;
+    class Private;
+    Private* const d;
 };
 
 
index d8703be95f7149163bd23e95ced593795066f98d..24b679de0e374c41b24733322e6e127808bfbd8b 100644 (file)
 #include "keduvocdocument.h"
 #include "keduvocexpression.h"
 
-KEduVocCsvReader::KEduVocCsvReader(QIODevice *file)
+KEduVocCsvReader::KEduVocCsvReader( QIODevice *file )
 {
-  // the file must be already open
-  m_inputFile = file;
-  m_errorMessage = "";
+    // the file must be already open
+    m_inputFile = file;
+    m_errorMessage = "";
 }
 
 
-bool KEduVocCsvReader::readDoc(KEduVocDocument *doc)
+bool KEduVocCsvReader::readDoc( KEduVocDocument *doc )
 {
-  m_doc = doc;
+    m_doc = doc;
 
-  QString separator = m_doc->csvDelimiter();
+    QString separator = m_doc->csvDelimiter();
 
-  QTextStream inputStream(m_inputFile);
-  inputStream.setCodec("UTF-8");
-  inputStream.setAutoDetectUnicode(true);
-  inputStream.seek(0);
+    QTextStream inputStream( m_inputFile );
+    inputStream.setCodec( "UTF-8" );
+    inputStream.setAutoDetectUnicode( true );
+    inputStream.seek( 0 );
 
-  int languageCount = 0;
+    int languageCount = 0;
 
-  while (!inputStream.atEnd()) {
-    QString s = inputStream.readLine();
+    while ( !inputStream.atEnd() ) {
+        QString s = inputStream.readLine();
 
-    if (!s.simplified().isEmpty()) {
-      KEduVocExpression expression(s, separator);
-      languageCount = qMax(languageCount, expression.translationIndices().count());
-      m_doc->appendEntry(&expression);
+        if ( !s.simplified().isEmpty() ) {
+            KEduVocExpression expression( s, separator );
+            languageCount = qMax( languageCount, expression.translationIndices().count() );
+            m_doc->appendEntry( &expression );
+        }
     }
-  }
 
-  for (int j = 0; j < languageCount; j++)
-    if (j == 0)
-      m_doc->appendIdentifier(i18nc("@title:column the original language column", "Original"));
-    else
-      m_doc->appendIdentifier(i18nc("@title:column one of the translation columns", "Translation %1", j));
+    for ( int j = 0; j < languageCount; j++ )
+        if ( j == 0 )
+            m_doc->appendIdentifier( i18nc( "@title:column the original language column", "Original" ) );
+        else
+            m_doc->appendIdentifier( i18nc( "@title:column one of the translation columns", "Translation %1", j ) );
 
-  return true;
+    return true;
 }
index 1d7fb6f78a8f914a95dce0816db8728d431bd362..fc9613b7bcb9d66cbe0f1bbccaa9b086e7de97ec 100644 (file)
@@ -26,16 +26,19 @@ class KEduVocDocument;
 class KEduVocCsvReader
 {
 public:
-  KEduVocCsvReader(QIODevice *file);
+    KEduVocCsvReader( QIODevice *file );
 
-  bool readDoc(KEduVocDocument *doc);
+    bool readDoc( KEduVocDocument *doc );
 
-  QString errorMessage() const {return m_errorMessage;}
+    QString errorMessage() const
+    {
+        return m_errorMessage;
+    }
 
 private:
-  QIODevice *m_inputFile;
-  KEduVocDocument *m_doc;
-  QString m_errorMessage;
+    QIODevice *m_inputFile;
+    KEduVocDocument *m_doc;
+    QString m_errorMessage;
 };
 
 #endif
index 3f7a08d2f358914d74f7c82e2722993eb3391222..c7c62e18ba79f45ceb5a6dd27f24ec18c9721fef 100644 (file)
 #include "keduvocdocument.h"
 #include "keduvocexpression.h"
 
-KEduVocCsvWriter::KEduVocCsvWriter(QFile *file)
+KEduVocCsvWriter::KEduVocCsvWriter( QFile *file )
 {
-  // the file must be already open
-  m_outputFile = file;
+    // the file must be already open
+    m_outputFile = file;
 }
 
 
-bool KEduVocCsvWriter::writeDoc(KEduVocDocument *doc, const QString &generator)
+bool KEduVocCsvWriter::writeDoc( KEduVocDocument *doc, const QString &generator )
 {
-  Q_UNUSED(generator);
+    Q_UNUSED( generator );
 
-  m_doc = doc;
+    m_doc = doc;
 
-  QString separator = m_doc->csvDelimiter();;
+    QString separator = m_doc->csvDelimiter();
+    ;
 
-  QTextStream outputStream;
-  outputStream.setDevice(m_outputFile);
-  outputStream.setCodec("UTF-8");
+    QTextStream outputStream;
+    outputStream.setDevice( m_outputFile );
+    outputStream.setCodec( "UTF-8" );
 
-  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";
+    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();
-  QString currentRow;
+    KEduVocExpression *expression;
+    int idCount = m_doc->identifierCount();
+    QString currentRow;
 
-  for (int e = 0; e < m_doc->entryCount(); e++)
-  {
-    expression = m_doc->entry(e);
-    currentRow = "";
-    bool sep = false;
+    for ( int e = 0; e < m_doc->entryCount(); e++ ) {
+        expression = m_doc->entry( e );
+        currentRow = "";
+        bool sep = false;
 
-    for (int i = 0; i < idCount; i++) {
-      if (!sep)
-        sep = true;
-      else
-        currentRow += separator;
+        for ( int i = 0; i < idCount; i++ ) {
+            if ( !sep )
+                sep = true;
+            else
+                currentRow += separator;
 
-        currentRow += expression->translation(i).text();
-    }
+            currentRow += expression->translation( i ).text();
+        }
 
-    if (!currentRow.isEmpty())
-      outputStream << currentRow << "\n";
-  }
+        if ( !currentRow.isEmpty() )
+            outputStream << currentRow << "\n";
+    }
 
-  return true;
+    return true;
 }
 
index 286e77fc12e18e751880e155708a3b28f6c5d38e..ae004439ced17cf26b64089a2166f92474571d53 100644 (file)
@@ -25,13 +25,13 @@ class KEduVocDocument;
 class KEduVocCsvWriter
 {
 public:
-  KEduVocCsvWriter(QFile *file);
+    KEduVocCsvWriter( QFile *file );
 
-  bool writeDoc(KEduVocDocument *doc, const QString &generator);
+    bool writeDoc( KEduVocDocument *doc, const QString &generator );
 
 private:
-  QFile *m_outputFile;
-  KEduVocDocument *m_doc;
+    QFile *m_outputFile;
+    KEduVocDocument *m_doc;
 };
 
 #endif
index 87177e8073d1ca509e679b14cc5ddc34f0b2189a..505e905fc2c0a68e557d0177a53e7303f5e766be 100644 (file)
 class KEduVocDocument::KEduVocDocumentPrivate
 {
 public:
-  KEduVocDocumentPrivate(KEduVocDocument* qq)
-    : q(qq)
-  {
-    init();
-  }
-
-  void init();
-
-  KEduVocDocument* q;
-
-  bool                      m_dirty;
-  KUrl                      m_url;
-  QList<bool>               m_sortIdentifier;
-  bool                      m_sortLesson;
-
-  // save these to document
-  QStringList               m_identifiers;      //0= origin, 1,.. translations
-  int                       m_currentLesson;
-  QList<int>                m_extraSizeHints;
-  QList<int>                m_sizeHints;
-
-  QString                   m_generator;
-  QString                   m_queryorg;
-  QString                   m_querytrans;
-  QList<KEduVocExpression>  m_vocabulary;
-  QList<int>                m_lessonsInQuery;
-
-  QStringList               m_tenseDescriptions;
-  QSet<QString>             m_usages;
-  QString                   m_title;
-  QString                   m_author;
-  QString                   m_license;
-  QString                   m_remark;
-  QString                   m_version;
-  QString                   m_csvDelimiter;
-
-  /** Categories that can later be used to sork kvtml files:
-    * language, music, children, anatomy
-    */
-  QString                   m_category;
+    KEduVocDocumentPrivate( KEduVocDocument* qq )
+            : q( qq )
+    {
+        init();
+    }
 
-  QList<KEduVocArticle>     m_articles;
-  QList<KEduVocConjugation> m_conjugations;
+    void init();
 
-  // make this a map so removals don't require renumbering :)
-  QMap<int, KEduVocLesson*>            m_lessons;
+    KEduVocDocument* q;
 
-  KEduVocWordType*          m_wordTypes;
+    bool                      m_dirty;
+    KUrl                      m_url;
+    QList<bool>               m_sortIdentifier;
+    bool                      m_sortLesson;
 
-  LeitnerSystem*            m_leitnerSystem;
-  bool                      m_activeLeitnerSystem;
-};
+    // save these to document
+    QStringList               m_identifiers;      //0= origin, 1,.. translations
+    int                       m_currentLesson;
+    QList<int>                m_extraSizeHints;
+    QList<int>                m_sizeHints;
 
+    QString                   m_generator;
+    QString                   m_queryorg;
+    QString                   m_querytrans;
+    QList<KEduVocExpression>  m_vocabulary;
+    QList<int>                m_lessonsInQuery;
 
-void KEduVocDocument::KEduVocDocumentPrivate::init()
-{
-  m_lessons.clear();
-  m_articles.clear();
-  m_tenseDescriptions.clear();
-  m_identifiers.clear();
-  m_sortIdentifier.clear();
-  m_extraSizeHints.clear();
-  m_sizeHints.clear();
-  m_vocabulary.clear();
-  m_dirty = false;
-  m_sortLesson = false;
-  m_currentLesson = 0;
-  m_queryorg = "";
-  m_querytrans = "";
-  m_url.setFileName(i18n("Untitled"));
-  m_title = "";
-  m_author = "";
-  m_remark = "";
-  m_version = "";
-  m_generator = "";
-  m_csvDelimiter = QString('\t');
-  m_activeLeitnerSystem = false;
-  m_leitnerSystem = NULL;
+    QStringList               m_tenseDescriptions;
+    QSet<QString>             m_usages;
+    QString                   m_title;
+    QString                   m_author;
+    QString                   m_license;
+    QString                   m_remark;
+    QString                   m_version;
+    QString                   m_csvDelimiter;
 
-  m_wordTypes = new KEduVocWordType();
-}
+    /** Categories that can later be used to sork kvtml files:
+      * language, music, children, anatomy
+      */
+    QString                   m_category;
+
+    QList<KEduVocArticle>     m_articles;
+    QList<KEduVocConjugation> m_conjugations;
+
+    // make this a map so removals don't require renumbering :)
+    QMap<int, KEduVocLesson*>  m_lessons;
+
+    KEduVocWordType*          m_wordTypes;
+
+    LeitnerSystem*            m_leitnerSystem;
+    bool                      m_activeLeitnerSystem;
+};
 
 
-KEduVocDocument::KEduVocDocument(QObject *parent)
-  : QObject(parent), d(new KEduVocDocumentPrivate(this))
+void KEduVocDocument::KEduVocDocumentPrivate::init()
 {
-}
+    m_lessons.clear();
+    m_articles.clear();
+    m_tenseDescriptions.clear();
+    m_identifiers.clear();
+    m_sortIdentifier.clear();
+    m_extraSizeHints.clear();
+    m_sizeHints.clear();
+    m_vocabulary.clear();
+    m_dirty = false;
+    m_sortLesson = false;
+    m_currentLesson = 0;
+    m_queryorg = "";
+    m_querytrans = "";
+    m_url.setFileName( i18n( "Untitled" ) );
+    m_title = "";
+    m_author = "";
+    m_remark = "";
+    m_version = "";
+    m_generator = "";
+    m_csvDelimiter = QString( '\t' );
+    m_activeLeitnerSystem = false;
+    m_leitnerSystem = NULL;
+
+    m_wordTypes = new KEduVocWordType();
+}
+
+
+KEduVocDocument::KEduVocDocument( QObject *parent )
+        : QObject( parent ), d( new KEduVocDocumentPrivate( this ) )
+{}
 
 
 KEduVocDocument::~KEduVocDocument()
@@ -150,762 +149,741 @@ KEduVocDocument::~KEduVocDocument()
 }
 
 
-void KEduVocDocument::setModified(bool dirty)
+void KEduVocDocument::setModified( bool dirty )
 {
-  d->m_dirty = dirty;
-  emit docModified(d->m_dirty);
+    d->m_dirty = dirty;
+    emit docModified( d->m_dirty );
 }
 
 
-void KEduVocDocument::appendEntry(KEduVocExpression *expression)
+void KEduVocDocument::appendEntry( KEduVocExpression *expression )
 {
-  d->m_vocabulary.append(*expression);
-  setModified();
+    d->m_vocabulary.append( *expression );
+    setModified();
 }
 
 
-void KEduVocDocument::insertEntry(KEduVocExpression *expression, int index)
+void KEduVocDocument::insertEntry( KEduVocExpression *expression, int index )
 {
-  d->m_vocabulary.insert(index, *expression);
-  setModified();
+    d->m_vocabulary.insert( index, *expression );
+    setModified();
 }
 
 
-KEduVocDocument::FileType KEduVocDocument::detectFileType(const QString &fileName)
+KEduVocDocument::FileType KEduVocDocument::detectFileType( const QString &fileName )
 {
-  QIODevice * f = KFilterDev::deviceForFile(fileName);
-  if (!f->open(QIODevice::ReadOnly))
-    return Csv;
+    QIODevice * f = KFilterDev::deviceForFile( fileName );
+    if ( !f->open( QIODevice::ReadOnly ) )
+        return Csv;
 
-  QDataStream is(f);
+    QDataStream is( f );
 
-  qint8 c1, c2, c3, c4, c5;
-  is >> c1
+    qint8 c1, c2, c3, c4, c5;
+    is >> c1
     >> c2
     >> c3
     >> c4
     >> c5;  // guess filetype by first x bytes
 
-  QTextStream ts(f);
-  QString line;
-  QString line2;
-
-  line = ts.readLine();
-  if (!ts.atEnd())
-    line2 = ts.readLine();
-  line.prepend(c5);
-  line.prepend(c4);
-  line.prepend(c3);
-  line.prepend(c2);
-  line.prepend(c1);
-
-  if (!is.device()->isOpen())
-    return KvdNone;
-
-  f->close();
-  if (c1 == '<' && c2 == '?' && c3 == 'x' && c4 == 'm' && c5 == 'l') {
-    if (line2.indexOf("pauker", 0) >  0)
-      return Pauker;
-    else if (line2.indexOf("xdxf", 0) >  0)
-      return Xdxf;
-    else
-      return Kvtml;
-  }
+    QTextStream ts( f );
+    QString line;
+    QString line2;
+
+    line = ts.readLine();
+    if ( !ts.atEnd() )
+        line2 = ts.readLine();
+    line.prepend( c5 );
+    line.prepend( c4 );
+    line.prepend( c3 );
+    line.prepend( c2 );
+    line.prepend( c1 );
+
+    if ( !is.device()->isOpen() )
+        return KvdNone;
+
+    f->close();
+    if ( c1 == '<' && c2 == '?' && c3 == 'x' && c4 == 'm' && c5 == 'l' ) {
+        if ( line2.indexOf( "pauker", 0 ) >  0 )
+            return Pauker;
+        else if ( line2.indexOf( "xdxf", 0 ) >  0 )
+            return Xdxf;
+        else
+            return Kvtml;
+    }
 
-  if (line == WQL_IDENT)
-    return Wql;
+    if ( line == WQL_IDENT )
+        return Wql;
 
-  if (c1 == '"' && (line.contains('"') == 1 || line.contains(QRegExp("\",[0-9]"))))
-    return Vokabeln;
+    if ( c1 == '"' && ( line.contains( '"' ) == 1 || line.contains( QRegExp( "\",[0-9]" ) ) ) )
+        return Vokabeln;
 
-  return Csv;
+    return Csv;
 }
 
 
-bool KEduVocDocument::open(const KUrl& url)
+bool KEduVocDocument::open( const KUrl& url )
 {
-  d->init();
-  if (!url.isEmpty())
-    d->m_url = url;
+    d->init();
+    if ( !url.isEmpty() )
+        d->m_url = url;
 
-  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);
+    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 );
 
-    if (!f->open(QIODevice::ReadOnly))
-    {
-      KMessageBox::error(0, errorMessage);
-      return false;
-    }
+        if ( !f->open( QIODevice::ReadOnly ) ) {
+            KMessageBox::error( 0, errorMessage );
+            return false;
+        }
 
-    FileType ft = detectFileType(url.path());
+        FileType ft = detectFileType( url.path() );
 
-    switch (ft) {
-      case Kvtml:
-      {
-        KEduVocKvtml2Reader kvtmlReader(f);
-        read = kvtmlReader.readDoc(this);
-        if (!read)
-          errorMessage = kvtmlReader.errorMessage();
-      }
-      break;
-
-      case Wql:
-      {
-        KEduVocWqlReader wqlReader(f);
-        d->m_url.setFileName(i18n("Untitled"));
-        read = wqlReader.readDoc(this);
-        if (!read)
-          errorMessage = wqlReader.errorMessage();
-      }
-      break;
-
-      case Pauker:
-      {
-        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());
-      }
-      break;
-
-      case Vokabeln:
-      {
-        KEduVocVokabelnReader vokabelnReader(f);
-        d->m_url.setFileName(i18n("Untitled"));
-        read = vokabelnReader.readDoc(this);
-        if (!read)
-          errorMessage = vokabelnReader.errorMessage();
-      }
-      break;
-
-      case Csv:
-      {
-        KEduVocCsvReader csvReader(f);
-        read = csvReader.readDoc(this);
-        if (!read)
-          errorMessage = csvReader.errorMessage();
-      }
-      break;
-
-      case Xdxf:
-      {
-        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());
-      }
-      break;
-
-      default:
-      {
-        KEduVocKvtml2Reader kvtmlReader(f);
-        read = kvtmlReader.readDoc(this);
-        if (!read)
-          errorMessage = kvtmlReader.errorMessage();
-      }
-    }
+        switch ( ft ) {
+            case Kvtml: {
+                KEduVocKvtml2Reader kvtmlReader( f );
+                read = kvtmlReader.readDoc( this );
+                if ( !read )
+                    errorMessage = kvtmlReader.errorMessage();
+            }
+            break;
+
+            case Wql: {
+                KEduVocWqlReader wqlReader( f );
+                d->m_url.setFileName( i18n( "Untitled" ) );
+                read = wqlReader.readDoc( this );
+                if ( !read )
+                    errorMessage = wqlReader.errorMessage();
+            }
+            break;
+
+            case Pauker: {
+                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() );
+            }
+            break;
+
+            case Vokabeln: {
+                KEduVocVokabelnReader vokabelnReader( f );
+                d->m_url.setFileName( i18n( "Untitled" ) );
+                read = vokabelnReader.readDoc( this );
+                if ( !read )
+                    errorMessage = vokabelnReader.errorMessage();
+            }
+            break;
 
-    if (!read) {
-      QString msg = i18n("Could not open or properly read \"%1\"\n(Error reported: %2)", url.path(), errorMessage);
-      KMessageBox::error(0, msg, i18n("Error Opening File"));
-    }
+            case Csv: {
+                KEduVocCsvReader csvReader( f );
+                read = csvReader.readDoc( this );
+                if ( !read )
+                    errorMessage = csvReader.errorMessage();
+            }
+            break;
+
+            case Xdxf: {
+                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() );
+            }
+            break;
 
-    f->close();
-    KIO::NetAccess::removeTempFile(temporaryFile);
-  }
-  return read;
+            default: {
+                KEduVocKvtml2Reader kvtmlReader( f );
+                read = kvtmlReader.readDoc( this );
+                if ( !read )
+                    errorMessage = kvtmlReader.errorMessage();
+            }
+        }
+
+        if ( !read ) {
+            QString msg = i18n( "Could not open or properly read \"%1\"\n(Error reported: %2)", url.path(), errorMessage );
+            KMessageBox::error( 0, msg, i18n( "Error Opening File" ) );
+        }
+
+        f->close();
+        KIO::NetAccess::removeTempFile( temporaryFile );
+    }
+    return read;
 }
 
 
-bool KEduVocDocument::saveAs(const KUrl & url, FileType ft, const QString & generator)
+bool KEduVocDocument::saveAs( const KUrl & url, FileType ft, const QString & generator )
 {
-  KUrl tmp(url);
+    KUrl tmp( url );
 
-  if (ft == Automatic)
-  {
-    if (tmp.path().right(strlen("." KVTML_EXT)) == "." KVTML_EXT)
-      ft = Kvtml;
-    else if (tmp.path().right(strlen("." CSV_EXT)) == "." CSV_EXT)
-      ft = Csv;
-    else
-    {
-      return false;
+    if ( ft == Automatic ) {
+        if ( tmp.path().right( strlen( "." KVTML_EXT ) ) == "." KVTML_EXT )
+            ft = Kvtml;
+        else if ( tmp.path().right( strlen( "." CSV_EXT ) ) == "." CSV_EXT )
+            ft = Csv;
+        else {
+            return false;
+        }
     }
-  }
 
-  bool saved = false;
+    bool saved = false;
 
-  while (!saved)
-  {
-    QFile f(tmp.path());
+    while ( !saved ) {
+        QFile f( tmp.path() );
 
-    if (!f.open(QIODevice::WriteOnly))
-    {
-      KMessageBox::error(0, i18n("<qt>Cannot write to file<br /><b>%1</b></qt>", tmp.path()));
-      return false;
-    }
+        if ( !f.open( QIODevice::WriteOnly ) ) {
+            KMessageBox::error( 0, i18n( "<qt>Cannot write to file<br /><b>%1</b></qt>", tmp.path() ) );
+            return false;
+        }
 
-    switch (ft) {
-      case Kvtml: {
-               // write version 2 file
-        KEduVocKvtml2Writer kvtmlWriter(&f);
-        saved = kvtmlWriter.writeDoc(this, generator);
-      }
-      break;
-         case Kvtml1: {
-               // write old version 1 file
-               KEduVocKvtmlWriter kvtmlWriter(&f);
-               saved = kvtmlWriter.writeDoc(this, generator);
-           }
-               break;
-      case Csv: {
-        KEduVocCsvWriter csvWriter(&f);
-        saved = csvWriter.writeDoc(this, generator);
-      }
-      break;
-      default: {
-        kError() << "kvcotrainDoc::saveAs(): unknown filetype" << endl;
-      }
-      break;
-    }
-    f.close();
+        switch ( ft ) {
+            case Kvtml: {
+                // write version 2 file
+                KEduVocKvtml2Writer kvtmlWriter( &f );
+                saved = kvtmlWriter.writeDoc( this, generator );
+            }
+            break;
+            case Kvtml1: {
+                // write old version 1 file
+                KEduVocKvtmlWriter kvtmlWriter( &f );
+                saved = kvtmlWriter.writeDoc( this, generator );
+            }
+            break;
+            case Csv: {
+                KEduVocCsvWriter csvWriter( &f );
+                saved = csvWriter.writeDoc( this, generator );
+            }
+            break;
+            default: {
+                kError() << "kvcotrainDoc::saveAs(): unknown filetype" << endl;
+            }
+            break;
+        }
+        f.close();
 
-    if (!saved) {
-      QString msg = i18n("Could not save \"%1\"\nDo you want to try again?", tmp.path());
-      int result = KMessageBox::warningContinueCancel(0, msg, i18n("Error Saving File"), KGuiItem(i18n("&Retry")));
-      if (result == KMessageBox::Cancel)
-        return false;
+        if ( !saved ) {
+            QString msg = i18n( "Could not save \"%1\"\nDo you want to try again?", tmp.path() );
+            int result = KMessageBox::warningContinueCancel( 0, msg, i18n( "Error Saving File" ), KGuiItem( i18n( "&Retry" ) ) );
+            if ( result == KMessageBox::Cancel )
+                return false;
+        }
     }
-  }
-  d->m_url = tmp;
-  setModified(false);
-  return true;
+    d->m_url = tmp;
+    setModified( false );
+    return true;
 }
 
 
 
-void KEduVocDocument::merge(KEduVocDocument *docToMerge, bool matchIdentifiers)
+void KEduVocDocument::merge( KEduVocDocument *docToMerge, bool matchIdentifiers )
 {
     kDebug() << "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.
 
-/*
-  if (docToMerge) {
+    /*
+      if (docToMerge) {
 
-    QStringList new_names = docToMerge->lessonDescriptions();
+        QStringList new_names = docToMerge->lessonDescriptions();
 
-    QStringList new_types = docToMerge->typeDescriptions();
+        QStringList new_types = docToMerge->typeDescriptions();
 
-    QStringList new_tenses = docToMerge->tenseDescriptions();
+        QStringList new_tenses = docToMerge->tenseDescriptions();
 
-    QList<int> old_in_query = lessonsInQuery();
-    QList<int> new_in_query = docToMerge->lessonsInQuery();
+        QList<int> old_in_query = lessonsInQuery();
+        QList<int> new_in_query = docToMerge->lessonsInQuery();
 
-    QStringList new_usages = docToMerge->usageDescriptions();
+        QStringList new_usages = docToMerge->usageDescriptions();
 
-    int lesson_offset = d->m_lessonDescriptions.count();
-    for (int i = 0; i < new_names.count(); i++) {
-      d->m_lessonDescriptions.append(new_names[i]);
-    }
+        int lesson_offset = d->m_lessonDescriptions.count();
+        for (int i = 0; i < new_names.count(); i++) {
+          d->m_lessonDescriptions.append(new_names[i]);
+        }
 
-    for (int i = 0; i < new_in_query.count(); i++)
-      old_in_query.append(new_in_query[i] + lesson_offset);
-    setLessonsInQuery(old_in_query);
+        for (int i = 0; i < new_in_query.count(); i++)
+          old_in_query.append(new_in_query[i] + lesson_offset);
+        setLessonsInQuery(old_in_query);
 
-    int types_offset = d->m_typeDescriptions.count();
-    for (int i = 0; i < new_types.count(); i++) {
-      d->m_typeDescriptions.append(new_types[i]);
-    }
-
-    int tenses_offset = d->m_tenseDescriptions.count();
-    for (int i = 0; i < new_tenses.count(); i++) {
-      d->m_tenseDescriptions.append(new_tenses[i]);
-    }
+        int types_offset = d->m_typeDescriptions.count();
+        for (int i = 0; i < new_types.count(); i++) {
+          d->m_typeDescriptions.append(new_types[i]);
+        }
 
-    int usages_offset = d->m_usageDescriptions.count();
-    for (int i = 0; i < new_usages.count(); i++) {
-      d->m_usageDescriptions.append(new_usages[i]);
-    }
+        int tenses_offset = d->m_tenseDescriptions.count();
+        for (int i = 0; i < new_tenses.count(); i++) {
+          d->m_tenseDescriptions.append(new_tenses[i]);
+        }
 
-    bool equal = true;
-    if (originalIdentifier() != docToMerge->originalIdentifier())
-      equal = false;
-    for (int i = 1; i < identifierCount(); i++)
-      if (identifier(i) != docToMerge->identifier(i))
-        equal = false;
+        int usages_offset = d->m_usageDescriptions.count();
+        for (int i = 0; i < new_usages.count(); i++) {
+          d->m_usageDescriptions.append(new_usages[i]);
+        }
 
-    if (!matchIdentifiers)
-      equal = true; ///@todo massive cheating, problem if docToMerge has more identifiers than this
+        bool equal = true;
+        if (originalIdentifier() != docToMerge->originalIdentifier())
+          equal = false;
+        for (int i = 1; i < identifierCount(); i++)
+          if (identifier(i) != docToMerge->identifier(i))
+            equal = false;
 
-    if (equal) {   // easy way: same language codes, just append
+        if (!matchIdentifiers)
+          equal = true; ///@todo massive cheating, problem if docToMerge has more identifiers than this
 
-      for (int i = 0; i < docToMerge->entryCount(); i++) {
-        KEduVocExpression *expr = docToMerge->entry(i);
+        if (equal) {   // easy way: same language codes, just append
 
-        expr->setLesson(expr->lesson() + lesson_offset);
+          for (int i = 0; i < docToMerge->entryCount(); i++) {
+            KEduVocExpression *expr = docToMerge->entry(i);
 
-        for (int lang = 0; lang <= expr->translationCount(); lang++) {
-          QString t = expr->translation(lang).type();
-          // adjust type offset
-          if (!t.isEmpty() && t.left(1) == QM_USER_TYPE) {
-            QString t2;
-            t.remove(0, 1);
-            t2.setNum(t.toInt() + types_offset);
-            t2.prepend(QM_USER_TYPE);
-            expr->translation(lang).setType (t2);
-          }
+            expr->setLesson(expr->lesson() + lesson_offset);
 
-          t = expr->translation(lang).usageLabel();
-          // adjust usage offset
-          QString tg;
-          if (!t.isEmpty()) {
-            QString t2;
-            while (t.left(strlen(":")) == UL_USER_USAGE) {
-              QString n;
-              t.remove(0, 1);
-              int next;
-              if ((next = t.indexOf(":")) >= 0) {
-                n = t.left(next);
-                t.remove(0, next + 1);
+            for (int lang = 0; lang <= expr->translationCount(); lang++) {
+              QString t = expr->translation(lang).type();
+              // adjust type offset
+              if (!t.isEmpty() && t.left(1) == QM_USER_TYPE) {
+                QString t2;
+                t.remove(0, 1);
+                t2.setNum(t.toInt() + types_offset);
+                t2.prepend(QM_USER_TYPE);
+                expr->translation(lang).setType (t2);
               }
-              else {
-                n = t;
-                t = "";
+
+              t = expr->translation(lang).usageLabel();
+              // adjust usage offset
+              QString tg;
+              if (!t.isEmpty()) {
+                QString t2;
+                while (t.left(strlen(":")) == UL_USER_USAGE) {
+                  QString n;
+                  t.remove(0, 1);
+                  int next;
+                  if ((next = t.indexOf(":")) >= 0) {
+                    n = t.left(next);
+                    t.remove(0, next + 1);
+                  }
+                  else {
+                    n = t;
+                    t = "";
+                  }
+
+                  t2.setNum(n.toInt() + usages_offset);
+                  t2.prepend(UL_USER_USAGE);
+                  if (tg.length() == 0)
+                    tg = t2;
+                  else
+                    tg += ':' + t2;
+                }
+
+                if (tg.length() == 0)
+                  tg = t;
+                else if (t.length() != 0)
+                  tg += ':' + t;
+
+                expr->translation(lang).setUsageLabel (tg);
               }
 
-              t2.setNum(n.toInt() + usages_offset);
-              t2.prepend(UL_USER_USAGE);
-              if (tg.length() == 0)
-                tg = t2;
-              else
-                tg += ':' + t2;
+              KEduVocConjugation conj = expr->translation(lang).conjugation();
+              bool condirty = false;
+              for (int ci = 0; ci < conj.entryCount(); ci++) {
+                t = conj.getType(ci);
+                if (!t.isEmpty() && t.left(1) == UL_USER_TENSE) {
+                  t.remove(0, strlen(UL_USER_TENSE));
+                  QString t2;
+                  t2.setNum(t.toInt() + tenses_offset);
+                  t2.prepend(UL_USER_TENSE);
+                  conj.setType(ci, t2);
+                  condirty = true;
+                }
+                if (condirty)
+                  expr->translation(lang).setConjugation(conj);
+              }
             }
 
-            if (tg.length() == 0)
-              tg = t;
-            else if (t.length() != 0)
-              tg += ':' + t;
-
-            expr->translation(lang).setUsageLabel (tg);
-          }
-
-          KEduVocConjugation conj = expr->translation(lang).conjugation();
-          bool condirty = false;
-          for (int ci = 0; ci < conj.entryCount(); ci++) {
-            t = conj.getType(ci);
-            if (!t.isEmpty() && t.left(1) == UL_USER_TENSE) {
-              t.remove(0, strlen(UL_USER_TENSE));
-              QString t2;
-              t2.setNum(t.toInt() + tenses_offset);
-              t2.prepend(UL_USER_TENSE);
-              conj.setType(ci, t2);
-              condirty = true;
-            }
-            if (condirty)
-              expr->translation(lang).setConjugation(conj);
+            appendEntry(expr);
           }
+          setModified();
         }
+        else { // hard way: move entries around, most attributes get lost
+          QList<int> move_matrix;
+          QList<bool> cs_equal;
+          QString s;
+
+          for (int i = 0; i < qMax (identifierCount(), docToMerge->identifierCount()); i++)
+            cs_equal.append(false);
+
+          move_matrix.append(docToMerge->indexOfIdentifier(originalIdentifier()));
+          for (int i = 1; i < identifierCount(); i++)
+            move_matrix.append(docToMerge->indexOfIdentifier(identifier(i)));
+
+          for (int j = 0; j < docToMerge->entryCount(); j++) {
+            KEduVocExpression new_expr;
+            KEduVocExpression *expr = docToMerge->entry(j);
+            new_expr.setLesson(expr->lesson()+lesson_offset);
+
+            for (int i = 0; i < move_matrix.count(); i++) {
+              int lpos = move_matrix[i];
+              if (lpos >= 0) {
+
+                if (lpos == 0)
+                  s = expr->original();
+                else
+                  s = expr->translation(lpos);
+
+                if (!cs_equal[lpos]) {
+                  cs_equal[lpos] = true;
+                  QString id = lpos == 0 ? originalIdentifier() : identifier(lpos);
+                }
+
+                if (i == 0)
+                  new_expr.setOriginal(s);
+                else
+                  new_expr.setTranslation(i, s);
+                QString r = expr->remark(lpos);
+                new_expr.setRemark (i, r);
+
+                QString t = expr->type(lpos);
+                if (!t.isEmpty() && t.left(1) == QM_USER_TYPE) {
+                  QString t2;
+                  t.remove(0, 1);
+                  t2.setNum(t.toInt() + types_offset);
+                  t2.prepend(QM_USER_TYPE);
+                  new_expr.setType(i, t2);
+                }
+
+                t = expr->usageLabel(lpos);
+                if (!t.isEmpty() && t.left(1) == QM_USER_TYPE) {
+                  QString t2;
+                  t.remove(0, 1);
+                  t2.setNum(t.toInt() + usages_offset);
+                  t2.prepend(QM_USER_TYPE);
+                  new_expr.setUsageLabel(i, t2);
+                }
+
+                KEduVocConjugation 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) {
+                    t.remove (0, strlen(QM_USER_TYPE));
+                    QString t2;
+                    t2.setNum(t.toInt() + tenses_offset);
+                    t2.prepend(QM_USER_TYPE);
+                    conj.setType(ci, t2);
+                  }
+                }
 
-        appendEntry(expr);
-      }
-      setModified();
-    }
-    else { // hard way: move entries around, most attributes get lost
-      QList<int> move_matrix;
-      QList<bool> cs_equal;
-      QString s;
-
-      for (int i = 0; i < qMax (identifierCount(), docToMerge->identifierCount()); i++)
-        cs_equal.append(false);
-
-      move_matrix.append(docToMerge->indexOfIdentifier(originalIdentifier()));
-      for (int i = 1; i < identifierCount(); i++)
-        move_matrix.append(docToMerge->indexOfIdentifier(identifier(i)));
-
-      for (int j = 0; j < docToMerge->entryCount(); j++) {
-        KEduVocExpression new_expr;
-        KEduVocExpression *expr = docToMerge->entry(j);
-        new_expr.setLesson(expr->lesson()+lesson_offset);
-
-        for (int i = 0; i < move_matrix.count(); i++) {
-          int lpos = move_matrix[i];
-          if (lpos >= 0) {
-
-            if (lpos == 0)
-              s = expr->original();
-            else
-              s = expr->translation(lpos);
-
-            if (!cs_equal[lpos]) {
-              cs_equal[lpos] = true;
-              QString id = lpos == 0 ? originalIdentifier() : identifier(lpos);
-            }
-
-            if (i == 0)
-              new_expr.setOriginal(s);
-            else
-              new_expr.setTranslation(i, s);
-            QString r = expr->remark(lpos);
-            new_expr.setRemark (i, r);
-
-            QString t = expr->type(lpos);
-            if (!t.isEmpty() && t.left(1) == QM_USER_TYPE) {
-              QString t2;
-              t.remove(0, 1);
-              t2.setNum(t.toInt() + types_offset);
-              t2.prepend(QM_USER_TYPE);
-              new_expr.setType(i, t2);
-            }
-
-            t = expr->usageLabel(lpos);
-            if (!t.isEmpty() && t.left(1) == QM_USER_TYPE) {
-              QString t2;
-              t.remove(0, 1);
-              t2.setNum(t.toInt() + usages_offset);
-              t2.prepend(QM_USER_TYPE);
-              new_expr.setUsageLabel(i, t2);
-            }
-
-            KEduVocConjugation 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) {
-                t.remove (0, strlen(QM_USER_TYPE));
-                QString t2;
-                t2.setNum(t.toInt() + tenses_offset);
-                t2.prepend(QM_USER_TYPE);
-                conj.setType(ci, t2);
               }
             }
-
+            // only append if entries are used
+            bool used = !new_expr.original().isEmpty();
+            for (int i = 1; i < identifierCount(); i++)
+              if (!new_expr.translation(i).isEmpty())
+                used = true;
+
+            if (used) {
+              appendEntry(&new_expr);
+              setModified();
+            }
           }
         }
-        // only append if entries are used
-        bool used = !new_expr.original().isEmpty();
-        for (int i = 1; i < identifierCount(); i++)
-          if (!new_expr.translation(i).isEmpty())
-            used = true;
-
-        if (used) {
-          appendEntry(&new_expr);
-          setModified();
-        }
       }
-    }
-  }
-*/
+    */
 }
 
 
-KEduVocExpression *KEduVocDocument::entry(int index)
+KEduVocExpression *KEduVocDocument::entry( int index )
 {
-  if (index < 0 || index >= d->m_vocabulary.size() )
-    return 0;
-  else
-    return &d->m_vocabulary[index];
+    if ( index < 0 || index >= d->m_vocabulary.size() )
+        return 0;
+    else
+        return &d->m_vocabulary[index];
 }
 
 
-void KEduVocDocument::removeEntry(int index)
+void KEduVocDocument::removeEntry( int index )
 {
-  if (index >= 0 && index < d->m_vocabulary.size() )
-    d->m_vocabulary.removeAt( index );
+    if ( index >= 0 && index < d->m_vocabulary.size() )
+        d->m_vocabulary.removeAt( index );
 }
 
 
-int KEduVocDocument::indexOfIdentifier(const QString &lang) const
+int KEduVocDocument::indexOfIdentifier( const QString &lang ) const
 {
-  QStringList::const_iterator first = d->m_identifiers.begin();
-  int count = 0;
-  while (first != d->m_identifiers.end()) {
-    if (*first == lang)
-      return count;
-    first++;
-    count++;
-  }
-  return -1;
+    QStringList::const_iterator first = d->m_identifiers.begin();
+    int count = 0;
+    while ( first != d->m_identifiers.end() ) {
+        if ( *first == lang )
+            return count;
+        first++;
+        count++;
+    }
+    return -1;
 }
 
 
-QString KEduVocDocument::identifier(int index) const
+QString KEduVocDocument::identifier( int index ) const
 {
-  if (index >= d->m_identifiers.size() || index < 0 )
-    return "";
-  else
-    return d->m_identifiers[index];
+    if ( index >= d->m_identifiers.size() || index < 0 )
+        return "";
+    else
+        return d->m_identifiers[index];
 }
 
 
-void KEduVocDocument::setIdentifier(int idx, const QString &id)
+void KEduVocDocument::setIdentifier( int idx, const QString &id )
 {
-  if (idx < d->m_identifiers.size() && idx >= 0 ) {
-    d->m_identifiers[idx] = id;
-  }
+    if ( idx < d->m_identifiers.size() && idx >= 0 ) {
+        d->m_identifiers[idx] = id;
+    }
 }
 
 
-QString KEduVocDocument::tenseName(int index) const
+QString KEduVocDocument::tenseName( int index ) const
 {
-  if (index >= d->m_tenseDescriptions.size())
-    return "";
-  else
-    return d->m_tenseDescriptions[index];
+    if ( index >= d->m_tenseDescriptions.size() )
+        return "";
+    else
+        return d->m_tenseDescriptions[index];
 }
 
 
-void KEduVocDocument::setTenseName(int idx, QString &id)
+void KEduVocDocument::setTenseName( int idx, QString &id )
 {
-  if (idx >= d->m_tenseDescriptions.size())
-    for (int i = d->m_tenseDescriptions.size(); i <= idx; i++)
-      d->m_tenseDescriptions.append ("");
+    if ( idx >= d->m_tenseDescriptions.size() )
+        for ( int i = d->m_tenseDescriptions.size(); i <= idx; i++ )
+            d->m_tenseDescriptions.append( "" );
 
-  d->m_tenseDescriptions[idx] = id;
+    d->m_tenseDescriptions[idx] = id;
 }
 
 
 QStringList KEduVocDocument::tenseDescriptions() const
 {
-  return d->m_tenseDescriptions;
+    return d->m_tenseDescriptions;
 }
 
 
-void KEduVocDocument::setTenseDescriptions(const QStringList &names)
+void KEduVocDocument::setTenseDescriptions( const QStringList &names )
 {
-  d->m_tenseDescriptions = names;
+    d->m_tenseDescriptions = names;
 }
 
 
-void KEduVocDocument::setConjugation(int idx, const KEduVocConjugation &con)
+void KEduVocDocument::setConjugation( int idx, const KEduVocConjugation &con )
 {
-  if ( idx < 0) return;
+    if ( idx < 0 ) return;
 
-  // extend conjugation with empty elements
-  if (d->m_conjugations.size() <= idx )
-    for (int i = d->m_conjugations.size(); i < idx+1; i++)
-      d->m_conjugations.append (KEduVocConjugation());
+    // extend conjugation with empty elements
+    if ( d->m_conjugations.size() <= idx )
+        for ( int i = d->m_conjugations.size(); i < idx+1; i++ )
+            d->m_conjugations.append( KEduVocConjugation() );
 
-  d->m_conjugations[idx] = con;
+    d->m_conjugations[idx] = con;
 }
 
 
 int KEduVocDocument::conjugationCount() const
 {
-  return d->m_conjugations.count();
+    return d->m_conjugations.count();
 }
 
 
-KEduVocConjugation KEduVocDocument::conjugation (int idx) const
+KEduVocConjugation KEduVocDocument::conjugation( int idx ) const
 {
-  if (idx >= d->m_conjugations.size() || idx < 0) {
-    return KEduVocConjugation();
-  }
-  else {
-    return d->m_conjugations[idx];
-  }
+    if ( idx >= d->m_conjugations.size() || idx < 0 ) {
+        return KEduVocConjugation();
+    } else {
+        return d->m_conjugations[idx];
+    }
 }
 
 
-void KEduVocDocument::setArticle(int idx, const KEduVocArticle &art)
+void KEduVocDocument::setArticle( int idx, const KEduVocArticle &art )
 {
-  if ( idx < 0) return;
+    if ( idx < 0 ) return;
 
-  // extend conjugation with empty elements
-  if (d->m_articles.size() <= idx )
-    for (int i = d->m_articles.size(); i < idx+1; i++)
-      d->m_articles.append (KEduVocArticle());
+    // extend conjugation with empty elements
+    if ( d->m_articles.size() <= idx )
+        for ( int i = d->m_articles.size(); i < idx+1; i++ )
+            d->m_articles.append( KEduVocArticle() );
 
-  d->m_articles[idx] = art;
+    d->m_articles[idx] = art;
 }
 
 
-KEduVocArticle KEduVocDocument::article (int idx) const
+KEduVocArticle KEduVocDocument::article( int idx ) const
 {
-  if (idx >= d->m_articles.size() || idx < 0) {
-    return KEduVocArticle();
-  }
-  else {
-    return d->m_articles[idx];
-  }
+    if ( idx >= d->m_articles.size() || idx < 0 ) {
+        return KEduVocArticle();
+    } else {
+        return d->m_articles[idx];
+    }
 }
 
 
 int KEduVocDocument::articleCount() const
 {
-  return d->m_articles.count();
+    return d->m_articles.count();
 }
 
 
-int KEduVocDocument::sizeHint (int idx) const
+int KEduVocDocument::sizeHint( int idx ) const
 {
-  if (idx < 0) {
-    idx = -idx;
-    if (idx >= d->m_extraSizeHints.size() )
-      return 80; // make a good guess about column size
-    else {
+    if ( idx < 0 ) {
+        idx = -idx;
+        if ( idx >= d->m_extraSizeHints.size() )
+            return 80; // make a good guess about column size
+        else {
 //      cout << "gsh " << idx << "  " << extraSizehints[idx] << endl;
-      return d->m_extraSizeHints[idx];
-    }
-  }
-  else {
-    if (idx >= d->m_sizeHints.size() )
-      return 150; // make a good guess about column size
-    else {
+            return d->m_extraSizeHints[idx];
+        }
+    } else {
+        if ( idx >= d->m_sizeHints.size() )
+            return 150; // make a good guess about column size
+        else {
 //      cout << "gsh " << idx << "  " << sizehints[idx] << endl;
-      return d->m_sizeHints[idx];
+            return d->m_sizeHints[idx];
+        }
     }
-  }
 }
 
 
-void KEduVocDocument::setSizeHint (int idx, const int width)
+void KEduVocDocument::setSizeHint( int idx, const int width )
 {
 //  cout << "ssh " << idx << "  " << width << endl;
-  if (idx < 0) {
-    idx = -idx;
-    if (idx >= d->m_extraSizeHints.size()) {
-      for (int i = d->m_extraSizeHints.size(); i <= idx; i++)
-        d->m_extraSizeHints.append (80);
-    }
-    d->m_extraSizeHints[idx] = width;
+    if ( idx < 0 ) {
+        idx = -idx;
+        if ( idx >= d->m_extraSizeHints.size() ) {
+            for ( int i = d->m_extraSizeHints.size(); i <= idx; i++ )
+                d->m_extraSizeHints.append( 80 );
+        }
+        d->m_extraSizeHints[idx] = width;
 
-  }
-  else {
-    if (idx >= d->m_sizeHints.size()) {
-      for (int i = d->m_sizeHints.size(); i <= idx; i++)
-        d->m_sizeHints.append (150);
+    } else {
+        if ( idx >= d->m_sizeHints.size() ) {
+            for ( int i = d->m_sizeHints.size(); i <= idx; i++ )
+                d->m_sizeHints.append( 150 );
+        }
+        d->m_sizeHints[idx] = width;
     }
-    d->m_sizeHints[idx] = width;
-  }
 }
 
 
-void KEduVocDocument::removeIdentifier(int index)
+void KEduVocDocument::removeIdentifier( int index )
 {
-  if (index < d->m_identifiers.size() && index >= 1 )
-  {
-    d->m_identifiers.removeAt(index);
-    for (int i = 0; i < d->m_vocabulary.count(); i++)
-      d->m_vocabulary[i].removeTranslation(index);
-  }
+    if ( index < d->m_identifiers.size() && index >= 1 ) {
+        d->m_identifiers.removeAt( index );
+        for ( int i = 0; i < d->m_vocabulary.count(); i++ )
+            d->m_vocabulary[i].removeTranslation( index );
+    }
 }
 
 
 QString KEduVocDocument::originalIdentifier() const
 {
-  if (d->m_identifiers.size() > 0)
-    return d->m_identifiers[0];
-  else
-    return "";
+    if ( d->m_identifiers.size() > 0 )
+        return d->m_identifiers[0];
+    else
+        return "";
 }
 
 
-void KEduVocDocument::setOriginalIdentifier(const QString &id)
+void KEduVocDocument::setOriginalIdentifier( const QString &id )
 {
-  if (d->m_identifiers.size() > 0) {
-    d->m_identifiers[0] = id;
-  }
+    if ( d->m_identifiers.size() > 0 ) {
+        d->m_identifiers[0] = id;
+    }
 }
 
 
 bool KEduVocDocument::isModified() const
 {
-  return d->m_dirty;
+    return d->m_dirty;
 }
 
 
 bool KEduVocDocument::leitnerSystemActive()
 {
-  return d->m_activeLeitnerSystem;
+    return d->m_activeLeitnerSystem;
 }
 
 void KEduVocDocument::setLeitnerSystemActive( bool yes )
 {
-       if( yes )
-       {
-               if (d->m_leitnerSystem == 0)
-                       createStandardLeitnerSystem(); //if nothing is loaded yet
+    if ( yes ) {
+        if ( d->m_leitnerSystem == 0 )
+            createStandardLeitnerSystem(); //if nothing is loaded yet
 
-               d->m_activeLeitnerSystem = true;
-       }
-       else if( !yes )
-               d->m_activeLeitnerSystem = false;
+        d->m_activeLeitnerSystem = true;
+    } else if ( !yes )
+        d->m_activeLeitnerSystem = false;
 }
 
 void KEduVocDocument::createStandardLeitnerSystem()
 {
-       LeitnerSystem* tmpSystem = new LeitnerSystem();
-       QString name = "Standard";
+    LeitnerSystem* tmpSystem = new LeitnerSystem();
+    QString name = "Standard";
 
-       tmpSystem->setSystemName( name );
-       tmpSystem->insertBox( "Box 1" );
-       tmpSystem->insertBox( "Box 2" );
-       tmpSystem->insertBox( "Box 3" );
-       tmpSystem->insertBox( "Box 4" );
-       tmpSystem->insertBox( "Box 5" );
+    tmpSystem->setSystemName( name );
+    tmpSystem->insertBox( "Box 1" );
+    tmpSystem->insertBox( "Box 2" );
+    tmpSystem->insertBox( "Box 3" );
+    tmpSystem->insertBox( "Box 4" );
+    tmpSystem->insertBox( "Box 5" );
 
-       tmpSystem->setCorrectBox( "Box 1", "Box 2" );
-       tmpSystem->setWrongBox( "Box 1", "Box 1" );
+    tmpSystem->setCorrectBox( "Box 1", "Box 2" );
+    tmpSystem->setWrongBox( "Box 1", "Box 1" );
 
-       tmpSystem->setCorrectBox( "Box 2", "Box 3" );
-       tmpSystem->setWrongBox( "Box 2", "Box 1" );
+    tmpSystem->setCorrectBox( "Box 2", "Box 3" );
+    tmpSystem->setWrongBox( "Box 2", "Box 1" );
 
-       tmpSystem->setCorrectBox( "Box 3", "Box 4" );
-       tmpSystem->setWrongBox( "Box 3", "Box 1" );
+    tmpSystem->setCorrectBox( "Box 3", "Box 4" );
+    tmpSystem->setWrongBox( "Box 3", "Box 1" );
 
-       tmpSystem->setCorrectBox( "Box 4", "Box 5" );
-       tmpSystem->setWrongBox( "Box 4", "Box 1" );
+    tmpSystem->setCorrectBox( "Box 4", "Box 5" );
+    tmpSystem->setWrongBox( "Box 4", "Box 1" );
 
-       tmpSystem->setCorrectBox( "Box 5", "Box 1" );
-       tmpSystem->setWrongBox( "Box 5", "Box 1" );
+    tmpSystem->setCorrectBox( "Box 5", "Box 1" );
+    tmpSystem->setWrongBox( "Box 5", "Box 1" );
 
-       d->m_leitnerSystem = tmpSystem;
+    d->m_leitnerSystem = tmpSystem;
 }
 
 void KEduVocDocument::setLeitnerSystem( LeitnerSystem* system )
 {
-  d->m_leitnerSystem = system;
+    d->m_leitnerSystem = system;
 }
 
 LeitnerSystem* KEduVocDocument::leitnerSystem()
 {
-  return d->m_leitnerSystem;
+    return d->m_leitnerSystem;
 }
 
 
 int KEduVocDocument::entryCount() const
 {
-  return d->m_vocabulary.count();
+    return d->m_vocabulary.count();
 }
 
 
-void KEduVocDocument::resetEntry(int index, int lesson)
+void KEduVocDocument::resetEntry( int index, int lesson )
 {
-  for (int i = 0; i < d->m_vocabulary.count(); i++)
-    if (/*lesson == 0 ||*/ lesson == d->m_vocabulary[i].lesson())
-    {
-        // index is the translation number whose grades are reset
-        d->m_vocabulary[i].resetGrades(index);
-    }
+    for ( int i = 0; i < d->m_vocabulary.count(); i++ )
+        if ( /*lesson == 0 ||*/ lesson == d->m_vocabulary[i].lesson() ) {
+            // index is the translation number whose grades are reset
+            d->m_vocabulary[i].resetGrades( index );
+        }
 }
 
 
 int KEduVocDocument::identifierCount() const
 {
-  return d->m_identifiers.count();  // number of translations
+    return d->m_identifiers.count();  // number of translations
 }
 
-int KEduVocDocument::appendIdentifier(const QString & id)
+int KEduVocDocument::appendIdentifier( const QString & id )
 {
-  d->m_identifiers.append(id);
-  return d->m_identifiers.size() - 1;
+    d->m_identifiers.append( id );
+    return d->m_identifiers.size() - 1;
 }
 
 //QString KEduVocDocument::lessonDescription(int idx) const
@@ -925,37 +903,34 @@ int KEduVocDocument::appendIdentifier(const QString & id)
 //}
 
 
-int KEduVocDocument::addLesson(const QString &lessonName, int position)
+int KEduVocDocument::addLesson( const QString &lessonName, int position )
 {
-  if (position == -1)
-  {
-    // no position was specified, so put it wherever there's a slot
-    position = 1;
-    while (d->m_lessons.contains(position))
-    {
-      ++position;
+    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;
+    KEduVocLesson *lesson = new KEduVocLesson;
+    lesson->setDescription( lessonName );
+    d->m_lessons.insert( position, lesson );
+    return position;
 }
 
 QMap<int, KEduVocLesson *> KEduVocDocument::lessons() const
 {
-  return d->m_lessons;
+    return d->m_lessons;
 }
 
-KEduVocLesson * KEduVocDocument::lesson(int index)
+KEduVocLesson * KEduVocDocument::lesson( int index )
 {
-  KEduVocLesson * retval(NULL);
-  if (d->m_lessons.contains(index))
-  {
-     retval = d->m_lessons[index];
-  }
-  return retval;
+    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)
@@ -964,201 +939,199 @@ KEduVocLesson * KEduVocDocument::lesson(int index)
 //}
 
 
-bool KEduVocDocument::lessonInQuery(int lessonIndex) const
+bool KEduVocDocument::lessonInQuery( int lessonIndex ) const
 {
-  return d->m_lessonsInQuery.contains(lessonIndex);
+    return d->m_lessonsInQuery.contains( lessonIndex );
 }
 
 
-void KEduVocDocument::addLessonToQuery(int lessonIndex)
+void KEduVocDocument::addLessonToQuery( int lessonIndex )
 {
-  if(!lessonInQuery(lessonIndex))
-    d->m_lessonsInQuery.append(lessonIndex);
+    if ( !lessonInQuery( lessonIndex ) )
+        d->m_lessonsInQuery.append( lessonIndex );
 }
 
 
-void KEduVocDocument::removeLessonFromQuery(int lessonIndex)
+void KEduVocDocument::removeLessonFromQuery( int lessonIndex )
 {
-  if(lessonInQuery(lessonIndex))
-    d->m_lessonsInQuery.removeAt(d->m_lessonsInQuery.indexOf(lessonIndex));
+    if ( lessonInQuery( lessonIndex ) )
+        d->m_lessonsInQuery.removeAt( d->m_lessonsInQuery.indexOf( lessonIndex ) );
 }
 
 
 QList<int> KEduVocDocument::lessonsInQuery() const
 {
-  return d->m_lessonsInQuery;
+    return d->m_lessonsInQuery;
 }
 
 
-void KEduVocDocument::setLessonsInQuery(const QList<int> &lesson_iq)
+void KEduVocDocument::setLessonsInQuery( const QList<int> &lesson_iq )
 {
-  d->m_lessonsInQuery = lesson_iq;
+    d->m_lessonsInQuery = lesson_iq;
 }
 
 KUrl KEduVocDocument::url() const
 {
-  return d->m_url;
+    return d->m_url;
 }
 
 
-void KEduVocDocument::setUrl(const KUrl& url)
+void KEduVocDocument::setUrl( const KUrl& url )
 {
-  d->m_url = url;
+    d->m_url = url;
 }
 
 
 QString KEduVocDocument::title() const
 {
-  if (d->m_title.isEmpty())
-    return d->m_url.fileName();
-  else
-    return d->m_title;
+    if ( d->m_title.isEmpty() )
+        return d->m_url.fileName();
+    else
+        return d->m_title;
 }
 
 
 QString KEduVocDocument::author() const
 {
-  return d->m_author;
+    return d->m_author;
 }
 
 
 QString KEduVocDocument::license() const
 {
-  return d->m_license;
+    return d->m_license;
 }
 
 
 QString KEduVocDocument::documentRemark() const
 {
-  return d->m_remark;
+    return d->m_remark;
 }
 
 
-void KEduVocDocument::queryIdentifier(QString &org, QString &trans) const
+void KEduVocDocument::queryIdentifier( QString &org, QString &trans ) const
 {
-  org = d->m_queryorg;
-  trans = d->m_querytrans;
+    org = d->m_queryorg;
+    trans = d->m_querytrans;
 }
 
 
-void KEduVocDocument::setQueryIdentifier(const QString &org, const QString &trans)
+void KEduVocDocument::setQueryIdentifier( const QString &org, const QString &trans )
 {
-  d->m_queryorg = org;
-  d->m_querytrans = trans;
+    d->m_queryorg = org;
+    d->m_querytrans = trans;
 }
 
 
-void KEduVocDocument::setTitle(const QString & title)
+void KEduVocDocument::setTitle( const QString & title )
 {
-  d->m_title = title.simplified();
+    d->m_title = title.simplified();
 }
 
 
-void KEduVocDocument::setAuthor(const QString & s)
+void KEduVocDocument::setAuthor( const QString & s )
 {
-  d->m_author = s.simplified();
+    d->m_author = s.simplified();
 }
 
 
-void KEduVocDocument::setLicense(const QString & s)
+void KEduVocDocument::setLicense( const QString & s )
 {
-  d->m_license = s.simplified();
+    d->m_license = s.simplified();
 }
 
 
-void KEduVocDocument::setDocumentRemark(const QString & s)
+void KEduVocDocument::setDocumentRemark( const QString & s )
 {
-  d->m_remark = s.simplified();
+    d->m_remark = s.simplified();
 }
 
 
-void KEduVocDocument::setGenerator(const QString & generator)
+void KEduVocDocument::setGenerator( const QString & generator )
 {
-  d->m_generator = generator;
+    d->m_generator = generator;
 }
 
 
 QString KEduVocDocument::generator() const
 {
-  return d->m_generator;
+    return d->m_generator;
 }
 
 
 QString KEduVocDocument::version() const
 {
-  return d->m_version;
+    return d->m_version;
 }
 
 
-void KEduVocDocument::setVersion(const QString & vers)
+void KEduVocDocument::setVersion( const QString & vers )
 {
-  d->m_version = vers;
+    d->m_version = vers;
 }
 
 
 int KEduVocDocument::currentLesson() const
 {
-  return d->m_currentLesson;
+    return d->m_currentLesson;
 }
 
 
-void KEduVocDocument::setCurrentLesson(int lesson)
+void KEduVocDocument::setCurrentLesson( int lesson )
 {
-  d->m_currentLesson = lesson;
+    d->m_currentLesson = lesson;
 }
 
 
 QStringList KEduVocDocument::lessonDescriptions() const
 {
-  QStringList descriptions;
-  QList<KEduVocLesson*> lessonObjects = lessons().values();
-  for (int i = 0; i < lessonObjects.count(); ++i)
-  {
-    descriptions.append(lessonObjects[i]->description());
-  }
-  return descriptions;
+    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_lessons.count();
+    return d->m_lessons.count();
 }
 
-bool KEduVocDocument::deleteLesson(int lessonIndex, int deleteMode)
+bool KEduVocDocument::deleteLesson( int lessonIndex, int deleteMode )
 {  // too bad we count from one!
-  lessonIndex++;
-  for (int ent = entryCount() - 1; ent  >= 0 ; ent--) {
-    if (entry(ent)->lesson() == lessonIndex) {
-      if (deleteMode == DeleteEmptyLesson)
-        return false; // stop if there are vocabs left in the lesson
-      if (deleteMode == DeleteEntriesAndLesson)
-        // delete entries of this lesson with this lesson
-        removeEntry(ent);
-    }
-  }//for entries
+    lessonIndex++;
+    for ( int ent = entryCount() - 1; ent  >= 0 ; ent-- ) {
+        if ( entry( ent )->lesson() == lessonIndex ) {
+            if ( deleteMode == DeleteEmptyLesson )
+                return false; // stop if there are vocabs left in the lesson
+            if ( deleteMode == DeleteEntriesAndLesson )
+                // delete entries of this lesson with this lesson
+                removeEntry( ent );
+        }
+    }//for entries
 
-  // for all above this lesson number - reduce lesson by one.
-  for (int ent = 0; ent < entryCount(); ent++) {
-    if (entry(ent)->lesson() > lessonIndex) {
-      entry(ent)->setLesson(entry(ent)->lesson()-1);
-    }
-  } // reduce lesson
+    // for all above this lesson number - reduce lesson by one.
+    for ( int ent = 0; ent < entryCount(); ent++ ) {
+        if ( entry( ent )->lesson() > lessonIndex ) {
+            entry( ent )->setLesson( entry( ent )->lesson()-1 );
+        }
+    } // reduce lesson
 
-  // finally just remove the lesson name
-  //d->m_lessonDescriptions.removeAt(lessonIndex-1); // because of the damned 0 arghh
+    // finally just remove the lesson name
+    //d->m_lessonDescriptions.removeAt(lessonIndex-1); // because of the damned 0 arghh
 
-  int currentInQuery = d->m_lessonsInQuery.indexOf(lessonIndex);
-  if(currentInQuery != -1)
-    d->m_lessonsInQuery.removeAt(currentInQuery);
+    int currentInQuery = d->m_lessonsInQuery.indexOf( lessonIndex );
+    if ( currentInQuery != -1 )
+        d->m_lessonsInQuery.removeAt( currentInQuery );
 
-  // move query entries
-  for(int queryLesson = 0; queryLesson < d->m_lessonsInQuery.count(); queryLesson++)
-  {
-    if(d->m_lessonsInQuery.at(queryLesson) > lessonIndex)
-      d->m_lessonsInQuery.replace(queryLesson, d->m_lessonsInQuery.at(queryLesson)-1);
-  }
-  return true;
+    // move query entries
+    for ( int queryLesson = 0; queryLesson < d->m_lessonsInQuery.count(); queryLesson++ ) {
+        if ( d->m_lessonsInQuery.at( queryLesson ) > lessonIndex )
+            d->m_lessonsInQuery.replace( queryLesson, d->m_lessonsInQuery.at( queryLesson )-1 );
+    }
+    return true;
 }
 
 
@@ -1200,215 +1173,221 @@ bool KEduVocDocument::deleteLesson(int lessonIndex, int deleteMode)
 //  }
 //}
 
-int KEduVocDocument::search(const QString &substr, int id, int first, int last, bool word_start)
+int KEduVocDocument::search( const QString &substr, int id, int first, int last, bool word_start )
 {
-  if (last >= entryCount() || last < 0)
-    last = entryCount();
+    if ( last >= entryCount() || last < 0 )
+        last = entryCount();
 
-  if (first < 0)
-    first = 0;
+    if ( first < 0 )
+        first = 0;
 
-  if (id >= identifierCount() || last < first)
-    return -1;
+    if ( id >= identifierCount() || last < first )
+        return -1;
 
 
-    for (int i = first; i < last; i++) {
-      if (word_start) {
-        if (entry(i)->translation(id).text().indexOf(substr, 0, Qt::CaseInsensitive) == 0) // case insensitive
-          return i;
-      }
-      else {
-        if (entry(i)->translation(id).text().indexOf(substr, 0, Qt::CaseInsensitive) > -1) // case insensitive
-          return i;
-      }
+    for ( int i = first; i < last; i++ ) {
+        if ( word_start ) {
+            if ( entry( i )->translation( id ).text().indexOf( substr, 0, Qt::CaseInsensitive ) == 0 )    // case insensitive
+                return i;
+        } else {
+            if ( entry( i )->translation( id ).text().indexOf( substr, 0, Qt::CaseInsensitive ) > -1 )    // case insensitive
+                return i;
+        }
 
-  }
-  return -1;
+    }
+    return -1;
 }
 
 
 QString KEduVocDocument::csvDelimiter() const
 {
-  return d->m_csvDelimiter;
+    return d->m_csvDelimiter;
 }
 
 
-void KEduVocDocument::setCsvDelimiter(const QString &delimiter)
+void KEduVocDocument::setCsvDelimiter( const QString &delimiter )
 {
-  d->m_csvDelimiter = delimiter;
+    d->m_csvDelimiter = delimiter;
 }
 
 
-class ExpRef {
+class ExpRef
+{
 
 public:
-  ExpRef() {}
-  ExpRef (KEduVocExpression *_exp, int _idx)
-  {
-    idx    = _idx;
-    exp    = _exp;
-  }
-
-  bool operator< (const ExpRef& y) const
-  {
-    QString s1;
-    QString s2;
-    int cmp;
-    foreach (int i, exp->translationIndices()) {
-
-      s1 = exp->translation(i).text();
-      s2 = y.exp->translation(i).text();
-      cmp = QString::compare(s1.toUpper(), s2.toUpper() );
-      if (cmp != 0)
+    ExpRef()
+    {}
+    ExpRef( KEduVocExpression *_exp, int _idx )
+    {
+        idx    = _idx;
+        exp    = _exp;
+    }
+
+    bool operator< ( const ExpRef& y ) const
+    {
+        QString s1;
+        QString s2;
+        int cmp;
+        foreach( int i, exp->translationIndices() ) {
+
+            s1 = exp->translation( i ).text();
+            s2 = y.exp->translation( i ).text();
+            cmp = QString::compare( s1.toUpper(), s2.toUpper() );
+            if ( cmp != 0 )
+                return cmp < 0;
+        }
         return cmp < 0;
     }
-    return cmp < 0;
-  }
 
-  int idx;
-  KEduVocExpression *exp;
+    int idx;
+    KEduVocExpression *exp;
 };
 
 typedef QList<ExpRef> ExpRefList;
 
 int KEduVocDocument::cleanUp()
 {
-  int count = 0;
-  KEduVocExpression *kve1, *kve2;
-  ExpRefList shadow;
-  QList<int> to_delete;
-
-  for (int i = 0; i < d->m_vocabulary.count(); i++) {
-    shadow.append(ExpRef (entry(i), i));
-  }
-  qStableSort(shadow.begin(), shadow.end());
-
-  int ent_no = 0;
-  int ent_percent = d->m_vocabulary.size () / 100;
-  float f_ent_percent = d->m_vocabulary.size () / 100.0;
-  emit progressChanged(this, 0);
-
-  for (int i = shadow.size() - 1; i > 0; i--) {
-    kve1 = shadow[i].exp;
-    kve2 = shadow[i - 1].exp;
-
-    ent_no++;
-    if (ent_percent != 0 && (ent_no % ent_percent) == 0 ) {
-      emit progressChanged(this, (int)((ent_no / f_ent_percent) / 2.0));
-       }
-
-    bool equal = true;
-    for (int l = 0; equal && l < identifierCount(); l++ ) {
-        if (kve1->translation(l).text() != kve2->translation(l).text()) {
-            equal = false;
-        }
+    int count = 0;
+    KEduVocExpression *kve1, *kve2;
+    ExpRefList shadow;
+    QList<int> to_delete;
+
+    for ( int i = 0; i < d->m_vocabulary.count(); i++ ) {
+        shadow.append( ExpRef( entry( i ), i ) );
     }
+    qStableSort( shadow.begin(), shadow.end() );
 
-    if (equal) {
-        to_delete.append(shadow[i - 1].idx);
-        count++;
+    int ent_no = 0;
+    int ent_percent = d->m_vocabulary.size() / 100;
+    float f_ent_percent = d->m_vocabulary.size() / 100.0;
+    emit progressChanged( this, 0 );
+
+    for ( int i = shadow.size() - 1; i > 0; i-- ) {
+        kve1 = shadow[i].exp;
+        kve2 = shadow[i - 1].exp;
+
+        ent_no++;
+        if ( ent_percent != 0 && ( ent_no % ent_percent ) == 0 ) {
+            emit progressChanged( this, ( int )(( ent_no / f_ent_percent ) / 2.0 ) );
+        }
+
+        bool equal = true;
+        for ( int l = 0; equal && l < identifierCount(); l++ ) {
+            if ( kve1->translation( l ).text() != kve2->translation( l ).text() ) {
+                equal = false;
+            }
+        }
+
+        if ( equal ) {
+            to_delete.append( shadow[i - 1].idx );
+            count++;
+        }
     }
-  }
 
-  // removing might take very long
-  ent_no = 0;
-  ent_percent = to_delete.size () / 100;
-  f_ent_percent = to_delete.size () / 100.0;
-  emit progressChanged(this, 0);
+    // removing might take very long
+    ent_no = 0;
+    ent_percent = to_delete.size() / 100;
+    f_ent_percent = to_delete.size() / 100.0;
+    emit progressChanged( this, 0 );
 
-  qStableSort(to_delete.begin(), to_delete.end());
+    qStableSort( to_delete.begin(), to_delete.end() );
 
-  for (int i = (int) to_delete.count() - 1; i >= 0; i--) {
-    ent_no++;
-    if (ent_percent != 0 && (ent_no % ent_percent) == 0 )
-      emit progressChanged(this, (int)(50 + ent_no / f_ent_percent / 2.0));
-    removeEntry(to_delete[i]);
-    setModified();
-  }
+    for ( int i = ( int ) to_delete.count() - 1; i >= 0; i-- ) {
+        ent_no++;
+        if ( ent_percent != 0 && ( ent_no % ent_percent ) == 0 )
+            emit progressChanged( this, ( int )( 50 + ent_no / f_ent_percent / 2.0 ) );
+        removeEntry( to_delete[i] );
+        setModified();
+    }
 
-  return count;
+    return count;
 }
 
 void KEduVocDocument::shuffle()
 {
-  KRandomSequence rs;
-  rs.randomize(d->m_vocabulary);
-  setModified();
-}
-
-
-QString KEduVocDocument::pattern(Mode mode)
-{
-  static const struct SupportedFilter
-  {
-    bool reading;
-    bool writing;
-    const char* extensions;
-    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("Text") },
-    // last is marker for the end, do not remove it
-    { false, false, 0, 0 }
-  };
-  QStringList newfilters;
-  QStringList allext;
-  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));
-      allext.append(QLatin1String(filters[i].extensions));
+    KRandomSequence rs;
+    rs.randomize( d->m_vocabulary );
+    setModified();
+}
+
+
+QString KEduVocDocument::pattern( Mode mode )
+{
+    static const struct SupportedFilter {
+        bool reading;
+        bool writing;
+        const char* extensions;
+        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( "Text" ) },
+                    // last is marker for the end, do not remove it
+                    { false, false, 0, 0 }
+                };
+    QStringList newfilters;
+    QStringList allext;
+    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 ) );
+            allext.append( QLatin1String( filters[i].extensions ) );
+        }
     }
-  }
-  newfilters.prepend(allext.join(" ") + '|' + i18n("All supported documents"));
-  return newfilters.join("\n");
+    newfilters.prepend( allext.join( " " ) + '|' + i18n( "All supported documents" ) );
+    return newfilters.join( "\n" );
 }
 
 
-KEduVocWordType* KEduVocDocument::wordTypes() {
+KEduVocWordType* KEduVocDocument::wordTypes()
+{
     return d->m_wordTypes;
 }
 
 
-QStringList KEduVocDocument::usages(){
+QStringList KEduVocDocument::usages()
+{
     return d->m_usages.values();
 }
 
 
-void KEduVocDocument::addUsage(const QString &usage){
-    d->m_usages.insert(usage);
+void KEduVocDocument::addUsage( const QString &usage )
+{
+    d->m_usages.insert( usage );
 }
 
 
-void KEduVocDocument::renameUsage(const QString &oldName, const QString &newName){
-    if ( d->m_usages.contains(oldName) ) {
-        d->m_usages.remove(oldName);
-        d->m_usages.insert(newName);
+void KEduVocDocument::renameUsage( const QString &oldName, const QString &newName )
+{
+    if ( d->m_usages.contains( oldName ) ) {
+        d->m_usages.remove( oldName );
+        d->m_usages.insert( newName );
     } else {
         return;
     }
 
-    for ( int i = 0; i < d->m_vocabulary.count(); i++) {
-        foreach (int translationIndex, d->m_vocabulary[i].translationIndices()) {
-            if ( d->m_vocabulary[i].translation(translationIndex).usages().contains(oldName) ) {
-                d->m_vocabulary[i].translation(translationIndex).usages().remove(oldName);
-                d->m_vocabulary[i].translation(translationIndex).usages().insert(newName);
+    for ( int i = 0; i < d->m_vocabulary.count(); i++ ) {
+        foreach( int translationIndex, d->m_vocabulary[i].translationIndices() ) {
+            if ( d->m_vocabulary[i].translation( translationIndex ).usages().contains( oldName ) ) {
+                d->m_vocabulary[i].translation( translationIndex ).usages().remove( oldName );
+                d->m_vocabulary[i].translation( translationIndex ).usages().insert( newName );
             }
         }
     }
 }
 
 
-void KEduVocDocument::removeUsage(const QString &name){
-    d->m_usages.remove(name);
+void KEduVocDocument::removeUsage( const QString &name )
+{
+    d->m_usages.remove( name );
 
-    for ( int i = 0; i < d->m_vocabulary.count(); i++) {
-        foreach (int translationIndex, d->m_vocabulary[i].translationIndices()) {
-            d->m_vocabulary[i].translation(translationIndex).usages().remove(name);
+    for ( int i = 0; i < d->m_vocabulary.count(); i++ ) {
+        foreach( int translationIndex, d->m_vocabulary[i].translationIndices() ) {
+            d->m_vocabulary[i].translation( translationIndex ).usages().remove( name );
         }
     }
 }
index cc218f366915657a3b3b6a9450b782c67bf2ae06..7b84711a86b0364ff1f58a9d0b2018532f36deea 100644 (file)
@@ -42,577 +42,579 @@ class KEduVocWordType;
  */
 class KEDUVOCDOCUMENT_EXPORT KEduVocDocument : public QObject
 {
-  Q_OBJECT
+    Q_OBJECT
 public:
 
-  enum FileType
-  {
-    KvdNone,
-    Automatic,
-    Kvtml,
-    Wql,
-    Pauker,
-    Vokabeln,
-    Xdxf,
-    Csv,
-    Kvtml1
-  };
-
-  /**
-   * Constructor for a KdeEdu vocabulary document
-   *
-   * @param parent calling object
-   */
-  explicit KEduVocDocument(QObject* parent = 0);
-
-  /**
-   * Destructor
-   */
-  ~KEduVocDocument();
-
-  // *** whole document methods ***
-
-  /**
-   * Open a document file
-   *
-   * @param url      url to file to open
-   * @returns        true if successful
-   */
-  bool open(const KUrl& url);
-
-  /**
-   * Saves the data under the given name
-   *
-   * @param url        if url is empty (or NULL) actual name is preserved
-   * @param ft         the filetype to be used when saving the document
-   * @param generator  the name of the application saving the document
-   * @returns          true if successful
-   */
-  bool saveAs(const KUrl & url, FileType ft, const QString & generator);
-
-  /**
-   * Merges data from another document
-   *
-   * @param docToMerge       document containing the data to be merged
-   * @param matchIdentifiers if true only entries having identifiers present in the
-   *                         current document will be mergedurl is empty (or NULL) actual name is preserved
-   */
-  void merge(KEduVocDocument *docToMerge, bool matchIdentifiers);
-
-  /**
-   * Indicates if the document is modified
-   *
-   * @param dirty   new state
-   */
-  void setModified(bool dirty = true);
-
-  /** @returns the modification state of the doc */
-  bool isModified() const;
-
-  /**
-   * Sets the URL of the XML file
-   */
-  void setUrl(const KUrl& url);
-
-  /** @returns the URL of the XML file */
-  KUrl url() const;
-
-
-
-  /** set the title of the file
-   * @param title title to set */
-  void setTitle(const QString & title);
-
-  /** @returns the title of the file */
-  QString title() const;
-
-  /** set the author of the file
-   * @param author author to set */
-  void setAuthor(const QString & author);
-
-  /** @returns the author of the file */
-  QString author() const;
-
-  /** set the license of the file
-   * @param license license to set */
-  void setLicense(const QString & license);
-
-  /** @returns the license of the file */
-  QString license() const;
-
-  /** set the remark of the file
-   * @param rem remark to set */
-  void setDocumentRemark(const QString & rem);
-
-  /** @return the remark of the file */
-  QString documentRemark() const;
-
-  /**
-   * Sets the generator of the file
-   */
-  void setGenerator(const QString & generator);
-
-  /** @returns the generator of the file */
-  QString generator() const;
-
-  /** Sets version of the loaded file
-   * @param ver the new version */
-  void setVersion(const QString & ver);
-
-  /** @returns the version of the loaded file */
-  QString version() const;
-
-  // *** entry methods ***
-
-  /**
-   * Appends a new expression to the end of the vocabulary
-   *
-   * @param expression      expression to append
-   */
-  void appendEntry(KEduVocExpression *expression);
-
-  /**
-   * Inserts a new expression
-   *
-   * @param expression      expression to insert
-   * @param index           index of entry
-   */
-  void insertEntry(KEduVocExpression *expression, int index);
-
-  /**
-   * Removes an expression from the document
-   *
-   * @param index           index of expression
-   */
-  void removeEntry(int index);
-
-  /**
-   * Shuffles vocabulary in a random order
-   */
-  void shuffle();
-
-  /**
-   * Removes duplicate entries (original plus all translations)
-   *
-   * @returns                 number of removed entries
-   */
-  int cleanUp();
-
-  /**
-   * @returns the number of entries
-   */
-  int entryCount() const;
-
-  /**
-   * Returns the recommended size
-   *
-   * @param index            number of expr, -1 = lesson
-   * @returns                width of column
-   */
-  int sizeHint(int index) const;
-
-  /**
-   * Sets the recommended size
-   *
-   * @param index            number of expr, -1 = lesson
-   * @param width            width of column
-   */
-  void setSizeHint (int index, const int width);
-
-  // *** identifier methods ***
-
-  /**
-   * @returns the number of different identifiers (usually languages)
-   */
-  int identifierCount() const;
-
-  /**
-   * Appends a new identifier (usually a language)
-   *
-   * @param id         the identifier to append
-   * @returns the identifier number
-   */
-  int appendIdentifier(const QString & id);
-
-  /**
-   * Sets the original identifier
-   *
-   * @param id              the new identifier
-   */
-  void setOriginalIdentifier(const QString &id);
-
-  /**
-   * @returns the original identifier
-   */
-  QString originalIdentifier() const;
-
-  /**
-   * Sets the identifier of translation
-   *
-   * @param index            number of translation 1..x
-   * @param lang             thr language identifier: en=english, de=german, ...
-   */
-  void setIdentifier(int index, const QString &lang);
-
-  /**
-   * Returns the identifier of translation @p index
-   *
-   * @param index            number of translation 1..x
-   * @returns                the language identifier: en=english, de=german, ...
-   */
-  QString identifier(int index) const;
-
-  /**
-   * Removes identifier an the according translation in all entries
-   *
-   * @param index            number of translation 1..x
-   */
-  void removeIdentifier(int index);
-
-  /**
-   * Determines the index of a given identifier
-   *
-   * @param lang             identifier of language
-   * @returns                index of identifier, 0 = original, 1..n = translation, -1 = not found
-   */
-  int indexOfIdentifier(const QString &lang) const;
-
-  // *** type methods ***
-
-  /**
-   * Returns the type handling class. See KEduVocWordType.
-   *
-   * @returns the KEduVocWordType* type handling class
-   */
-  KEduVocWordType* wordTypes();
-
-
-  // *** tense methods ***
-
-  /**
-   * Sets the tense string
-   *
-   * @param index            number of tense
-   * @param str              name of tense
-   */
-  void setTenseName(int index, QString &str);
-
-  /**
-   * Returns the tense string
-   *
-   * @param index            number of tense
-   * @returns                string
-   */
-  QString tenseName(int index) const;
-
-  /**
-   * Sets the description of the tenses
-   */
-  void setTenseDescriptions(const QStringList &names);
-
-  /**
-   * Gets the descriptions of the tenses
-   */
-  QStringList tenseDescriptions() const;
-
-  // *** usage methods ***
-
-  /**
-   * Gets the descriptions of the usages.
-   * Usages are context information in a dictionary you may find [biol.]
-   * [am.] and the like to hint at the context in which the word is usually used.
-   */
-  QStringList usages();
-
-  /**
-   * Adds a usage label to the doc.
-   *
-   * @param usage    name of the usage
-   */
-  void addUsage(const QString &usage);
-
-  /**
-   * Rename a usage label.
-   * Actually changes the label in the vocabulary as well.
-   *
-   * @param oldName    old name of the usage label
-   * @param newName    new name of the usage label
-   */
-  void renameUsage(const QString &oldName, const QString &newName);
-
-  /**
-   * Remove a usage label.
-   * Also removes the label from all translations.
-   *
-   * @param name    new name of the usage label
-   */
-  void removeUsage(const QString &name);
-
-  // *** grade methods ***
-
-  /**
-   * Sets grades to KV_NORM_GRADE, counts to 0 ...
-   *
-   * @param index    index of language 0..x, -1 = all
-   * @param lesson   lesson id, if this is 0 all lesson are affected,
-   *                 otherwise only matching numbers
-   */
-  void resetEntry(int index = -1, int lesson = 0);
-
-  /**
-   * Returns pointer to expression object @p index
-   *
-   * @param index     index of desired entry
-   * @returns         pointer to object or NULL if index out of range
-   */
-  KEduVocExpression *entry(int index);
-
-  /**
-   * Search substring in vocabulary (case insensitive always)
-   *
-   * @param substr     partial string to search
-   * @param id         which language to search: 0=org, 1..x=translation
-   * @param first      index from where to start
-   * @param last       index of last entry, -1 goes till end
-   * @param word_start false: search partial string,
-   *                   true:always from beginning of word
-   * @returns          the index of found entry, -1 if none
-   */
-  int search(const QString &substr, int id, int first=0, int last=-1, bool word_start = false);
-
-  /**
-   * Retrieves the identifiers for the current query
-   *
-   * @param org        identifier for original
-   * @param trans      identifier for translation
-   */
-  void queryIdentifier(QString &org, QString &trans) const;
-
-  /**
-   * Sets the identifiers for the current query
-   *
-   * @param org        identifier for original
-   * @param trans      identifier for translation
-   */
-  void setQueryIdentifier(const QString &org, const QString &trans);
-
-  // *** lesson methods ***
-
-  /**
-   * @returns the current lesson index
-   */
-  int currentLesson() const;
-
-  /**
-   * Sets current lesson index
-   * @param lesson    index of lesson
-   */
-  void setCurrentLesson(int lesson);
-
-  /** get a lesson object
-   * @returns a pointer to the lesson object at the specified index or NULL if there isn't one
-   */
-  KEduVocLesson *lesson(int index);
-
-  /** get all lesson objects
-   * @returns a map of pointers to lesson objects
-   */
-  QMap<int, KEduVocLesson *> lessons() const;
-
-  /**
-   * @returns                the number of lessons defined
-   */
-  int lessonCount() const;
-
-  /**
-   * Get list of ALL lessons that are selected for query.
-   * @returns a list with the lessons in the current query
-   */
-  QList<int> lessonsInQuery() const;
-
-  /**
-   * Sets ALL lessons in the query. Better use addLessonToQuery and removeLessonFromQuery.
-   */
-  void setLessonsInQuery(const QList<int> &lesson_iq);
-
-  /**
-   * Check if @p lessonIndex is in the query.
-   * @param lessonIndex - index of the lesson
-   * @return true if in query
-   */
-  bool lessonInQuery(int lessonIndex) const;
-
-  /**
-   * Add @p lessonIndex to the query.
-   * @param lessonIndex - index of the lesson
-   */
-  void addLessonToQuery(int lessonIndex);
-
-  /**
-   * Remove @p lessonIndex from the query.
-   * @param lessonIndex - index of the lesson
-   */
-  void removeLessonFromQuery(int lessonIndex);
-
-  /**
-   * 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 addLesson(const QString &lessonName, int position = -1);
-
-  /**
-   * Delete a lesson.
-   * @param lessonIndex which lesson
-   * @param deleteMode either KVocDocument::DeleteEmptyLesson (delete only if empty) or KVocDocument::DeleteEntriesAndLesson (delete including vocabulary in that lesson)
-   * @returns if the deletion was successful. If there are vocabularies in the lesson, but DeleteEmptyLesson, this will return false and not delete the lesson.
-   */
-  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);
-
-  /**
-   * 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);
-
-  // *** conjugation methods ***
-
-  /**
-   * @param index            index of translation
-   * @returns                a pointer to conjugations if available
-   */
-  KEduVocConjugation conjugation(int index) const;
-
-  /**
-   * Sets conjugations
-   *
-   * @param index            index of translation
-   * @param con              conjugation block
-   */
-  void setConjugation(int index, const KEduVocConjugation &con);
-
-  /**
-   * @returns                the number of conjugations
-  */
-  int conjugationCount() const;
-
-  // *** article methods ***
-
-  /**
-   * @param index            index of translation
-   * @returns                a pointer to articles if available
-   */
-  KEduVocArticle article(int index) const;
-
-  /**
-   * Sets the articles
-   *
-   * @param index            index of translation
-   * @param art              article block
-   */
-  void setArticle(int index, const KEduVocArticle &art);
-
-  /**
-   * @returns                the number of articles
-  */
-  int articleCount() const;
-
-  // *** file format specific methods ***
-
-  /**
-   * Returns the delimiter (separator) used for csv import and export.
-   * The default is a single tab character
-   *
-   * @returns                the delimiter used
-   */
-  QString csvDelimiter() const;
-
-  /**
-   * Sets the delimiter (separator) used for csv import and export
-   *
-   * @param delimiter        the delimiter to use
-   */
-  void setCsvDelimiter(const QString &delimiter);
-
-  bool leitnerSystemActive();
-  void setLeitnerSystemActive(bool yes);
-  void createStandardLeitnerSystem();
-  void setLeitnerSystem( LeitnerSystem* system );
-  LeitnerSystem* leitnerSystem();
-
-  static FileType detectFileType(const QString &fileName);
-
-  enum Mode {
-    Reading,
-    Writing
-  };
-
-  enum LessonDeletion {
-    DeleteEmptyLesson,
-    DeleteEntriesAndLesson
-  };
-
-  /**
-   * Create a string with the supported document types, that can be used
-   * as filter in KFileDialog. It includes also an entry to match all the
-   * supported types.
-   *
-   * @param mode             the mode for the supported document types
-   * @returns                the filter string
-   */
-  static QString pattern(Mode mode);
+    enum FileType
+    {
+        KvdNone,
+        Automatic,
+        Kvtml,
+        Wql,
+        Pauker,
+        Vokabeln,
+        Xdxf,
+        Csv,
+        Kvtml1
+    };
+
+    /**
+     * Constructor for a KdeEdu vocabulary document
+     *
+     * @param parent calling object
+     */
+    explicit KEduVocDocument( QObject* parent = 0 );
+
+    /**
+     * Destructor
+     */
+    ~KEduVocDocument();
+
+    // *** whole document methods ***
+
+    /**
+     * Open a document file
+     *
+     * @param url      url to file to open
+     * @returns        true if successful
+     */
+    bool open( const KUrl& url );
+
+    /**
+     * Saves the data under the given name
+     *
+     * @param url        if url is empty (or NULL) actual name is preserved
+     * @param ft         the filetype to be used when saving the document
+     * @param generator  the name of the application saving the document
+     * @returns          true if successful
+     */
+    bool saveAs( const KUrl & url, FileType ft, const QString & generator );
+
+    /**
+     * Merges data from another document
+     *
+     * @param docToMerge       document containing the data to be merged
+     * @param matchIdentifiers if true only entries having identifiers present in the
+     *                         current document will be mergedurl is empty (or NULL) actual name is preserved
+     */
+    void merge( KEduVocDocument *docToMerge, bool matchIdentifiers );
+
+    /**
+     * Indicates if the document is modified
+     *
+     * @param dirty   new state
+     */
+    void setModified( bool dirty = true );
+
+    /** @returns the modification state of the doc */
+    bool isModified() const;
+
+    /**
+     * Sets the URL of the XML file
+     */
+    void setUrl( const KUrl& url );
+
+    /** @returns the URL of the XML file */
+    KUrl url() const;
+
+
+
+    /** set the title of the file
+     * @param title title to set */
+    void setTitle( const QString & title );
+
+    /** @returns the title of the file */
+    QString title() const;
+
+    /** set the author of the file
+     * @param author author to set */
+    void setAuthor( const QString & author );
+
+    /** @returns the author of the file */
+    QString author() const;
+
+    /** set the license of the file
+     * @param license license to set */
+    void setLicense( const QString & license );
+
+    /** @returns the license of the file */
+    QString license() const;
+
+    /** set the remark of the file
+     * @param rem remark to set */
+    void setDocumentRemark( const QString & rem );
+
+    /** @return the remark of the file */
+    QString documentRemark() const;
+
+    /**
+     * Sets the generator of the file
+     */
+    void setGenerator( const QString & generator );
+
+    /** @returns the generator of the file */
+    QString generator() const;
+
+    /** Sets version of the loaded file
+     * @param ver the new version */
+    void setVersion( const QString & ver );
+
+    /** @returns the version of the loaded file */
+    QString version() const;
+
+    // *** entry methods ***
+
+    /**
+     * Appends a new expression to the end of the vocabulary
+     *
+     * @param expression      expression to append
+     */
+    void appendEntry( KEduVocExpression *expression );
+
+    /**
+     * Inserts a new expression
+     *
+     * @param expression      expression to insert
+     * @param index           index of entry
+     */
+    void insertEntry( KEduVocExpression *expression, int index );
+
+    /**
+     * Removes an expression from the document
+     *
+     * @param index           index of expression
+     */
+    void removeEntry( int index );
+
+    /**
+     * Shuffles vocabulary in a random order
+     */
+    void shuffle();
+
+    /**
+     * Removes duplicate entries (original plus all translations)
+     *
+     * @returns                 number of removed entries
+     */
+    int cleanUp();
+
+    /**
+     * @returns the number of entries
+     */
+    int entryCount() const;
+
+    /**
+     * Returns the recommended size
+     *
+     * @param index            number of expr, -1 = lesson
+     * @returns                width of column
+     */
+    int sizeHint( int index ) const;
+
+    /**
+     * Sets the recommended size
+     *
+     * @param index            number of expr, -1 = lesson
+     * @param width            width of column
+     */
+    void setSizeHint( int index, const int width );
+
+    // *** identifier methods ***
+
+    /**
+     * @returns the number of different identifiers (usually languages)
+     */
+    int identifierCount() const;
+
+    /**
+     * Appends a new identifier (usually a language)
+     *
+     * @param id         the identifier to append
+     * @returns the identifier number
+     */
+    int appendIdentifier( const QString & id );
+
+    /**
+     * Sets the original identifier
+     *
+     * @param id              the new identifier
+     */
+    void setOriginalIdentifier( const QString &id );
+
+    /**
+     * @returns the original identifier
+     */
+    QString originalIdentifier() const;
+
+    /**
+     * Sets the identifier of translation
+     *
+     * @param index            number of translation 1..x
+     * @param lang             thr language identifier: en=english, de=german, ...
+     */
+    void setIdentifier( int index, const QString &lang );
+
+    /**
+     * Returns the identifier of translation @p index
+     *
+     * @param index            number of translation 1..x
+     * @returns                the language identifier: en=english, de=german, ...
+     */
+    QString identifier( int index ) const;
+
+    /**
+     * Removes identifier an the according translation in all entries
+     *
+     * @param index            number of translation 1..x
+     */
+    void removeIdentifier( int index );
+
+    /**
+     * Determines the index of a given identifier
+     *
+     * @param lang             identifier of language
+     * @returns                index of identifier, 0 = original, 1..n = translation, -1 = not found
+     */
+    int indexOfIdentifier( const QString &lang ) const;
+
+    // *** type methods ***
+
+    /**
+     * Returns the type handling class. See KEduVocWordType.
+     *
+     * @returns the KEduVocWordType* type handling class
+     */
+    KEduVocWordType* wordTypes();
+
+
+    // *** tense methods ***
+
+    /**
+     * Sets the tense string
+     *
+     * @param index            number of tense
+     * @param str              name of tense
+     */
+    void setTenseName( int index, QString &str );
+
+    /**
+     * Returns the tense string
+     *
+     * @param index            number of tense
+     * @returns                string
+     */
+    QString tenseName( int index ) const;
+
+    /**
+     * Sets the description of the tenses
+     */
+    void setTenseDescriptions( const QStringList &names );
+
+    /**
+     * Gets the descriptions of the tenses
+     */
+    QStringList tenseDescriptions() const;
+
+    // *** usage methods ***
+
+    /**
+     * Gets the descriptions of the usages.
+     * Usages are context information in a dictionary you may find [biol.]
+     * [am.] and the like to hint at the context in which the word is usually used.
+     */
+    QStringList usages();
+
+    /**
+     * Adds a usage label to the doc.
+     *
+     * @param usage    name of the usage
+     */
+    void addUsage( const QString &usage );
+
+    /**
+     * Rename a usage label.
+     * Actually changes the label in the vocabulary as well.
+     *
+     * @param oldName    old name of the usage label
+     * @param newName    new name of the usage label
+     */
+    void renameUsage( const QString &oldName, const QString &newName );
+
+    /**
+     * Remove a usage label.
+     * Also removes the label from all translations.
+     *
+     * @param name    new name of the usage label
+     */
+    void removeUsage( const QString &name );
+
+    // *** grade methods ***
+
+    /**
+     * Sets grades to KV_NORM_GRADE, counts to 0 ...
+     *
+     * @param index    index of language 0..x, -1 = all
+     * @param lesson   lesson id, if this is 0 all lesson are affected,
+     *                 otherwise only matching numbers
+     */
+    void resetEntry( int index = -1, int lesson = 0 );
+
+    /**
+     * Returns pointer to expression object @p index
+     *
+     * @param index     index of desired entry
+     * @returns         pointer to object or NULL if index out of range
+     */
+    KEduVocExpression *entry( int index );
+
+    /**
+     * Search substring in vocabulary (case insensitive always)
+     *
+     * @param substr     partial string to search
+     * @param id         which language to search: 0=org, 1..x=translation
+     * @param first      index from where to start
+     * @param last       index of last entry, -1 goes till end
+     * @param word_start false: search partial string,
+     *                   true:always from beginning of word
+     * @returns          the index of found entry, -1 if none
+     */
+    int search( const QString &substr, int id, int first=0, int last=-1, bool word_start = false );
+
+    /**
+     * Retrieves the identifiers for the current query
+     *
+     * @param org        identifier for original
+     * @param trans      identifier for translation
+     */
+    void queryIdentifier( QString &org, QString &trans ) const;
+
+    /**
+     * Sets the identifiers for the current query
+     *
+     * @param org        identifier for original
+     * @param trans      identifier for translation
+     */
+    void setQueryIdentifier( const QString &org, const QString &trans );
+
+    // *** lesson methods ***
+
+    /**
+     * @returns the current lesson index
+     */
+    int currentLesson() const;
+
+    /**
+     * Sets current lesson index
+     * @param lesson    index of lesson
+     */
+    void setCurrentLesson( int lesson );
+
+    /** get a lesson object
+     * @returns a pointer to the lesson object at the specified index or NULL if there isn't one
+     */
+    KEduVocLesson *lesson( int index );
+
+    /** get all lesson objects
+     * @returns a map of pointers to lesson objects
+     */
+    QMap<int, KEduVocLesson *> lessons() const;
+
+    /**
+     * @returns                the number of lessons defined
+     */
+    int lessonCount() const;
+
+    /**
+     * Get list of ALL lessons that are selected for query.
+     * @returns a list with the lessons in the current query
+     */
+    QList<int> lessonsInQuery() const;
+
+    /**
+     * Sets ALL lessons in the query. Better use addLessonToQuery and removeLessonFromQuery.
+     */
+    void setLessonsInQuery( const QList<int> &lesson_iq );
+
+    /**
+     * Check if @p lessonIndex is in the query.
+     * @param lessonIndex - index of the lesson
+     * @return true if in query
+     */
+    bool lessonInQuery( int lessonIndex ) const;
+
+    /**
+     * Add @p lessonIndex to the query.
+     * @param lessonIndex - index of the lesson
+     */
+    void addLessonToQuery( int lessonIndex );
+
+    /**
+     * Remove @p lessonIndex from the query.
+     * @param lessonIndex - index of the lesson
+     */
+    void removeLessonFromQuery( int lessonIndex );
+
+    /**
+     * 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 addLesson( const QString &lessonName, int position = -1 );
+
+    /**
+     * Delete a lesson.
+     * @param lessonIndex which lesson
+     * @param deleteMode either KVocDocument::DeleteEmptyLesson (delete only if empty) or KVocDocument::DeleteEntriesAndLesson (delete including vocabulary in that lesson)
+     * @returns if the deletion was successful. If there are vocabularies in the lesson, but DeleteEmptyLesson, this will return false and not delete the lesson.
+     */
+    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);
+
+    /**
+     * 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);
+
+    // *** conjugation methods ***
+
+    /**
+     * @param index            index of translation
+     * @returns                a pointer to conjugations if available
+     */
+    KEduVocConjugation conjugation( int index ) const;
+
+    /**
+     * Sets conjugations
+     *
+     * @param index            index of translation
+     * @param con              conjugation block
+     */
+    void setConjugation( int index, const KEduVocConjugation &con );
+
+    /**
+     * @returns                the number of conjugations
+    */
+    int conjugationCount() const;
+
+    // *** article methods ***
+
+    /**
+     * @param index            index of translation
+     * @returns                a pointer to articles if available
+     */
+    KEduVocArticle article( int index ) const;
+
+    /**
+     * Sets the articles
+     *
+     * @param index            index of translation
+     * @param art              article block
+     */
+    void setArticle( int index, const KEduVocArticle &art );
+
+    /**
+     * @returns                the number of articles
+    */
+    int articleCount() const;
+
+    // *** file format specific methods ***
+
+    /**
+     * Returns the delimiter (separator) used for csv import and export.
+     * The default is a single tab character
+     *
+     * @returns                the delimiter used
+     */
+    QString csvDelimiter() const;
+
+    /**
+     * Sets the delimiter (separator) used for csv import and export
+     *
+     * @param delimiter        the delimiter to use
+     */
+    void setCsvDelimiter( const QString &delimiter );
+
+    bool leitnerSystemActive();
+    void setLeitnerSystemActive( bool yes );
+    void createStandardLeitnerSystem();
+    void setLeitnerSystem( LeitnerSystem* system );
+    LeitnerSystem* leitnerSystem();
+
+    static FileType detectFileType( const QString &fileName );
+
+    enum Mode
+    {
+        Reading,
+        Writing
+    };
+
+    enum LessonDeletion
+    {
+        DeleteEmptyLesson,
+        DeleteEntriesAndLesson
+    };
+
+    /**
+     * Create a string with the supported document types, that can be used
+     * as filter in KFileDialog. It includes also an entry to match all the
+     * supported types.
+     *
+     * @param mode             the mode for the supported document types
+     * @returns                the filter string
+     */
+    static QString pattern( Mode mode );
 
 Q_SIGNALS:
-  void progressChanged (KEduVocDocument *, int curr_percent);
+    void progressChanged( KEduVocDocument *, int curr_percent );
 
-  /**
-   * Emitted when the document becomes modified or saved.
-   * @returns state (true=modified)
-   */
-  void docModified (bool mod);
+    /**
+     * Emitted when the document becomes modified or saved.
+     * @returns state (true=modified)
+     */
+    void docModified( bool mod );
 
 private:
-  // The private data of this - see KEduVocDocument::Private, implemented in keduvocdocument.cpp
-  class KEduVocDocumentPrivate;
-  KEduVocDocumentPrivate* const d;
+    // The private data of this - see KEduVocDocument::Private, implemented in keduvocdocument.cpp
+    class KEduVocDocumentPrivate;
+    KEduVocDocumentPrivate* const d;
 
-  Q_DISABLE_COPY(KEduVocDocument)
+    Q_DISABLE_COPY( KEduVocDocument )
 };
 
 
index 1a5b7d0b12e8a301103af733593209432c34db2d..ef3b8fb3da6666265a2d7c889f01805a0280463a 100644 (file)
 class KEduVocExpression::KEduVocExpressionPrivate
 {
 public:
-  KEduVocExpressionPrivate(KEduVocExpression* qq)
-    : q(qq)
-  {
-    init();
-  }
+    KEduVocExpressionPrivate( KEduVocExpression* qq )
+            : q( qq )
+    {
+        init();
+    }
 
-  void init();
+    void init();
 
-  bool operator==(const KEduVocExpressionPrivate &p) const;
+    bool operator== ( const KEduVocExpressionPrivate &p ) const;
 
-  KEduVocExpression* q;
+    KEduVocExpression* q;
 
-  QString m_leitnerBox;
-  int m_sortIndex;
-  int m_lesson;
-  bool m_inQuery;
-  bool m_active;
-  int m_sizeHint;
+    QString m_leitnerBox;
+    int m_sortIndex;
+    int m_lesson;
+    bool m_inQuery;
+    bool m_active;
+    int m_sizeHint;
 
-  QMap <int, KEduVocTranslation> m_translations;
+    QMap <int, KEduVocTranslation> m_translations;
 };
 
 
 void KEduVocExpression::KEduVocExpressionPrivate::init()
 {
-  m_translations.clear();
+    m_translations.clear();
 
-  m_inQuery = false;
-  m_active = true;
-  m_lesson = 0;
-  m_sortIndex = 0;
-  m_sizeHint = 0;
+    m_inQuery = false;
+    m_active = true;
+    m_lesson = 0;
+    m_sortIndex = 0;
+    m_sizeHint = 0;
 }
 
 
-bool KEduVocExpression::KEduVocExpressionPrivate::operator==(const KEduVocExpression::KEduVocExpressionPrivate &p) const
+bool KEduVocExpression::KEduVocExpressionPrivate::operator== ( const KEduVocExpression::KEduVocExpressionPrivate &p ) const
 {
-  return
-    m_translations == p.m_translations &&
-    m_leitnerBox == p.m_leitnerBox &&
-    m_lesson == p.m_lesson &&
-    m_sortIndex == p.m_sortIndex &&
-    m_inQuery == p.m_inQuery &&
-    m_active == p.m_active;
+    return
+        m_translations == p.m_translations &&
+        m_leitnerBox == p.m_leitnerBox &&
+        m_lesson == p.m_lesson &&
+        m_sortIndex == p.m_sortIndex &&
+        m_inQuery == p.m_inQuery &&
+        m_active == p.m_active;
 }
 
 
 KEduVocExpression::KEduVocExpression()
-  : d(new KEduVocExpressionPrivate(this))
-{
-}
+        : d( new KEduVocExpressionPrivate( this ) )
+{}
 
-KEduVocExpression::KEduVocExpression(const QString & expression, int lesson)
-  : d(new KEduVocExpressionPrivate(this))
+KEduVocExpression::KEduVocExpression( const QString & expression, int lesson )
+        : d( new KEduVocExpressionPrivate( this ) )
 {
-  setTranslation(0, expression.simplified());
-  d->m_lesson = lesson;
+    setTranslation( 0, expression.simplified() );
+    d->m_lesson = lesson;
 }
 
-KEduVocExpression::KEduVocExpression(const QString & expression, const QString & separator, int lesson)
-  : d(new KEduVocExpressionPrivate(this))
+KEduVocExpression::KEduVocExpression( const QString & expression, const QString & separator, int lesson )
+        : d( new KEduVocExpressionPrivate( this ) )
 {
-  QString se;
-  QString expr = expression;
-  d->m_lesson = lesson;
+    QString se;
+    QString expr = expression;
+    d->m_lesson = lesson;
 
-  if (separator.length()) {
-    int pos = expr.indexOf(separator);
-    int translationIndex = 0;
-      se = expr.left(pos).simplified();
-      setTranslation(translationIndex, se);
-      expr.remove(0, pos + separator.length());
+    if ( separator.length() ) {
+        int pos = expr.indexOf( separator );
+        int translationIndex = 0;
+        se = expr.left( pos ).simplified();
+        setTranslation( translationIndex, se );
+        expr.remove( 0, pos + separator.length() );
 
-      // gather all translations
-      while ((pos = expr.indexOf(separator)) != -1) {
+        // gather all translations
+        while (( pos = expr.indexOf( separator ) ) != -1 ) {
+            translationIndex++;
+            se = expr.left( pos ).simplified();
+            setTranslation( translationIndex, se );
+            expr.remove( 0, pos + separator.length() );
+        }
         translationIndex++;
-        se = expr.left(pos).simplified();
-        setTranslation(translationIndex, se);
-        expr.remove(0, pos + separator.length());
-      }
-      translationIndex++;
-      setTranslation(translationIndex, expr.simplified());
-  }
+        setTranslation( translationIndex, expr.simplified() );
+    }
 }
 
 
-KEduVocExpression::KEduVocExpression(const KEduVocExpression &expression)
-  : d(new KEduVocExpressionPrivate(*expression.d))
-{
-}
+KEduVocExpression::KEduVocExpression( const KEduVocExpression &expression )
+        : d( new KEduVocExpressionPrivate( *expression.d ) )
+{}
 
 
 KEduVocExpression::~KEduVocExpression()
 {
-  delete d;
+    delete d;
 }
 
 
-void KEduVocExpression::removeTranslation(int index)
+void KEduVocExpression::removeTranslation( int index )
 {
-    d->m_translations.remove(index);
+    d->m_translations.remove( index );
 }
 
 
-void KEduVocExpression::setTranslation(int index, const QString & expr)
+void KEduVocExpression::setTranslation( int index, const QString & expr )
 {
-  if (index < 0)
-    return;
+    if ( index < 0 )
+        return;
 
 ///@todo get rid of this nonsense:
-/* not needed with qmap but for now all translations <= index are expected to exist
-  // extend translations with empty strings if necessary
-  for (int i = d->m_translations.count(); i < index + 1; i++) {
-      d->m_translations.append("");
-  }
-*/
-  for (int i = d->m_translations.count(); i <= index; i++) {
-      d->m_translations[i] = KEduVocTranslation("");
-  }
+    /* not needed with qmap but for now all translations <= index are expected to exist
+      // extend translations with empty strings if necessary
+      for (int i = d->m_translations.count(); i < index + 1; i++) {
+          d->m_translations.append("");
+      }
+    */
+    for ( int i = d->m_translations.count(); i <= index; i++ ) {
+        d->m_translations[i] = KEduVocTranslation( "" );
+    }
 //  if (index <= translations.count())
 
-  d->m_translations[index] = expr.simplified();
+    d->m_translations[index] = expr.simplified();
 }
 
 
 int KEduVocExpression::lesson() const
 {
-  return d->m_lesson;
+    return d->m_lesson;
 }
 
 
-void KEduVocExpression::setLesson(int l)
+void KEduVocExpression::setLesson( int l )
 {
-  d->m_lesson = l;
+    d->m_lesson = l;
 }
 
 QString KEduVocExpression::leitnerBox() const
 {
-  return d->m_leitnerBox;
+    return d->m_leitnerBox;
 }
 
 
-void KEduVocExpression::setLeitnerBox(const QString& box)
+void KEduVocExpression::setLeitnerBox( const QString& box )
 {
-  d->m_leitnerBox = box;
+    d->m_leitnerBox = box;
 }
 
 
 bool KEduVocExpression::isInQuery() const
 {
-  return d->m_inQuery;
+    return d->m_inQuery;
 }
 
 
-void KEduVocExpression::setInQuery(bool flag)
+void KEduVocExpression::setInQuery( bool flag )
 {
-  d->m_inQuery = flag;
+    d->m_inQuery = flag;
 }
 
 
 bool KEduVocExpression::isActive() const
 {
-  return d->m_active;
+    return d->m_active;
 }
 
 
-void KEduVocExpression::setActive(bool flag)
+void KEduVocExpression::setActive( bool flag )
 {
-  d->m_active = flag;
+    d->m_active = flag;
 }
 
 int KEduVocExpression::sizeHint() const
 {
-  return d->m_sizeHint;
+    return d->m_sizeHint;
 }
 
-void KEduVocExpression::setSizeHint(int sizeHint)
+void KEduVocExpression::setSizeHint( int sizeHint )
 {
-  d->m_sizeHint = sizeHint;
+    d->m_sizeHint = sizeHint;
 }
 
-void KEduVocExpression::resetGrades(int index)
+void KEduVocExpression::resetGrades( int index )
 {
     if ( index == -1 ) { // clear grades for all languages
-        foreach (KEduVocTranslation trans, d->m_translations) {
+        foreach( KEduVocTranslation trans, d->m_translations ) {
             trans.resetGrades();
         }
         return;
     }
 
     // only language index
-    if ( d->m_translations.contains(index) ) {
+    if ( d->m_translations.contains( index ) ) {
         d->m_translations[index].resetGrades();
     }
 }
 
 
-KEduVocExpression& KEduVocExpression::operator=(const KEduVocExpression &expression)
+KEduVocExpression& KEduVocExpression::operator= ( const KEduVocExpression &expression )
 {
-  *d = *expression.d;
-  return *this;
+    *d = *expression.d;
+    return *this;
 }
 
 
-bool KEduVocExpression::operator==(const KEduVocExpression &expression) const
+bool KEduVocExpression::operator== ( const KEduVocExpression &expression ) const
 {
-  return (*d == *expression.d);
+    return ( *d == *expression.d );
 }
 
-KEduVocTranslation & KEduVocExpression::translation(int index) const
+KEduVocTranslation & KEduVocExpression::translation( int index ) const
 {
     return d->m_translations[index];
 }
index 616936e3681e312d429b212a9607e0ed692d7017..6a00e0addcfc095307e729da8df9b9460e34a550 100644 (file)
@@ -34,82 +34,82 @@ class KEDUVOCDOCUMENT_EXPORT KEduVocExpression
 {
 public:
 
-  /** default constructor for an empty vocabulary expression
-   */
-  explicit KEduVocExpression();
+    /** default constructor for an empty vocabulary expression
+     */
+    explicit KEduVocExpression();
 
-  /** Constructor for a vocabulary expression with an original
-   *
-   * @param expression       original
-   * @param lesson           lesson number, 0 for none
-   */
-  explicit KEduVocExpression(const QString & expression, int lesson = 0);
+    /** Constructor for a vocabulary expression with an original
+     *
+     * @param expression       original
+     * @param lesson           lesson number, 0 for none
+     */
+    explicit KEduVocExpression( const QString & expression, int lesson = 0 );
 
-  /** Constructor for a vocabulary expression with an original and one or more translations
-   *
-   * @param expression       expression
-   * @param separator        expression will be split into an original and one or more translations using separator
-   * @param lesson           lesson number, 0 for none
-   */
-  KEduVocExpression(const QString & expression, const QString & separator, int lesson = 0);
+    /** Constructor for a vocabulary expression with an original and one or more translations
+     *
+     * @param expression       expression
+     * @param separator        expression will be split into an original and one or more translations using separator
+     * @param lesson           lesson number, 0 for none
+     */
+    KEduVocExpression( const QString & expression, const QString & separator, int lesson = 0 );
 
-  KEduVocExpression(const KEduVocExpression &expression);
+    KEduVocExpression( const KEduVocExpression &expression );
 
-  ~KEduVocExpression();
+    ~KEduVocExpression();
 
-  /** returns index of lesson (0 = none)
-   */
-  int lesson() const;
+    /** returns index of lesson (0 = none)
+     */
+    int lesson() const;
 
-  /** sets index of lesson (0 = none)
-   */
-  void setLesson(int l);
+    /** sets index of lesson (0 = none)
+     */
+    void setLesson( int l );
 
     /** reset all grades of the entry
      * @param index     identifier (language)
      */
-    void resetGrades(int index);
+    void resetGrades( int index );
 
-  /** returns flag if entry is "selected" for queries
-   */
-  bool isInQuery() const;
+    /** returns flag if entry is "selected" for queries
+     */
+    bool isInQuery() const;
 
-  /** set entry "selected"
-   */
-  void setInQuery(bool flag = true);
+    /** set entry "selected"
+     */
+    void setInQuery( bool flag = true );
 
-  /** returns flag if entry is activated for queries
-   */
-  bool isActive() const;
+    /** returns flag if entry is activated for queries
+     */
+    bool isActive() const;
 
-  /** set entry active (enabled for queries)
-   */
-  void setActive(bool flag = true);
+    /** set entry active (enabled for queries)
+     */
+    void setActive( bool flag = true );
 
     int sizeHint() const;
-    void setSizeHint(int sizeHint);
+    void setSizeHint( int sizeHint );
 
-  /** returns this translation
-   *
-   * @return                 expression or "" if no translation available
-   */
-    QString translationString(int index) const;
+    /** returns this translation
+     *
+     * @return                 expression or "" if no translation available
+     */
+    QString translationString( int index ) const;
 
-  void setTranslation(int index, const KEduVocTranslation & translation);
-  /**
-   * Add a translation to this expression
-   * @param index            number of translation = the identifier
-   * @param expression       the translation
-   */
-  void setTranslation(int index, const QString &expression);
+    void setTranslation( int index, const KEduVocTranslation & translation );
+    /**
+     * Add a translation to this expression
+     * @param index            number of translation = the identifier
+     * @param expression       the translation
+     */
+    void setTranslation( int index, const QString &expression );
 
-  void setTranslation(const QString &identifier, const QString & expression);
+    void setTranslation( const QString &identifier, const QString & expression );
 
-  /** removes a translation
-   *
-   * @param index            number of translation 1..x
-   */
-  void removeTranslation(int index);
+    /** removes a translation
+     *
+     * @param index            number of translation 1..x
+     */
+    void removeTranslation( int index );
 
 
     /**
@@ -117,28 +117,28 @@ public:
      * @param index of the language identifier
      * @return the translation
      */
-    KEduVocTranslation & translation (int index) const;
+    KEduVocTranslation & translation( int index ) const;
 
-    QList<int> translationIndices ( ) const;
+    QList<int> translationIndices() const;
 
-  /** sets the box of the Leitner system which actually contains the expression
-   *
-   * @param box              the box's name
-   */
-  void setLeitnerBox(const QString & box);
+    /** sets the box of the Leitner system which actually contains the expression
+     *
+     * @param box              the box's name
+     */
+    void setLeitnerBox( const QString & box );
 
-  /** returns the name of the Leitner system's box actually containing the expression
-   *
-   * @return                 the box's name
-   */
-  QString leitnerBox() const;
+    /** returns the name of the Leitner system's box actually containing the expression
+     *
+     * @return                 the box's name
+     */
+    QString leitnerBox() const;
 
-  KEduVocExpression& operator=(const KEduVocExpression &expression);
-  bool operator==(const KEduVocExpression &expression) const;
+    KEduVocExpression& operator= ( const KEduVocExpression &expression );
+    bool operator== ( const KEduVocExpression &expression ) const;
 
 private:
-  class KEduVocExpressionPrivate;
-  KEduVocExpressionPrivate* const d;
+    class KEduVocExpressionPrivate;
+    KEduVocExpressionPrivate* const d;
 };
 
 #endif // KEduVocExpression_H
index ac9e8f25bee6d91f13b251865945aa09bad76f69..df99b7a3a8c3498db00ff80f96ac818438a8aa66 100644 (file)
@@ -17,7 +17,7 @@
 
 class KEduVocGrade::KEduVocGradePrivate
 {
-  public:
+public:
     grade_t m_grade;
     count_t m_queryCount;
     count_t m_badCount;
@@ -25,23 +25,23 @@ class KEduVocGrade::KEduVocGradePrivate
 };
 
 KEduVocGrade::KEduVocGrade()
-  :d(new KEduVocGradePrivate)
+        :d( new KEduVocGradePrivate )
 {
     resetGrades();
 }
 
-KEduVocGrade::KEduVocGrade(const KEduVocGrade &other)
-  :d(new KEduVocGradePrivate)
+KEduVocGrade::KEduVocGrade( const KEduVocGrade &other )
+        :d( new KEduVocGradePrivate )
 {
-    setGrade(other.grade());
-    setQueryCount(other.queryCount());
-    setBadCount(other.badCount());
-    setQueryDate(other.queryDate());
+    setGrade( other.grade() );
+    setQueryCount( other.queryCount() );
+    setBadCount( other.badCount() );
+    setQueryDate( other.queryDate() );
 }
 
 KEduVocGrade::~KEduVocGrade()
 {
-  delete d;
+    delete d;
 }
 
 void KEduVocGrade::resetGrades()
@@ -51,18 +51,18 @@ void KEduVocGrade::resetGrades()
     d->m_badCount = 0;
 
     QDateTime dt;
-    dt.setTime_t(0);
+    dt.setTime_t( 0 );
     d->m_queryDate = dt;
 }
 
 
-grade_t KEduVocGrade::grade () const
+grade_t KEduVocGrade::grade() const
 {
     return d->m_grade;
 }
 
 
-void KEduVocGrade::setGrade ( grade_t grade )
+void KEduVocGrade::setGrade( grade_t grade )
 {
     if ( grade > KV_MAX_GRADE )
         grade = KV_MAX_GRADE;
@@ -70,61 +70,61 @@ void KEduVocGrade::setGrade ( grade_t grade )
 }
 
 
-void KEduVocGrade::incGrade ()
+void KEduVocGrade::incGrade()
 {
-    setGrade ( grade() + 1 );
+    setGrade( grade() + 1 );
 }
 
 
-void KEduVocGrade::decGrade ()
+void KEduVocGrade::decGrade()
 {
-    setGrade ( grade() - 1 );
+    setGrade( grade() - 1 );
 }
 
 
-count_t KEduVocGrade::queryCount ( )  const
+count_t KEduVocGrade::queryCount()  const
 {
     return d->m_queryCount;
 }
 
 
-void KEduVocGrade::incQueryCount ( )
+void KEduVocGrade::incQueryCount()
 {
-    setQueryCount ( queryCount() + 1 );
+    setQueryCount( queryCount() + 1 );
 }
 
 
-void KEduVocGrade::incBadCount ( )
+void KEduVocGrade::incBadCount()
 {
-    setBadCount ( badCount() + 1 );
+    setBadCount( badCount() + 1 );
 }
 
 
-void KEduVocGrade::setQueryCount ( count_t count )
+void KEduVocGrade::setQueryCount( count_t count )
 {
     d->m_queryCount = count;
 }
 
 
-count_t KEduVocGrade::badCount ( ) const
+count_t KEduVocGrade::badCount() const
 {
     return d->m_badCount;
 }
 
 
-void KEduVocGrade::setBadCount ( count_t count )
+void KEduVocGrade::setBadCount( count_t count )
 {
     d->m_badCount = count;
 }
 
 
-QDateTime KEduVocGrade::queryDate () const
+QDateTime KEduVocGrade::queryDate() const
 {
     return d->m_queryDate;
 }
 
 
-void KEduVocGrade::setQueryDate ( const QDateTime & date )
+void KEduVocGrade::setQueryDate( const QDateTime & date )
 {
     d->m_queryDate = date;
 }
index ca3ccc63867455bc35851dd2c94f6c152f34fec8..680e27f23ab50b03e14283f5cf60489e434241c7 100644 (file)
@@ -54,7 +54,7 @@ typedef unsigned short count_t;
 /**
 Contains grading information (query date, bad count) for one language with respect to another.
 
      @author Frederik Gladhorn <frederik.gladhorn@kdemail.net>
+ @author Frederik Gladhorn <frederik.gladhorn@kdemail.net>
 */
 class KEDUVOCDOCUMENT_EXPORT KEduVocGrade
 {
@@ -66,15 +66,15 @@ public:
      * provides safe copy of d pointer
      * @param other object to copy from
      */
-    KEduVocGrade(const KEduVocGrade &other);
+    KEduVocGrade( const KEduVocGrade &other );
 
     /** default destructor */
     ~KEduVocGrade();
 
-    /** returns query count as int 
+    /** returns query count as int
     * @returns query count
     */
-    count_t queryCount(   ) const;
+    count_t queryCount() const;
 
     /** set query count as int
     * @param count the new count
@@ -84,7 +84,7 @@ public:
     /** returns bad query count as int
     * @returns bad query count
     */
-    count_t badCount( ) const;
+    count_t badCount() const;
 
     /** set bad query count as int
     * @param count the new count
@@ -92,10 +92,10 @@ public:
     void setBadCount( count_t count );
 
     /** increment bad query count of given translation by 1 */
-    void incBadCount( );
+    void incBadCount();
 
     /** increment query count of given translation by 1 */
-    void incQueryCount( );
+    void incQueryCount();
 
 
     /**
@@ -114,20 +114,20 @@ public:
     grade_t grade() const;
 
     /** increments grade of given translation */
-    void incGrade(  );
+    void incGrade();
 
     /** decrements grade of given translation */
-    void decGrade(  );
+    void decGrade();
 
     /** returns last query date of given translation as int
     */
-    QDateTime queryDate(  ) const;
+    QDateTime queryDate() const;
 
 
     /** Set last query date
     * @param date             the new date
     */
-    void setQueryDate ( const QDateTime & date );
+    void setQueryDate( const QDateTime & date );
 
 private:
     class KEduVocGradePrivate;
index df83a7ccc3d9ef5730c520ffc64b5aa67b8d1b41..a829ec9a71f9315a88f721bf0dd9c47a5cd012f2 100644 (file)
 
 class KEduVocComparison::Private
 {
-  public:
+public:
     QString ls1;
     QString ls2;
     QString ls3;
 };
 
 KEduVocComparison::KEduVocComparison()
-: d(new Private)
-{
-}
+        : d( new Private )
+{}
 
-KEduVocComparison::KEduVocComparison(const KEduVocComparison &other)
-: d(new Private)
+KEduVocComparison::KEduVocComparison( const KEduVocComparison &other )
+        : d( new Private )
 {
-  setL1(other.l1());
-  setL2(other.l2());
-  setL3(other.l3());
+    setL1( other.l1() );
+    setL2( other.l2() );
+    setL3( other.l3() );
 }
 
-KEduVocComparison::KEduVocComparison(const QString &l1, const QString &l2, const QString &l3)
-: d(new Private)
+KEduVocComparison::KEduVocComparison( const QString &l1, const QString &l2, const QString &l3 )
+        : d( new Private )
 {
-  setL1(l1);
-  setL2(l2);
-  setL3(l3);
+    setL1( l1 );
+    setL2( l2 );
+    setL3( l3 );
 }
 
 KEduVocComparison::~KEduVocComparison()
 {
-  delete d;
+    delete d;
 }
 
-KEduVocComparison &KEduVocComparison::operator=(const KEduVocComparison& other)
+KEduVocComparison &KEduVocComparison::operator= ( const KEduVocComparison& other )
 {
-  setL1(other.l1());
-  setL2(other.l2());
-  setL3(other.l3());
+    setL1( other.l1() );
+    setL2( other.l2() );
+    setL3( other.l3() );
 
-  return *this;
+    return *this;
 }
 
 bool KEduVocComparison::isEmpty() const
 {
-  return d->ls1.simplified().isEmpty() && d->ls2.simplified().isEmpty() && d->ls3.simplified().isEmpty();
+    return d->ls1.simplified().isEmpty() && d->ls2.simplified().isEmpty() && d->ls3.simplified().isEmpty();
 }
 
 
 void KEduVocComparison::clear()
 {
-  d->ls1 = "";
-  d->ls2 = "";
-  d->ls3 = "";
+    d->ls1 = "";
+    d->ls2 = "";
+    d->ls3 = "";
 }
 
-bool KEduVocComparison::operator ==(const KEduVocComparison& a) const
+bool KEduVocComparison::operator == ( const KEduVocComparison& a ) const
 {
-  return (d->ls1 == a.l1() && d->ls2 == a.l2() && d->ls3 == a.l3());
+    return ( d->ls1 == a.l1() && d->ls2 == a.l2() && d->ls3 == a.l3() );
 }
 
-void KEduVocComparison::setL1(const QString &s)
+void KEduVocComparison::setL1( const QString &s )
 {
-  d->ls1 = s;
+    d->ls1 = s;
 }
 
-void KEduVocComparison::setL2(const QString &s)
+void KEduVocComparison::setL2( const QString &s )
 {
-  d->ls2 = s;
+    d->ls2 = s;
 }
 
-void KEduVocComparison::setL3(const QString &s)
+void KEduVocComparison::setL3( const QString &s )
 {
-  d->ls3 = s;
+    d->ls3 = s;
 }
 
 QString KEduVocComparison::l1() const
 {
-  return d->ls1;
+    return d->ls1;
 }
 QString KEduVocComparison::l2() const
 {
-  return d->ls2;
+    return d->ls2;
 }
 
 QString KEduVocComparison::l3() const
 {
-  return d->ls3;
+    return d->ls3;
 }
 
 
@@ -122,7 +121,7 @@ QString KEduVocComparison::l3() const
 
 class KEduVocArticle::Private
 {
-  public:
+public:
     QString fem_def;
     QString fem_indef;
     QString mal_def;
@@ -132,86 +131,85 @@ class KEduVocArticle::Private
 };
 
 KEduVocArticle::KEduVocArticle()
-:d(new Private)
-{
-}
+        :d( new Private )
+{}
 
-KEduVocArticle::KEduVocArticle(const KEduVocArticle &other)
-:d(new Private)
+KEduVocArticle::KEduVocArticle( const KEduVocArticle &other )
+        :d( new Private )
 {
-  operator=(other);
+    operator= ( other );
 }
 
-KEduVocArticle &KEduVocArticle::operator=(const KEduVocArticle& other)
+KEduVocArticle &KEduVocArticle::operator= ( const KEduVocArticle& other )
 {
-  d->fem_def = other.d->fem_def;
-  d->fem_indef = other.d->fem_indef;
-  d->mal_def = other.d->mal_def;
-  d->mal_indef = other.d->mal_indef;
-  d->nat_def = other.d->nat_def;
-  d->nat_indef = other.d->nat_indef;
+    d->fem_def = other.d->fem_def;
+    d->fem_indef = other.d->fem_indef;
+    d->mal_def = other.d->mal_def;
+    d->mal_indef = other.d->mal_indef;
+    d->nat_def = other.d->nat_def;
+    d->nat_indef = other.d->nat_indef;
 
-  return *this;
+    return *this;
 }
 
-KEduVocArticle::KEduVocArticle(const QString &fem_def, const QString &fem_indef, const QString &mal_def, const QString &mal_indef, const QString &nat_def, const QString &nat_indef)
-:d(new Private)
+KEduVocArticle::KEduVocArticle( const QString &fem_def, const QString &fem_indef, const QString &mal_def, const QString &mal_indef, const QString &nat_def, const QString &nat_indef )
+        :d( new Private )
 {
-  setFemale  (fem_def, fem_indef);
-  setMale    (mal_def, mal_indef);
-  setNatural (nat_def, nat_indef);
+    setFemale( fem_def, fem_indef );
+    setMale( mal_def, mal_indef );
+    setNatural( nat_def, nat_indef );
 }
 
 KEduVocArticle::~KEduVocArticle()
 {
-  delete d;
+    delete d;
 }
 
-void KEduVocArticle::setFemale(const QString &def, const QString &indef)
+void KEduVocArticle::setFemale( const QString &def, const QString &indef )
 {
-  d->fem_def = def;
-  d->fem_indef = indef;
+    d->fem_def = def;
+    d->fem_indef = indef;
 }
 
 
-void KEduVocArticle::setMale(const QString &def, const QString &indef)
+void KEduVocArticle::setMale( const QString &def, const QString &indef )
 {
-  d->mal_def = def;
-  d->mal_indef = indef;
+    d->mal_def = def;
+    d->mal_indef = indef;
 }
 
 
-void KEduVocArticle::setNatural(const QString &def, const QString &indef)
+void KEduVocArticle::setNatural( const QString &def, const QString &indef )
 {
-  d->nat_def = def;
-  d->nat_indef = indef;
+    d->nat_def = def;
+    d->nat_indef = indef;
 }
 
 
-void KEduVocArticle::getFemale(QString *def, QString *indef) const
+void KEduVocArticle::getFemale( QString *def, QString *indef ) const
 {
-  if (def)
-    *def = d->fem_def;
-  if (indef)
-    *indef = d->fem_indef;
+    if ( def )
+        *def = d->fem_def;
+    if ( indef )
+        *indef = d->fem_indef;
 }
 
 
-void KEduVocArticle::getMale(QString *def, QString *indef) const
+void KEduVocArticle::getMale( QString *def, QString *indef ) const
 {
-  if (def)
-    *def = d->mal_def;
-  if (indef)
-    *indef = d->mal_indef;
+    if ( def )
+        *def = d->mal_def;
+    if ( indef )
+        *indef = d->mal_indef;
 }
 
 
-void KEduVocArticle::getNatural(QString *def, QString *indef) const
+void KEduVocArticle::getNatural( QString *def, QString *indef ) const
 {
-  if (def)
-    *def = d->nat_def;
-  if (indef)
-    *indef = d->nat_indef;
+    if ( def )
+        *def = d->nat_def;
+    if ( indef )
+        *indef = d->nat_indef;
 }
 
 
index c2c7046d9c89c18a2fe20ea98424c10865119010..7f75029987f760fea7fa81792d6dd262ba1c2549 100644 (file)
@@ -40,79 +40,79 @@ class KEDUVOCDOCUMENT_EXPORT KEduVocArticle
 {
 public:
 
-  /**
-   * The constructor without arguments
-   */
-  explicit KEduVocArticle();
-
-  /** copy constructor for d-pointer safety
-   * @param other article object to copy
-   */
-  KEduVocArticle(const KEduVocArticle &other);
-
-  /**
-   * The constructor with arguments
-   * @param fem_def reference to a QString with the definite female article
-   * @param fem_indef reference to a QString with the indefinite female article
-   * @param mal_def reference to a QString with the definite male article
-   * @param mal_indef reference to a QString with the indefinite male article
-   * @param nat_def reference to a QString with the definite neutral article
-   * @param nat_indef reference to a QString with the indefinite neutral article
-   */
-  KEduVocArticle( const QString &fem_def, const QString &fem_indef, const QString &mal_def, const QString &mal_indef, const QString &nat_def, const QString &nat_indef );
-
-  /**
-   * default destructor, deletes the d pointer
-   */
-  ~KEduVocArticle();
-
-  /**
-   * Sets the female articles
-   * @param def const reference to a QString with the definite female article
-   * @param indef const reference to a QString with the indefinite female article
-   */
-  void setFemale(const QString &def, const QString &indef);
-
-  /**
-   * Sets the male articles
-   * @param def const reference to a QString with the definite male article
-   * @param indef const reference to a QString with the indefinite male article
-   */
-  void setMale(const QString &def, const QString &indef);
-
-  /**
-   * Sets the neutral articles
-   * @param def const reference to a QString with the definite neutral article
-   * @param indef const reference to a QString with the indefinite neutral article
-   */
-  void setNatural(const QString &def, const QString &indef);
-
-  /** get the female articles
-   * @param def pointer to the definite form
-   * @param indef pointer to the indefinite form
-   */
-  void getFemale (QString *def, QString *indef) const;
-
-  /** get the male articles
-   * @param def pointer to the definite form
-   * @param indef pointer to the indefinite form
-   */
-  void getMale   (QString *def, QString *indef) const;
-
-  /** get the neutral articles
-   * @param def pointer to the definite form
-   * @param indef pointer to the indefinite form
-   */
-  void getNatural(QString *def, QString *indef) const;
-
-  /**
-   * assignment operator for d-pointer copying
-   */
-  KEduVocArticle &operator=(const KEduVocArticle& other);
+    /**
+     * The constructor without arguments
+     */
+    explicit KEduVocArticle();
+
+    /** copy constructor for d-pointer safety
+     * @param other article object to copy
+     */
+    KEduVocArticle( const KEduVocArticle &other );
+
+    /**
+     * The constructor with arguments
+     * @param fem_def reference to a QString with the definite female article
+     * @param fem_indef reference to a QString with the indefinite female article
+     * @param mal_def reference to a QString with the definite male article
+     * @param mal_indef reference to a QString with the indefinite male article
+     * @param nat_def reference to a QString with the definite neutral article
+     * @param nat_indef reference to a QString with the indefinite neutral article
+     */
+    KEduVocArticle( const QString &fem_def, const QString &fem_indef, const QString &mal_def, const QString &mal_indef, const QString &nat_def, const QString &nat_indef );
+
+    /**
+     * default destructor, deletes the d pointer
+     */
+    ~KEduVocArticle();
+
+    /**
+     * Sets the female articles
+     * @param def const reference to a QString with the definite female article
+     * @param indef const reference to a QString with the indefinite female article
+     */
+    void setFemale( const QString &def, const QString &indef );
+
+    /**
+     * Sets the male articles
+     * @param def const reference to a QString with the definite male article
+     * @param indef const reference to a QString with the indefinite male article
+     */
+    void setMale( const QString &def, const QString &indef );
+
+    /**
+     * Sets the neutral articles
+     * @param def const reference to a QString with the definite neutral article
+     * @param indef const reference to a QString with the indefinite neutral article
+     */
+    void setNatural( const QString &def, const QString &indef );
+
+    /** get the female articles
+     * @param def pointer to the definite form
+     * @param indef pointer to the indefinite form
+     */
+    void getFemale( QString *def, QString *indef ) const;
+
+    /** get the male articles
+     * @param def pointer to the definite form
+     * @param indef pointer to the indefinite form
+     */
+    void getMale( QString *def, QString *indef ) const;
+
+    /** get the neutral articles
+     * @param def pointer to the definite form
+     * @param indef pointer to the indefinite form
+     */
+    void getNatural( QString *def, QString *indef ) const;
+
+    /**
+     * assignment operator for d-pointer copying
+     */
+    KEduVocArticle &operator= ( const KEduVocArticle& other );
 
 private:
-  class Private;
-  Private * const d;
+    class Private;
+    Private * const d;
 };
 
 
@@ -120,80 +120,80 @@ class KEDUVOCDOCUMENT_EXPORT KEduVocComparison
 {
 public:
 
-  /**
-   * The constructor without arguments
-   */
-  explicit KEduVocComparison();
-
-  /** copy constructor
-   * @param other comparison object to copy
-   */
-  KEduVocComparison(const KEduVocComparison &other);
-
-  /**
-   * The constructor with arguments
-   * @param l1
-   * @param l2
-   * @param l3
-   */
-  KEduVocComparison(const QString &l1, const QString &l2, const QString &l3);
-
-  /** default destructor, deletes the d-pointer */
-  ~KEduVocComparison();
-
-  /** set the first comparison
-   @param s value to set
-   */
-  void setL1(const QString &s);
-
-  /** set the second comparison
-   @param s value to set
-   */
-  void setL2(const QString &s);
-
-  /** set the third comparison
-   @param s value to set
-   */
-  void setL3(const QString &s);
-
-  /** get the first comparison
-   * @returns the first comparison
-   */
-  QString l1() const;
-
-  /** get the second comparison
-   * @returns the second comparison
-   */
-  QString l2() const;
-
-  /** get the third comparison
-   * @returns the third comparison
-   */
-  QString l3() const;
-
-  /** is the comparison empty
-   * @returns true if empty, false otherwise
-   */
-  bool isEmpty() const;
-
-  /** clear the comparison */
-  void clear();
-
-  /** equality operator
-   * @param a object to compare to
-   * @returns true if comparisons are the same, false otherwise
-   */
-  bool operator == (const KEduVocComparison& a) const;
-
-  /** assignment operator for d-pointer copying
-   * @param other object to copy from
-   * @returns reference to this object
-   */
-  KEduVocComparison &operator=(const KEduVocComparison& other);
+    /**
+     * The constructor without arguments
+     */
+    explicit KEduVocComparison();
+
+    /** copy constructor
+     * @param other comparison object to copy
+     */
+    KEduVocComparison( const KEduVocComparison &other );
+
+    /**
+     * The constructor with arguments
+     * @param l1
+     * @param l2
+     * @param l3
+     */
+    KEduVocComparison( const QString &l1, const QString &l2, const QString &l3 );
+
+    /** default destructor, deletes the d-pointer */
+    ~KEduVocComparison();
+
+    /** set the first comparison
+     @param s value to set
+     */
+    void setL1( const QString &s );
+
+    /** set the second comparison
+     @param s value to set
+     */
+    void setL2( const QString &s );
+
+    /** set the third comparison
+     @param s value to set
+     */
+    void setL3( const QString &s );
+
+    /** get the first comparison
+     * @returns the first comparison
+     */
+    QString l1() const;
+
+    /** get the second comparison
+     * @returns the second comparison
+     */
+    QString l2() const;
+
+    /** get the third comparison
+     * @returns the third comparison
+     */
+    QString l3() const;
+
+    /** is the comparison empty
+     * @returns true if empty, false otherwise
+     */
+    bool isEmpty() const;
+
+    /** clear the comparison */
+    void clear();
+
+    /** equality operator
+     * @param a object to compare to
+     * @returns true if comparisons are the same, false otherwise
+     */
+    bool operator == ( const KEduVocComparison& a ) const;
+
+    /** assignment operator for d-pointer copying
+     * @param other object to copy from
+     * @returns reference to this object
+     */
+    KEduVocComparison &operator= ( const KEduVocComparison& other );
 
 private:
-  class Private;
-  Private * const d;
+    class Private;
+    Private * const d;
 };
 
 
index 2aa5230af83bfa750736dc0170b917b54ecfaebb..92b6f940ad20f2eb7bdff1e6893cbbcfa28e1d6b 100644 (file)
 #include "keduvockvtmlreader.h"
 #include "keduvoccommon_p.h"
 
-KEduVocKvtml2Reader::KEduVocKvtml2Reader(QIODevice *file)
-: m_inputFile(file)
+KEduVocKvtml2Reader::KEduVocKvtml2Reader( QIODevice *file )
+        : m_inputFile( file )
 {
-  // the file must be already open
-  if (!m_inputFile->isOpen())
-  {
-    m_errorMessage = i18n("file must be opened first");
-  }
+    // the file must be already open
+    if ( !m_inputFile->isOpen() ) {
+        m_errorMessage = i18n( "file must be opened first" );
+    }
 }
 
 
-bool KEduVocKvtml2Reader::readDoc(KEduVocDocument *doc)
+bool KEduVocKvtml2Reader::readDoc( KEduVocDocument *doc )
 {
-  m_doc = doc;
+    m_doc = doc;
 
-  QDomDocument domDoc("KEduVocDocument");
+    QDomDocument domDoc( "KEduVocDocument" );
 
-  if (!domDoc.setContent(m_inputFile, &m_errorMessage))
-    return false;
+    if ( !domDoc.setContent( m_inputFile, &m_errorMessage ) )
+        return false;
 
-  QDomElement domElementKvtml = domDoc.documentElement();
-  if (domElementKvtml.tagName() != KVTML_TAG)
-  {
-    m_errorMessage = i18n("This is not a KDE Vocabulary document.");
-    return false;
-  }
+    QDomElement domElementKvtml = domDoc.documentElement();
+    if ( domElementKvtml.tagName() != KVTML_TAG ) {
+        m_errorMessage = i18n( "This is not a KDE Vocabulary document." );
+        return false;
+    }
 
-  if (domElementKvtml.attribute(KVTML_VERSION).toFloat() < 2.0)
-  {
-    // read the file with the old format
+    if ( domElementKvtml.attribute( KVTML_VERSION ).toFloat() < 2.0 ) {
+        // read the file with the old format
 
-    // first reset the file to the beginning
-    m_inputFile->seek(0);
-    KEduVocKvtmlReader oldFormat(m_inputFile);
+        // first reset the file to the beginning
+        m_inputFile->seek( 0 );
+        KEduVocKvtmlReader oldFormat( m_inputFile );
 
-    // get the return value
-    bool retval = oldFormat.readDoc(doc);
+        // get the return value
+        bool retval = oldFormat.readDoc( doc );
 
-    // pass the errormessage up
-    m_errorMessage = oldFormat.errorMessage();
-    return retval;
-  }
+        // pass the errormessage up
+        m_errorMessage = oldFormat.errorMessage();
+        return retval;
+    }
 
-  //-------------------------------------------------------------------------
-  // Information
-  //-------------------------------------------------------------------------
+    //-------------------------------------------------------------------------
+    // Information
+    //-------------------------------------------------------------------------
 
-  QDomElement info = domElementKvtml.firstChildElement(KVTML_INFORMATION);
-  if (!info.isNull())
-  {
-    if (!readInformation(info))
-      return false;
-  }
+    QDomElement info = domElementKvtml.firstChildElement( KVTML_INFORMATION );
+    if ( !info.isNull() ) {
+        if ( !readInformation( info ) )
+            return false;
+    }
 
-  bool result = readGroups(domElementKvtml);  // read sub-groups
+    bool result = readGroups( domElementKvtml ); // read sub-groups
 
-  return result;
+    return result;
 }
 
-bool KEduVocKvtml2Reader::readInformation(QDomElement &informationElement)
+bool KEduVocKvtml2Reader::readInformation( QDomElement &informationElement )
 {
-  // read the generator
-  QDomElement currentElement = informationElement.firstChildElement(KVTML_GENERATOR);
-  if (!currentElement.isNull())
-  {
-    m_doc->setGenerator(currentElement.text());
-    // add the version if it's there
-    int pos = m_doc->generator().lastIndexOf(KVD_VERS_PREFIX);
-    if (pos >= 0)
-    {
-      m_doc->setVersion(m_doc->generator().remove(0, pos + 2));
-    }
-  }
-
-  // read the title
-  currentElement = informationElement.firstChildElement(KVTML_TITLE);
-  if (!currentElement.isNull())
-  {
-    m_doc->setTitle(currentElement.text());
-  }
-
-  // read the author
-  currentElement = informationElement.firstChildElement(KVTML_AUTHOR);
-  if (!currentElement.isNull())
-  {
-    m_doc->setAuthor(currentElement.text());
-  }
-
-  // read the license
-  currentElement = informationElement.firstChildElement(KVTML_LICENSE);
-  if (!currentElement.isNull())
-  {
-    m_doc->setLicense(currentElement.text());
-  }
-
-  // read the comment
-  currentElement = informationElement.firstChildElement(KVTML_COMMENT);
-  if (!currentElement.isNull())
-  {
-    m_doc->setDocumentRemark(currentElement.text());
-  }
-
-  return true;
+    // read the generator
+    QDomElement currentElement = informationElement.firstChildElement( KVTML_GENERATOR );
+    if ( !currentElement.isNull() ) {
+        m_doc->setGenerator( currentElement.text() );
+        // add the version if it's there
+        int pos = m_doc->generator().lastIndexOf( KVD_VERS_PREFIX );
+        if ( pos >= 0 ) {
+            m_doc->setVersion( m_doc->generator().remove( 0, pos + 2 ) );
+        }
+    }
+
+    // read the title
+    currentElement = informationElement.firstChildElement( KVTML_TITLE );
+    if ( !currentElement.isNull() ) {
+        m_doc->setTitle( currentElement.text() );
+    }
+
+    // read the author
+    currentElement = informationElement.firstChildElement( KVTML_AUTHOR );
+    if ( !currentElement.isNull() ) {
+        m_doc->setAuthor( currentElement.text() );
+    }
+
+    // read the license
+    currentElement = informationElement.firstChildElement( KVTML_LICENSE );
+    if ( !currentElement.isNull() ) {
+        m_doc->setLicense( currentElement.text() );
+    }
+
+    // read the comment
+    currentElement = informationElement.firstChildElement( KVTML_COMMENT );
+    if ( !currentElement.isNull() ) {
+        m_doc->setDocumentRemark( currentElement.text() );
+    }
+
+    return true;
 }
 
-bool KEduVocKvtml2Reader::readGroups(QDomElement &domElementParent)
+bool KEduVocKvtml2Reader::readGroups( QDomElement &domElementParent )
 {
-  bool result = false;
+    bool result = false;
 
-  QDomElement currentElement;
+    QDomElement currentElement;
 
-  QDomElement groupElement = domElementParent.firstChildElement(KVTML_IDENTIFIERS);
-  if (!groupElement.isNull())
-  {
-    QDomNodeList entryList = groupElement.elementsByTagName(KVTML_IDENTIFIER);
-    if (entryList.length() <= 0)
-    {
-      m_errorMessage = i18n("missing identifier elements from identifiers tag");
-      return false;
+    QDomElement groupElement = domElementParent.firstChildElement( KVTML_IDENTIFIERS );
+    if ( !groupElement.isNull() ) {
+        QDomNodeList entryList = groupElement.elementsByTagName( KVTML_IDENTIFIER );
+        if ( entryList.length() <= 0 ) {
+            m_errorMessage = i18n( "missing identifier elements from identifiers tag" );
+            return false;
+        }
+
+        for ( int i = 0; i < entryList.count(); ++i ) {
+            currentElement = entryList.item( i ).toElement();
+            if ( currentElement.parentNode() == groupElement ) {
+                result = readIdentifier( currentElement );
+                if ( !result )
+                    return false;
+            }
+        }
     }
 
-    for (int i = 0; i < entryList.count(); ++i)
-    {
-      currentElement = entryList.item(i).toElement();
-      if (currentElement.parentNode() == groupElement)
-      {
-        result = readIdentifier(currentElement);
-        if (!result)
-          return false;
-      }
+    groupElement = domElementParent.firstChildElement( KVTML_WORDTYPEDEFINITIONS );
+    if ( !groupElement.isNull() ) {
+        readTypes( groupElement );
     }
-  }
-
-  groupElement = domElementParent.firstChildElement(KVTML_WORDTYPEDEFINITIONS);
-  if (!groupElement.isNull())
-  {
-    readTypes(groupElement);
-  }
-
-  groupElement = domElementParent.firstChildElement(KVTML_TENSES);
-  if (!groupElement.isNull())
-  {
-    readTenses(groupElement);
-  }
-
-  groupElement = domElementParent.firstChildElement(KVTML_USAGES);
-  if (!groupElement.isNull())
-  {
-    readUsages(groupElement);
-  }
-
-  groupElement = domElementParent.firstChildElement(KVTML_ENTRIES);
-  if (!groupElement.isNull())
-  {
-         QDomNodeList entryList = groupElement.elementsByTagName(KVTML_ENTRY);
-    if (entryList.length() <= 0)
-    {
-      m_errorMessage = i18n("no entries found in 'entries' tag");
-      return false; // at least one entry is required
+
+    groupElement = domElementParent.firstChildElement( KVTML_TENSES );
+    if ( !groupElement.isNull() ) {
+        readTenses( groupElement );
     }
 
-    for (int i = 0; i < entryList.count(); ++i)
-    {
-      currentElement = entryList.item(i).toElement();
-      if (currentElement.parentNode() == groupElement)
-      {
-        result = readEntry(currentElement);
-        if (!result)
-          return false;
-      }
+    groupElement = domElementParent.firstChildElement( KVTML_USAGES );
+    if ( !groupElement.isNull() ) {
+        readUsages( groupElement );
     }
-  }
 
-  groupElement = domElementParent.firstChildElement(KVTML_LESSONS);
-  if (!groupElement.isNull())
-  {
-         QDomNodeList entryList = groupElement.elementsByTagName(KVTML_LESSON);
-    if (entryList.length() <= 0)
-    {
-      m_errorMessage = i18n("no lessons found in 'lessons' tag");
-      return false; // at least one entry is required
+    groupElement = domElementParent.firstChildElement( KVTML_ENTRIES );
+    if ( !groupElement.isNull() ) {
+        QDomNodeList entryList = groupElement.elementsByTagName( KVTML_ENTRY );
+        if ( entryList.length() <= 0 ) {
+            m_errorMessage = i18n( "no entries found in 'entries' tag" );
+            return false; // at least one entry is required
+        }
+
+        for ( int i = 0; i < entryList.count(); ++i ) {
+            currentElement = entryList.item( i ).toElement();
+            if ( currentElement.parentNode() == groupElement ) {
+                result = readEntry( currentElement );
+                if ( !result )
+                    return false;
+            }
+        }
     }
 
-    for (int i = 0; i < entryList.count(); ++i)
-    {
-      currentElement = entryList.item(i).toElement();
-      if (currentElement.parentNode() == groupElement)
-      {
-        result = readLesson(currentElement);
-        if (!result)
-          return false;
-      }
+    groupElement = domElementParent.firstChildElement( KVTML_LESSONS );
+    if ( !groupElement.isNull() ) {
+        QDomNodeList entryList = groupElement.elementsByTagName( KVTML_LESSON );
+        if ( entryList.length() <= 0 ) {
+            m_errorMessage = i18n( "no lessons found in 'lessons' tag" );
+            return false; // at least one entry is required
+        }
+
+        for ( int i = 0; i < entryList.count(); ++i ) {
+            currentElement = entryList.item( i ).toElement();
+            if ( currentElement.parentNode() == groupElement ) {
+                result = readLesson( currentElement );
+                if ( !result )
+                    return false;
+            }
+        }
     }
-  }
 
-  return true;
+    return true;
 }
 
-bool KEduVocKvtml2Reader::readIdentifier(QDomElement &identifierElement)
+bool KEduVocKvtml2Reader::readIdentifier( QDomElement &identifierElement )
 {
-  bool result = true;
-  int id = identifierElement.attribute(KVTML_ID).toInt(&result);
-  if (!result)
-  {
-    m_errorMessage = i18n("identifier missing id");
-    return false;
-  }
-
-  QDomElement currentElement = identifierElement.firstChildElement(KVTML_IDENTIFIERTYPE);
-  if (!currentElement.isNull())
-  {
-    // TODO: do something with the type
-  }
-
-  currentElement = identifierElement.firstChildElement(KVTML_LOCALE);
-  if (!currentElement.isNull())
-  {
-    // TODO: do we want to use this for the identifier, or the name?
-    int index = m_doc->appendIdentifier(currentElement.text());
-    if (index != id)
-    {
-      m_errorMessage = i18n("identifiers out of order");
-      return false;
-    }
-  }
-
-  currentElement = identifierElement.firstChildElement(KVTML_NAME);
-  if (!currentElement.isNull())
-  {
-    // TODO: do something with the name
-  }
-
-  currentElement = identifierElement.firstChildElement(KVTML_SIZEHINT);
-  if (!currentElement.isNull())
-  {
-    // TODO: do something with the sizehint
-  }
-
-  // read sub-parts
-  currentElement = identifierElement.firstChildElement(KVTML_ARTICLE);
-  if (!currentElement.isNull())
-  {
-    readArticle(currentElement, id);
-  }
-
-  currentElement = identifierElement.firstChildElement(KVTML_PERSONALPRONOUNS);
-  if (!currentElement.isNull())
-  {
-    KEduVocConjugation personalPronouns;
-    readConjugation(currentElement, personalPronouns);
-    m_doc->setConjugation(id, personalPronouns);
-  }
-  return result;
+    bool result = true;
+    int id = identifierElement.attribute( KVTML_ID ).toInt( &result );
+    if ( !result ) {
+        m_errorMessage = i18n( "identifier missing id" );
+        return false;
+    }
+
+    QDomElement currentElement = identifierElement.firstChildElement( KVTML_IDENTIFIERTYPE );
+    if ( !currentElement.isNull() ) {
+        // TODO: do something with the type
+    }
+
+    currentElement = identifierElement.firstChildElement( KVTML_LOCALE );
+    if ( !currentElement.isNull() ) {
+        // TODO: do we want to use this for the identifier, or the name?
+        int index = m_doc->appendIdentifier( currentElement.text() );
+        if ( index != id ) {
+            m_errorMessage = i18n( "identifiers out of order" );
+            return false;
+        }
+    }
+
+    currentElement = identifierElement.firstChildElement( KVTML_NAME );
+    if ( !currentElement.isNull() ) {
+        // TODO: do something with the name
+    }
+
+    currentElement = identifierElement.firstChildElement( KVTML_SIZEHINT );
+    if ( !currentElement.isNull() ) {
+        // TODO: do something with the sizehint
+    }
+
+    // read sub-parts
+    currentElement = identifierElement.firstChildElement( KVTML_ARTICLE );
+    if ( !currentElement.isNull() ) {
+        readArticle( currentElement, id );
+    }
+
+    currentElement = identifierElement.firstChildElement( KVTML_PERSONALPRONOUNS );
+    if ( !currentElement.isNull() ) {
+        KEduVocConjugation personalPronouns;
+        readConjugation( currentElement, personalPronouns );
+        m_doc->setConjugation( id, personalPronouns );
+    }
+    return result;
 }
 
-bool KEduVocKvtml2Reader::readEntry(QDomElement &entryElement)
+bool KEduVocKvtml2Reader::readEntry( QDomElement &entryElement )
 {
-  KEduVocExpression expr;
-  QDomElement currentElement;
-  bool result = true;
-
-  // get entry id
-  int id = entryElement.attribute(KVTML_ID).toInt(&result);
-  if (!result)
-  {
-    m_errorMessage = i18n("entry missing id");
-    return false;
-  }
-
-  // read info tags: inactive, inquery, and sizehint
-  currentElement = entryElement.firstChildElement(KVTML_INACTIVE);
-  if (!currentElement.isNull())
-  {
-    // set the active state of the expression
-    if (currentElement.text() == KVTML_TRUE)
-    {
-      expr.setActive(false);
+    KEduVocExpression expr;
+    QDomElement currentElement;
+    bool result = true;
+
+    // get entry id
+    int id = entryElement.attribute( KVTML_ID ).toInt( &result );
+    if ( !result ) {
+        m_errorMessage = i18n( "entry missing id" );
+        return false;
     }
-    else
-    {
-      expr.setActive(true);
+
+    // read info tags: inactive, inquery, and sizehint
+    currentElement = entryElement.firstChildElement( KVTML_INACTIVE );
+    if ( !currentElement.isNull() ) {
+        // set the active state of the expression
+        if ( currentElement.text() == KVTML_TRUE ) {
+            expr.setActive( false );
+        } else {
+            expr.setActive( true );
+        }
     }
-  }
 
-  currentElement = entryElement.firstChildElement(KVTML_INQUERY);
-  if (!currentElement.isNull())
-  {
-    // set the inquery information
-    if (currentElement.text() == KVTML_TRUE)
-    {
-      expr.setInQuery(true);
+    currentElement = entryElement.firstChildElement( KVTML_INQUERY );
+    if ( !currentElement.isNull() ) {
+        // set the inquery information
+        if ( currentElement.text() == KVTML_TRUE ) {
+            expr.setInQuery( true );
+        } else {
+            expr.setInQuery( false );
+        }
     }
-    else
-    {
-      expr.setInQuery(false);
-    }
-  }
-
-  currentElement = entryElement.firstChildElement(KVTML_SIZEHINT);
-  if (!currentElement.isNull())
-  {
-    // set the sizehint
-    expr.setSizeHint(currentElement.text().toInt());
-  }
-
-  // read translation children
-  QDomNodeList translationList = entryElement.elementsByTagName(KVTML_TRANSLATION);
-  if (translationList.length() <= 0)
-  {
-    m_errorMessage = i18n("no translations found");
-    return false; // at least one translation is required
-  }
-
-  for (int i = 0; i < translationList.count(); ++i)
-  {
-    currentElement = translationList.item(i).toElement();
-    if (currentElement.parentNode() == entryElement)
-    {
-      result = readTranslation(currentElement, expr, i);
-      if (!result)
-        return false;
+
+    currentElement = entryElement.firstChildElement( KVTML_SIZEHINT );
+    if ( !currentElement.isNull() ) {
+        // set the sizehint
+        expr.setSizeHint( currentElement.text().toInt() );
+    }
+
+    // read translation children
+    QDomNodeList translationList = entryElement.elementsByTagName( KVTML_TRANSLATION );
+    if ( translationList.length() <= 0 ) {
+        m_errorMessage = i18n( "no translations found" );
+        return false; // at least one translation is required
     }
-  }
 
-  // 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;
+    for ( int i = 0; i < translationList.count(); ++i ) {
+        currentElement = translationList.item( i ).toElement();
+        if ( currentElement.parentNode() == entryElement ) {
+            result = readTranslation( currentElement, expr, i );
+            if ( !result )
+                return false;
+        }
+    }
+
+    // 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;
 }
 
-bool KEduVocKvtml2Reader::readTranslation(QDomElement &translationElement,
-                                          KEduVocExpression &expr, int index)
+bool KEduVocKvtml2Reader::readTranslation( QDomElement &translationElement,
+        KEduVocExpression &expr, int index )
 {
-  QDomElement currentElement = translationElement.firstChildElement(KVTML_TEXT);
-  if (!currentElement.isNull())
-  {
-    expr.translation(index).setText(currentElement.text());
-  }
-
-  currentElement = translationElement.firstChildElement(KVTML_COMMENT);
-  if (!currentElement.isNull())
-  {
-    expr.translation(index).setComment(currentElement.text());
-  }
-
-  currentElement = translationElement.firstChildElement(KVTML_WORDTYPE);
-  if (!currentElement.isNull())
-  {
-    QDomElement typeElement = currentElement.firstChildElement(KVTML_TYPENAME);
-    expr.translation(index).setType(typeElement.text());
-    // read subtype if the type is not empty
-    typeElement = currentElement.firstChildElement(KVTML_SUBTYPENAME);
-    if (!typeElement.isNull())
-    {
-      expr.translation(index).setSubType(typeElement.text());
-    }
-  }
-
-  //<pronunciation></pronunciation>
-  currentElement = translationElement.firstChildElement(KVTML_PRONUNCIATION);
-  if (!currentElement.isNull())
-  {
-    expr.translation(index).setPronunciation(currentElement.text());
-  }
-
-  //<falsefriend fromid="1"></falsefriend>
-  currentElement = translationElement.firstChildElement(KVTML_FALSEFRIEND);
-  if (!currentElement.isNull())
-  {
-    int fromid = currentElement.attribute(KVTML_FROMID).toInt();
-    expr.translation(index).setFalseFriend(fromid, currentElement.text());
-  }
-
-  //<antonym></antonym>
-  currentElement = translationElement.firstChildElement(KVTML_ANTONYM);
-  if (!currentElement.isNull())
-  {
-    expr.translation(index).setAntonym(currentElement.text());
-  }
-
-  //<synonym></synonym>
-  currentElement = translationElement.firstChildElement(KVTML_SYNONYM);
-  if (!currentElement.isNull())
-  {
-    expr.translation(index).setSynonym(currentElement.text());
-  }
-
-  //<example></example>
-  currentElement = translationElement.firstChildElement(KVTML_EXAMPLE);
-  if (!currentElement.isNull())
-  {
-    expr.translation(index).setExample(currentElement.text());
-  }
-
-  //<usage></usage> can be as often as there are usage labels
-  currentElement = translationElement.firstChildElement(KVTML_USAGE);
-  while (!currentElement.isNull())
-  {
-    expr.translation(index).usages().insert(currentElement.text());
-    currentElement = currentElement.nextSiblingElement(KVTML_USAGE);
-  }
-
-  //<paraphrase></paraphrase>
-  currentElement = translationElement.firstChildElement(KVTML_PARAPHRASE);
-  if (!currentElement.isNull())
-  {
-    expr.translation(index).setParaphrase(currentElement.text());
-  }
-
-  // conjugations
-  currentElement = translationElement.firstChildElement(KVTML_CONJUGATION);
-  KEduVocConjugation conjugation;
-  while (!currentElement.isNull())
-  {
-    // read any conjugations (NOTE: this will overwrite any conjugations of the same type for this
-    // translation, as the type is used as the key
-    readConjugation(currentElement, conjugation);
-    currentElement = currentElement.nextSiblingElement(KVTML_CONJUGATION);
-  }
-  if (conjugation.entryCount() > 0)
-  {
-    expr.translation(index).setConjugation(conjugation);
-  }
-
-  // grade elements
-  currentElement = translationElement.firstChildElement(KVTML_GRADE);
-  while (!currentElement.isNull())
-  {
-    // TODO: read grade
-    readGrade(currentElement, expr, index);
-    currentElement = currentElement.nextSiblingElement(KVTML_GRADE);
-  }
-
-  // comparisons
-  currentElement = translationElement.firstChildElement(KVTML_COMPARISON);
-  if (!currentElement.isNull())
-  {
-    KEduVocComparison comparison;
-    readComparison(currentElement, comparison);
-    expr.translation(index).setComparison(comparison);
-  }
-
-  // multiple choice
-  currentElement = translationElement.firstChildElement(KVTML_MULTIPLECHOICE);
-  if (!currentElement.isNull())
-  {
-    KEduVocMultipleChoice mc;
-    readMultipleChoice(currentElement, mc);
-    expr.translation(index).setMultipleChoice(mc);
-  }
-
-  // image
-  currentElement = translationElement.firstChildElement(KVTML_IMAGE);
-  if (!currentElement.isNull())
-  {
-    // TODO: do something with the image
-  }
-
-  // sound
-  currentElement = translationElement.firstChildElement(KVTML_SOUND);
-  if (!currentElement.isNull())
-  {
-    // TODO: do something with the sound
-  }
-
-  return true;
+    QDomElement currentElement = translationElement.firstChildElement( KVTML_TEXT );
+    if ( !currentElement.isNull() ) {
+        expr.translation( index ).setText( currentElement.text() );
+    }
+
+    currentElement = translationElement.firstChildElement( KVTML_COMMENT );
+    if ( !currentElement.isNull() ) {
+        expr.translation( index ).setComment( currentElement.text() );
+    }
+
+    currentElement = translationElement.firstChildElement( KVTML_WORDTYPE );
+    if ( !currentElement.isNull() ) {
+        QDomElement typeElement = currentElement.firstChildElement( KVTML_TYPENAME );
+        expr.translation( index ).setType( typeElement.text() );
+        // read subtype if the type is not empty
+        typeElement = currentElement.firstChildElement( KVTML_SUBTYPENAME );
+        if ( !typeElement.isNull() ) {
+            expr.translation( index ).setSubType( typeElement.text() );
+        }
+    }
+
+    //<pronunciation></pronunciation>
+    currentElement = translationElement.firstChildElement( KVTML_PRONUNCIATION );
+    if ( !currentElement.isNull() ) {
+        expr.translation( index ).setPronunciation( currentElement.text() );
+    }
+
+    //<falsefriend fromid="1"></falsefriend>
+    currentElement = translationElement.firstChildElement( KVTML_FALSEFRIEND );
+    if ( !currentElement.isNull() ) {
+        int fromid = currentElement.attribute( KVTML_FROMID ).toInt();
+        expr.translation( index ).setFalseFriend( fromid, currentElement.text() );
+    }
+
+    //<antonym></antonym>
+    currentElement = translationElement.firstChildElement( KVTML_ANTONYM );
+    if ( !currentElement.isNull() ) {
+        expr.translation( index ).setAntonym( currentElement.text() );
+    }
+
+    //<synonym></synonym>
+    currentElement = translationElement.firstChildElement( KVTML_SYNONYM );
+    if ( !currentElement.isNull() ) {
+        expr.translation( index ).setSynonym( currentElement.text() );
+    }
+
+    //<example></example>
+    currentElement = translationElement.firstChildElement( KVTML_EXAMPLE );
+    if ( !currentElement.isNull() ) {
+        expr.translation( index ).setExample( currentElement.text() );
+    }
+
+    //<usage></usage> can be as often as there are usage labels
+    currentElement = translationElement.firstChildElement( KVTML_USAGE );
+    while ( !currentElement.isNull() ) {
+        expr.translation( index ).usages().insert( currentElement.text() );
+        currentElement = currentElement.nextSiblingElement( KVTML_USAGE );
+    }
+
+    //<paraphrase></paraphrase>
+    currentElement = translationElement.firstChildElement( KVTML_PARAPHRASE );
+    if ( !currentElement.isNull() ) {
+        expr.translation( index ).setParaphrase( currentElement.text() );
+    }
+
+    // conjugations
+    currentElement = translationElement.firstChildElement( KVTML_CONJUGATION );
+    KEduVocConjugation conjugation;
+    while ( !currentElement.isNull() ) {
+        // read any conjugations (NOTE: this will overwrite any conjugations of the same type for this
+        // translation, as the type is used as the key
+        readConjugation( currentElement, conjugation );
+        currentElement = currentElement.nextSiblingElement( KVTML_CONJUGATION );
+    }
+    if ( conjugation.entryCount() > 0 ) {
+        expr.translation( index ).setConjugation( conjugation );
+    }
+
+    // grade elements
+    currentElement = translationElement.firstChildElement( KVTML_GRADE );
+    while ( !currentElement.isNull() ) {
+        // TODO: read grade
+        readGrade( currentElement, expr, index );
+        currentElement = currentElement.nextSiblingElement( KVTML_GRADE );
+    }
+
+    // comparisons
+    currentElement = translationElement.firstChildElement( KVTML_COMPARISON );
+    if ( !currentElement.isNull() ) {
+        KEduVocComparison comparison;
+        readComparison( currentElement, comparison );
+        expr.translation( index ).setComparison( comparison );
+    }
+
+    // multiple choice
+    currentElement = translationElement.firstChildElement( KVTML_MULTIPLECHOICE );
+    if ( !currentElement.isNull() ) {
+        KEduVocMultipleChoice mc;
+        readMultipleChoice( currentElement, mc );
+        expr.translation( index ).setMultipleChoice( mc );
+    }
+
+    // image
+    currentElement = translationElement.firstChildElement( KVTML_IMAGE );
+    if ( !currentElement.isNull() ) {
+        // TODO: do something with the image
+    }
+
+    // sound
+    currentElement = translationElement.firstChildElement( KVTML_SOUND );
+    if ( !currentElement.isNull() ) {
+        // TODO: do something with the sound
+    }
+
+    return true;
 }
 
-bool KEduVocKvtml2Reader::readLesson(QDomElement &lessonElement)
+bool KEduVocKvtml2Reader::readLesson( QDomElement &lessonElement )
 {
-  // NOTE: currently this puts an identifier into the last lesson it is in, once support for multiple lessons
-  // is in the entry class, all lessons that include an entry will be in there
-  int lessonId = 0;
-
-  //<name>Lesson name</name>
-  QDomElement currentElement = lessonElement.firstChildElement(KVTML_NAME);
-  if (!currentElement.isNull())
-  {
-    lessonId = m_doc->addLesson(currentElement.text());
-  }
-  else
-  {
-    m_errorMessage = i18n("each lesson must have a name");
-    return false;
-  }
-
-  //<query>true</query>
-  currentElement = lessonElement.firstChildElement(KVTML_QUERY);
-  if (!currentElement.isNull())
-  {
-    if (currentElement.text() == KVTML_TRUE)
-    {
-      m_doc->addLessonToQuery(lessonId);
+    // NOTE: currently this puts an identifier into the last lesson it is in, once support for multiple lessons
+    // is in the entry class, all lessons that include an entry will be in there
+    int lessonId = 0;
+
+    //<name>Lesson name</name>
+    QDomElement currentElement = lessonElement.firstChildElement( KVTML_NAME );
+    if ( !currentElement.isNull() ) {
+        lessonId = m_doc->addLesson( currentElement.text() );
+    } else {
+        m_errorMessage = i18n( "each lesson must have a name" );
+        return false;
     }
-  }
 
-  //<current>true</current>
-  currentElement = lessonElement.firstChildElement(KVTML_CURRENT);
-  if (!currentElement.isNull())
-  {
-    if (currentElement.text() == KVTML_TRUE)
-    {
-      m_doc->setCurrentLesson(lessonId);
-    }
-  }
-
-  //<entryid>0</entryid>
-  currentElement = lessonElement.firstChildElement(KVTML_ENTRYID);
-  while (!currentElement.isNull())
-  {
-    int entryId = currentElement.text().toInt();
-    // 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);
-  }
-
-  return true;
+    //<query>true</query>
+    currentElement = lessonElement.firstChildElement( KVTML_QUERY );
+    if ( !currentElement.isNull() ) {
+        if ( currentElement.text() == KVTML_TRUE ) {
+            m_doc->addLessonToQuery( lessonId );
+        }
+    }
+
+    //<current>true</current>
+    currentElement = lessonElement.firstChildElement( KVTML_CURRENT );
+    if ( !currentElement.isNull() ) {
+        if ( currentElement.text() == KVTML_TRUE ) {
+            m_doc->setCurrentLesson( lessonId );
+        }
+    }
+
+    //<entryid>0</entryid>
+    currentElement = lessonElement.firstChildElement( KVTML_ENTRYID );
+    while ( !currentElement.isNull() ) {
+        int entryId = currentElement.text().toInt();
+        // 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 );
+    }
+
+    return true;
 }
 
 
-bool KEduVocKvtml2Reader::readArticle(QDomElement &articleElement, int identifierNum)
+bool KEduVocKvtml2Reader::readArticle( QDomElement &articleElement, int identifierNum )
 /*
  <article>
   <definite>
@@ -570,63 +498,57 @@ bool KEduVocKvtml2Reader::readArticle(QDomElement &articleElement, int identifie
  </article>
 */
 {
-  QString fem_def = "";
-  QString mal_def = "";
-  QString nat_def = "";
-  QString fem_indef = "";
-  QString mal_indef = "";
-  QString nat_indef = "";
-
-  QDomElement currentElement = articleElement.firstChildElement(KVTML_DEFINITE);
-  if (!currentElement.isNull())
-  {
-    QDomElement subElement = currentElement.firstChildElement(KVTML_MALE);
-    if (!subElement.isNull())
-    {
-      mal_def = subElement.text();
-    }
+    QString fem_def = "";
+    QString mal_def = "";
+    QString nat_def = "";
+    QString fem_indef = "";
+    QString mal_indef = "";
+    QString nat_indef = "";
+
+    QDomElement currentElement = articleElement.firstChildElement( KVTML_DEFINITE );
+    if ( !currentElement.isNull() )
+    {
+        QDomElement subElement = currentElement.firstChildElement( KVTML_MALE );
+        if ( !subElement.isNull() ) {
+            mal_def = subElement.text();
+        }
 
-    subElement = currentElement.firstChildElement(KVTML_FEMALE);
-    if (!subElement.isNull())
-    {
-      fem_def = subElement.text();
-    }
+        subElement = currentElement.firstChildElement( KVTML_FEMALE );
+        if ( !subElement.isNull() ) {
+            fem_def = subElement.text();
+        }
 
-    subElement = currentElement.firstChildElement(KVTML_NEUTRAL);
-    if (!subElement.isNull())
-    {
-      nat_def = subElement.text();
+        subElement = currentElement.firstChildElement( KVTML_NEUTRAL );
+        if ( !subElement.isNull() ) {
+            nat_def = subElement.text();
+        }
     }
-  }
 
-  currentElement = articleElement.firstChildElement(KVTML_INDEFINITE);
-  if (!currentElement.isNull())
-  {
-    QDomElement subElement = currentElement.firstChildElement(KVTML_MALE);
-    if (!subElement.isNull())
+    currentElement = articleElement.firstChildElement( KVTML_INDEFINITE );
+    if ( !currentElement.isNull() )
     {
-      mal_indef = subElement.text();
-    }
+        QDomElement subElement = currentElement.firstChildElement( KVTML_MALE );
+        if ( !subElement.isNull() ) {
+            mal_indef = subElement.text();
+        }
 
-    subElement = currentElement.firstChildElement(KVTML_FEMALE);
-    if (!subElement.isNull())
-    {
-      fem_indef = subElement.text();
-    }
+        subElement = currentElement.firstChildElement( KVTML_FEMALE );
+        if ( !subElement.isNull() ) {
+            fem_indef = subElement.text();
+        }
 
-    subElement = currentElement.firstChildElement(KVTML_NEUTRAL);
-    if (!subElement.isNull())
-    {
-      nat_indef = subElement.text();
+        subElement = currentElement.firstChildElement( KVTML_NEUTRAL );
+        if ( !subElement.isNull() ) {
+            nat_indef = subElement.text();
+        }
     }
-  }
-  m_doc->setArticle(identifierNum, KEduVocArticle(fem_def, fem_indef, mal_def, mal_indef, nat_def, nat_indef));
+    m_doc->setArticle( identifierNum, KEduVocArticle( fem_def, fem_indef, mal_def, mal_indef, nat_def, nat_indef ) );
 
-  return true;
+    return true;
 }
 
 
-bool KEduVocKvtml2Reader::readConjugation(QDomElement &conjugElement, KEduVocConjugation &curr_conjug)
+bool KEduVocKvtml2Reader::readConjugation( QDomElement &conjugElement, KEduVocConjugation &curr_conjug )
 /*
  <conjugation>
   <tenseid>1</tenseid>
@@ -650,188 +572,170 @@ bool KEduVocKvtml2Reader::readConjugation(QDomElement &conjugElement, KEduVocCon
  </conjugation>
 */
 {
-  bool p3_common;
-  bool s3_common;
-  QString singfirst;
-  QString singsecond;
-  QString singthirdmale;
-  QString singthirdfemale;
-  QString singthirdneutral;
-  QString plurfirst;
-  QString plursecond;
-  QString plurthirdmale;
-  QString plurthirdfemale;
-  QString plurthirdneutral;
-  QString type;
-
-  QDomElement typeElement = conjugElement.firstChildElement(KVTML_CONJUGATIONTYPE);
-  if (!typeElement.isNull())
-  {
-    type = typeElement.text();
-  }
-
-  // TODO: add something here to link and/or store tense information
-
-  QDomElement currentGroup = conjugElement.firstChildElement(KVTML_SINGULAR);
-  if (!currentGroup.isNull())
-  {
-    QDomElement currentElement = currentGroup.firstChildElement(KVTML_1STPERSON);
-    if (!currentElement.isNull())
-    {
-      singfirst = currentElement.text();
-    }
-
-    currentElement = currentGroup.firstChildElement(KVTML_2NDPERSON);
-    if (!currentElement.isNull())
-    {
-      singsecond = currentElement.text();
-    }
-
-    currentGroup = currentGroup.firstChildElement(KVTML_3RDPERSON);
-    if (!currentGroup.isNull())
-    {
-      currentElement = currentGroup.firstChildElement(KVTML_COMMON);
-      if (!currentElement.isNull())
-      {
-        s3_common = true;
-        singthirdmale = currentElement.text();
-        singthirdfemale = singthirdmale;
-        singthirdneutral = singthirdmale;
-      }
-      else
-      {
-        s3_common = false;
-        currentElement = currentGroup.firstChildElement(KVTML_MALE);
-        if (!currentElement.isNull())
-        {
-          singthirdmale = currentElement.text();
-        }
-
-        currentElement = currentGroup.firstChildElement(KVTML_FEMALE);
-        if (!currentElement.isNull())
-        {
-          singthirdfemale = currentElement.text();
+    bool p3_common;
+    bool s3_common;
+    QString singfirst;
+    QString singsecond;
+    QString singthirdmale;
+    QString singthirdfemale;
+    QString singthirdneutral;
+    QString plurfirst;
+    QString plursecond;
+    QString plurthirdmale;
+    QString plurthirdfemale;
+    QString plurthirdneutral;
+    QString type;
+
+    QDomElement typeElement = conjugElement.firstChildElement( KVTML_CONJUGATIONTYPE );
+    if ( !typeElement.isNull() )
+    {
+        type = typeElement.text();
+    }
+
+    // TODO: add something here to link and/or store tense information
+
+    QDomElement currentGroup = conjugElement.firstChildElement( KVTML_SINGULAR );
+    if ( !currentGroup.isNull() )
+    {
+        QDomElement currentElement = currentGroup.firstChildElement( KVTML_1STPERSON );
+        if ( !currentElement.isNull() ) {
+            singfirst = currentElement.text();
         }
 
-        currentElement = currentGroup.firstChildElement(KVTML_NEUTRAL);
-        if (!currentElement.isNull())
-        {
-          singthirdneutral = currentElement.text();
+        currentElement = currentGroup.firstChildElement( KVTML_2NDPERSON );
+        if ( !currentElement.isNull() ) {
+            singsecond = currentElement.text();
         }
-      }
-
-    }
-  }
 
-  currentGroup = conjugElement.firstChildElement(KVTML_PLURAL);
-  if (!currentGroup.isNull())
-  {
-    QDomElement currentElement = currentGroup.firstChildElement(KVTML_1STPERSON);
-    if (!currentElement.isNull())
-    {
-      plurfirst = currentElement.text();
-    }
+        currentGroup = currentGroup.firstChildElement( KVTML_3RDPERSON );
+        if ( !currentGroup.isNull() ) {
+            currentElement = currentGroup.firstChildElement( KVTML_COMMON );
+            if ( !currentElement.isNull() ) {
+                s3_common = true;
+                singthirdmale = currentElement.text();
+                singthirdfemale = singthirdmale;
+                singthirdneutral = singthirdmale;
+            } else {
+                s3_common = false;
+                currentElement = currentGroup.firstChildElement( KVTML_MALE );
+                if ( !currentElement.isNull() ) {
+                    singthirdmale = currentElement.text();
+                }
+
+                currentElement = currentGroup.firstChildElement( KVTML_FEMALE );
+                if ( !currentElement.isNull() ) {
+                    singthirdfemale = currentElement.text();
+                }
+
+                currentElement = currentGroup.firstChildElement( KVTML_NEUTRAL );
+                if ( !currentElement.isNull() ) {
+                    singthirdneutral = currentElement.text();
+                }
+            }
 
-    currentElement = currentGroup.firstChildElement(KVTML_2NDPERSON);
-    if (!currentElement.isNull())
-    {
-      plursecond = currentElement.text();
+        }
     }
 
-    currentGroup = currentGroup.firstChildElement(KVTML_3RDPERSON);
-    if (!currentGroup.isNull())
+    currentGroup = conjugElement.firstChildElement( KVTML_PLURAL );
+    if ( !currentGroup.isNull() )
     {
-      currentElement = currentGroup.firstChildElement(KVTML_COMMON);
-      if (!currentElement.isNull())
-      {
-        p3_common = true;
-        plurthirdmale = currentElement.text();
-        plurthirdfemale = singthirdmale;
-        plurthirdneutral = singthirdmale;
-      }
-      else
-      {
-        p3_common = false;
-        currentElement = currentGroup.firstChildElement(KVTML_MALE);
-        if (!currentElement.isNull())
-        {
-          plurthirdmale = currentElement.text();
+        QDomElement currentElement = currentGroup.firstChildElement( KVTML_1STPERSON );
+        if ( !currentElement.isNull() ) {
+            plurfirst = currentElement.text();
         }
 
-        currentElement = currentGroup.firstChildElement(KVTML_FEMALE);
-        if (!currentElement.isNull())
-        {
-          plurthirdfemale = currentElement.text();
+        currentElement = currentGroup.firstChildElement( KVTML_2NDPERSON );
+        if ( !currentElement.isNull() ) {
+            plursecond = currentElement.text();
         }
 
-        currentElement = currentGroup.firstChildElement(KVTML_NEUTRAL);
-        if (!currentElement.isNull())
-        {
-          plurthirdneutral = currentElement.text();
-        }
-      }
+        currentGroup = currentGroup.firstChildElement( KVTML_3RDPERSON );
+        if ( !currentGroup.isNull() ) {
+            currentElement = currentGroup.firstChildElement( KVTML_COMMON );
+            if ( !currentElement.isNull() ) {
+                p3_common = true;
+                plurthirdmale = currentElement.text();
+                plurthirdfemale = singthirdmale;
+                plurthirdneutral = singthirdmale;
+            } else {
+                p3_common = false;
+                currentElement = currentGroup.firstChildElement( KVTML_MALE );
+                if ( !currentElement.isNull() ) {
+                    plurthirdmale = currentElement.text();
+                }
+
+                currentElement = currentGroup.firstChildElement( KVTML_FEMALE );
+                if ( !currentElement.isNull() ) {
+                    plurthirdfemale = currentElement.text();
+                }
+
+                currentElement = currentGroup.firstChildElement( KVTML_NEUTRAL );
+                if ( !currentElement.isNull() ) {
+                    plurthirdneutral = currentElement.text();
+                }
+            }
 
+        }
     }
-  }
-
-  curr_conjug.setPers3SingularCommon(type, s3_common);
-  curr_conjug.setPers3PluralCommon(type, p3_common);
-  curr_conjug.setPers1Singular(type, singfirst);
-  curr_conjug.setPers2Singular(type, singsecond);
-  curr_conjug.setPers3FemaleSingular(type, singthirdfemale);
-  curr_conjug.setPers3MaleSingular(type, singthirdmale);
-  curr_conjug.setPers3NaturalSingular(type, singthirdneutral);
-  curr_conjug.setPers1Plural(type, plurfirst);
-  curr_conjug.setPers2Plural(type, plursecond);
-  curr_conjug.setPers3FemalePlural(type, plurthirdfemale);
-  curr_conjug.setPers3MalePlural(type, plurthirdmale);
-  curr_conjug.setPers3NaturalPlural(type, plurthirdneutral);
 
-  return true;
+    curr_conjug.setPers3SingularCommon( type, s3_common );
+    curr_conjug.setPers3PluralCommon( type, p3_common );
+    curr_conjug.setPers1Singular( type, singfirst );
+    curr_conjug.setPers2Singular( type, singsecond );
+    curr_conjug.setPers3FemaleSingular( type, singthirdfemale );
+    curr_conjug.setPers3MaleSingular( type, singthirdmale );
+    curr_conjug.setPers3NaturalSingular( type, singthirdneutral );
+    curr_conjug.setPers1Plural( type, plurfirst );
+    curr_conjug.setPers2Plural( type, plursecond );
+    curr_conjug.setPers3FemalePlural( type, plurthirdfemale );
+    curr_conjug.setPers3MalePlural( type, plurthirdmale );
+    curr_conjug.setPers3NaturalPlural( type, plurthirdneutral );
+
+    return true;
 }
 
-bool KEduVocKvtml2Reader::readTypes(QDomElement &typesElement)
+bool KEduVocKvtml2Reader::readTypes( QDomElement &typesElement )
 {
     QString mainTypeName;
 
-    QDomElement currentTypeElement =    typesElement.firstChildElement(KVTML_WORDTYPEDEFINITION);
+    QDomElement currentTypeElement =    typesElement.firstChildElement( KVTML_WORDTYPEDEFINITION );
     // go over <wordtypedefinition> elements
     while ( !currentTypeElement.isNull() ) {
         // set type and specialtype
         mainTypeName =
-            currentTypeElement.firstChildElement(KVTML_TYPENAME).text();
+            currentTypeElement.firstChildElement( KVTML_TYPENAME ).text();
         m_doc->wordTypes()->addType( mainTypeName,
-            currentTypeElement.firstChildElement(KVTML_SPECIALWORDTYPE).text());
+                                     currentTypeElement.firstChildElement( KVTML_SPECIALWORDTYPE ).text() );
 
         // iterate sub type elements <subwordtypedefinition>
-        QDomElement currentSubTypeElement =    currentTypeElement.firstChildElement(KVTML_SUBWORDTYPEDEFINITION);
+        QDomElement currentSubTypeElement =    currentTypeElement.firstChildElement( KVTML_SUBWORDTYPEDEFINITION );
         while ( !currentSubTypeElement.isNull() ) {
             // set type and specialtype
             m_doc->wordTypes()->addSubType( mainTypeName,
-                currentSubTypeElement.firstChildElement(KVTML_SUBTYPENAME).text(),
-                currentSubTypeElement.firstChildElement(KVTML_SPECIALWORDTYPE).text());
+                                            currentSubTypeElement.firstChildElement( KVTML_SUBTYPENAME ).text(),
+                                            currentSubTypeElement.firstChildElement( KVTML_SPECIALWORDTYPE ).text() );
 
 
-            currentSubTypeElement = currentSubTypeElement.nextSiblingElement(KVTML_SUBWORDTYPEDEFINITION);
+            currentSubTypeElement = currentSubTypeElement.nextSiblingElement( KVTML_SUBWORDTYPEDEFINITION );
         }
 
 
 
 
 
-        currentTypeElement = currentTypeElement.nextSiblingElement(KVTML_WORDTYPEDEFINITION);
+        currentTypeElement = currentTypeElement.nextSiblingElement( KVTML_WORDTYPEDEFINITION );
     }
 
 
-  /*
-  for (int i = 0; i < typeNodes.count(); ++i)
-  {
-    QDomElement currentElement = typeNodes.item(i).toElement();
-    if (currentElement.parentNode() == typesElement)
+    /*
+    for (int i = 0; i < typeNodes.count(); ++i)
     {
-      m_doc->wordTypes()->addType(currentElement.text());
-    }
-  }*/
+      QDomElement currentElement = typeNodes.item(i).toElement();
+      if (currentElement.parentNode() == typesElement)
+      {
+        m_doc->wordTypes()->addType(currentElement.text());
+      }
+    }*/
 
 
 
@@ -850,48 +754,44 @@ bool KEduVocKvtml2Reader::readTypes(QDomElement &typesElement)
 //   }
 
 //   m_doc->setTypeDescriptions(types);
-  return true;
+    return true;
 }
 
 
-bool KEduVocKvtml2Reader::readTenses(QDomElement &tensesElement)
+bool KEduVocKvtml2Reader::readTenses( QDomElement &tensesElement )
 {
-  QStringList tenses;
+    QStringList tenses;
 
-  QDomNodeList tenseNodes = tensesElement.elementsByTagName(KVTML_TENSE);
-  for (int i = 0; i < tenseNodes.count(); ++i)
-  {
-    QDomElement currentElement = tenseNodes.item(i).toElement();
-    if (currentElement.parentNode() == tensesElement)
-    {
-      tenses.append(currentElement.text());
+    QDomNodeList tenseNodes = tensesElement.elementsByTagName( KVTML_TENSE );
+    for ( int i = 0; i < tenseNodes.count(); ++i ) {
+        QDomElement currentElement = tenseNodes.item( i ).toElement();
+        if ( currentElement.parentNode() == tensesElement ) {
+            tenses.append( currentElement.text() );
+        }
     }
-  }
 
-  m_doc->setTenseDescriptions(tenses);
-  return true;
+    m_doc->setTenseDescriptions( tenses );
+    return true;
 }
 
 
-bool KEduVocKvtml2Reader::readUsages(QDomElement &usagesElement)
+bool KEduVocKvtml2Reader::readUsages( QDomElement &usagesElement )
 {
-  QStringList usages;
+    QStringList usages;
 
-  QDomNodeList usageNodes = usagesElement.elementsByTagName(KVTML_USAGE);
-  for (int i = 0; i < usageNodes.count(); ++i)
-  {
-    QDomElement currentElement = usageNodes.item(i).toElement();
-    if (currentElement.parentNode() == usagesElement)
-    {
-      m_doc->addUsage(currentElement.text());
+    QDomNodeList usageNodes = usagesElement.elementsByTagName( KVTML_USAGE );
+    for ( int i = 0; i < usageNodes.count(); ++i ) {
+        QDomElement currentElement = usageNodes.item( i ).toElement();
+        if ( currentElement.parentNode() == usagesElement ) {
+            m_doc->addUsage( currentElement.text() );
+        }
     }
-  }
 
-  return true;
+    return true;
 }
 
 
-bool KEduVocKvtml2Reader::readComparison(QDomElement &domElementParent, KEduVocComparison &comp)
+bool KEduVocKvtml2Reader::readComparison( QDomElement &domElementParent, KEduVocComparison &comp )
 /*
  <comparison>
    <absolute>good</absolute>
@@ -900,29 +800,29 @@ bool KEduVocKvtml2Reader::readComparison(QDomElement &domElementParent, KEduVocC
  </comparison>
 */
 {
-  QDomElement currentElement;
-
-  currentElement = domElementParent.firstChildElement(KVTML_ABSOLUTE);
-  if (!currentElement.isNull()) {
-    comp.setL1(currentElement.text());
-  }
-
-  currentElement = domElementParent.firstChildElement(KVTML_COMPARATIVE);
-  if (!currentElement.isNull())
-  {
-    comp.setL2(currentElement.text());
-  }
-
-  currentElement = domElementParent.firstChildElement(KVTML_SUPERLATIVE);
-  if (!currentElement.isNull())
-  {
-    comp.setL3(currentElement.text());
-  }
-  return true;
+    QDomElement currentElement;
+
+    currentElement = domElementParent.firstChildElement( KVTML_ABSOLUTE );
+    if ( !currentElement.isNull() ) {
+        comp.setL1( currentElement.text() );
+    }
+
+    currentElement = domElementParent.firstChildElement( KVTML_COMPARATIVE );
+    if ( !currentElement.isNull() )
+    {
+        comp.setL2( currentElement.text() );
+    }
+
+    currentElement = domElementParent.firstChildElement( KVTML_SUPERLATIVE );
+    if ( !currentElement.isNull() )
+    {
+        comp.setL3( currentElement.text() );
+    }
+    return true;
 }
 
 
-bool KEduVocKvtml2Reader::readMultipleChoice(QDomElement &multipleChoiceElement, KEduVocMultipleChoice &mc)
+bool KEduVocKvtml2Reader::readMultipleChoice( QDomElement &multipleChoiceElement, KEduVocMultipleChoice &mc )
 /*
  <multiplechoice>
    <choice>good</choice>
@@ -934,61 +834,55 @@ bool KEduVocKvtml2Reader::readMultipleChoice(QDomElement &multipleChoiceElement,
 */
 
 {
-  QDomElement currentElement;
-  QString s;
-  mc.clear();
-
-  QDomNodeList choiceNodes = multipleChoiceElement.elementsByTagName(KVTML_CHOICE);
-  for (int i = 0; i < choiceNodes.count(); ++i)
-  {
-    currentElement = choiceNodes.item(i).toElement();
-    if (currentElement.parentNode() == multipleChoiceElement)
+    QDomElement currentElement;
+    QString s;
+    mc.clear();
+
+    QDomNodeList choiceNodes = multipleChoiceElement.elementsByTagName( KVTML_CHOICE );
+    for ( int i = 0; i < choiceNodes.count(); ++i )
     {
-      mc.appendChoice(currentElement.text());
+        currentElement = choiceNodes.item( i ).toElement();
+        if ( currentElement.parentNode() == multipleChoiceElement ) {
+            mc.appendChoice( currentElement.text() );
+        }
     }
-  }
-  return true;
+    return true;
 }
 
-bool KEduVocKvtml2Reader::readGrade(QDomElement &gradeElement, KEduVocExpression &expr, int index)
+bool KEduVocKvtml2Reader::readGrade( QDomElement &gradeElement, KEduVocExpression &expr, int index )
 {
-  bool result = true;
-  int id = gradeElement.attribute(KVTML_FROMID).toInt(&result);
-  if (!result)
-  {
-    m_errorMessage = i18n("identifier missing id");
-    return false;
-  }
-
-  QDomElement currentElement = gradeElement.firstChildElement(KVTML_CURRENTGRADE);
-  if (!currentElement.isNull())
-  {
-       int value = currentElement.text().toInt();
-       expr.translation(index).gradeFrom(id).setGrade(value);
-  }
-
-  currentElement = gradeElement.firstChildElement(KVTML_COUNT);
-  if (!currentElement.isNull())
-  {
-    int value = currentElement.text().toInt();
-    expr.translation(index).gradeFrom(id).setQueryCount(value);
-  }
-
-  currentElement = gradeElement.firstChildElement(KVTML_ERRORCOUNT);
-  if (!currentElement.isNull())
-  {
-    int value = currentElement.text().toInt();
-    expr.translation(index).gradeFrom(id).setBadCount(value);
-  }
-
-  currentElement = gradeElement.firstChildElement(KVTML_DATE);
-  if (!currentElement.isNull())
-  {
-    QDateTime value = QDateTime::fromTime_t(currentElement.text().toUInt());
-    expr.translation(index).gradeFrom(id).setQueryDate(value);
-  }
-
-  return true;
+    bool result = true;
+    int id = gradeElement.attribute( KVTML_FROMID ).toInt( &result );
+    if ( !result ) {
+        m_errorMessage = i18n( "identifier missing id" );
+        return false;
+    }
+
+    QDomElement currentElement = gradeElement.firstChildElement( KVTML_CURRENTGRADE );
+    if ( !currentElement.isNull() ) {
+        int value = currentElement.text().toInt();
+        expr.translation( index ).gradeFrom( id ).setGrade( value );
+    }
+
+    currentElement = gradeElement.firstChildElement( KVTML_COUNT );
+    if ( !currentElement.isNull() ) {
+        int value = currentElement.text().toInt();
+        expr.translation( index ).gradeFrom( id ).setQueryCount( value );
+    }
+
+    currentElement = gradeElement.firstChildElement( KVTML_ERRORCOUNT );
+    if ( !currentElement.isNull() ) {
+        int value = currentElement.text().toInt();
+        expr.translation( index ).gradeFrom( id ).setBadCount( value );
+    }
+
+    currentElement = gradeElement.firstChildElement( KVTML_DATE );
+    if ( !currentElement.isNull() ) {
+        QDateTime value = QDateTime::fromTime_t( currentElement.text().toUInt() );
+        expr.translation( index ).gradeFrom( id ).setQueryDate( value );
+    }
+
+    return true;
 }
 
 
index e357a76dc2ecdd148b900eae218168635c9fe337..60587e85eb8547b4ad7e586917bff7ead50ce3ba 100644 (file)
@@ -32,107 +32,110 @@ class KEduVocDocument;
 */
 class KEduVocKvtml2Reader : public QObject
 {
-  Q_OBJECT
+    Q_OBJECT
 public:
-  /** default constructor 
-   * @param file file to read from
-   */
-  KEduVocKvtml2Reader(QIODevice *file);
-
-  /** read the document
-   * @param doc document object to store the data in
-   */
-  bool readDoc(KEduVocDocument *doc);
-  
-  /** read information entries
-   * @param informationElement QDomElement information
-   */
-  bool readInformation(QDomElement &informationElement);
-
-  /** read group elements: identifiers, entries, types, usages, lessons */
-  bool readGroups(QDomElement &domElementParent);
-
-  /** read an identifier
-   * @param identifierElement QDomElement for the identifier to read
-   */
-  bool readIdentifier(QDomElement &identifierElement);
-  
-  /** read an identifiers articles
-   * @param articleElement QDomElement for the article group
-   * @param identifierNum number of the identifier this article is inside of
-   */
-  bool readArticle(QDomElement &articleElement, int identifierNum);
-  
-  /** read in a conjugation
-   * @param conjugElement QDomElement for the conjugation group
-   * @param curr_conjug conjugation object to populate
-   */
-  bool readConjugation(QDomElement &conjugElement, KEduVocConjugation &curr_conjug);
-
-  /** read the types
-   * @param typesElement QDomElement for the types group
-   */
-  bool readTypes(QDomElement &typesElement);
-  
-  /** read the tenses
-   * @param tensesElement QDomElement for the tenses group
-   */
-  bool readTenses(QDomElement &tensesElement);
-  
-  /** read the usages
-   * @param usagesElement QDomElement for the usages group
-   */
-  bool readUsages(QDomElement &usagesElement);
-
-  /** read an entry
-   * @param entryElement QDomElement for the entry to read
-   */
-  bool readEntry(QDomElement &entryElement);
-
-  /** read a translation
-   * @param translationElement QDomElement for the translation to read
-   */
-  bool readTranslation(QDomElement &translationElement, KEduVocExpression &expr, int index);
-
-  /** read a comparison
-   * @param comparisonElement comparison group element
-   * @param comp comparison object to read into
-   */
-  bool readComparison(QDomElement &comparisonElement, KEduVocComparison &comp);
-  
-  /** read a multiple choice group
-   * @param multipleChoiceElement element to read from
-   * @param mc KEduVocMultipleChoice object to read to
-   */
-  bool readMultipleChoice(QDomElement &multipleChoiceElement, KEduVocMultipleChoice &mc);
-  
-  /** read a grade
-   * @param gradeElement element to read from
-   * @param expr expression element to add grades to
-   * @param index index of the current translation
-   */
-  bool readGrade(QDomElement &gradeElement, KEduVocExpression &expr, int index);
-
-  /** read a lesson, and append it to the document
-   * @param lessonElement element to read from
-   */
-  bool readLesson(QDomElement &lessonElement);
-
-  /** get the errormessage string 
-   * @returns the errormessage string
-   */
-  QString errorMessage() const { return m_errorMessage; }
+    /** default constructor
+     * @param file file to read from
+     */
+    KEduVocKvtml2Reader( QIODevice *file );
+
+    /** read the document
+     * @param doc document object to store the data in
+     */
+    bool readDoc( KEduVocDocument *doc );
+
+    /** read information entries
+     * @param informationElement QDomElement information
+     */
+    bool readInformation( QDomElement &informationElement );
+
+    /** read group elements: identifiers, entries, types, usages, lessons */
+    bool readGroups( QDomElement &domElementParent );
+
+    /** read an identifier
+     * @param identifierElement QDomElement for the identifier to read
+     */
+    bool readIdentifier( QDomElement &identifierElement );
+
+    /** read an identifiers articles
+     * @param articleElement QDomElement for the article group
+     * @param identifierNum number of the identifier this article is inside of
+     */
+    bool readArticle( QDomElement &articleElement, int identifierNum );
+
+    /** read in a conjugation
+     * @param conjugElement QDomElement for the conjugation group
+     * @param curr_conjug conjugation object to populate
+     */
+    bool readConjugation( QDomElement &conjugElement, KEduVocConjugation &curr_conjug );
+
+    /** read the types
+     * @param typesElement QDomElement for the types group
+     */
+    bool readTypes( QDomElement &typesElement );
+
+    /** read the tenses
+     * @param tensesElement QDomElement for the tenses group
+     */
+    bool readTenses( QDomElement &tensesElement );
+
+    /** read the usages
+     * @param usagesElement QDomElement for the usages group
+     */
+    bool readUsages( QDomElement &usagesElement );
+
+    /** read an entry
+     * @param entryElement QDomElement for the entry to read
+     */
+    bool readEntry( QDomElement &entryElement );
+
+    /** read a translation
+     * @param translationElement QDomElement for the translation to read
+     */
+    bool readTranslation( QDomElement &translationElement, KEduVocExpression &expr, int index );
+
+    /** read a comparison
+     * @param comparisonElement comparison group element
+     * @param comp comparison object to read into
+     */
+    bool readComparison( QDomElement &comparisonElement, KEduVocComparison &comp );
+
+    /** read a multiple choice group
+     * @param multipleChoiceElement element to read from
+     * @param mc KEduVocMultipleChoice object to read to
+     */
+    bool readMultipleChoice( QDomElement &multipleChoiceElement, KEduVocMultipleChoice &mc );
+
+    /** read a grade
+     * @param gradeElement element to read from
+     * @param expr expression element to add grades to
+     * @param index index of the current translation
+     */
+    bool readGrade( QDomElement &gradeElement, KEduVocExpression &expr, int index );
+
+    /** read a lesson, and append it to the document
+     * @param lessonElement element to read from
+     */
+    bool readLesson( QDomElement &lessonElement );
+
+    /** get the errormessage string
+     * @returns the errormessage string
+     */
+    QString errorMessage() const
+    {
+        return m_errorMessage;
+    }
 
 private:
 
-  /** pre-opened QIODevice to read from */
-  QIODevice *m_inputFile;
-  
-  /** KEduVocDocument to read to */
-  KEduVocDocument *m_doc;
-  
-  /** error message */
-  QString m_errorMessage;
+    /** pre-opened QIODevice to read from */
+    QIODevice *m_inputFile;
+
+    /** KEduVocDocument to read to */
+    KEduVocDocument *m_doc;
+
+    /** error message */
+    QString m_errorMessage;
 };
 
 #endif
index 67097b032482d4f30c435aa236d37bf849c23dee..2d8960f841fc81bbcaffc535d8c0622e844dd66d 100644 (file)
 #include "keduvocwordtype.h"
 #include "kvtml2defs.h"
 
-KEduVocKvtml2Writer::KEduVocKvtml2Writer(QFile *file)
+KEduVocKvtml2Writer::KEduVocKvtml2Writer( QFile *file )
 {
-  // the file must be already open
-  m_outputFile = file;
+    // the file must be already open
+    m_outputFile = file;
 }
 
 
-bool KEduVocKvtml2Writer::writeDoc(KEduVocDocument *doc, const QString &generator)
+bool KEduVocKvtml2Writer::writeDoc( KEduVocDocument *doc, const QString &generator )
 {
-  m_doc = doc;
-
-  m_domDoc = QDomDocument("kvtml PUBLIC \"kvtml2.dtd\" \"http://edu.kde.org/kanagram/kvtml2.dtd\"");
-  m_domDoc.appendChild(m_domDoc.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""));
-  QDomElement domElementKvtml = m_domDoc.createElement("kvtml");
-  m_domDoc.appendChild(domElementKvtml);
-
-  domElementKvtml.setAttribute(KVTML_VERSION, (QString) "2.0");
-
-  // information group
-  QDomElement currentElement = m_domDoc.createElement(KVTML_INFORMATION);
-  writeInformation(currentElement, generator);
-  domElementKvtml.appendChild(currentElement);
-
-  // identifiers
-  currentElement = m_domDoc.createElement(KVTML_IDENTIFIERS);
-  writeIdentifiers(currentElement);
-  domElementKvtml.appendChild(currentElement);
-
-  // types
-  currentElement = m_domDoc.createElement(KVTML_WORDTYPEDEFINITIONS);
-  writeTypes(currentElement);
-  if (currentElement.hasChildNodes())
-  {
-    domElementKvtml.appendChild(currentElement);
-  }
-
-  // tenses
-  currentElement = m_domDoc.createElement(KVTML_TENSES);
-  writeTenses(currentElement);
-  if (currentElement.hasChildNodes())
-  {
-    domElementKvtml.appendChild(currentElement);
-  }
-
-  // usages
-  currentElement = m_domDoc.createElement(KVTML_USAGES);
-  writeUsages(currentElement);
-  if (currentElement.hasChildNodes())
-  {
-    domElementKvtml.appendChild(currentElement);
-  }
-
-  // entries
-  currentElement = m_domDoc.createElement(KVTML_ENTRIES);
-  if (!writeEntries(currentElement))
-  {
-    // at least one entry is required!
-    return false;
-  }
-  domElementKvtml.appendChild(currentElement);
-
-  // lessons
-  currentElement = m_domDoc.createElement(KVTML_LESSONS);
-  writeLessons(currentElement);
-  if (currentElement.hasChildNodes())
-  {
-    domElementKvtml.appendChild(currentElement);
-  }
-
-  m_domDoc.appendChild(domElementKvtml);
-
-  QTextStream ts(m_outputFile);
-  m_domDoc.save(ts, 2);
-
-  return true;
+    m_doc = doc;
+
+    m_domDoc = QDomDocument( "kvtml PUBLIC \"kvtml2.dtd\" \"http://edu.kde.org/kanagram/kvtml2.dtd\"" );
+    m_domDoc.appendChild( m_domDoc.createProcessingInstruction( "xml", "version=\"1.0\" encoding=\"UTF-8\"" ) );
+    QDomElement domElementKvtml = m_domDoc.createElement( "kvtml" );
+    m_domDoc.appendChild( domElementKvtml );
+
+    domElementKvtml.setAttribute( KVTML_VERSION, ( QString ) "2.0" );
+
+    // information group
+    QDomElement currentElement = m_domDoc.createElement( KVTML_INFORMATION );
+    writeInformation( currentElement, generator );
+    domElementKvtml.appendChild( currentElement );
+
+    // identifiers
+    currentElement = m_domDoc.createElement( KVTML_IDENTIFIERS );
+    writeIdentifiers( currentElement );
+    domElementKvtml.appendChild( currentElement );
+
+    // types
+    currentElement = m_domDoc.createElement( KVTML_WORDTYPEDEFINITIONS );
+    writeTypes( currentElement );
+    if ( currentElement.hasChildNodes() ) {
+        domElementKvtml.appendChild( currentElement );
+    }
+
+    // tenses
+    currentElement = m_domDoc.createElement( KVTML_TENSES );
+    writeTenses( currentElement );
+    if ( currentElement.hasChildNodes() ) {
+        domElementKvtml.appendChild( currentElement );
+    }
+
+    // usages
+    currentElement = m_domDoc.createElement( KVTML_USAGES );
+    writeUsages( currentElement );
+    if ( currentElement.hasChildNodes() ) {
+        domElementKvtml.appendChild( currentElement );
+    }
+
+    // entries
+    currentElement = m_domDoc.createElement( KVTML_ENTRIES );
+    if ( !writeEntries( currentElement ) ) {
+        // at least one entry is required!
+        return false;
+    }
+    domElementKvtml.appendChild( currentElement );
+
+    // lessons
+    currentElement = m_domDoc.createElement( KVTML_LESSONS );
+    writeLessons( currentElement );
+    if ( currentElement.hasChildNodes() ) {
+        domElementKvtml.appendChild( currentElement );
+    }
+
+    m_domDoc.appendChild( domElementKvtml );
+
+    QTextStream ts( m_outputFile );
+    m_domDoc.save( ts, 2 );
+
+    return true;
 }
 
-bool KEduVocKvtml2Writer::writeInformation(QDomElement &informationElement, const QString &generator)
+bool KEduVocKvtml2Writer::writeInformation( QDomElement &informationElement, const QString &generator )
 {
-  QDomElement currentElement;
-  QDomText textNode;
-
-  // generator
-  informationElement.appendChild(newTextElement(KVTML_GENERATOR, generator));
-
-  // title
-  if (!m_doc->title().isEmpty())
-  {
-    informationElement.appendChild(newTextElement(KVTML_TITLE, m_doc->title()));
-  }
-
-  // author
-  if (!m_doc->author().isEmpty())
-  {
-    informationElement.appendChild(newTextElement(KVTML_AUTHOR, m_doc->author()));
-  }
-
-  // license
-  if (!m_doc->license().isEmpty())
-  {
-    informationElement.appendChild(newTextElement(KVTML_LICENSE, m_doc->license()));
-  }
-
-  // comment
-  if (!m_doc->documentRemark().isEmpty())
-  {
-    informationElement.appendChild(newTextElement(KVTML_COMMENT, m_doc->documentRemark()));
-  }
-
-  return true;
+    QDomElement currentElement;
+    QDomText textNode;
+
+    // generator
+    informationElement.appendChild( newTextElement( KVTML_GENERATOR, generator ) );
+
+    // title
+    if ( !m_doc->title().isEmpty() ) {
+        informationElement.appendChild( newTextElement( KVTML_TITLE, m_doc->title() ) );
+    }
+
+    // author
+    if ( !m_doc->author().isEmpty() ) {
+        informationElement.appendChild( newTextElement( KVTML_AUTHOR, m_doc->author() ) );
+    }
+
+    // license
+    if ( !m_doc->license().isEmpty() ) {
+        informationElement.appendChild( newTextElement( KVTML_LICENSE, m_doc->license() ) );
+    }
+
+    // comment
+    if ( !m_doc->documentRemark().isEmpty() ) {
+        informationElement.appendChild( newTextElement( KVTML_COMMENT, m_doc->documentRemark() ) );
+    }
+
+    return true;
 }
 
 
-bool KEduVocKvtml2Writer::writeIdentifiers(QDomElement &identifiersElement)
+bool KEduVocKvtml2Writer::writeIdentifiers( QDomElement &identifiersElement )
 {
-  for (int i = 0; i < m_doc->identifierCount(); ++i)
-  {
-    // create the node
-    QDomElement identifier = m_domDoc.createElement(KVTML_IDENTIFIER);
-
-    // set the id
-    identifier.setAttribute(KVTML_ID, QString::number(i));
-
-    // record the identifier as the locale for now
-    // TODO: when support for more parts of the identifier is in the document class (name, type, etc.) store those here as well
-    identifier.appendChild(newTextElement(KVTML_LOCALE, m_doc->identifier(i)));
-
-    // record articles
-    QDomElement article = m_domDoc.createElement(KVTML_ARTICLE);
-    writeArticle(article, i);
-    if (article.hasChildNodes())
-    {
-      identifier.appendChild(article);
-    }
-
-    // record personalpronouns
-    QDomElement personalpronouns = m_domDoc.createElement(KVTML_PERSONALPRONOUNS);
-    writeConjugation(personalpronouns, m_doc->conjugation(i), QString());
-    if (personalpronouns.hasChildNodes())
-    {
-      identifier.appendChild(personalpronouns);
-    }
-
-    // add this identifier to the group
-    identifiersElement.appendChild(identifier);
-  }
-  return true;
+    for ( int i = 0; i < m_doc->identifierCount(); ++i ) {
+        // create the node
+        QDomElement identifier = m_domDoc.createElement( KVTML_IDENTIFIER );
+
+        // set the id
+        identifier.setAttribute( KVTML_ID, QString::number( i ) );
+
+        // record the identifier as the locale for now
+        // TODO: when support for more parts of the identifier is in the document class (name, type, etc.) store those here as well
+        identifier.appendChild( newTextElement( KVTML_LOCALE, m_doc->identifier( i ) ) );
+
+        // record articles
+        QDomElement article = m_domDoc.createElement( KVTML_ARTICLE );
+        writeArticle( article, i );
+        if ( article.hasChildNodes() ) {
+            identifier.appendChild( article );
+        }
+
+        // record personalpronouns
+        QDomElement personalpronouns = m_domDoc.createElement( KVTML_PERSONALPRONOUNS );
+        writeConjugation( personalpronouns, m_doc->conjugation( i ), QString() );
+        if ( personalpronouns.hasChildNodes() ) {
+            identifier.appendChild( personalpronouns );
+        }
+
+        // add this identifier to the group
+        identifiersElement.appendChild( identifier );
+    }
+    return true;
 }
 
-bool KEduVocKvtml2Writer::writeLessons(QDomElement &lessonsElement)
+bool KEduVocKvtml2Writer::writeLessons( QDomElement &lessonsElement )
 {
-  if (m_doc->lessonCount() == 0)
-    return true;
+    if ( m_doc->lessonCount() == 0 )
+        return true;
 
-  QMap<int, KEduVocLesson*> lessons = m_doc->lessons();
+    QMap<int, KEduVocLesson*> lessons = m_doc->lessons();
 
-  foreach(int lessonid, lessons.keys())
-  {
-    KEduVocLesson * thisLesson = lessons[lessonid];
+    foreach( int lessonid, lessons.keys() ) {
+        KEduVocLesson * thisLesson = lessons[lessonid];
 
-    // make lesson element
-    QDomElement thisLessonElement = m_domDoc.createElement(KVTML_LESSON);
+        // make lesson element
+        QDomElement thisLessonElement = m_domDoc.createElement( KVTML_LESSON );
 
-    // add a name
-    thisLessonElement.appendChild(newTextElement(KVTML_NAME, thisLesson->description()));
+        // add a name
+        thisLessonElement.appendChild( newTextElement( KVTML_NAME, thisLesson->description() ) );
 
-    // add a inquery tag
-    thisLessonElement.appendChild(newTextElement(KVTML_QUERY, m_doc->lessonInQuery(lessonid) ? KVTML_TRUE : KVTML_FALSE));
+        // add a inquery tag
+        thisLessonElement.appendChild( newTextElement( KVTML_QUERY, m_doc->lessonInQuery( lessonid ) ? KVTML_TRUE : KVTML_FALSE ) );
 
-    // add a current tag
-    thisLessonElement.appendChild(newTextElement(KVTML_CURRENT, m_doc->currentLesson() == lessonid ? KVTML_TRUE : KVTML_FALSE));
+        // add a current tag
+        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() == lessonid)
-      {
-        thisLessonElement.appendChild(newTextElement(KVTML_ENTRYID, QString::number(i)));
-      }
-    }
+        // TODO: add the entryids...
+        for ( int i = 0; i < m_doc->entryCount(); ++i ) {
+            if ( m_doc->entry( i )->lesson() == lessonid ) {
+                thisLessonElement.appendChild( newTextElement( KVTML_ENTRYID, QString::number( i ) ) );
+            }
+        }
 
-    lessonsElement.appendChild(thisLessonElement);
-  }
+        lessonsElement.appendChild( thisLessonElement );
+    }
 
-  return true;
+    return true;
 }
 
 
-bool KEduVocKvtml2Writer::writeArticle(QDomElement &articleElement, int article)
+bool KEduVocKvtml2Writer::writeArticle( QDomElement &articleElement, int article )
 {
-  QDomElement definite = m_domDoc.createElement(KVTML_DEFINITE);
-  QDomElement indefinite = m_domDoc.createElement(KVTML_INDEFINITE);
-  QString def;
-  QString indef;
-
-  // male
-  m_doc->article(article).getMale(&def, &indef);
-  if (!def.isEmpty())
-  {
-    definite.appendChild(newTextElement(KVTML_MALE, def));
-  }
-  if (!indef.isEmpty())
-  {
-    indefinite.appendChild(newTextElement(KVTML_MALE, indef));
-  }
-
-  // female
-  m_doc->article(article).getFemale(&def, &indef);
-  if (!def.isEmpty())
-  {
-    definite.appendChild(newTextElement(KVTML_FEMALE, def));
-  }
-  if (!indef.isEmpty())
-  {
-    indefinite.appendChild(newTextElement(KVTML_FEMALE, indef));
-  }
-
-  // neutral
-  m_doc->article(article).getNatural(&def, &indef);
-  if (!def.isEmpty())
-  {
-    definite.appendChild(newTextElement(KVTML_NEUTRAL, def));
-  }
-  if (!indef.isEmpty())
-  {
-    indefinite.appendChild(newTextElement(KVTML_NEUTRAL, indef));
-  }
-
-  if (definite.hasChildNodes())
-  {
-    articleElement.appendChild(definite);
-  }
-
-  if (indefinite.hasChildNodes())
-  {
-    articleElement.appendChild(indefinite);
-  }
-  return true;
+    QDomElement definite = m_domDoc.createElement( KVTML_DEFINITE );
+    QDomElement indefinite = m_domDoc.createElement( KVTML_INDEFINITE );
+    QString def;
+    QString indef;
+
+    // male
+    m_doc->article( article ).getMale( &def, &indef );
+    if ( !def.isEmpty() ) {
+        definite.appendChild( newTextElement( KVTML_MALE, def ) );
+    }
+    if ( !indef.isEmpty() ) {
+        indefinite.appendChild( newTextElement( KVTML_MALE, indef ) );
+    }
+
+    // female
+    m_doc->article( article ).getFemale( &def, &indef );
+    if ( !def.isEmpty() ) {
+        definite.appendChild( newTextElement( KVTML_FEMALE, def ) );
+    }
+    if ( !indef.isEmpty() ) {
+        indefinite.appendChild( newTextElement( KVTML_FEMALE, indef ) );
+    }
+
+    // neutral
+    m_doc->article( article ).getNatural( &def, &indef );
+    if ( !def.isEmpty() ) {
+        definite.appendChild( newTextElement( KVTML_NEUTRAL, def ) );
+    }
+    if ( !indef.isEmpty() ) {
+        indefinite.appendChild( newTextElement( KVTML_NEUTRAL, indef ) );
+    }
+
+    if ( definite.hasChildNodes() ) {
+        articleElement.appendChild( definite );
+    }
+
+    if ( indefinite.hasChildNodes() ) {
+        articleElement.appendChild( indefinite );
+    }
+    return true;
 }
 
-bool KEduVocKvtml2Writer::writeTypes(QDomElement &typesElement)
+bool KEduVocKvtml2Writer::writeTypes( QDomElement &typesElement )
 {
     KEduVocWordType* wt = m_doc->wordTypes();
-    foreach ( QString mainTypeName, wt->typeNameList() ) {
-kDebug() << "Writing type: " << mainTypeName;
-        QDomElement typeDefinitionElement = m_domDoc.createElement(KVTML_WORDTYPEDEFINITION);
-        typeDefinitionElement.appendChild(newTextElement(KVTML_TYPENAME, mainTypeName));
-        if ( !wt->specialType(mainTypeName).isEmpty() ) {
-            typeDefinitionElement.appendChild(newTextElement(KVTML_SPECIALWORDTYPE, wt->specialType(mainTypeName)));
+    foreach( QString mainTypeName, wt->typeNameList() ) {
+        kDebug() << "Writing type: " << mainTypeName;
+        QDomElement typeDefinitionElement = m_domDoc.createElement( KVTML_WORDTYPEDEFINITION );
+        typeDefinitionElement.appendChild( newTextElement( KVTML_TYPENAME, mainTypeName ) );
+        if ( !wt->specialType( mainTypeName ).isEmpty() ) {
+            typeDefinitionElement.appendChild( newTextElement( KVTML_SPECIALWORDTYPE, wt->specialType( mainTypeName ) ) );
         }
 
         // subtypes
-        foreach ( QString subTypeName, wt->subTypeNameList(mainTypeName) ) {
-            QDomElement subTypeDefinitionElement = m_domDoc.createElement(KVTML_SUBWORDTYPEDEFINITION);
-            subTypeDefinitionElement.appendChild(newTextElement(KVTML_SUBTYPENAME, subTypeName));
-            if ( !wt->specialSubType(mainTypeName, subTypeName).isEmpty() ) {
-                subTypeDefinitionElement.appendChild(newTextElement(KVTML_SPECIALWORDTYPE, wt->specialSubType(mainTypeName, subTypeName)));
+        foreach( QString subTypeName, wt->subTypeNameList( mainTypeName ) ) {
+            QDomElement subTypeDefinitionElement = m_domDoc.createElement( KVTML_SUBWORDTYPEDEFINITION );
+            subTypeDefinitionElement.appendChild( newTextElement( KVTML_SUBTYPENAME, subTypeName ) );
+            if ( !wt->specialSubType( mainTypeName, subTypeName ).isEmpty() ) {
+                subTypeDefinitionElement.appendChild( newTextElement( KVTML_SPECIALWORDTYPE, wt->specialSubType( mainTypeName, subTypeName ) ) );
             }
-            typeDefinitionElement.appendChild(subTypeDefinitionElement);
+            typeDefinitionElement.appendChild( subTypeDefinitionElement );
         }
-        typesElement.appendChild(typeDefinitionElement);
+        typesElement.appendChild( typeDefinitionElement );
     }
 
 
 
 
 
-/*
-  foreach(QString type, m_doc->typeDescriptions())
-  {
-    if (!(type.isNull()) )
-    {
-      typesElement.appendChild(newTextElement(KVTML_WORDTYPE, type));
-    }
-  }*/
+    /*
+      foreach(QString type, m_doc->typeDescriptions())
+      {
+        if (!(type.isNull()) )
+        {
+          typesElement.appendChild(newTextElement(KVTML_WORDTYPE, type));
+        }
+      }*/
 
-  return true;
+    return true;
 }
 
 
-bool KEduVocKvtml2Writer::writeTenses(QDomElement &tensesElement)
+bool KEduVocKvtml2Writer::writeTenses( QDomElement &tensesElement )
 {
-  foreach(QString tense, m_doc->tenseDescriptions())
-  {
-    if (!(tense.isNull()))
-    {
-      tensesElement.appendChild(newTextElement(KVTML_TENSE, tense));
+    foreach( QString tense, m_doc->tenseDescriptions() ) {
+        if ( !( tense.isNull() ) ) {
+            tensesElement.appendChild( newTextElement( KVTML_TENSE, tense ) );
+        }
     }
-  }
 
-  return true;
+    return true;
 }
 
 
-bool KEduVocKvtml2Writer::writeUsages(QDomElement &usagesElement)
+bool KEduVocKvtml2Writer::writeUsages( QDomElement &usagesElement )
 {
-  foreach(QString usage, m_doc->usages())
-  {
-    usagesElement.appendChild(newTextElement(KVTML_USAGE, usage));
-  }
+    foreach( QString usage, m_doc->usages() ) {
+        usagesElement.appendChild( newTextElement( KVTML_USAGE, usage ) );
+    }
 
-  return true;
+    return true;
 }
 
-bool KEduVocKvtml2Writer::writeEntries(QDomElement &entriesElement)
+bool KEduVocKvtml2Writer::writeEntries( QDomElement &entriesElement )
 {
-  // loop through entries
-  for (int i = 0; i < m_doc->entryCount(); ++i)
-  {
-    KEduVocExpression *thisEntry = m_doc->entry(i);
+    // loop through entries
+    for ( int i = 0; i < m_doc->entryCount(); ++i ) {
+        KEduVocExpression *thisEntry = m_doc->entry( i );
 
-    // write entry tag
-    QDomElement entryElement = m_domDoc.createElement(KVTML_ENTRY);
+        // write entry tag
+        QDomElement entryElement = m_domDoc.createElement( KVTML_ENTRY );
 
-    // add id
-    entryElement.setAttribute(KVTML_ID, QString::number(i));
+        // add id
+        entryElement.setAttribute( KVTML_ID, QString::number( i ) );
 
-    // write inactive
-    entryElement.appendChild(newTextElement(KVTML_INACTIVE, thisEntry->isActive() ? KVTML_FALSE : KVTML_TRUE));
+        // write inactive
+        entryElement.appendChild( newTextElement( KVTML_INACTIVE, thisEntry->isActive() ? KVTML_FALSE : KVTML_TRUE ) );
 
-    // write inquery
-    entryElement.appendChild(newTextElement(KVTML_INQUERY, thisEntry->isInQuery() ? KVTML_TRUE : KVTML_FALSE));
+        // write inquery
+        entryElement.appendChild( newTextElement( KVTML_INQUERY, thisEntry->isInQuery() ? KVTML_TRUE : KVTML_FALSE ) );
 
-    // write sizehint
-    if (thisEntry->sizeHint() > 0)
-    {
-      entryElement.appendChild(newTextElement(KVTML_SIZEHINT, QString::number(thisEntry->sizeHint()) ));
-    }
+        // write sizehint
+        if ( thisEntry->sizeHint() > 0 ) {
+            entryElement.appendChild( newTextElement( KVTML_SIZEHINT, QString::number( thisEntry->sizeHint() ) ) );
+        }
 
-    // loop through translations
-    foreach (int trans, thisEntry->translationIndices()) {
-      // write translations
-      QDomElement translation = m_domDoc.createElement(KVTML_TRANSLATION);
-      translation.setAttribute(KVTML_ID, QString::number(trans));
-      writeTranslation(translation, thisEntry->translation(trans));
-      entryElement.appendChild(translation);
+        // loop through translations
+        foreach( int trans, thisEntry->translationIndices() ) {
+            // write translations
+            QDomElement translation = m_domDoc.createElement( KVTML_TRANSLATION );
+            translation.setAttribute( KVTML_ID, QString::number( trans ) );
+            writeTranslation( translation, thisEntry->translation( trans ) );
+            entryElement.appendChild( translation );
+        }
+        // add this entry to the entriesElement
+        entriesElement.appendChild( entryElement );
     }
-    // add this entry to the entriesElement
-    entriesElement.appendChild(entryElement);
-  }
-  return true;
+    return true;
 }
 
-bool KEduVocKvtml2Writer::writeTranslation(QDomElement &translationElement, KEduVocTranslation &translation)
+bool KEduVocKvtml2Writer::writeTranslation( QDomElement &translationElement, KEduVocTranslation &translation )
 {
-  // <text>Kniebeugen</text>
-  translationElement.appendChild(newTextElement(KVTML_TEXT, translation.text()));
-
-  // <wordtype></wordtype>
-  if (!translation.type().isEmpty())
-  {
-    QDomElement wordTypeElement = m_domDoc.createElement(KVTML_WORDTYPE);
-    translationElement.appendChild(wordTypeElement);
-    //<typename>noun</typename>
-    wordTypeElement.appendChild(newTextElement(KVTML_TYPENAME, translation.type()));
-    // <subwordtype>male</subwordtype>
-    if (!translation.subType().isEmpty())
-    {
-      wordTypeElement.appendChild(newTextElement(KVTML_SUBTYPENAME, translation.subType()));
-    }
-  }
-
-  // <comment></comment>
-  translationElement.appendChild(newTextElement(KVTML_COMMENT, translation.comment()));
-
-  // <pronunciation></pronunciation>
-  if (!translation.pronunciation().isEmpty())
-  {
-    translationElement.appendChild(newTextElement(KVTML_PRONUNCIATION, translation.pronunciation()));
-  }
-
-  // <falsefriend fromid="0"></falsefriend>
-  // loop through the identifiers
-  for (int i = 0; i < m_doc->identifierCount(); ++i)
-  {
-       // see if this identifier has a falsefriend in this translation
-       QString thisFriend = translation.falseFriend(i);
-       if (!thisFriend.isEmpty())
-       {
-         // if so, create it, and set the fromid to i
-         QDomElement thisFriendElement = newTextElement(KVTML_FALSEFRIEND, thisFriend);
-         thisFriendElement.setAttribute(KVTML_FROMID, QString::number(i));
-         translationElement.appendChild(thisFriendElement);
-       }
-  }
-
-  // <antonym></antonym>
-  if (!translation.antonym().isEmpty())
-  {
-    translationElement.appendChild(newTextElement(KVTML_ANTONYM, translation.antonym()));
-  }
-
-  // <synonym></synonym>
-  if (!translation.synonym().isEmpty())
-  {
-    translationElement.appendChild(newTextElement(KVTML_SYNONYM, translation.synonym()));
-  }
-
-  // <example></example>
-  if (!translation.example().isEmpty())
-  {
-    translationElement.appendChild(newTextElement(KVTML_EXAMPLE, translation.example()));
-  }
-
-  // <usage></usage>
-  foreach (QString usage, translation.usages())
-  {
-    translationElement.appendChild(newTextElement(KVTML_USAGE, usage));
-  }
-
-  // <paraphrase></paraphrase>
-  if (!translation.paraphrase().isEmpty())
-  {
-    translationElement.appendChild(newTextElement(KVTML_PARAPHRASE, translation.paraphrase()));
-  }
-
-  // grades
-  for (int i = 0; i < m_doc->identifierCount(); ++i)
-  {
-       KEduVocGrade thisGrade = translation.gradeFrom(i);
-       if (thisGrade.queryCount() > 0)
-       {
-         QDomElement gradeElement = m_domDoc.createElement(KVTML_GRADE);
-         gradeElement.setAttribute(KVTML_FROMID, QString::number(i));
-         //<currentgrade>2</currentgrade>
-         gradeElement.appendChild(newTextElement(KVTML_CURRENTGRADE, QString::number(thisGrade.grade())));
-
-         //<count>6</count>
-         gradeElement.appendChild(newTextElement(KVTML_COUNT, QString::number(thisGrade.queryCount())));
-
-         //<errorcount>1</errorcount>
-         gradeElement.appendChild(newTextElement(KVTML_ERRORCOUNT, QString::number(thisGrade.badCount())));
-
-         //<date>949757271</date>
-         gradeElement.appendChild(newTextElement(KVTML_DATE, QString::number(thisGrade.queryDate().toTime_t())));
-
-         translationElement.appendChild(gradeElement);
-       }
-  }
-
-  // conjugation
-  if (translation.conjugation().entryCount() <= 0)
-  {
-    KEduVocConjugation conjugation = translation.conjugation();
-    for (int i = 0; i < conjugation.entryCount(); ++i)
-    {
-      QDomElement thisElement = m_domDoc.createElement(KVTML_CONJUGATION);
-      writeConjugation(thisElement, conjugation, conjugation.getType(i));
-      translationElement.appendChild(thisElement);
-    }
-  }
-
-  // comparison
-  if (!translation.comparison().isEmpty())
-  {
-    QDomElement comparisonElement = m_domDoc.createElement(KVTML_COMPARISON);
-    writeComparison(comparisonElement, translation.comparison());
-    translationElement.appendChild(comparisonElement);
-  }
-
-  // multiplechoice
-  if (!translation.multipleChoice().isEmpty())
-  {
-    QDomElement multipleChoiceElement = m_domDoc.createElement(KVTML_MULTIPLECHOICE);
-    writeMultipleChoice(multipleChoiceElement, translation.multipleChoice());
-    translationElement.appendChild(multipleChoiceElement);
-  }
-
-  // image
-  // sound
-
-  return true;
+    // <text>Kniebeugen</text>
+    translationElement.appendChild( newTextElement( KVTML_TEXT, translation.text() ) );
+
+    // <wordtype></wordtype>
+    if ( !translation.type().isEmpty() ) {
+        QDomElement wordTypeElement = m_domDoc.createElement( KVTML_WORDTYPE );
+        translationElement.appendChild( wordTypeElement );
+        //<typename>noun</typename>
+        wordTypeElement.appendChild( newTextElement( KVTML_TYPENAME, translation.type() ) );
+        // <subwordtype>male</subwordtype>
+        if ( !translation.subType().isEmpty() ) {
+            wordTypeElement.appendChild( newTextElement( KVTML_SUBTYPENAME, translation.subType() ) );
+        }
+    }
+
+    // <comment></comment>
+    translationElement.appendChild( newTextElement( KVTML_COMMENT, translation.comment() ) );
+
+    // <pronunciation></pronunciation>
+    if ( !translation.pronunciation().isEmpty() ) {
+        translationElement.appendChild( newTextElement( KVTML_PRONUNCIATION, translation.pronunciation() ) );
+    }
+
+    // <falsefriend fromid="0"></falsefriend>
+    // loop through the identifiers
+    for ( int i = 0; i < m_doc->identifierCount(); ++i ) {
+        // see if this identifier has a falsefriend in this translation
+        QString thisFriend = translation.falseFriend( i );
+        if ( !thisFriend.isEmpty() ) {
+            // if so, create it, and set the fromid to i
+            QDomElement thisFriendElement = newTextElement( KVTML_FALSEFRIEND, thisFriend );
+            thisFriendElement.setAttribute( KVTML_FROMID, QString::number( i ) );
+            translationElement.appendChild( thisFriendElement );
+        }
+    }
+
+    // <antonym></antonym>
+    if ( !translation.antonym().isEmpty() ) {
+        translationElement.appendChild( newTextElement( KVTML_ANTONYM, translation.antonym() ) );
+    }
+
+    // <synonym></synonym>
+    if ( !translation.synonym().isEmpty() ) {
+        translationElement.appendChild( newTextElement( KVTML_SYNONYM, translation.synonym() ) );
+    }
+
+    // <example></example>
+    if ( !translation.example().isEmpty() ) {
+        translationElement.appendChild( newTextElement( KVTML_EXAMPLE, translation.example() ) );
+    }
+
+    // <usage></usage>
+    foreach( QString usage, translation.usages() ) {
+        translationElement.appendChild( newTextElement( KVTML_USAGE, usage ) );
+    }
+
+    // <paraphrase></paraphrase>
+    if ( !translation.paraphrase().isEmpty() ) {
+        translationElement.appendChild( newTextElement( KVTML_PARAPHRASE, translation.paraphrase() ) );
+    }
+
+    // grades
+    for ( int i = 0; i < m_doc->identifierCount(); ++i ) {
+        KEduVocGrade thisGrade = translation.gradeFrom( i );
+        if ( thisGrade.queryCount() > 0 ) {
+            QDomElement gradeElement = m_domDoc.createElement( KVTML_GRADE );
+            gradeElement.setAttribute( KVTML_FROMID, QString::number( i ) );
+            //<currentgrade>2</currentgrade>
+            gradeElement.appendChild( newTextElement( KVTML_CURRENTGRADE, QString::number( thisGrade.grade() ) ) );
+
+            //<count>6</count>
+            gradeElement.appendChild( newTextElement( KVTML_COUNT, QString::number( thisGrade.queryCount() ) ) );
+
+            //<errorcount>1</errorcount>
+            gradeElement.appendChild( newTextElement( KVTML_ERRORCOUNT, QString::number( thisGrade.badCount() ) ) );
+
+            //<date>949757271</date>
+            gradeElement.appendChild( newTextElement( KVTML_DATE, QString::number( thisGrade.queryDate().toTime_t() ) ) );
+
+            translationElement.appendChild( gradeElement );
+        }
+    }
+
+    // conjugation
+    if ( translation.conjugation().entryCount() <= 0 ) {
+        KEduVocConjugation conjugation = translation.conjugation();
+        for ( int i = 0; i < conjugation.entryCount(); ++i ) {
+            QDomElement thisElement = m_domDoc.createElement( KVTML_CONJUGATION );
+            writeConjugation( thisElement, conjugation, conjugation.getType( i ) );
+            translationElement.appendChild( thisElement );
+        }
+    }
+
+    // comparison
+    if ( !translation.comparison().isEmpty() ) {
+        QDomElement comparisonElement = m_domDoc.createElement( KVTML_COMPARISON );
+        writeComparison( comparisonElement, translation.comparison() );
+        translationElement.appendChild( comparisonElement );
+    }
+
+    // multiplechoice
+    if ( !translation.multipleChoice().isEmpty() ) {
+        QDomElement multipleChoiceElement = m_domDoc.createElement( KVTML_MULTIPLECHOICE );
+        writeMultipleChoice( multipleChoiceElement, translation.multipleChoice() );
+        translationElement.appendChild( multipleChoiceElement );
+    }
+
+    // image
+    // sound
+
+    return true;
 }
 
-bool KEduVocKvtml2Writer::writeComparison(QDomElement &comparisonElement, const KEduVocComparison &comparison)
+bool KEduVocKvtml2Writer::writeComparison( QDomElement &comparisonElement, const KEduVocComparison &comparison )
 /*
  <comparison>
    <absolute>good</absolute>
@@ -511,15 +467,15 @@ bool KEduVocKvtml2Writer::writeComparison(QDomElement &comparisonElement, const
  </comparison>
 */
 {
-  comparisonElement.appendChild(newTextElement(KVTML_ABSOLUTE, comparison.l1()));
-  comparisonElement.appendChild(newTextElement(KVTML_COMPARATIVE, comparison.l2()));
-  comparisonElement.appendChild(newTextElement(KVTML_SUPERLATIVE, comparison.l3()));
+    comparisonElement.appendChild( newTextElement( KVTML_ABSOLUTE, comparison.l1() ) );
+    comparisonElement.appendChild( newTextElement( KVTML_COMPARATIVE, comparison.l2() ) );
+    comparisonElement.appendChild( newTextElement( KVTML_SUPERLATIVE, comparison.l3() ) );
 
-  return true;
+    return true;
 }
 
 
-bool KEduVocKvtml2Writer::writeMultipleChoice(QDomElement &multipleChoiceElement, const KEduVocMultipleChoice &mc)
+bool KEduVocKvtml2Writer::writeMultipleChoice( QDomElement &multipleChoiceElement, const KEduVocMultipleChoice &mc )
 /*
  <multiplechoice>
    <choice>good</choice>
@@ -530,83 +486,74 @@ bool KEduVocKvtml2Writer::writeMultipleChoice(QDomElement &multipleChoiceElement
  </multiplechoice>
 */
 {
-  QStringList choices = mc.choices();
-  for (int i = 0; i < choices.size(); ++i)
-  {
-    multipleChoiceElement.appendChild(newTextElement(KVTML_CHOICE, choices[i]));
-  }
+    QStringList choices = mc.choices();
+    for ( int i = 0; i < choices.size(); ++i ) {
+        multipleChoiceElement.appendChild( newTextElement( KVTML_CHOICE, choices[i] ) );
+    }
 
-  return true;
+    return true;
 }
 
-bool KEduVocKvtml2Writer::writeConjugation(QDomElement &conjugationElement,
-                        const KEduVocConjugation &conjugation, const QString &type)
+bool KEduVocKvtml2Writer::writeConjugation( QDomElement &conjugationElement,
+        const KEduVocConjugation &conjugation, const QString &type )
 {
-  // first singular conjugations
-  QString first = conjugation.pers1Singular(type);
-  QString second = conjugation.pers2Singular(type);
-  bool third_common = conjugation.pers3SingularCommon(type);
-  QString third_male = conjugation.pers3MaleSingular(type);
-  QString third_female = conjugation.pers3FemaleSingular(type);
-  QString third_neutral = conjugation.pers3NaturalSingular(type);
-
-  if (!first.isEmpty() || !second.isEmpty() || !third_female.isEmpty() ||
-      !third_male.isEmpty() || !third_neutral.isEmpty())
-  {
-    QDomElement singular = m_domDoc.createElement(KVTML_SINGULAR);
-
-    singular.appendChild(newTextElement(KVTML_1STPERSON, first));
-    singular.appendChild(newTextElement(KVTML_2NDPERSON, second));
-
-    if (third_common)
-    {
-      singular.appendChild(newTextElement(KVTML_COMMON, third_female));
-    }
-    else
-    {
-      singular.appendChild(newTextElement(KVTML_MALE, third_male));
-      singular.appendChild(newTextElement(KVTML_FEMALE, third_female));
-      singular.appendChild(newTextElement(KVTML_NEUTRAL, third_neutral));
-    }
-    conjugationElement.appendChild(singular);
-  }
-
-  // now for plurals
-  first = conjugation.pers1Plural(type);
-  second = conjugation.pers2Plural(type);
-  third_common = conjugation.pers3PluralCommon(type);
-  third_male = conjugation.pers3MalePlural(type);
-  third_female = conjugation.pers3FemalePlural(type);
-  third_neutral = conjugation.pers3NaturalPlural(type);
-
-  if (!first.isEmpty() || !second.isEmpty() || !third_female.isEmpty() ||
-      !third_male.isEmpty() || !third_neutral.isEmpty())
-  {
-    QDomElement plural = m_domDoc.createElement(KVTML_PLURAL);
-
-    plural.appendChild(newTextElement(KVTML_1STPERSON, first));
-    plural.appendChild(newTextElement(KVTML_2NDPERSON, second));
-
-    if (third_common)
-    {
-      plural.appendChild(newTextElement(KVTML_COMMON, third_female));
-    }
-    else
-    {
-      plural.appendChild(newTextElement(KVTML_MALE, third_male));
-      plural.appendChild(newTextElement(KVTML_FEMALE, third_female));
-      plural.appendChild(newTextElement(KVTML_NEUTRAL, third_neutral));
-    }
-    conjugationElement.appendChild(plural);
-  }
-
-  return true;
+    // first singular conjugations
+    QString first = conjugation.pers1Singular( type );
+    QString second = conjugation.pers2Singular( type );
+    bool third_common = conjugation.pers3SingularCommon( type );
+    QString third_male = conjugation.pers3MaleSingular( type );
+    QString third_female = conjugation.pers3FemaleSingular( type );
+    QString third_neutral = conjugation.pers3NaturalSingular( type );
+
+    if ( !first.isEmpty() || !second.isEmpty() || !third_female.isEmpty() ||
+            !third_male.isEmpty() || !third_neutral.isEmpty() ) {
+        QDomElement singular = m_domDoc.createElement( KVTML_SINGULAR );
+
+        singular.appendChild( newTextElement( KVTML_1STPERSON, first ) );
+        singular.appendChild( newTextElement( KVTML_2NDPERSON, second ) );
+
+        if ( third_common ) {
+            singular.appendChild( newTextElement( KVTML_COMMON, third_female ) );
+        } else {
+            singular.appendChild( newTextElement( KVTML_MALE, third_male ) );
+            singular.appendChild( newTextElement( KVTML_FEMALE, third_female ) );
+            singular.appendChild( newTextElement( KVTML_NEUTRAL, third_neutral ) );
+        }
+        conjugationElement.appendChild( singular );
+    }
+
+    // now for plurals
+    first = conjugation.pers1Plural( type );
+    second = conjugation.pers2Plural( type );
+    third_common = conjugation.pers3PluralCommon( type );
+    third_male = conjugation.pers3MalePlural( type );
+    third_female = conjugation.pers3FemalePlural( type );
+    third_neutral = conjugation.pers3NaturalPlural( type );
+
+    if ( !first.isEmpty() || !second.isEmpty() || !third_female.isEmpty() ||
+            !third_male.isEmpty() || !third_neutral.isEmpty() ) {
+        QDomElement plural = m_domDoc.createElement( KVTML_PLURAL );
+
+        plural.appendChild( newTextElement( KVTML_1STPERSON, first ) );
+        plural.appendChild( newTextElement( KVTML_2NDPERSON, second ) );
+
+        if ( third_common ) {
+            plural.appendChild( newTextElement( KVTML_COMMON, third_female ) );
+        } else {
+            plural.appendChild( newTextElement( KVTML_MALE, third_male ) );
+            plural.appendChild( newTextElement( KVTML_FEMALE, third_female ) );
+            plural.appendChild( newTextElement( KVTML_NEUTRAL, third_neutral ) );
+        }
+        conjugationElement.appendChild( plural );
+    }
+
+    return true;
 }
 
-QDomElement KEduVocKvtml2Writer::newTextElement(const QString &elementName, const QString &text)
+QDomElement KEduVocKvtml2Writer::newTextElement( const QString &elementName, const QString &text )
 {
-  QDomElement retval = m_domDoc.createElement(elementName);
-  QDomText textNode = m_domDoc.createTextNode(text);
-  retval.appendChild(textNode);
-  return retval;
+    QDomElement retval = m_domDoc.createElement( elementName );
+    QDomText textNode = m_domDoc.createTextNode( text );
+    retval.appendChild( textNode );
+    return retval;
 }
index bd4b05e177910bba4c1a3dcd7c3c741862cf23d5..07b1b0bad0c9586b967168d15d857c38dc05c004 100644 (file)
@@ -34,87 +34,87 @@ class KEduVocDocument;
 class KEduVocKvtml2Writer
 {
 public:
-  KEduVocKvtml2Writer(QFile *file);
-
-  bool writeDoc(KEduVocDocument *doc, const QString &generator);
-
-  /** write information entries
-   * @param informationElement QDomElement information to write to
-   * @param generator text describing generator
-   */
-  bool writeInformation(QDomElement &informationElement, const QString &generator);
-
-  /** write identifiers group
-   * @param identifiersElement QDomElement identifiers to write to
-   */
-  bool writeIdentifiers(QDomElement &identifiersElement);
-
-  /** write article
-   * @param articleElement QDomElement article to write to
-   * @param article the article number to write
-   */
-  bool writeArticle(QDomElement &articleElement, int article);
-
-  /** write conjugation
-   * @param conjugationElement QDomElement conjugation or personalpronouns to write to
-   * @param conjugation object to write
-   * @param type conjugation type
-   */
-  bool writeConjugation(QDomElement &conjugationElement, const KEduVocConjugation &conjugation,
-                        const QString &type);
-
-  /** write types
-   * @param typesElement QDomElement types to write to
-   */
-  bool writeTypes(QDomElement &typesElement);
-
-  /** write tenses
-   * @param tensesElement QDomElement tenses to write to
-   */
-  bool writeTenses(QDomElement &tensesElement);
-
-  /** write usages
-   * @param usagesElement QDomElement usages to write to
-   */
-  bool writeUsages(QDomElement &usagesElement);
-
-  /** write entries
-   * @param entriesElement QDomElement entries to write to
-   */
-  bool writeEntries(QDomElement &entriesElement);
-
-  /** write a translation
-   * @param translationElement QDomElement translation to write to, with id pre-set
-   * @param translation object to write
-   */
-  bool writeTranslation(QDomElement &translationElement, KEduVocTranslation &translation);
-
-  /** write the lesson group
-   * @param lessonsElement QDomElement lessons to write to
-   */
-  bool writeLessons(QDomElement &lessonsElement);
-
-  /** write a comparison
-   * @param comparisonElement QDomElement comparison to write to
-   * @param comparison object to write
-   * @returns success
-   */
-  bool writeComparison(QDomElement &comparisonElement, const KEduVocComparison &comparison);
-
-  /** write multiple choice choices
-   * @param multipleChoiceElement QDomElement multiplechoice to write to
-   * @returns success
-   */
-  bool writeMultipleChoice(QDomElement &multipleChoiceElement, const KEduVocMultipleChoice &mc);
+    KEduVocKvtml2Writer( QFile *file );
+
+    bool writeDoc( KEduVocDocument *doc, const QString &generator );
+
+    /** write information entries
+     * @param informationElement QDomElement information to write to
+     * @param generator text describing generator
+     */
+    bool writeInformation( QDomElement &informationElement, const QString &generator );
+
+    /** write identifiers group
+     * @param identifiersElement QDomElement identifiers to write to
+     */
+    bool writeIdentifiers( QDomElement &identifiersElement );
+
+    /** write article
+     * @param articleElement QDomElement article to write to
+     * @param article the article number to write
+     */
+    bool writeArticle( QDomElement &articleElement, int article );
+
+    /** write conjugation
+     * @param conjugationElement QDomElement conjugation or personalpronouns to write to
+     * @param conjugation object to write
+     * @param type conjugation type
+     */
+    bool writeConjugation( QDomElement &conjugationElement, const KEduVocConjugation &conjugation,
+                           const QString &type );
+
+    /** write types
+     * @param typesElement QDomElement types to write to
+     */
+    bool writeTypes( QDomElement &typesElement );
+
+    /** write tenses
+     * @param tensesElement QDomElement tenses to write to
+     */
+    bool writeTenses( QDomElement &tensesElement );
+
+    /** write usages
+     * @param usagesElement QDomElement usages to write to
+     */
+    bool writeUsages( QDomElement &usagesElement );
+
+    /** write entries
+     * @param entriesElement QDomElement entries to write to
+     */
+    bool writeEntries( QDomElement &entriesElement );
+
+    /** write a translation
+     * @param translationElement QDomElement translation to write to, with id pre-set
+     * @param translation object to write
+     */
+    bool writeTranslation( QDomElement &translationElement, KEduVocTranslation &translation );
+
+    /** write the lesson group
+     * @param lessonsElement QDomElement lessons to write to
+     */
+    bool writeLessons( QDomElement &lessonsElement );
+
+    /** write a comparison
+     * @param comparisonElement QDomElement comparison to write to
+     * @param comparison object to write
+     * @returns success
+     */
+    bool writeComparison( QDomElement &comparisonElement, const KEduVocComparison &comparison );
+
+    /** write multiple choice choices
+     * @param multipleChoiceElement QDomElement multiplechoice to write to
+     * @returns success
+     */
+    bool writeMultipleChoice( QDomElement &multipleChoiceElement, const KEduVocMultipleChoice &mc );
 
 private:
 
-  QDomElement newTextElement(const QString &elementName, const QString &text);
+    QDomElement newTextElement( const QString &elementName, const QString &text );
 
-  QFile *m_outputFile;
-  KEduVocDocument *m_doc;
+    QFile *m_outputFile;
+    KEduVocDocument *m_doc;
 
-  QDomDocument m_domDoc;
+    QDomDocument m_domDoc;
 };
 
 #endif
index f639f6929783d59dbc7f4beba61523d5520f1430..46931622d9e4b17426d4b8e41d21bba2d10c1323 100644 (file)
 
 #include <KDebug>
 
-const QString KEduVocKvtmlCompability::KVTML_1_USAGE_USER_DEFINED = QString("#");
-const QString KEduVocKvtmlCompability::KVTML_1_USAGE_SEPERATOR = QString(":");
+const QString KEduVocKvtmlCompability::KVTML_1_USAGE_USER_DEFINED = QString( "#" );
+const QString KEduVocKvtmlCompability::KVTML_1_USAGE_SEPERATOR = QString( ":" );
 
-const QString KEduVocKvtmlCompability::KVTML_1_TYPE_USER = QString("#");
-const QString KEduVocKvtmlCompability::KVTML_1_TYPE_DIV = QString(":");
+const QString KEduVocKvtmlCompability::KVTML_1_TYPE_USER = QString( "#" );
+const QString KEduVocKvtmlCompability::KVTML_1_TYPE_DIV = QString( ":" );
 
 
 KEduVocKvtmlCompability::KEduVocKvtmlCompability()
@@ -41,10 +41,10 @@ KEduVocKvtmlCompability::KEduVocKvtmlCompability()
 }
 
 
-QSet<QString> KEduVocKvtmlCompability::usageFromKvtml1(const QString & oldUsage) const
+QSet<QString> KEduVocKvtmlCompability::usageFromKvtml1( const QString & oldUsage ) const
 {
     QSet<QString> usages;
-    foreach ( QString usage , oldUsage.split(KVTML_1_USAGE_SEPERATOR, QString::SkipEmptyParts) ) {
+    foreach( QString usage , oldUsage.split( KVTML_1_USAGE_SEPERATOR, QString::SkipEmptyParts ) ) {
         usages.insert( m_usages[usage] );
     }
     return usages;
@@ -55,67 +55,67 @@ QMap< QString, QString > KEduVocKvtmlCompability::usageMap()
 {
     QMap< QString, QString > usages;
 
-    usages["Am"    ] = i18n("Americanism");
-    usages["abbr"  ] = i18n("abbreviation");
-    usages["anat"  ] = i18n("anatomy");
-    usages["astr"  ] = i18n("astronomy");
-    usages["biol"  ] = i18n("biology");
-    usages["bs"    ] = i18n("bad sense");
-    usages["contp" ] = i18n("contemptuously");
-    usages["eccl"  ] = i18n("ecclesiastical");
-    usages["fig"   ] = i18n("figuratively");
-    usages["geol"  ] = i18n("geology");
-    usages["hist"  ] = i18n("historical");
-    usages["icht"  ] = i18n("ichthyology");
-    usages["ifm"   ] = i18n("informal");
-    usages["iro"   ] = i18n("ironic");
-    usages["irr"   ] = i18n("irregular");
-    usages["lit"   ] = i18n("literary");
-    usages["metal" ] = i18n("metallurgy");
-    usages["meteo" ] = i18n("meteorology");
-    usages["miner" ] = i18n("mineralogy");
-    usages["mot"   ] = i18n("motoring");
-    usages["mount" ] = i18n("mountaineering");
-    usages["myth"  ] = i18n("mythology");
-    usages["npr"   ] = i18n("proper name");
-    usages["opt"   ] = i18n("optics");
-    usages["orn"   ] = i18n("ornithology");
-    usages["os"    ] = i18n("oneself");
-    usages["p"     ] = i18n("person");
-    usages["parl"  ] = i18n("parliamentary");
-    usages["pharm" ] = i18n("pharmacy");
-    usages["phls"  ] = i18n("philosophy");
-    usages["phot"  ] = i18n("photography");
-    usages["phys"  ] = i18n("physics");
-    usages["physio"] = i18n("physiology");
-    usages["pl"    ] = i18n("plural");
-    usages["poet"  ] = i18n("poetry");
-    usages["pol"   ] = i18n("politics");
-    usages["prov"  ] = i18n("provincialism");
-    usages["psych" ] = i18n("psychology");
-    usages["rhet"  ] = i18n("rhetoric");
-    usages["surv"  ] = i18n("surveying");
-    usages["telg"  ] = i18n("telegraphy");
-    usages["telph" ] = i18n("telephony");
-    usages["thea"  ] = i18n("theater");
-    usages["typo"  ] = i18n("typography");
-    usages["univ"  ] = i18n("university");
-    usages["vet"   ] = i18n("veterinary medicine");
-    usages["zoo"   ] = i18n("zoology");
+    usages["Am"    ] = i18n( "Americanism" );
+    usages["abbr"  ] = i18n( "abbreviation" );
+    usages["anat"  ] = i18n( "anatomy" );
+    usages["astr"  ] = i18n( "astronomy" );
+    usages["biol"  ] = i18n( "biology" );
+    usages["bs"    ] = i18n( "bad sense" );
+    usages["contp" ] = i18n( "contemptuously" );
+    usages["eccl"  ] = i18n( "ecclesiastical" );
+    usages["fig"   ] = i18n( "figuratively" );
+    usages["geol"  ] = i18n( "geology" );
+    usages["hist"  ] = i18n( "historical" );
+    usages["icht"  ] = i18n( "ichthyology" );
+    usages["ifm"   ] = i18n( "informal" );
+    usages["iro"   ] = i18n( "ironic" );
+    usages["irr"   ] = i18n( "irregular" );
+    usages["lit"   ] = i18n( "literary" );
+    usages["metal" ] = i18n( "metallurgy" );
+    usages["meteo" ] = i18n( "meteorology" );
+    usages["miner" ] = i18n( "mineralogy" );
+    usages["mot"   ] = i18n( "motoring" );
+    usages["mount" ] = i18n( "mountaineering" );
+    usages["myth"  ] = i18n( "mythology" );
+    usages["npr"   ] = i18n( "proper name" );
+    usages["opt"   ] = i18n( "optics" );
+    usages["orn"   ] = i18n( "ornithology" );
+    usages["os"    ] = i18n( "oneself" );
+    usages["p"     ] = i18n( "person" );
+    usages["parl"  ] = i18n( "parliamentary" );
+    usages["pharm" ] = i18n( "pharmacy" );
+    usages["phls"  ] = i18n( "philosophy" );
+    usages["phot"  ] = i18n( "photography" );
+    usages["phys"  ] = i18n( "physics" );
+    usages["physio"] = i18n( "physiology" );
+    usages["pl"    ] = i18n( "plural" );
+    usages["poet"  ] = i18n( "poetry" );
+    usages["pol"   ] = i18n( "politics" );
+    usages["prov"  ] = i18n( "provincialism" );
+    usages["psych" ] = i18n( "psychology" );
+    usages["rhet"  ] = i18n( "rhetoric" );
+    usages["surv"  ] = i18n( "surveying" );
+    usages["telg"  ] = i18n( "telegraphy" );
+    usages["telph" ] = i18n( "telephony" );
+    usages["thea"  ] = i18n( "theater" );
+    usages["typo"  ] = i18n( "typography" );
+    usages["univ"  ] = i18n( "university" );
+    usages["vet"   ] = i18n( "veterinary medicine" );
+    usages["zoo"   ] = i18n( "zoology" );
 
     return usages;
 }
 
-void KEduVocKvtmlCompability::addUserdefinedUsage(const QString & usage)
+void KEduVocKvtmlCompability::addUserdefinedUsage( const QString & usage )
 {
     // start counting at 1 !!!
     m_userdefinedUsageCounter++;
-    m_usages[KVTML_1_USAGE_USER_DEFINED + QString::number(m_userdefinedUsageCounter)] = usage;
+    m_usages[KVTML_1_USAGE_USER_DEFINED + QString::number( m_userdefinedUsageCounter )] = usage;
 }
 
 QSet< QString > KEduVocKvtmlCompability::documentUsages() const
 {
-    return QSet<QString>::fromList(m_usages.values());
+    return QSet<QString>::fromList( m_usages.values() );
 }
 
 
@@ -124,56 +124,54 @@ QSet< QString > KEduVocKvtmlCompability::documentUsages() const
 void KEduVocKvtmlCompability::initOldTypeLists()
 {
     m_oldMainTypeNames.clear();
-    m_oldMainTypeNames.insert("v", i18n("Verb"));
-    m_oldMainTypeNames.insert("n", i18n("Noun"));
-    m_oldMainTypeNames.insert("nm", i18n("Name"));
-    m_oldMainTypeNames.insert("ar", i18n("Article"));
-    m_oldMainTypeNames.insert("aj", i18n("Adjective"));
-    m_oldMainTypeNames.insert("av", i18n("Adverb"));
-    m_oldMainTypeNames.insert("pr", i18n("Pronoun"));
-    m_oldMainTypeNames.insert("ph", i18n("Phrase"));
-    m_oldMainTypeNames.insert("num", i18n("Numeral"));
-    m_oldMainTypeNames.insert("con", i18n("Conjunction"));
-    m_oldMainTypeNames.insert("pre", i18n("Preposition"));
-    m_oldMainTypeNames.insert("qu", i18n("Question"));
-    m_oldMainTypeNames.insert("ifm", i18n("Informal"));
-    m_oldMainTypeNames.insert("fig", i18n("Figuratively"));
+    m_oldMainTypeNames.insert( "v", i18n( "Verb" ) );
+    m_oldMainTypeNames.insert( "n", i18n( "Noun" ) );
+    m_oldMainTypeNames.insert( "nm", i18n( "Name" ) );
+    m_oldMainTypeNames.insert( "ar", i18n( "Article" ) );
+    m_oldMainTypeNames.insert( "aj", i18n( "Adjective" ) );
+    m_oldMainTypeNames.insert( "av", i18n( "Adverb" ) );
+    m_oldMainTypeNames.insert( "pr", i18n( "Pronoun" ) );
+    m_oldMainTypeNames.insert( "ph", i18n( "Phrase" ) );
+    m_oldMainTypeNames.insert( "num", i18n( "Numeral" ) );
+    m_oldMainTypeNames.insert( "con", i18n( "Conjunction" ) );
+    m_oldMainTypeNames.insert( "pre", i18n( "Preposition" ) );
+    m_oldMainTypeNames.insert( "qu", i18n( "Question" ) );
+    m_oldMainTypeNames.insert( "ifm", i18n( "Informal" ) );
+    m_oldMainTypeNames.insert( "fig", i18n( "Figuratively" ) );
 
     m_oldSubTypeNames.clear();
-    m_oldSubTypeNames.insert("ord", i18n("Ordinal"));
-    m_oldSubTypeNames.insert("crd", i18n("Cardinal"));
-    m_oldSubTypeNames.insert("def", i18n("Definite"));
-    m_oldSubTypeNames.insert("ind", i18n("Indefinite"));
-    m_oldSubTypeNames.insert("re", i18n("Regular"));
-    m_oldSubTypeNames.insert("ir", i18n("Irregular"));
-    m_oldSubTypeNames.insert("pos", i18n("Possessive"));
-    m_oldSubTypeNames.insert("per", i18n("Personal"));
-    m_oldSubTypeNames.insert("m", i18n("Male"));
-    m_oldSubTypeNames.insert("f", i18n("Female"));
-    m_oldSubTypeNames.insert("s", i18n("Neutral"));
+    m_oldSubTypeNames.insert( "ord", i18n( "Ordinal" ) );
+    m_oldSubTypeNames.insert( "crd", i18n( "Cardinal" ) );
+    m_oldSubTypeNames.insert( "def", i18n( "Definite" ) );
+    m_oldSubTypeNames.insert( "ind", i18n( "Indefinite" ) );
+    m_oldSubTypeNames.insert( "re", i18n( "Regular" ) );
+    m_oldSubTypeNames.insert( "ir", i18n( "Irregular" ) );
+    m_oldSubTypeNames.insert( "pos", i18n( "Possessive" ) );
+    m_oldSubTypeNames.insert( "per", i18n( "Personal" ) );
+    m_oldSubTypeNames.insert( "m", i18n( "Male" ) );
+    m_oldSubTypeNames.insert( "f", i18n( "Female" ) );
+    m_oldSubTypeNames.insert( "s", i18n( "Neutral" ) );
 
 }
 
 
-QString KEduVocKvtmlCompability::mainTypeFromOldFormat(const QString & typeSubtypeString) const
+QString KEduVocKvtmlCompability::mainTypeFromOldFormat( const QString & typeSubtypeString ) const
 {
     QString mainType;
     int i;
 
-    if ((i = typeSubtypeString.indexOf(KVTML_1_TYPE_DIV)) >= 0)
-        mainType = typeSubtypeString.left(i);
+    if (( i = typeSubtypeString.indexOf( KVTML_1_TYPE_DIV ) ) >= 0 )
+        mainType = typeSubtypeString.left( i );
     else
         mainType = typeSubtypeString;
 
     // convert from pre-0.5 versions (I guess we can just leave that in here.
     // I seriously doubt that any such documents exist...
-    if (mainType == "1") {
+    if ( mainType == "1" ) {
         mainType = QM_VERB;
-    }
-    else if (mainType == "2") {
+    } else if ( mainType == "2" ) {
         mainType = QM_NOUN;
-    }
-    else if (mainType == "3") {
+    } else if ( mainType == "3" ) {
         mainType = QM_NAME;
     }
 
@@ -186,12 +184,12 @@ QString KEduVocKvtmlCompability::mainTypeFromOldFormat(const QString & typeSubty
 }
 
 
-QString KEduVocKvtmlCompability::subTypeFromOldFormat(const QString & typeSubtypeString) const
+QString KEduVocKvtmlCompability::subTypeFromOldFormat( const QString & typeSubtypeString ) const
 {
     int i;
     QString t = typeSubtypeString;
-    if ((i = t.indexOf(KVTML_1_TYPE_DIV)) >= 0) {
-        t.remove(0, i+1);
+    if (( i = t.indexOf( KVTML_1_TYPE_DIV ) ) >= 0 ) {
+        t.remove( 0, i+1 );
     } else {
         return QString();
     }
@@ -204,12 +202,12 @@ QString KEduVocKvtmlCompability::subTypeFromOldFormat(const QString & typeSubtyp
     return wt;
 }
 
-QString KEduVocKvtmlCompability::oldType(const QString & mainType, const QString & subType) const
+QString KEduVocKvtmlCompability::oldType( const QString & mainType, const QString & subType ) const
 {
     QString oldType;
     QString oldSubType;
-    oldType = m_oldMainTypeNames.key(mainType);
-    oldSubType = m_oldSubTypeNames.key(subType);
+    oldType = m_oldMainTypeNames.key( mainType );
+    oldSubType = m_oldSubTypeNames.key( subType );
     if ( !oldSubType.isEmpty() ) {
         return oldType + KVTML_1_TYPE_DIV + oldSubType;
     }
index 0294effb6436e6ae1c00c42de5c5687eea1cb347..12782653272795f9a1ec11bf0ab5e597fb06542e 100644 (file)
@@ -81,7 +81,8 @@
 /**
   * @file contains defines and constants necessary for reading kvtml files prior to KDE4. kvtml version 1.
   */
-class KEduVocKvtmlCompability {
+class KEduVocKvtmlCompability
+{
 
 public:
     /**
@@ -118,14 +119,14 @@ public:
      * @param typeSubtypeString the old string containing everything
      * @return new main type
      */
-    QString mainTypeFromOldFormat(const QString& typeSubtypeString) const;
+    QString mainTypeFromOldFormat( const QString& typeSubtypeString ) const;
 
     /**
      * Get the subtype from an old type definition
      * @param typeSubtypeString the old string containing everything
      * @return new sub type
      */
-    QString subTypeFromOldFormat(const QString& typeSubtypeString) const;
+    QString subTypeFromOldFormat( const QString& typeSubtypeString ) const;
 
     /**
      * To write old docs: convert a nice new type to the ugly old style.
@@ -133,7 +134,7 @@ public:
      * @param subType subtype
      * @return old type string
      */
-    QString oldType(const QString& mainType, const QString& subType) const;
+    QString oldType( const QString& mainType, const QString& subType ) const;
 
 
 private:
index 35f9427e003c2a183444634f350740d09fba6434..5b1cc3fd0856ea3950f5dd7bf362c20494a7cb73 100644 (file)
 #include "kvtmldefs.h"
 #include "keduvoccommon_p.h"
 
-KEduVocKvtmlReader::KEduVocKvtmlReader(QIODevice *file)
+KEduVocKvtmlReader::KEduVocKvtmlReader( QIODevice *file )
 {
-  // the file must be already open
-  m_inputFile = file;
-  m_errorMessage = "";
+    // the file must be already open
+    m_inputFile = file;
+    m_errorMessage = "";
 }
 
 
-bool KEduVocKvtmlReader::readDoc(KEduVocDocument *doc)
+bool KEduVocKvtmlReader::readDoc( KEduVocDocument *doc )
 {
-  m_doc = doc;
-  m_cols = 0;
-  m_lines = 0;
-
-  QDomDocument domDoc("KEduVocDocument");
-
-  if (!domDoc.setContent(m_inputFile, &m_errorMessage))
-    return false;
-
-  QDomElement domElementKvtml = domDoc.documentElement();
-  if (domElementKvtml.tagName() != KV_DOCTYPE)
-  {
-    m_errorMessage = i18n("This is not a KDE Vocabulary document.");
-    return false;
-  }
-
-  //-------------------------------------------------------------------------
-  // Attributes
-  //-------------------------------------------------------------------------
-
-  QDomAttr documentAttribute;
-  documentAttribute = domElementKvtml.attributeNode(KV_ENCODING);
-  if (!documentAttribute.isNull())
-  {
-    // TODO handle old encodings
-    // Qt DOM API autodetects encoding, so is there anything to do ?
-  }
-
-  documentAttribute = domElementKvtml.attributeNode(KV_TITLE);
-  if (!documentAttribute.isNull())
-    m_doc->setTitle(documentAttribute.value());
-
-  documentAttribute = domElementKvtml.attributeNode(KV_AUTHOR);
-  if (!documentAttribute.isNull())
-    m_doc->setAuthor(documentAttribute.value());
-
-  documentAttribute = domElementKvtml.attributeNode(KV_LICENSE);
-  if (!documentAttribute.isNull())
-    m_doc->setLicense(documentAttribute.value());
-
-  documentAttribute = domElementKvtml.attributeNode(KV_DOC_REM);
-  if (!documentAttribute.isNull())
-    m_doc->setDocumentRemark(documentAttribute.value());
-
-  documentAttribute = domElementKvtml.attributeNode(KV_GENERATOR);
-  if (!documentAttribute.isNull())
-  {
-    m_doc->setGenerator(documentAttribute.value());
-    int pos = m_doc->generator().lastIndexOf(KVD_VERS_PREFIX);
-    if (pos >= 0)
-      m_doc->setVersion(m_doc->generator().remove(0, pos + 2));
-  }
-
-  documentAttribute = domElementKvtml.attributeNode(KV_COLS);
-  if (!documentAttribute.isNull())
-    m_cols = documentAttribute.value().toInt(); ///currently not used anywhere
-
-  documentAttribute = domElementKvtml.attributeNode(KV_LINES);
-  if (!documentAttribute.isNull())
-    m_lines = documentAttribute.value().toInt();
-
-  //-------------------------------------------------------------------------
-  // Children
-  //-------------------------------------------------------------------------
-
-  bool result = readBody(domElementKvtml);  // read vocabulary
-
-  return result;
+    m_doc = doc;
+    m_cols = 0;
+    m_lines = 0;
+
+    QDomDocument domDoc( "KEduVocDocument" );
+
+    if ( !domDoc.setContent( m_inputFile, &m_errorMessage ) )
+        return false;
+
+    QDomElement domElementKvtml = domDoc.documentElement();
+    if ( domElementKvtml.tagName() != KV_DOCTYPE ) {
+        m_errorMessage = i18n( "This is not a KDE Vocabulary document." );
+        return false;
+    }
+
+    //-------------------------------------------------------------------------
+    // Attributes
+    //-------------------------------------------------------------------------
+
+    QDomAttr documentAttribute;
+    documentAttribute = domElementKvtml.attributeNode( KV_ENCODING );
+    if ( !documentAttribute.isNull() ) {
+        // TODO handle old encodings
+        // Qt DOM API autodetects encoding, so is there anything to do ?
+    }
+
+    documentAttribute = domElementKvtml.attributeNode( KV_TITLE );
+    if ( !documentAttribute.isNull() )
+        m_doc->setTitle( documentAttribute.value() );
+
+    documentAttribute = domElementKvtml.attributeNode( KV_AUTHOR );
+    if ( !documentAttribute.isNull() )
+        m_doc->setAuthor( documentAttribute.value() );
+
+    documentAttribute = domElementKvtml.attributeNode( KV_LICENSE );
+    if ( !documentAttribute.isNull() )
+        m_doc->setLicense( documentAttribute.value() );
+
+    documentAttribute = domElementKvtml.attributeNode( KV_DOC_REM );
+    if ( !documentAttribute.isNull() )
+        m_doc->setDocumentRemark( documentAttribute.value() );
+
+    documentAttribute = domElementKvtml.attributeNode( KV_GENERATOR );
+    if ( !documentAttribute.isNull() ) {
+        m_doc->setGenerator( documentAttribute.value() );
+        int pos = m_doc->generator().lastIndexOf( KVD_VERS_PREFIX );
+        if ( pos >= 0 )
+            m_doc->setVersion( m_doc->generator().remove( 0, pos + 2 ) );
+    }
+
+    documentAttribute = domElementKvtml.attributeNode( KV_COLS );
+    if ( !documentAttribute.isNull() )
+        m_cols = documentAttribute.value().toInt(); ///currently not used anywhere
+
+    documentAttribute = domElementKvtml.attributeNode( KV_LINES );
+    if ( !documentAttribute.isNull() )
+        m_lines = documentAttribute.value().toInt();
+
+    //-------------------------------------------------------------------------
+    // Children
+    //-------------------------------------------------------------------------
+
+    bool result = readBody( domElementKvtml ); // read vocabulary
+
+    return result;
 }
 
 
-bool KEduVocKvtmlReader::readBody(QDomElement &domElementParent)
+bool KEduVocKvtmlReader::readBody( QDomElement &domElementParent )
 {
-  bool result = false;
-
-  QDomElement currentElement;
-
-  currentElement = domElementParent.firstChildElement(KV_LESS_GRP);
-  if (!currentElement.isNull()) {
-    result = readLesson(currentElement);
-    if (!result)
-      return false;
-  }
-
-  currentElement = domElementParent.firstChildElement(KV_ARTICLE_GRP);
-  if (!currentElement.isNull()) {
-    result = readArticle(currentElement);
-    if (!result)
-      return false;
-  }
-
-  currentElement = domElementParent.firstChildElement(KV_CONJUG_GRP);
-  if (!currentElement.isNull()) {
-    QList<KEduVocConjugation> conjugations;
-    result = readConjug(currentElement, conjugations);
-    if (result) {
-      KEduVocConjugation conjug;
-      for (int i = 0; i< conjugations.count(); i++) {
-        conjug = conjugations[i];
-        m_doc->setConjugation(i, conjug);
-      }
+    bool result = false;
+
+    QDomElement currentElement;
+
+    currentElement = domElementParent.firstChildElement( KV_LESS_GRP );
+    if ( !currentElement.isNull() ) {
+        result = readLesson( currentElement );
+        if ( !result )
+            return false;
     }
-    else
-      return false;
-  }
-
-
-  // initialize the list of predefined types
-  m_doc->wordTypes()->createDefaultWordTypes();
-  currentElement = domElementParent.firstChildElement(KV_TYPE_GRP);
-  if (!currentElement.isNull()) {
-    result = readType(currentElement);
-    if (!result)
-      return false;
-  }
-
-  currentElement = domElementParent.firstChildElement(KV_TENSE_GRP);
-  if (!currentElement.isNull()) {
-    result = readTense(currentElement);
-    if (!result)
-      return false;
-  }
-
-  currentElement = domElementParent.firstChildElement(KV_USAGE_GRP);
-  if (!currentElement.isNull()) {
-    result = readUsage(currentElement);
-    if (!result)
-      return false;
-  }
-
-  QDomNodeList entryList = domElementParent.elementsByTagName(KV_EXPR);
-  if (entryList.length() <= 0)
-    return false;
-
-  for (int i = 0; i < entryList.count(); ++i) {
-    currentElement = entryList.item(i).toElement();
-    if (currentElement.parentNode() == domElementParent) {
-      result = readExpression(currentElement);
-      if (!result)
+
+    currentElement = domElementParent.firstChildElement( KV_ARTICLE_GRP );
+    if ( !currentElement.isNull() ) {
+        result = readArticle( currentElement );
+        if ( !result )
+            return false;
+    }
+
+    currentElement = domElementParent.firstChildElement( KV_CONJUG_GRP );
+    if ( !currentElement.isNull() ) {
+        QList<KEduVocConjugation> conjugations;
+        result = readConjug( currentElement, conjugations );
+        if ( result ) {
+            KEduVocConjugation conjug;
+            for ( int i = 0; i< conjugations.count(); i++ ) {
+                conjug = conjugations[i];
+                m_doc->setConjugation( i, conjug );
+            }
+        } else
+            return false;
+    }
+
+
+    // initialize the list of predefined types
+    m_doc->wordTypes()->createDefaultWordTypes();
+    currentElement = domElementParent.firstChildElement( KV_TYPE_GRP );
+    if ( !currentElement.isNull() ) {
+        result = readType( currentElement );
+        if ( !result )
+            return false;
+    }
+
+    currentElement = domElementParent.firstChildElement( KV_TENSE_GRP );
+    if ( !currentElement.isNull() ) {
+        result = readTense( currentElement );
+        if ( !result )
+            return false;
+    }
+
+    currentElement = domElementParent.firstChildElement( KV_USAGE_GRP );
+    if ( !currentElement.isNull() ) {
+        result = readUsage( currentElement );
+        if ( !result )
+            return false;
+    }
+
+    QDomNodeList entryList = domElementParent.elementsByTagName( KV_EXPR );
+    if ( entryList.length() <= 0 )
         return false;
+
+    for ( int i = 0; i < entryList.count(); ++i ) {
+        currentElement = entryList.item( i ).toElement();
+        if ( currentElement.parentNode() == domElementParent ) {
+            result = readExpression( currentElement );
+            if ( !result )
+                return false;
+        }
     }
-  }
 
-  return true;
+    return true;
 }
 
 
-bool KEduVocKvtmlReader::readLesson(QDomElement &domElementParent)
+bool KEduVocKvtmlReader::readLesson( QDomElement &domElementParent )
 {
-  QString s;
-  QDomAttr attribute;
-  QDomElement currentElement;
-
-  //-------------------------------------------------------------------------
-  // Attributes
-  //-------------------------------------------------------------------------
-
-  attribute = domElementParent.attributeNode(KV_SIZEHINT);
-  if (!attribute.isNull())
-    m_doc->setSizeHint(-1, attribute.value().toInt());
-
-  //-------------------------------------------------------------------------
-  // Children
-  //-------------------------------------------------------------------------
-
-  QDomNodeList entryList = domElementParent.elementsByTagName(KV_LESS_DESC);
-  if (entryList.length() <= 0)
-    return false;
-
-  QList<int> inQueryList;
-
-  for (int i = 0; i < entryList.count(); ++i) {
-    currentElement = entryList.item(i).toElement();
-    if (currentElement.parentNode() == domElementParent) {
-      int no = 0;
-      bool isCurr = false;
-
-      attribute = currentElement.attributeNode(KV_LESS_NO);
-      if (!attribute.isNull())
-        no = attribute.value().toInt();
-
-      attribute = currentElement.attributeNode(KV_LESS_CURR);
-      if (!attribute.isNull())
-        isCurr = attribute.value().toInt() != 0;
-
-      if (isCurr && no != 0)
-        m_doc->setCurrentLesson(no);
-
-      attribute = currentElement.attributeNode(KV_LESS_QUERY);
-      if (!attribute.isNull())
-        if (attribute.value().toInt() != 0 && no > 0)
-          inQueryList.append(no);
-
-      s = currentElement.text();
-      if (s.isNull())
-        s = "";
-      m_doc->addLesson(s, no);
+    QString s;
+    QDomAttr attribute;
+    QDomElement currentElement;
+
+    //-------------------------------------------------------------------------
+    // Attributes
+    //-------------------------------------------------------------------------
+
+    attribute = domElementParent.attributeNode( KV_SIZEHINT );
+    if ( !attribute.isNull() )
+        m_doc->setSizeHint( -1, attribute.value().toInt() );
+
+    //-------------------------------------------------------------------------
+    // Children
+    //-------------------------------------------------------------------------
+
+    QDomNodeList entryList = domElementParent.elementsByTagName( KV_LESS_DESC );
+    if ( entryList.length() <= 0 )
+        return false;
+
+    QList<int> inQueryList;
+
+    for ( int i = 0; i < entryList.count(); ++i ) {
+        currentElement = entryList.item( i ).toElement();
+        if ( currentElement.parentNode() == domElementParent ) {
+            int no = 0;
+            bool isCurr = false;
+
+            attribute = currentElement.attributeNode( KV_LESS_NO );
+            if ( !attribute.isNull() )
+                no = attribute.value().toInt();
+
+            attribute = currentElement.attributeNode( KV_LESS_CURR );
+            if ( !attribute.isNull() )
+                isCurr = attribute.value().toInt() != 0;
+
+            if ( isCurr && no != 0 )
+                m_doc->setCurrentLesson( no );
+
+            attribute = currentElement.attributeNode( KV_LESS_QUERY );
+            if ( !attribute.isNull() )
+                if ( attribute.value().toInt() != 0 && no > 0 )
+                    inQueryList.append( no );
+
+            s = currentElement.text();
+            if ( s.isNull() )
+                s = "";
+            m_doc->addLesson( s, no );
+        }
     }
-  }
 
-  if (inQueryList.count() > 0)
-    m_doc->setLessonsInQuery(inQueryList);
+    if ( inQueryList.count() > 0 )
+        m_doc->setLessonsInQuery( inQueryList );
 
-  return true;
+    return true;
 }
 
 
-bool KEduVocKvtmlReader::readArticle(QDomElement &domElementParent)
+bool KEduVocKvtmlReader::readArticle( QDomElement &domElementParent )
 /*
  <article>
   <e l="de">        lang determines also lang order in entries !!
@@ -264,104 +260,100 @@ bool KEduVocKvtmlReader::readArticle(QDomElement &domElementParent)
 */
 {
 
-  QString s;
-  QDomAttr attribute;
-  QDomElement currentElement;
-  QDomElement article;
+    QString s;
+    QDomAttr attribute;
+    QDomElement currentElement;
+    QDomElement article;
 
-  QDomNodeList entryList = domElementParent.elementsByTagName(KV_ART_ENTRY);
-  if (entryList.length() <= 0)
-    return false;
+    QDomNodeList entryList = domElementParent.elementsByTagName( KV_ART_ENTRY );
+    if ( entryList.length() <= 0 )
+        return false;
 
-  for (int i = 0; i < entryList.count(); ++i) {
+    for ( int i = 0; i < entryList.count(); ++i ) {
 
 //kDebug() << "KEduVocKvtmlReader::readArticle() read " << entryList.count() << " articles. ";
-    currentElement = entryList.item(i).toElement();
-    if (currentElement.parentNode() == domElementParent) {
-      QString lang;
-      attribute = currentElement.attributeNode(KV_LANG);
-
-      if (m_doc->identifierCount() <= i)
-      {
-        // first entry
-        if (!attribute.isNull())         // no definition in first entry
-          lang = attribute.value();
-        else
-          lang = "original";
-        m_doc->appendIdentifier(lang);
+        currentElement = entryList.item( i ).toElement();
+        if ( currentElement.parentNode() == domElementParent ) {
+            QString lang;
+            attribute = currentElement.attributeNode( KV_LANG );
+
+            if ( m_doc->identifierCount() <= i ) {
+                // first entry
+                if ( !attribute.isNull() )       // no definition in first entry
+                    lang = attribute.value();
+                else
+                    lang = "original";
+                m_doc->appendIdentifier( lang );
 //kDebug() << " Identifier " << i << " is " << lang;
-      }
-      else
-      {
-        if (!attribute.isNull() && attribute.value() != m_doc->identifier(i))
-        {
-          // different originals ?
-          m_errorMessage = i18n("Ambiguous definition of language code");
-          return false;
+            } else {
+                if ( !attribute.isNull() && attribute.value() != m_doc->identifier( i ) ) {
+                    // different originals ?
+                    m_errorMessage = i18n( "Ambiguous definition of language code" );
+                    return false;
+                }
+            }
+
+            //---------
+            // Children
+
+            QString fem_def = "";
+            QString mal_def = "";
+            QString nat_def = "";
+            QString fem_indef = "";
+            QString mal_indef = "";
+            QString nat_indef = "";
+
+            article = currentElement.firstChildElement( KV_ART_FD );
+            if ( !article.isNull() ) {
+                fem_def = article.text();
+                if ( fem_def.isNull() )
+                    fem_def = "";
+            }
+
+            article = currentElement.firstChildElement( KV_ART_FI );
+            if ( !article.isNull() ) {
+                fem_indef = article.text();
+                if ( fem_indef.isNull() )
+                    fem_indef = "";
+            }
+
+            article = currentElement.firstChildElement( KV_ART_MD );
+            if ( !article.isNull() ) {
+                mal_def = article.text();
+                if ( mal_def.isNull() )
+                    mal_def = "";
+            }
+
+            article = currentElement.firstChildElement( KV_ART_MI );
+            if ( !article.isNull() ) {
+                mal_indef = article.text();
+                if ( mal_indef.isNull() )
+                    mal_indef = "";
+            }
+
+            article = currentElement.firstChildElement( KV_ART_ND );
+            if ( !article.isNull() ) {
+                nat_def = article.text();
+                if ( nat_def.isNull() )
+                    nat_def = "";
+            }
+
+            article = currentElement.firstChildElement( KV_ART_NI );
+            if ( !article.isNull() ) {
+                nat_indef = article.text();
+                if ( nat_indef.isNull() )
+                    nat_indef = "";
+            }
+
+            m_doc->setArticle( i, KEduVocArticle( fem_def, fem_indef, mal_def, mal_indef, nat_def, nat_indef ) );
         }
-      }
-
-      //---------
-      // Children
-
-      QString fem_def = "";
-      QString mal_def = "";
-      QString nat_def = "";
-      QString fem_indef = "";
-      QString mal_indef = "";
-      QString nat_indef = "";
-
-      article = currentElement.firstChildElement(KV_ART_FD);
-      if (!article.isNull()) {
-        fem_def = article.text();
-        if (fem_def.isNull())
-          fem_def = "";
-      }
-
-      article = currentElement.firstChildElement(KV_ART_FI);
-      if (!article.isNull()) {
-        fem_indef = article.text();
-        if (fem_indef.isNull())
-          fem_indef = "";
-      }
-
-      article = currentElement.firstChildElement(KV_ART_MD);
-      if (!article.isNull()) {
-        mal_def = article.text();
-        if (mal_def.isNull())
-          mal_def = "";
-      }
-
-      article = currentElement.firstChildElement(KV_ART_MI);
-      if (!article.isNull()) {
-        mal_indef = article.text();
-        if (mal_indef.isNull())
-          mal_indef = "";
-      }
-
-      article = currentElement.firstChildElement(KV_ART_ND);
-      if (!article.isNull()) {
-        nat_def = article.text();
-        if (nat_def.isNull())
-          nat_def = "";
-      }
-
-      article = currentElement.firstChildElement(KV_ART_NI);
-      if (!article.isNull()) {
-        nat_indef = article.text();
-        if (nat_indef.isNull())
-          nat_indef = "";
-      }
-
-      m_doc->setArticle(i, KEduVocArticle(fem_def, fem_indef, mal_def, mal_indef, nat_def, nat_indef));
     }
-  }
 
-  return true;
+    return true;
 }
 
 
-bool KEduVocKvtmlReader::readConjug(QDomElement &domElementParent, QList<KEduVocConjugation> &curr_conjug)
+bool KEduVocKvtmlReader::readConjug( QDomElement &domElementParent, QList<KEduVocConjugation> &curr_conjug )
 /*
  <conjugation>        used in header for definiton of "prefix"
   <e l="de">          lang determines also lang order in entries !!
@@ -394,312 +386,280 @@ bool KEduVocKvtmlReader::readConjug(QDomElement &domElementParent, QList<KEduVoc
  </conjugation>
 */
 {
-  QString s;
-  bool p3_common;
-  bool s3_common;
-  QString pers1_sing;
-  QString pers2_sing;
-  QString pers3_m_sing;
-  QString pers3_f_sing;
-  QString pers3_n_sing;
-  QString pers1_plur;
-  QString pers2_plur;
-  QString pers3_m_plur;
-  QString pers3_f_plur;
-  QString pers3_n_plur;
-  QString lang;
-  QString type;
-
-  // this gets a list of keduvocconjugations, count will be the conjug number to be filled.
-  int count = 0;
+    QString s;
+    bool p3_common;
+    bool s3_common;
+    QString pers1_sing;
+    QString pers2_sing;
+    QString pers3_m_sing;
+    QString pers3_f_sing;
+    QString pers3_n_sing;
+    QString pers1_plur;
+    QString pers2_plur;
+    QString pers3_m_plur;
+    QString pers3_f_plur;
+    QString pers3_n_plur;
+    QString lang;
+    QString type;
+
+    // this gets a list of keduvocconjugations, count will be the conjug number to be filled.
+    int count = 0;
 
 // reset
-  curr_conjug.clear();
+    curr_conjug.clear();
 // create new empty one
-  curr_conjug.append(KEduVocConjugation());
-
-  QDomElement domElementConjugChild = domElementParent.firstChild().toElement();
-  while (!domElementConjugChild.isNull())
-  {
-    if (domElementConjugChild.tagName() == KV_CON_ENTRY)
-    {               // if KV_CON_ENTRY == "e" is found, we are reading a personal pronun definition.
-      // CONJ_PREFIX is defined as "--"
-      type = CONJ_PREFIX;
-
-      //----------
-      // Attribute
-
-      QString lang;
-      QDomAttr domAttrLang = domElementConjugChild.attributeNode(KV_LANG); // "l"
-
-      if (m_doc->identifierCount() <= count)
-      {
-        // first entry
-        if (!domAttrLang.isNull())            // no definition in first entry
-          lang = domAttrLang.value();
-        else
-          lang = "original";
-        m_doc->appendIdentifier(lang);
-      }
-      else
-      {
-        if (!domAttrLang.isNull() && domAttrLang.value() != m_doc->identifier(count))
-        {
-          // different originals ?
-          m_errorMessage = i18n("Ambiguous definition of language code");
-          return false;
-        }
-      }
-    }
-    else if (domElementConjugChild.tagName() == KV_CON_TYPE)
-    {                       // this means reading translations KV_CON_TYPE == "t"
-      //----------
-      // Attribute
-
-        // "n" == is the type is the tense
-      QDomAttr domAttrLang = domElementConjugChild.attributeNode(KV_CON_NAME);
-      type = domAttrLang.value();
-      if (type.isNull())
-        type = "";
-
-        // if it starts with "#" the user typed in the tense name
-      if (type.length() != 0 && type.left(1) == UL_USER_TENSE)
-      {
-        int num = qMin(type.mid (1, 40).toInt(), 1000); // paranoia check
-        if (num > m_doc->tenseDescriptions().count())
-        {
-          // description missing ?
-          QString s;
-          QStringList sl = m_doc->tenseDescriptions();
-          for (int i = m_doc->tenseDescriptions().count(); i < num; i++)
-          {
-            s.setNum(i + 1);
-            s.prepend("#");  // invent descr according to number
-            sl.append(s);
-          }
-          m_doc->setTenseDescriptions(sl);
-        }
-      }
-    }
+    curr_conjug.append( KEduVocConjugation() );
 
-    pers1_sing = "";
-    pers2_sing = "";
-    pers3_m_sing = "";
-    pers3_f_sing = "";
-    pers3_n_sing = "";
-    pers1_plur = "";
-    pers2_plur = "";
-    pers3_m_plur = "";
-    pers3_f_plur = "";
-    pers3_n_plur = "";
-    p3_common = false;
-    s3_common = false;
-
-    // get the individual entries for persons...
-    QDomElement domElementConjugGrandChild = domElementConjugChild.firstChild().toElement();
-    while (!domElementConjugGrandChild.isNull())
+    QDomElement domElementConjugChild = domElementParent.firstChild().toElement();
+    while ( !domElementConjugChild.isNull() )
     {
-      if (domElementConjugGrandChild.tagName() == KV_CON_P1S)
-      {
-        pers1_sing = domElementConjugGrandChild.text();
-        if (pers1_sing.isNull())
-          pers1_sing = "";
-      }
-      else if (domElementConjugGrandChild.tagName() == KV_CON_P2S)
-      {
-        pers2_sing = domElementConjugGrandChild.text();
-        if (pers2_sing.isNull())
-          pers2_sing = "";
-      }
-      else if (domElementConjugGrandChild.tagName() == KV_CON_P3SF)
-      {
-        QDomAttr domAttrCommon = domElementConjugGrandChild.attributeNode(KV_CONJ_COMMON);
-        if (!domAttrCommon.isNull())
-          s3_common = domAttrCommon.value().toInt();  // returns 0 if the conversion fails
-
-        pers3_f_sing = domElementConjugGrandChild.text();
-        if (pers3_f_sing.isNull())
-          pers3_f_sing = "";
-      }
-      else if (domElementConjugGrandChild.tagName() == KV_CON_P3SM)
-      {
-        pers3_m_sing = domElementConjugGrandChild.text();
-        if (pers3_m_sing.isNull())
-          pers3_m_sing = "";
-      }
-      else if (domElementConjugGrandChild.tagName() == KV_CON_P3SN)
-      {
-        pers3_n_sing = domElementConjugGrandChild.text();
-        if (pers3_n_sing.isNull())
-          pers3_n_sing = "";
-      }
-      else if (domElementConjugGrandChild.tagName() == KV_CON_P1P)
-      {
-        pers1_plur = domElementConjugGrandChild.text();
-        if (pers1_plur.isNull())
-          pers1_plur = "";
-      }
-      else if (domElementConjugGrandChild.tagName() == KV_CON_P2P)
-      {
-        pers2_plur = domElementConjugGrandChild.text();
-        if (pers2_plur.isNull())
-          pers2_plur = "";
-      }
-      else if (domElementConjugGrandChild.tagName() == KV_CON_P3PF)
-      {
-        QDomAttr domAttrCommon = domElementConjugGrandChild.attributeNode(KV_CONJ_COMMON);
-        if (!domAttrCommon.isNull())
-          p3_common = domAttrCommon.value().toInt();  // returns 0 if the conversion fails
-
-        pers3_f_plur = domElementConjugGrandChild.text();
-        if (pers3_f_plur.isNull())
-          pers3_f_plur = "";
-      }
-      else if (domElementConjugGrandChild.tagName() == KV_CON_P3PM)
-      {
-        pers3_m_plur = domElementConjugGrandChild.text();
-        if (pers3_m_plur.isNull())
-          pers3_m_plur = "";
-      }
-      else if (domElementConjugGrandChild.tagName() == KV_CON_P3PN)
-      {
-        pers3_n_plur = domElementConjugGrandChild.text();
-        if (pers3_n_plur.isNull())
-          pers3_n_plur = "";
-      }
-      else
-      {
-        return false;
-      }
-
-      domElementConjugGrandChild = domElementConjugGrandChild.nextSibling().toElement();
-    } // while - probably to be sure, because the persons could be in any order.
-      // I guess this goes over only one set, such as:
-      // <s1>traigo</s1><s2>traes</s2><s3fcommon="1">trae</s3f>
-      // <p1>traemos</p1><p2>traéis</p2><p3f common="1">traen</p3f>
-      // until no elements are left in that soup.
-
-
-
-    if (domElementConjugChild.tagName() == KV_CON_ENTRY)
-      while (count + 1 > (int) curr_conjug.size() )
-        curr_conjug.append(KEduVocConjugation());
-
-    // now set the data: [count] - number of conjug?
-    // type - the tense?
-    // finally the person
-    curr_conjug[count].setPers3SingularCommon(type, s3_common);
-    curr_conjug[count].setPers3PluralCommon(type, p3_common);
-    curr_conjug[count].setPers1Singular(type, pers1_sing);
-    curr_conjug[count].setPers2Singular(type, pers2_sing);
-    curr_conjug[count].setPers3FemaleSingular(type, pers3_f_sing);
-    curr_conjug[count].setPers3MaleSingular(type, pers3_m_sing);
-    curr_conjug[count].setPers3NaturalSingular(type, pers3_n_sing);
-    curr_conjug[count].setPers1Plural(type, pers1_plur);
-    curr_conjug[count].setPers2Plural(type, pers2_plur);
-    curr_conjug[count].setPers3FemalePlural(type, pers3_f_plur);
-    curr_conjug[count].setPers3MalePlural(type, pers3_m_plur);
-    curr_conjug[count].setPers3NaturalPlural(type, pers3_n_plur);
-
-    if (domElementConjugChild.tagName() == KV_CON_ENTRY)
-      count++;
-
-    domElementConjugChild = domElementConjugChild.nextSibling().toElement();
-  } // while -> next type, count++
-
-  return true;
+        if ( domElementConjugChild.tagName() == KV_CON_ENTRY ) {            // if KV_CON_ENTRY == "e" is found, we are reading a personal pronun definition.
+            // CONJ_PREFIX is defined as "--"
+            type = CONJ_PREFIX;
+
+            //----------
+            // Attribute
+
+            QString lang;
+            QDomAttr domAttrLang = domElementConjugChild.attributeNode( KV_LANG ); // "l"
+
+            if ( m_doc->identifierCount() <= count ) {
+                // first entry
+                if ( !domAttrLang.isNull() )          // no definition in first entry
+                    lang = domAttrLang.value();
+                else
+                    lang = "original";
+                m_doc->appendIdentifier( lang );
+            } else {
+                if ( !domAttrLang.isNull() && domAttrLang.value() != m_doc->identifier( count ) ) {
+                    // different originals ?
+                    m_errorMessage = i18n( "Ambiguous definition of language code" );
+                    return false;
+                }
+            }
+        } else if ( domElementConjugChild.tagName() == KV_CON_TYPE ) {                    // this means reading translations KV_CON_TYPE == "t"
+            //----------
+            // Attribute
+
+            // "n" == is the type is the tense
+            QDomAttr domAttrLang = domElementConjugChild.attributeNode( KV_CON_NAME );
+            type = domAttrLang.value();
+            if ( type.isNull() )
+                type = "";
+
+            // if it starts with "#" the user typed in the tense name
+            if ( type.length() != 0 && type.left( 1 ) == UL_USER_TENSE ) {
+                int num = qMin( type.mid( 1, 40 ).toInt(), 1000 ); // paranoia check
+                if ( num > m_doc->tenseDescriptions().count() ) {
+                    // description missing ?
+                    QString s;
+                    QStringList sl = m_doc->tenseDescriptions();
+                    for ( int i = m_doc->tenseDescriptions().count(); i < num; i++ ) {
+                        s.setNum( i + 1 );
+                        s.prepend( "#" ); // invent descr according to number
+                        sl.append( s );
+                    }
+                    m_doc->setTenseDescriptions( sl );
+                }
+            }
+        }
+
+        pers1_sing = "";
+        pers2_sing = "";
+        pers3_m_sing = "";
+        pers3_f_sing = "";
+        pers3_n_sing = "";
+        pers1_plur = "";
+        pers2_plur = "";
+        pers3_m_plur = "";
+        pers3_f_plur = "";
+        pers3_n_plur = "";
+        p3_common = false;
+        s3_common = false;
+
+        // get the individual entries for persons...
+        QDomElement domElementConjugGrandChild = domElementConjugChild.firstChild().toElement();
+        while ( !domElementConjugGrandChild.isNull() ) {
+            if ( domElementConjugGrandChild.tagName() == KV_CON_P1S ) {
+                pers1_sing = domElementConjugGrandChild.text();
+                if ( pers1_sing.isNull() )
+                    pers1_sing = "";
+            } else if ( domElementConjugGrandChild.tagName() == KV_CON_P2S ) {
+                pers2_sing = domElementConjugGrandChild.text();
+                if ( pers2_sing.isNull() )
+                    pers2_sing = "";
+            } else if ( domElementConjugGrandChild.tagName() == KV_CON_P3SF ) {
+                QDomAttr domAttrCommon = domElementConjugGrandChild.attributeNode( KV_CONJ_COMMON );
+                if ( !domAttrCommon.isNull() )
+                    s3_common = domAttrCommon.value().toInt();  // returns 0 if the conversion fails
+
+                pers3_f_sing = domElementConjugGrandChild.text();
+                if ( pers3_f_sing.isNull() )
+                    pers3_f_sing = "";
+            } else if ( domElementConjugGrandChild.tagName() == KV_CON_P3SM ) {
+                pers3_m_sing = domElementConjugGrandChild.text();
+                if ( pers3_m_sing.isNull() )
+                    pers3_m_sing = "";
+            } else if ( domElementConjugGrandChild.tagName() == KV_CON_P3SN ) {
+                pers3_n_sing = domElementConjugGrandChild.text();
+                if ( pers3_n_sing.isNull() )
+                    pers3_n_sing = "";
+            } else if ( domElementConjugGrandChild.tagName() == KV_CON_P1P ) {
+                pers1_plur = domElementConjugGrandChild.text();
+                if ( pers1_plur.isNull() )
+                    pers1_plur = "";
+            } else if ( domElementConjugGrandChild.tagName() == KV_CON_P2P ) {
+                pers2_plur = domElementConjugGrandChild.text();
+                if ( pers2_plur.isNull() )
+                    pers2_plur = "";
+            } else if ( domElementConjugGrandChild.tagName() == KV_CON_P3PF ) {
+                QDomAttr domAttrCommon = domElementConjugGrandChild.attributeNode( KV_CONJ_COMMON );
+                if ( !domAttrCommon.isNull() )
+                    p3_common = domAttrCommon.value().toInt();  // returns 0 if the conversion fails
+
+                pers3_f_plur = domElementConjugGrandChild.text();
+                if ( pers3_f_plur.isNull() )
+                    pers3_f_plur = "";
+            } else if ( domElementConjugGrandChild.tagName() == KV_CON_P3PM ) {
+                pers3_m_plur = domElementConjugGrandChild.text();
+                if ( pers3_m_plur.isNull() )
+                    pers3_m_plur = "";
+            } else if ( domElementConjugGrandChild.tagName() == KV_CON_P3PN ) {
+                pers3_n_plur = domElementConjugGrandChild.text();
+                if ( pers3_n_plur.isNull() )
+                    pers3_n_plur = "";
+            } else {
+                return false;
+            }
+
+            domElementConjugGrandChild = domElementConjugGrandChild.nextSibling().toElement();
+        } // while - probably to be sure, because the persons could be in any order.
+        // I guess this goes over only one set, such as:
+        // <s1>traigo</s1><s2>traes</s2><s3fcommon="1">trae</s3f>
+        // <p1>traemos</p1><p2>traÃ\83©is</p2><p3f common="1">traen</p3f>
+        // until no elements are left in that soup.
+
+
+
+        if ( domElementConjugChild.tagName() == KV_CON_ENTRY )
+            while ( count + 1 > ( int ) curr_conjug.size() )
+                curr_conjug.append( KEduVocConjugation() );
+
+        // now set the data: [count] - number of conjug?
+        // type - the tense?
+        // finally the person
+        curr_conjug[count].setPers3SingularCommon( type, s3_common );
+        curr_conjug[count].setPers3PluralCommon( type, p3_common );
+        curr_conjug[count].setPers1Singular( type, pers1_sing );
+        curr_conjug[count].setPers2Singular( type, pers2_sing );
+        curr_conjug[count].setPers3FemaleSingular( type, pers3_f_sing );
+        curr_conjug[count].setPers3MaleSingular( type, pers3_m_sing );
+        curr_conjug[count].setPers3NaturalSingular( type, pers3_n_sing );
+        curr_conjug[count].setPers1Plural( type, pers1_plur );
+        curr_conjug[count].setPers2Plural( type, pers2_plur );
+        curr_conjug[count].setPers3FemalePlural( type, pers3_f_plur );
+        curr_conjug[count].setPers3MalePlural( type, pers3_m_plur );
+        curr_conjug[count].setPers3NaturalPlural( type, pers3_n_plur );
+
+        if ( domElementConjugChild.tagName() == KV_CON_ENTRY )
+            count++;
+
+        domElementConjugChild = domElementConjugChild.nextSibling().toElement();
+    } // while -> next type, count++
+
+    return true;
 }
 
 
-bool KEduVocKvtmlReader::readType(QDomElement &domElementParent)
+bool KEduVocKvtmlReader::readType( QDomElement &domElementParent )
 {
-  QString s;
-  QDomElement currentElement;
+    QString s;
+    QDomElement currentElement;
 
-  QDomNodeList entryList = domElementParent.elementsByTagName(KV_TYPE_DESC);
-  if (entryList.length() <= 0)
-    return false;
+    QDomNodeList entryList = domElementParent.elementsByTagName( KV_TYPE_DESC );
+    if ( entryList.length() <= 0 )
+        return false;
 
-  for (int i = 0; i < entryList.count(); ++i) {
-    currentElement = entryList.item(i).toElement();
-    if (currentElement.parentNode() == domElementParent) {
-      // We need to even add empty elements since the old system relied on
-      // the order. So "type1" "" "type2" should be just like that.
+    for ( int i = 0; i < entryList.count(); ++i ) {
+        currentElement = entryList.item( i ).toElement();
+        if ( currentElement.parentNode() == domElementParent ) {
+            // We need to even add empty elements since the old system relied on
+            // the order. So "type1" "" "type2" should be just like that.
 
-      kDebug() << "Adding old self defined type: " << currentElement.text();
-      // add the type to the list of available types
-      m_doc->wordTypes()->addType(currentElement.text());
+            kDebug() << "Adding old self defined type: " << currentElement.text();
+            // add the type to the list of available types
+            m_doc->wordTypes()->addType( currentElement.text() );
 
-      // from this the #1 are transformed to something sensible again
-      m_oldSelfDefinedTypes.append(currentElement.text());
+            // from this the #1 are transformed to something sensible again
+            m_oldSelfDefinedTypes.append( currentElement.text() );
+        }
     }
-  }
 
-  return true;
+    return true;
 }
 
 
-bool KEduVocKvtmlReader::readTense(QDomElement &domElementParent)
+bool KEduVocKvtmlReader::readTense( QDomElement &domElementParent )
 {
-  QString s;
-  QDomElement currentElement;
-  QStringList descriptions;
+    QString s;
+    QDomElement currentElement;
+    QStringList descriptions;
 
-  QDomNodeList entryList = domElementParent.elementsByTagName(KV_TENSE_DESC);
-  if (entryList.length() <= 0)
-    return false;
+    QDomNodeList entryList = domElementParent.elementsByTagName( KV_TENSE_DESC );
+    if ( entryList.length() <= 0 )
+        return false;
 
-  descriptions.clear();
+    descriptions.clear();
 
-  for (int i = 0; i < entryList.count(); ++i) {
-    currentElement = entryList.item(i).toElement();
-    if (currentElement.parentNode() == domElementParent) {
-      int no = 0;
+    for ( int i = 0; i < entryList.count(); ++i ) {
+        currentElement = entryList.item( i ).toElement();
+        if ( currentElement.parentNode() == domElementParent ) {
+            int no = 0;
 
-      QDomAttr attribute = currentElement.attributeNode(KV_TENSE_NO);
-      if (!attribute.isNull())
-        no = attribute.value().toInt();
+            QDomAttr attribute = currentElement.attributeNode( KV_TENSE_NO );
+            if ( !attribute.isNull() )
+                no = attribute.value().toInt();
 
-      s = currentElement.text();
-      if (s.isNull())
-        s = "";
-      descriptions.append(s);
+            s = currentElement.text();
+            if ( s.isNull() )
+                s = "";
+            descriptions.append( s );
+        }
     }
-  }
 
-  m_doc->setTenseDescriptions(descriptions);
-  return true;
+    m_doc->setTenseDescriptions( descriptions );
+    return true;
 }
 
 
-bool KEduVocKvtmlReader::readUsage(QDomElement &domElementParent)
+bool KEduVocKvtmlReader::readUsage( QDomElement &domElementParent )
 {
-  // get user defined usages
+    // get user defined usages
 
-  QDomElement currentElement;
+    QDomElement currentElement;
 
-  QDomNodeList entryList = domElementParent.elementsByTagName(KV_USAGE_DESC);
-  if (entryList.length() <= 0) {
-    return false;
-  }
+    QDomNodeList entryList = domElementParent.elementsByTagName( KV_USAGE_DESC );
+    if ( entryList.length() <= 0 ) {
+        return false;
+    }
 
 
-  for (int i = 0; i < entryList.count(); ++i) {
-    currentElement = entryList.item(i).toElement();
-    if (currentElement.parentNode() == domElementParent) {
-      m_compability.addUserdefinedUsage(currentElement.text());
+    for ( int i = 0; i < entryList.count(); ++i ) {
+        currentElement = entryList.item( i ).toElement();
+        if ( currentElement.parentNode() == domElementParent ) {
+            m_compability.addUserdefinedUsage( currentElement.text() );
+        }
     }
-  }
 
-  foreach ( QString usage, m_compability.documentUsages() ) {
-    m_doc->addUsage(usage);
-  }
+    foreach( QString usage, m_compability.documentUsages() ) {
+        m_doc->addUsage( usage );
+    }
 
-  return true;
+    return true;
 }
 
 
-bool KEduVocKvtmlReader::readComparison(QDomElement &domElementParent, KEduVocComparison &comp)
+bool KEduVocKvtmlReader::readComparison( QDomElement &domElementParent, KEduVocComparison &comp )
 /*
  <comparison>
    <l1>good</l1>
@@ -708,39 +668,39 @@ bool KEduVocKvtmlReader::readComparison(QDomElement &domElementParent, KEduVocCo
  </comparison>
 */
 {
-  QString s;
-  comp.clear();
-
-  QDomElement currentElement;
-
-  currentElement = domElementParent.firstChildElement(KV_COMP_L1);
-  if (!currentElement.isNull()) {
-    s = currentElement.text();
-    if (s.isNull())
-      s = "";
-    comp.setL1(s);
-  }
-
-  currentElement = domElementParent.firstChildElement(KV_COMP_L2);
-  if (!currentElement.isNull()) {
-    s = currentElement.text();
-    if (s.isNull())
-      s = "";
-    comp.setL2(s);
-  }
-
-  currentElement = domElementParent.firstChildElement(KV_COMP_L3);
-  if (!currentElement.isNull()) {
-    s = currentElement.text();
-    if (s.isNull())
-      s = "";
-    comp.setL3(s);
-  }
-  return true;
+    QString s;
+    comp.clear();
+
+    QDomElement currentElement;
+
+    currentElement = domElementParent.firstChildElement( KV_COMP_L1 );
+    if ( !currentElement.isNull() ) {
+        s = currentElement.text();
+        if ( s.isNull() )
+            s = "";
+        comp.setL1( s );
+    }
+
+    currentElement = domElementParent.firstChildElement( KV_COMP_L2 );
+    if ( !currentElement.isNull() ) {
+        s = currentElement.text();
+        if ( s.isNull() )
+            s = "";
+        comp.setL2( s );
+    }
+
+    currentElement = domElementParent.firstChildElement( KV_COMP_L3 );
+    if ( !currentElement.isNull() ) {
+        s = currentElement.text();
+        if ( s.isNull() )
+            s = "";
+        comp.setL3( s );
+    }
+    return true;
 }
 
 
-bool KEduVocKvtmlReader::readMultipleChoice(QDomElement &domElementParent, KEduVocMultipleChoice &mc)
+bool KEduVocKvtmlReader::readMultipleChoice( QDomElement &domElementParent, KEduVocMultipleChoice &mc )
 /*
  <multiplechoice>
    <mc1>good</mc1>
@@ -752,519 +712,490 @@ bool KEduVocKvtmlReader::readMultipleChoice(QDomElement &domElementParent, KEduV
 */
 
 {
-  QString s;
-  mc.clear();
-
-  QDomElement currentElement;
-
-  currentElement = domElementParent.firstChildElement(KV_MC_1);
-  if (!currentElement.isNull()) {
-    s = currentElement.text();
-    mc.appendChoice(s);
-  }
-
-  currentElement = domElementParent.firstChildElement(KV_MC_2);
-  if (!currentElement.isNull()) {
-    s = currentElement.text();
-    mc.appendChoice(s);
-  }
-
-  currentElement = domElementParent.firstChildElement(KV_MC_3);
-  if (!currentElement.isNull()) {
-    s = currentElement.text();
-    mc.appendChoice(s);
-  }
-
-  currentElement = domElementParent.firstChildElement(KV_MC_4);
-  if (!currentElement.isNull()) {
-    s = currentElement.text();
-    mc.appendChoice(s);
-  }
-
-  currentElement = domElementParent.firstChildElement(KV_MC_5);
-  if (!currentElement.isNull()) {
-    s = currentElement.text();
-    mc.appendChoice(s);
-  }
-
-  return true;
+    QString s;
+    mc.clear();
+
+    QDomElement currentElement;
+
+    currentElement = domElementParent.firstChildElement( KV_MC_1 );
+    if ( !currentElement.isNull() ) {
+        s = currentElement.text();
+        mc.appendChoice( s );
+    }
+
+    currentElement = domElementParent.firstChildElement( KV_MC_2 );
+    if ( !currentElement.isNull() ) {
+        s = currentElement.text();
+        mc.appendChoice( s );
+    }
+
+    currentElement = domElementParent.firstChildElement( KV_MC_3 );
+    if ( !currentElement.isNull() ) {
+        s = currentElement.text();
+        mc.appendChoice( s );
+    }
+
+    currentElement = domElementParent.firstChildElement( KV_MC_4 );
+    if ( !currentElement.isNull() ) {
+        s = currentElement.text();
+        mc.appendChoice( s );
+    }
+
+    currentElement = domElementParent.firstChildElement( KV_MC_5 );
+    if ( !currentElement.isNull() ) {
+        s = currentElement.text();
+        mc.appendChoice( s );
+    }
+
+    return true;
 }
 
 
 bool KEduVocKvtmlReader::readExpressionChildAttributes( QDomElement &domElementExpressionChild,
-                                                        QString &lang,
-                                                        grade_t &grade, grade_t &rev_grade,
-                                                        int &count, int &rev_count,
-                                                        QDateTime &date, QDateTime &rev_date,
-                                                        QString &remark,
-                                                        int &bcount, int &rev_bcount,
-                                                        QString &query_id,
-                                                        QString &pronunciation,
-                                                        int &width,
-                                                        QString &type,
-                                                        QString &subType,
-                                                        QString &faux_ami_f,
-                                                        QString &faux_ami_t,
-                                                        QString &synonym,
-                                                        QString &example,
-                                                        QString &antonym,
-                                                        QSet<QString> &usages,
-                                                        QString &paraphrase)
+        QString &lang,
+        grade_t &grade, grade_t &rev_grade,
+        int &count, int &rev_count,
+        QDateTime &date, QDateTime &rev_date,
+        QString &remark,
+        int &bcount, int &rev_bcount,
+        QString &query_id,
+        QString &pronunciation,
+        int &width,
+        QString &type,
+        QString &subType,
+        QString &faux_ami_f,
+        QString &faux_ami_t,
+        QString &synonym,
+        QString &example,
+        QString &antonym,
+        QSet<QString> &usages,
+        QString &paraphrase )
 {
-  int pos;
-  QDomAttr attribute;
-
-  lang = "";
-  attribute = domElementExpressionChild.attributeNode(KV_LANG);
-  if (!attribute.isNull())
-    lang = attribute.value();
-
-  width = -1;
-  attribute = domElementExpressionChild.attributeNode(KV_SIZEHINT);
-  if (!attribute.isNull())
-    width = attribute.value().toInt();
-
-  grade = KV_NORM_GRADE;
-  rev_grade = KV_NORM_GRADE;
-  attribute = domElementExpressionChild.attributeNode(KV_GRADE);
-  if (!attribute.isNull())
-  {
-    QString s = attribute.value();
-    if ((pos = s.indexOf(';')) >= 1)
-    {
-      grade = s.left(pos).toInt();
-      rev_grade = s.mid(pos + 1, s.length()).toInt();
+    int pos;
+    QDomAttr attribute;
+
+    lang = "";
+    attribute = domElementExpressionChild.attributeNode( KV_LANG );
+    if ( !attribute.isNull() )
+        lang = attribute.value();
+
+    width = -1;
+    attribute = domElementExpressionChild.attributeNode( KV_SIZEHINT );
+    if ( !attribute.isNull() )
+        width = attribute.value().toInt();
+
+    grade = KV_NORM_GRADE;
+    rev_grade = KV_NORM_GRADE;
+    attribute = domElementExpressionChild.attributeNode( KV_GRADE );
+    if ( !attribute.isNull() ) {
+        QString s = attribute.value();
+        if (( pos = s.indexOf( ';' ) ) >= 1 ) {
+            grade = s.left( pos ).toInt();
+            rev_grade = s.mid( pos + 1, s.length() ).toInt();
+        } else
+            grade = s.toInt();
     }
-    else
-      grade = s.toInt();
-  }
-
-  count = 0;
-  rev_count = 0;
-  attribute = domElementExpressionChild.attributeNode(KV_COUNT);
-  if (!attribute.isNull())
-  {
-    QString s = attribute.value();
-    if ((pos = s.indexOf(';')) >= 1)
-    {
-      count = s.left(pos).toInt();
-      rev_count = s.mid(pos + 1, s.length()).toInt();
+
+    count = 0;
+    rev_count = 0;
+    attribute = domElementExpressionChild.attributeNode( KV_COUNT );
+    if ( !attribute.isNull() ) {
+        QString s = attribute.value();
+        if (( pos = s.indexOf( ';' ) ) >= 1 ) {
+            count = s.left( pos ).toInt();
+            rev_count = s.mid( pos + 1, s.length() ).toInt();
+        } else
+            count = s.toInt();
     }
-    else
-      count = s.toInt();
-  }
-
-  bcount = 0;
-  rev_bcount = 0;
-  attribute = domElementExpressionChild.attributeNode(KV_BAD);
-  if (!attribute.isNull())
-  {
-    QString s = attribute.value();
-    if ((pos = s.indexOf(';')) >= 1)
-    {
-      bcount = s.left(pos).toInt();
-      rev_bcount = s.mid(pos + 1, s.length()).toInt();
+
+    bcount = 0;
+    rev_bcount = 0;
+    attribute = domElementExpressionChild.attributeNode( KV_BAD );
+    if ( !attribute.isNull() ) {
+        QString s = attribute.value();
+        if (( pos = s.indexOf( ';' ) ) >= 1 ) {
+            bcount = s.left( pos ).toInt();
+            rev_bcount = s.mid( pos + 1, s.length() ).toInt();
+        } else
+            bcount = s.toInt();
     }
-    else
-      bcount = s.toInt();
-  }
-
-  date.setTime_t(0);
-  rev_date.setTime_t(0);
-  attribute = domElementExpressionChild.attributeNode(KV_DATE);
-  if (!attribute.isNull())
-  {
-    QString s = attribute.value();
-    if ((pos = s.indexOf(';')) >= 1)
-    {
-      date.setTime_t(s.left(pos).toInt());
-      rev_date.setTime_t(s.mid(pos + 1, s.length()).toInt());
+
+    date.setTime_t( 0 );
+    rev_date.setTime_t( 0 );
+    attribute = domElementExpressionChild.attributeNode( KV_DATE );
+    if ( !attribute.isNull() ) {
+        QString s = attribute.value();
+        if (( pos = s.indexOf( ';' ) ) >= 1 ) {
+            date.setTime_t( s.left( pos ).toInt() );
+            rev_date.setTime_t( s.mid( pos + 1, s.length() ).toInt() );
+        } else
+            date.setTime_t( s.toInt() );
     }
-    else
-      date.setTime_t(s.toInt());
-  }
-
-  attribute = domElementExpressionChild.attributeNode(KV_DATE2);
-  if (!attribute.isNull())
-  {
-    //this format is deprecated and ignored.
-  }
-
-  remark = "";
-  attribute = domElementExpressionChild.attributeNode(KV_REMARK);
-  if (!attribute.isNull())
-    remark = attribute.value();
-
-  faux_ami_f = "";
-  attribute = domElementExpressionChild.attributeNode(KV_FAUX_AMI_F);
-  if (!attribute.isNull())
-    faux_ami_f = attribute.value();
-
-  faux_ami_t = "";
-  attribute = domElementExpressionChild.attributeNode(KV_FAUX_AMI_T);
-  if (!attribute.isNull())
-    faux_ami_t = attribute.value();
-
-  synonym = "";
-  attribute = domElementExpressionChild.attributeNode(KV_SYNONYM);
-  if (!attribute.isNull())
-    synonym = attribute.value();
-
-  example = "";
-  attribute = domElementExpressionChild.attributeNode(KV_EXAMPLE);
-  if (!attribute.isNull())
-    example = attribute.value();
+
+    attribute = domElementExpressionChild.attributeNode( KV_DATE2 );
+    if ( !attribute.isNull() ) {
+        //this format is deprecated and ignored.
+    }
+
+    remark = "";
+    attribute = domElementExpressionChild.attributeNode( KV_REMARK );
+    if ( !attribute.isNull() )
+        remark = attribute.value();
+
+    faux_ami_f = "";
+    attribute = domElementExpressionChild.attributeNode( KV_FAUX_AMI_F );
+    if ( !attribute.isNull() )
+        faux_ami_f = attribute.value();
+
+    faux_ami_t = "";
+    attribute = domElementExpressionChild.attributeNode( KV_FAUX_AMI_T );
+    if ( !attribute.isNull() )
+        faux_ami_t = attribute.value();
+
+    synonym = "";
+    attribute = domElementExpressionChild.attributeNode( KV_SYNONYM );
+    if ( !attribute.isNull() )
+        synonym = attribute.value();
+
+    example = "";
+    attribute = domElementExpressionChild.attributeNode( KV_EXAMPLE );
+    if ( !attribute.isNull() )
+        example = attribute.value();
 
 ///@todo usages
 
-  attribute = domElementExpressionChild.attributeNode(KV_USAGE);
-  if (!attribute.isNull())
-  {
-    kDebug() << "Read usages: " << attribute.value();
-    usages = m_compability.usageFromKvtml1(attribute.value());
+    attribute = domElementExpressionChild.attributeNode( KV_USAGE );
+    if ( !attribute.isNull() ) {
+        kDebug() << "Read usages: " << attribute.value();
+        usages = m_compability.usageFromKvtml1( attribute.value() );
 
-    /*
-    usage = attribute.value();
+        /*
+        usage = attribute.value();
 
-    if (usage.length() != 0 && usage.left(1) == UL_USER_USAGE)
-    {
-      int num = qMin(usage.mid (1, 40).toInt(), 1000); // paranioa check
-      if (num > m_doc->usageDescriptions().count())
-      {
-        // description missing ?
-        QStringList sl = m_doc->usageDescriptions();
-        QString s;
-        for (int i = m_doc->usageDescriptions().count(); i < num; i++)
+        if (usage.length() != 0 && usage.left(1) == UL_USER_USAGE)
         {
-          s.setNum(i + 1);
-          s.prepend("#");  // invent descr according to number
-          sl.append(s);
-        }
-        m_doc->setUsageDescriptions(sl);
-      }
-    }*/
-  }
+          int num = qMin(usage.mid (1, 40).toInt(), 1000); // paranioa check
+          if (num > m_doc->usageDescriptions().count())
+          {
+            // description missing ?
+            QStringList sl = m_doc->usageDescriptions();
+            QString s;
+            for (int i = m_doc->usageDescriptions().count(); i < num; i++)
+            {
+              s.setNum(i + 1);
+              s.prepend("#");  // invent descr according to number
+              sl.append(s);
+            }
+            m_doc->setUsageDescriptions(sl);
+          }
+        }*/
+    }
 
-  paraphrase = "";
-  attribute = domElementExpressionChild.attributeNode(KV_PARAPHRASE);
-  if (!attribute.isNull())
-    paraphrase = attribute.value();
+    paraphrase = "";
+    attribute = domElementExpressionChild.attributeNode( KV_PARAPHRASE );
+    if ( !attribute.isNull() )
+        paraphrase = attribute.value();
 
-  antonym = "";
-  attribute = domElementExpressionChild.attributeNode(KV_ANTONYM);
-  if (!attribute.isNull())
-    antonym = attribute.value();
+    antonym = "";
+    attribute = domElementExpressionChild.attributeNode( KV_ANTONYM );
+    if ( !attribute.isNull() )
+        antonym = attribute.value();
 
     // this is all done by reference - so we have to care about "type" :(
-    attribute = domElementExpressionChild.attributeNode(KV_EXPRTYPE);
-    if (!attribute.isNull())
-    {
+    attribute = domElementExpressionChild.attributeNode( KV_EXPRTYPE );
+    if ( !attribute.isNull() ) {
         QString oldType = attribute.value();
-        if (oldType.length() >= 2 && type.left(1) == QM_USER_TYPE)
-        {
+        if ( oldType.length() >= 2 && type.left( 1 ) == QM_USER_TYPE ) {
             // they started counting at 1
-            int selfDefinedTypeIndex = oldType.right(type.count()-1).toInt() -1;
+            int selfDefinedTypeIndex = oldType.right( type.count()-1 ).toInt() -1;
             // append invented types (do we not trust our own writer?)
-            if ( selfDefinedTypeIndex >= m_oldSelfDefinedTypes.count() )
-            {
-                while (selfDefinedTypeIndex >= m_oldSelfDefinedTypes.count()) {
-                    m_oldSelfDefinedTypes.append( i18n("User defined word type %1", m_oldSelfDefinedTypes.count() - 1) );
+            if ( selfDefinedTypeIndex >= m_oldSelfDefinedTypes.count() ) {
+                while ( selfDefinedTypeIndex >= m_oldSelfDefinedTypes.count() ) {
+                    m_oldSelfDefinedTypes.append( i18n( "User defined word type %1", m_oldSelfDefinedTypes.count() - 1 ) );
                 }
             }
-            type = m_oldSelfDefinedTypes.value(selfDefinedTypeIndex);
+            type = m_oldSelfDefinedTypes.value( selfDefinedTypeIndex );
         } else {
-            type = m_compability.mainTypeFromOldFormat(oldType);
-            subType = m_compability.subTypeFromOldFormat(oldType);
+            type = m_compability.mainTypeFromOldFormat( oldType );
+            subType = m_compability.subTypeFromOldFormat( oldType );
         } // not user defined - preset types
     }
 
-  pronunciation = "";
-  attribute = domElementExpressionChild.attributeNode(KV_PRONUNCE);
-  if (!attribute.isNull())
-    pronunciation = attribute.value();
+    pronunciation = "";
+    attribute = domElementExpressionChild.attributeNode( KV_PRONUNCE );
+    if ( !attribute.isNull() )
+        pronunciation = attribute.value();
 
-  query_id = "";
-  attribute = domElementExpressionChild.attributeNode(KV_QUERY);
-  if (!attribute.isNull())
-    query_id = attribute.value();
+    query_id = "";
+    attribute = domElementExpressionChild.attributeNode( KV_QUERY );
+    if ( !attribute.isNull() )
+        query_id = attribute.value();
 
-  return true;
+    return true;
 }
 
 
-bool KEduVocKvtmlReader::readExpression(QDomElement &domElementParent)
+bool KEduVocKvtmlReader::readExpression( QDomElement &domElementParent )
 {
-  grade_t                   grade;
-  grade_t                   r_grade;
-  int                       qcount;
-  int                       r_qcount;
-  int                       bcount;
-  int                       r_bcount;
-  QString                   remark;
-  QString                   pronunciation;
-  QDateTime                 qdate;
-  QDateTime                 r_qdate;
-  bool                      inquery;
-  bool                      active;
-  QString                   lang;
-  QString                   textstr;
-  QString                   q_org;
-  QString                   q_trans;
-  QString                   query_id;
-  int                       lesson = 0;
-  int                       width;
-  QString                   type;
-  QString                   subType;
-  QString                   faux_ami_f;
-  QString                   faux_ami_t;
-  QString                   synonym;
-  QString                   example;
-  QString                   antonym;
-  QSet<QString>             usage;
-  QString                   paraphrase;
-  QList<KEduVocConjugation> conjug;
-  KEduVocComparison         comparison;
-  KEduVocMultipleChoice     mc;
-  KEduVocExpression         expr;
-
-  QDomAttr                  attribute;
-  QDomElement               currentElement;
-  QDomElement               currentChild;
-
-  //-------------------------------------------------------------------------
-  // Attributes
-  //-------------------------------------------------------------------------
-
-  attribute = domElementParent.attributeNode(KV_LESS_MEMBER);
-  if (!attribute.isNull())
-  {
-    lesson = attribute.value().toInt();
-  }
-
-  if (lesson && lesson > m_doc->lessonCount())
-  {
-    // 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;
-  else
-    inquery = false;
-
-  attribute = domElementParent.attributeNode(KV_INACTIVE);
-  if (!attribute.isNull())
-    active = attribute.value() == "1" ? false : true;
-  else
-    active = true;
+    grade_t                   grade;
+    grade_t                   r_grade;
+    int                       qcount;
+    int                       r_qcount;
+    int                       bcount;
+    int                       r_bcount;
+    QString                   remark;
+    QString                   pronunciation;
+    QDateTime                 qdate;
+    QDateTime                 r_qdate;
+    bool                      inquery;
+    bool                      active;
+    QString                   lang;
+    QString                   textstr;
+    QString                   q_org;
+    QString                   q_trans;
+    QString                   query_id;
+    int                       lesson = 0;
+    int                       width;
+    QString                   type;
+    QString                   subType;
+    QString                   faux_ami_f;
+    QString                   faux_ami_t;
+    QString                   synonym;
+    QString                   example;
+    QString                   antonym;
+    QSet<QString>             usage;
+    QString                   paraphrase;
+    QList<KEduVocConjugation> conjug;
+    KEduVocComparison         comparison;
+    KEduVocMultipleChoice     mc;
+    KEduVocExpression         expr;
+
+    QDomAttr                  attribute;
+    QDomElement               currentElement;
+    QDomElement               currentChild;
+
+    //-------------------------------------------------------------------------
+    // Attributes
+    //-------------------------------------------------------------------------
+
+    attribute = domElementParent.attributeNode( KV_LESS_MEMBER );
+    if ( !attribute.isNull() ) {
+        lesson = attribute.value().toInt();
+    }
+
+    if ( lesson && lesson > m_doc->lessonCount() ) {
+        // 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;
+    else
+        inquery = false;
+
+    attribute = domElementParent.attributeNode( KV_INACTIVE );
+    if ( !attribute.isNull() )
+        active = attribute.value() == "1" ? false : true;
+    else
+        active = true;
 
     // this is all done by reference - so we have to care about "type" :(
-    attribute = domElementParent.attributeNode(KV_EXPRTYPE);
-    if (!attribute.isNull())
-    {
+    attribute = domElementParent.attributeNode( KV_EXPRTYPE );
+    if ( !attribute.isNull() ) {
         QString oldType = attribute.value();
 
-        if (oldType.length() >= 2 && type.left(1) == QM_USER_TYPE)
-        {
+        if ( oldType.length() >= 2 && type.left( 1 ) == QM_USER_TYPE ) {
             // they started counting at 1
-            int selfDefinedTypeIndex = oldType.right(type.count()-1).toInt() -1;
+            int selfDefinedTypeIndex = oldType.right( type.count()-1 ).toInt() -1;
             // append invented types (do we not trust our own writer?)
-            if ( selfDefinedTypeIndex >= m_oldSelfDefinedTypes.count() )
-            {
-                while (selfDefinedTypeIndex >= m_oldSelfDefinedTypes.count()) {
-                    m_oldSelfDefinedTypes.append( i18n("User defined word type %1", m_oldSelfDefinedTypes.count() - 1) );
+            if ( selfDefinedTypeIndex >= m_oldSelfDefinedTypes.count() ) {
+                while ( selfDefinedTypeIndex >= m_oldSelfDefinedTypes.count() ) {
+                    m_oldSelfDefinedTypes.append( i18n( "User defined word type %1", m_oldSelfDefinedTypes.count() - 1 ) );
                 }
             }
-            type = m_oldSelfDefinedTypes.value(selfDefinedTypeIndex);
+            type = m_oldSelfDefinedTypes.value( selfDefinedTypeIndex );
         } else {
-            type = m_compability.mainTypeFromOldFormat(oldType);
-            subType = m_compability.subTypeFromOldFormat(oldType);
+            type = m_compability.mainTypeFromOldFormat( oldType );
+            subType = m_compability.subTypeFromOldFormat( oldType );
         } // not user defined - preset types
     }
 
 
-  //-------------------------------------------------------------------------
-  // Children 'Translation'
-  //-------------------------------------------------------------------------
+    //-------------------------------------------------------------------------
+    // Children 'Translation'
+    //-------------------------------------------------------------------------
 
-  //QDomNodeList translationList = domElementParent.elementsByTagName(KV_TRANS);
+    //QDomNodeList translationList = domElementParent.elementsByTagName(KV_TRANS);
 
     // count which translation we are on
     int i=0;
 
     // kvtml 1: we always have an original element (required)
-    currentElement = domElementParent.firstChildElement(KV_ORG);
-    if (currentElement.isNull()) { // sanity check
-        m_errorMessage = i18n("Data for original language missing");
+    currentElement = domElementParent.firstChildElement( KV_ORG );
+    if ( currentElement.isNull() ) { // sanity check
+        m_errorMessage = i18n( "Data for original language missing" );
         return false;
     }
 
-    while (!currentElement.isNull()) {
+    while ( !currentElement.isNull() ) {
 
-      //-----------
-      // Attributes
-      //-----------
+        //-----------
+        // Attributes
+        //-----------
 
-      // read attributes - the order of the query grades is interchanged!
-      if (i == 0 && !readExpressionChildAttributes( currentElement, lang, grade, r_grade, qcount, r_qcount, qdate, r_qdate, remark, bcount, r_bcount, query_id,
-                                          pronunciation, width, type, subType, faux_ami_t, faux_ami_f, synonym, example, antonym, usage, paraphrase))
-        return false;
+        // read attributes - the order of the query grades is interchanged!
+        if ( i == 0 && !readExpressionChildAttributes( currentElement, lang, grade, r_grade, qcount, r_qcount, qdate, r_qdate, remark, bcount, r_bcount, query_id,
+                pronunciation, width, type, subType, faux_ami_t, faux_ami_f, synonym, example, antonym, usage, paraphrase ) )
+            return false;
 
-      if (i != 0 && !readExpressionChildAttributes( currentElement, lang, grade, r_grade, qcount, r_qcount, qdate, r_qdate, remark, bcount, r_bcount, query_id,
-                                          pronunciation, width, type, subType, faux_ami_f, faux_ami_t, synonym, example, antonym, usage, paraphrase))
-        return false;
+        if ( i != 0 && !readExpressionChildAttributes( currentElement, lang, grade, r_grade, qcount, r_qcount, qdate, r_qdate, remark, bcount, r_bcount, query_id,
+                pronunciation, width, type, subType, faux_ami_f, faux_ami_t, synonym, example, antonym, usage, paraphrase ) )
+            return false;
 
-      if (m_doc->entryCount() == 0)
-      {
-        // only accept in first entry
-        if (width >= 0)
-          m_doc->setSizeHint(i, width);
+        if ( m_doc->entryCount() == 0 ) {
+            // only accept in first entry
+            if ( width >= 0 )
+                m_doc->setSizeHint( i, width );
 
-        if (query_id == KV_O)
-          q_org = lang;
+            if ( query_id == KV_O )
+                q_org = lang;
 
-        if (query_id == KV_T)
+            if ( query_id == KV_T )
 
-          q_trans = lang;
-      }
+                q_trans = lang;
+        }
 //kDebug() << " TranslationList.count(): " << translationList.count() << "  Entry count: " << m_doc->entryCount();
-        if (m_doc->entryCount() == 0) { // this is because in kvtml the languages are saved in the FIRST ENTRY ONLY.
+        if ( m_doc->entryCount() == 0 ) { // this is because in kvtml the languages are saved in the FIRST ENTRY ONLY.
 //kDebug() << " Read Expression with identifiers: " << lang;
             // new translation
-            if (lang.isEmpty()) {
-                if (i == 0) {
+            if ( lang.isEmpty() ) {
+                if ( i == 0 ) {
                     lang = "original";
                 } else {
                     // no definition in first entry ?
-                    lang.setNum(m_doc->identifierCount());
-                    lang.prepend("translation ");
+                    lang.setNum( m_doc->identifierCount() );
+                    lang.prepend( "translation " );
                 }
 
             }
-            if (m_doc->identifierCount() <= i)
-              m_doc->appendIdentifier(lang);
-        }
-        else
-        {
-            if (lang != m_doc->identifier(i) && !lang.isEmpty())
-            {
-            // different language ?
-            m_errorMessage = i18n("ambiguous definition of language code");
-            return false;
+            if ( m_doc->identifierCount() <= i )
+                m_doc->appendIdentifier( lang );
+        } else {
+            if ( lang != m_doc->identifier( i ) && !lang.isEmpty() ) {
+                // different language ?
+                m_errorMessage = i18n( "ambiguous definition of language code" );
+                return false;
             }
         }
 
-      //---------
-      // Children
+        //---------
+        // Children
 
-      currentChild = currentElement.firstChildElement(KV_CONJUG_GRP);
-      if (!currentChild.isNull()) {
-          conjug.clear();
-          if (!readConjug(currentChild, conjug))
-            return false;
-      }
+        currentChild = currentElement.firstChildElement( KV_CONJUG_GRP );
+        if ( !currentChild.isNull() ) {
+            conjug.clear();
+            if ( !readConjug( currentChild, conjug ) )
+                return false;
+        }
 
-      currentChild = currentElement.firstChildElement(KV_COMPARISON_GRP);
-      if (!currentChild.isNull()) {
-          comparison.clear();
-          if (!readComparison(currentChild, comparison))
-            return false;
-      }
+        currentChild = currentElement.firstChildElement( KV_COMPARISON_GRP );
+        if ( !currentChild.isNull() ) {
+            comparison.clear();
+            if ( !readComparison( currentChild, comparison ) )
+                return false;
+        }
 
-      currentChild = currentElement.firstChildElement(KV_MULTIPLECHOICE_GRP);
-      if (!currentChild.isNull()) {
-          mc.clear();
-          if (!readMultipleChoice(currentChild, mc))
-            return false;
-      }
-
-      textstr = currentElement.lastChild().toText().data();
-      if (textstr.isNull())
-        textstr = "";
-
-      if (i == 0) {
-                 expr = KEduVocExpression(textstr);
-                 expr.setLesson(lesson);
-                 expr.setInQuery(inquery);
-                 expr.setActive(active);
-         } else {
-                 expr.setTranslation(i, textstr);
-         }
-
-      if (conjug.size() > 0) {
-        for ( int conjugationIndex = 0; conjugationIndex < conjug.size(); conjugationIndex++ ) {
-            expr.translation(i).setConjugation(conjug[conjugationIndex]);
+        currentChild = currentElement.firstChildElement( KV_MULTIPLECHOICE_GRP );
+        if ( !currentChild.isNull() ) {
+            mc.clear();
+            if ( !readMultipleChoice( currentChild, mc ) )
+                return false;
+        }
+
+        textstr = currentElement.lastChild().toText().data();
+        if ( textstr.isNull() )
+            textstr = "";
+
+        if ( i == 0 ) {
+            expr = KEduVocExpression( textstr );
+            expr.setLesson( lesson );
+            expr.setInQuery( inquery );
+            expr.setActive( active );
+        } else {
+            expr.setTranslation( i, textstr );
+        }
+
+        if ( conjug.size() > 0 ) {
+            for ( int conjugationIndex = 0; conjugationIndex < conjug.size(); conjugationIndex++ ) {
+                expr.translation( i ).setConjugation( conjug[conjugationIndex] );
+            }
+            //expr.setConjugation(i, conjug[0]); ///@todo check if this is better than the above!
+
+            conjug.clear();
         }
-        //expr.setConjugation(i, conjug[0]); ///@todo check if this is better than the above!
-
-        conjug.clear();
-      }
-      if (!comparison.isEmpty())
-      {
-        expr.translation(i).setComparison(comparison);
-        comparison.clear();
-      }
-      if (!mc.isEmpty())
-      {
-        expr.translation(i).setMultipleChoice(mc);
-        mc.clear();
-      }
-
-      if (!type.isEmpty()) {
-        expr.translation(i).setType(type);
-        if (!subType.isEmpty()) {
-            expr.translation(i).setSubType(subType);
+        if ( !comparison.isEmpty() ) {
+            expr.translation( i ).setComparison( comparison );
+            comparison.clear();
         }
-      }
-
-      if (!remark.isEmpty() )
-        expr.translation(i).setComment (remark);
-      if (!pronunciation.isEmpty() )
-        expr.translation(i).setPronunciation(pronunciation);
-      if (!faux_ami_f.isEmpty() )
-        expr.translation(i).setFalseFriend (0, faux_ami_f);
-      if (!faux_ami_t.isEmpty() )
-        expr.translation(0).setFalseFriend (i, faux_ami_t);
-      if (!synonym.isEmpty() )
-        expr.translation(i).setSynonym (synonym);
-      if (!example.isEmpty() )
-        expr.translation(i).setExample (example);
-      if (!usage.isEmpty() )
-        expr.translation(i).setUsages (usage);
-      if (!paraphrase.isEmpty() )
-        expr.translation(i).setParaphrase (paraphrase);
-      if (!antonym.isEmpty() )
-        expr.translation(i).setAntonym (antonym);
-
-      if ( i != 0 ) {
-               expr.translation(i).gradeFrom(0).setGrade(grade);
-               expr.translation(0).gradeFrom(i).setGrade(r_grade);
-        expr.translation(i).gradeFrom(0).setQueryCount(qcount);
-        expr.translation(0).gradeFrom(i).setQueryCount(r_qcount);
-        expr.translation(i).gradeFrom(0).setBadCount(bcount);
-        expr.translation(0).gradeFrom(i).setBadCount(r_bcount);
-        expr.translation(i).gradeFrom(0).setQueryDate(qdate);
-        expr.translation(0).gradeFrom(i).setQueryDate(r_qdate);
-      }
-
-      // Next translation
-      currentElement = currentElement.nextSiblingElement(KV_TRANS);
-      i++;
-  }
-
-  if (m_doc->entryCount() == 0)
-    m_doc->setQueryIdentifier(q_org, q_trans);
-  m_doc->appendEntry(&expr);
-
-  // also add this entryid to the lesson it's part of
-  if (m_doc->lesson(lesson) != NULL)
-  {
-       m_doc->lesson(lesson)->addEntry(m_doc->entryCount());
-  }
-
-  return true;
+        if ( !mc.isEmpty() ) {
+            expr.translation( i ).setMultipleChoice( mc );
+            mc.clear();
+        }
+
+        if ( !type.isEmpty() ) {
+            expr.translation( i ).setType( type );
+            if ( !subType.isEmpty() ) {
+                expr.translation( i ).setSubType( subType );
+            }
+        }
+
+        if ( !remark.isEmpty() )
+            expr.translation( i ).setComment( remark );
+        if ( !pronunciation.isEmpty() )
+            expr.translation( i ).setPronunciation( pronunciation );
+        if ( !faux_ami_f.isEmpty() )
+            expr.translation( i ).setFalseFriend( 0, faux_ami_f );
+        if ( !faux_ami_t.isEmpty() )
+            expr.translation( 0 ).setFalseFriend( i, faux_ami_t );
+        if ( !synonym.isEmpty() )
+            expr.translation( i ).setSynonym( synonym );
+        if ( !example.isEmpty() )
+            expr.translation( i ).setExample( example );
+        if ( !usage.isEmpty() )
+            expr.translation( i ).setUsages( usage );
+        if ( !paraphrase.isEmpty() )
+            expr.translation( i ).setParaphrase( paraphrase );
+        if ( !antonym.isEmpty() )
+            expr.translation( i ).setAntonym( antonym );
+
+        if ( i != 0 ) {
+            expr.translation( i ).gradeFrom( 0 ).setGrade( grade );
+            expr.translation( 0 ).gradeFrom( i ).setGrade( r_grade );
+            expr.translation( i ).gradeFrom( 0 ).setQueryCount( qcount );
+            expr.translation( 0 ).gradeFrom( i ).setQueryCount( r_qcount );
+            expr.translation( i ).gradeFrom( 0 ).setBadCount( bcount );
+            expr.translation( 0 ).gradeFrom( i ).setBadCount( r_bcount );
+            expr.translation( i ).gradeFrom( 0 ).setQueryDate( qdate );
+            expr.translation( 0 ).gradeFrom( i ).setQueryDate( r_qdate );
+        }
+
+        // Next translation
+        currentElement = currentElement.nextSiblingElement( KV_TRANS );
+        i++;
+    }
+
+    if ( m_doc->entryCount() == 0 )
+        m_doc->setQueryIdentifier( q_org, q_trans );
+    m_doc->appendEntry( &expr );
+
+    // also add this entryid to the lesson it's part of
+    if ( m_doc->lesson( lesson ) != NULL ) {
+        m_doc->lesson( lesson )->addEntry( m_doc->entryCount() );
+    }
+
+    return true;
 }
 
 #include "keduvockvtmlreader.moc"
index 3a7f67bb4ec0098472ee84b2ba0cede12ed76c74..4970cf5e5d831fbf6bc3ee3f7a0589269a8dd420 100644 (file)
@@ -39,54 +39,57 @@ class KEduVocDocument;
 */
 class KEduVocKvtmlReader : public QObject
 {
-  Q_OBJECT
+    Q_OBJECT
 public:
-  KEduVocKvtmlReader(QIODevice *file);
+    KEduVocKvtmlReader( QIODevice *file );
 
-  bool readDoc(KEduVocDocument *doc);
+    bool readDoc( KEduVocDocument *doc );
 
-  bool readLesson(QDomElement &domElementParent);
-  bool readArticle(QDomElement &domElementParent);
-  bool readConjug(QDomElement &domElementParent, QList<KEduVocConjugation> &curr_conjug);
-  bool readOptions(QDomElement &domElementParent);
-  bool readType(QDomElement &domElementParent);
-  bool readTense(QDomElement &domElementParent);
-  bool readUsage(QDomElement &domElementParent);
-  bool readComparison(QDomElement &domElementParent, KEduVocComparison &comp);
-  bool readMultipleChoice(QDomElement &domElementParent, KEduVocMultipleChoice &mc);
-  bool readExpressionChildAttributes(QDomElement &domElementExpressionChild,
-                                     QString &lang,
-                                     grade_t &grade, grade_t &rev_grade,
-                                     int &count, int &rev_count,
-                                     QDateTime &date, QDateTime &rev_date,
-                                     QString &remark,
-                                     int &bcount, int &rev_bcount,
-                                     QString &query_id,
-                                     QString &pronunciation,
-                                     int &width,
-                                     QString &type,
-                                     QString &subType,
-                                     QString &faux_ami_f,
-                                     QString &faux_ami_t,
-                                     QString &synonym,
-                                     QString &example,
-                                     QString &antonym,
-                                     QSet<QString> &usage,
-                                     QString &paraphrase);
-  bool readExpression(QDomElement &domElementParent);
-  bool readBody(QDomElement &domElementParent);
+    bool readLesson( QDomElement &domElementParent );
+    bool readArticle( QDomElement &domElementParent );
+    bool readConjug( QDomElement &domElementParent, QList<KEduVocConjugation> &curr_conjug );
+    bool readOptions( QDomElement &domElementParent );
+    bool readType( QDomElement &domElementParent );
+    bool readTense( QDomElement &domElementParent );
+    bool readUsage( QDomElement &domElementParent );
+    bool readComparison( QDomElement &domElementParent, KEduVocComparison &comp );
+    bool readMultipleChoice( QDomElement &domElementParent, KEduVocMultipleChoice &mc );
+    bool readExpressionChildAttributes( QDomElement &domElementExpressionChild,
+                                        QString &lang,
+                                        grade_t &grade, grade_t &rev_grade,
+                                        int &count, int &rev_count,
+                                        QDateTime &date, QDateTime &rev_date,
+                                        QString &remark,
+                                        int &bcount, int &rev_bcount,
+                                        QString &query_id,
+                                        QString &pronunciation,
+                                        int &width,
+                                        QString &type,
+                                        QString &subType,
+                                        QString &faux_ami_f,
+                                        QString &faux_ami_t,
+                                        QString &synonym,
+                                        QString &example,
+                                        QString &antonym,
+                                        QSet<QString> &usage,
+                                        QString &paraphrase );
+    bool readExpression( QDomElement &domElementParent );
+    bool readBody( QDomElement &domElementParent );
 
-  QString errorMessage() const {return m_errorMessage;}
+    QString errorMessage() const
+    {
+        return m_errorMessage;
+    }
 
 private:
-  QIODevice *m_inputFile;
-  KEduVocDocument *m_doc;
-  QString m_errorMessage;
-  int m_cols;
-  int m_lines;
-  QStringList m_oldSelfDefinedTypes;
+    QIODevice *m_inputFile;
+    KEduVocDocument *m_doc;
+    QString m_errorMessage;
+    int m_cols;
+    int m_lines;
+    QStringList m_oldSelfDefinedTypes;
 
-  KEduVocKvtmlCompability m_compability;
+    KEduVocKvtmlCompability m_compability;
 };
 
 #endif
index d893c1bb7bb1811680c57cf607004a258e25a3ce..10c58014e5ee25a7b589c5bef342560835a36140 100644 (file)
 #include "kvtmldefs.h"
 #include "keduvoccommon_p.h"
 
-KEduVocKvtmlWriter::KEduVocKvtmlWriter(QFile *file)
+KEduVocKvtmlWriter::KEduVocKvtmlWriter( QFile *file )
 {
-  // the file must be already open
-  m_outputFile = file;
+    // the file must be already open
+    m_outputFile = file;
 }
 
 
-bool KEduVocKvtmlWriter::writeDoc(KEduVocDocument *doc, const QString &generator)
+bool KEduVocKvtmlWriter::writeDoc( KEduVocDocument *doc, const QString &generator )
 {
-  bool first_expr = true;
+    bool first_expr = true;
 
-  m_doc = doc;
+    m_doc = doc;
 
-  QDomDocument domDoc("kvtml SYSTEM \"kvoctrain.dtd\"");
-  domDoc.appendChild(domDoc.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""));
-  QDomElement domElementKvtml = domDoc.createElement("kvtml");
-  domDoc.appendChild(domElementKvtml);
+    QDomDocument domDoc( "kvtml SYSTEM \"kvoctrain.dtd\"" );
+    domDoc.appendChild( domDoc.createProcessingInstruction( "xml", "version=\"1.0\" encoding=\"UTF-8\"" ) );
+    QDomElement domElementKvtml = domDoc.createElement( "kvtml" );
+    domDoc.appendChild( domElementKvtml );
 
-  domElementKvtml.setAttribute(KV_ENCODING, (QString) "UTF-8");
-  domElementKvtml.setAttribute(KV_GENERATOR, generator);
-  domElementKvtml.setAttribute(KV_COLS, m_doc->identifierCount());
-  domElementKvtml.setAttribute(KV_LINES, m_doc->entryCount());
+    domElementKvtml.setAttribute( KV_ENCODING, ( QString ) "UTF-8" );
+    domElementKvtml.setAttribute( KV_GENERATOR, generator );
+    domElementKvtml.setAttribute( KV_COLS, m_doc->identifierCount() );
+    domElementKvtml.setAttribute( KV_LINES, m_doc->entryCount() );
 
-  if (!m_doc->title().isEmpty())
-    domElementKvtml.setAttribute(KV_TITLE, m_doc->title());
+    if ( !m_doc->title().isEmpty() )
+        domElementKvtml.setAttribute( KV_TITLE, m_doc->title() );
 
-  if (!m_doc->author().isEmpty())
-    domElementKvtml.setAttribute(KV_AUTHOR, m_doc->author());
+    if ( !m_doc->author().isEmpty() )
+        domElementKvtml.setAttribute( KV_AUTHOR, m_doc->author() );
 
-  if (!m_doc->license().isEmpty())
-    domElementKvtml.setAttribute(KV_LICENSE, m_doc->license());
+    if ( !m_doc->license().isEmpty() )
+        domElementKvtml.setAttribute( KV_LICENSE, m_doc->license() );
 
-  if (!m_doc->documentRemark().isEmpty())
-    domElementKvtml.setAttribute(KV_DOC_REM, m_doc->documentRemark());
+    if ( !m_doc->documentRemark().isEmpty() )
+        domElementKvtml.setAttribute( KV_DOC_REM, m_doc->documentRemark() );
 
-  if (!writeLesson(domDoc, domElementKvtml))
-    return false;
-
-  if (!writeArticle(domDoc, domElementKvtml))
-    return false;
+    if ( !writeLesson( domDoc, domElementKvtml ) )
+        return false;
 
-  QList<KEduVocConjugation> conjugations;
-  for (int i = 0; i < m_doc->conjugationCount(); i++)
-    conjugations.append(m_doc->conjugation(i));
-  if (conjugations.count() > 0) {
-    if (!writeConjugHeader(domDoc, domElementKvtml, conjugations))
-      return false;
-  }
+    if ( !writeArticle( domDoc, domElementKvtml ) )
+        return false;
 
-  if (!writeType(domDoc, domElementKvtml))
-    return false;
+    QList<KEduVocConjugation> conjugations;
+    for ( int i = 0; i < m_doc->conjugationCount(); i++ )
+        conjugations.append( m_doc->conjugation( i ) );
+    if ( conjugations.count() > 0 ) {
+        if ( !writeConjugHeader( domDoc, domElementKvtml, conjugations ) )
+            return false;
+    }
 
-  if (!writeTense(domDoc, domElementKvtml))
-    return false;
+    if ( !writeType( domDoc, domElementKvtml ) )
+        return false;
 
-  if (!writeUsage(domDoc, domElementKvtml))
-    return false;
+    if ( !writeTense( domDoc, domElementKvtml ) )
+        return false;
 
-  QString q_org, q_trans;
-  m_doc->queryIdentifier(q_org, q_trans);
+    if ( !writeUsage( domDoc, domElementKvtml ) )
+        return false;
 
-  int entryCount = m_doc->entryCount();
+    QString q_org, q_trans;
+    m_doc->queryIdentifier( q_org, q_trans );
 
-  for (int i = 0; i < entryCount; i++)
-  {
-    KEduVocExpression *entry = m_doc->entry(i);
-    QDomElement domElementExpression = domDoc.createElement(KV_EXPR);
+    int entryCount = m_doc->entryCount();
 
-    if (entry->lesson() != 0)
-    {
-      int lm = entry->lesson();
-      if (lm > m_doc->lessonCount())
-      {
-        // should not be
-        kError() << "index of lesson member too high: " << lm << endl;
-        lm = 0;
-      }
-      domElementExpression.setAttribute(KV_LESS_MEMBER, lm);
-    }
+    for ( int i = 0; i < entryCount; i++ ) {
+        KEduVocExpression *entry = m_doc->entry( i );
+        QDomElement domElementExpression = domDoc.createElement( KV_EXPR );
 
-    if (entry->isInQuery())
-      domElementExpression.setAttribute(KV_SELECTED, 1);
-
-    if (!entry->isActive())
-      domElementExpression.setAttribute (KV_INACTIVE, 1);
+        if ( entry->lesson() != 0 ) {
+            int lm = entry->lesson();
+            if ( lm > m_doc->lessonCount() ) {
+                // should not be
+                kError() << "index of lesson member too high: " << lm << endl;
+                lm = 0;
+            }
+            domElementExpression.setAttribute( KV_LESS_MEMBER, lm );
+        }
 
-    QDomElement domElementOriginal = domDoc.createElement(KV_ORG);
-    if (first_expr)
-    {
-      // save space, only tell language in first entry
-      QString s;
-      domElementOriginal.setAttribute(KV_SIZEHINT, m_doc->sizeHint(0));
-
-      s = m_doc->identifier(0).simplified();
-      if (s.isEmpty() )
-        s = "original";
-      domElementOriginal.setAttribute(KV_LANG, s);
-      if (s == q_org)
-        domElementOriginal.setAttribute(KV_QUERY, (QString) KV_O);
-      else if (s == q_trans)
-        domElementOriginal.setAttribute(KV_QUERY, (QString) KV_T);
-    }
+        if ( entry->isInQuery() )
+            domElementExpression.setAttribute( KV_SELECTED, 1 );
+
+        if ( !entry->isActive() )
+            domElementExpression.setAttribute( KV_INACTIVE, 1 );
+
+        QDomElement domElementOriginal = domDoc.createElement( KV_ORG );
+        if ( first_expr ) {
+            // save space, only tell language in first entry
+            QString s;
+            domElementOriginal.setAttribute( KV_SIZEHINT, m_doc->sizeHint( 0 ) );
+
+            s = m_doc->identifier( 0 ).simplified();
+            if ( s.isEmpty() )
+                s = "original";
+            domElementOriginal.setAttribute( KV_LANG, s );
+            if ( s == q_org )
+                domElementOriginal.setAttribute( KV_QUERY, ( QString ) KV_O );
+            else if ( s == q_trans )
+                domElementOriginal.setAttribute( KV_QUERY, ( QString ) KV_T );
+        }
 
-    if (!entry->translation(0).comment().isEmpty() )
-      domElementOriginal.setAttribute(KV_REMARK, entry->translation(0).comment());
+        if ( !entry->translation( 0 ).comment().isEmpty() )
+            domElementOriginal.setAttribute( KV_REMARK, entry->translation( 0 ).comment() );
 
-    if (!entry->translation(0).synonym().isEmpty() )
-      domElementOriginal.setAttribute(KV_SYNONYM, entry->translation(0).synonym());
+        if ( !entry->translation( 0 ).synonym().isEmpty() )
+            domElementOriginal.setAttribute( KV_SYNONYM, entry->translation( 0 ).synonym() );
 
-    if (!entry->translation(0).example().isEmpty() )
-      domElementOriginal.setAttribute(KV_EXAMPLE, entry->translation(0).example());
+        if ( !entry->translation( 0 ).example().isEmpty() )
+            domElementOriginal.setAttribute( KV_EXAMPLE, entry->translation( 0 ).example() );
 ///@todo enable writing of usages
-/*
-    if (!entry->translation(0).usageLabel().isEmpty() )
-      domElementOriginal.setAttribute(KV_USAGE, entry->translation(0).usageLabel());
-*/
-    if (!entry->translation(0).paraphrase().isEmpty() )
-      domElementOriginal.setAttribute(KV_PARAPHRASE, entry->translation(0).paraphrase());
+        /*
+            if (!entry->translation(0).usageLabel().isEmpty() )
+              domElementOriginal.setAttribute(KV_USAGE, entry->translation(0).usageLabel());
+        */
+        if ( !entry->translation( 0 ).paraphrase().isEmpty() )
+            domElementOriginal.setAttribute( KV_PARAPHRASE, entry->translation( 0 ).paraphrase() );
 
-    if (!entry->translation(0).antonym().isEmpty() )
-      domElementOriginal.setAttribute(KV_ANTONYM, entry->translation(0).antonym());
+        if ( !entry->translation( 0 ).antonym().isEmpty() )
+            domElementOriginal.setAttribute( KV_ANTONYM, entry->translation( 0 ).antonym() );
 
-    if (!entry->translation(0).pronunciation().isEmpty() )
-      domElementOriginal.setAttribute(KV_PRONUNCE, entry->translation(0).pronunciation());
+        if ( !entry->translation( 0 ).pronunciation().isEmpty() )
+            domElementOriginal.setAttribute( KV_PRONUNCE, entry->translation( 0 ).pronunciation() );
 
-    if (!entry->translation(0).type().isEmpty())
-      domElementOriginal.setAttribute(KV_EXPRTYPE, m_compability.oldType(entry->translation(0).type(), entry->translation(0).subType()));
+        if ( !entry->translation( 0 ).type().isEmpty() )
+            domElementOriginal.setAttribute( KV_EXPRTYPE, m_compability.oldType( entry->translation( 0 ).type(), entry->translation( 0 ).subType() ) );
 
-    if (!writeMultipleChoice(domDoc, domElementOriginal, entry->translation(0).multipleChoice()))
-      return false;
+        if ( !writeMultipleChoice( domDoc, domElementOriginal, entry->translation( 0 ).multipleChoice() ) )
+            return false;
 
-    QString s;
-    QString entype = s = entry->translation(0).type();
-    int pos = s.indexOf(QM_TYPE_DIV);
-    if (pos >= 0)
-      entype = s.left(pos);
-    else
-      entype = s;
-
-    if (entype == QM_VERB && entry->translation(0).conjugation().entryCount() > 0)
-    {
-      KEduVocConjugation conj = entry->translation(0).conjugation();
-      if (!writeConjugEntry(domDoc, domElementOriginal, conj))
-        return false;
-    }
-    else if (entype == QM_ADJ && !entry->translation(0).comparison().isEmpty())
-    {
-      KEduVocComparison comp = entry->translation(0).comparison();
-      if (!writeComparison(domDoc, domElementOriginal, comp))
-        return false;
-    }
-
-    QDomText domTextOriginal = domDoc.createTextNode(entry->translation(0).text());
-    domElementOriginal.appendChild(domTextOriginal);
-    domElementExpression.appendChild(domElementOriginal);
-
-    int trans = 1;
-    while (trans < m_doc->identifierCount())
-    {
-      QDomElement domElementTranslation = domDoc.createElement(KV_TRANS);
-      if (first_expr)
-      {
-        // save space, only tell language in first entry
         QString s;
-        domElementTranslation.setAttribute(KV_SIZEHINT, m_doc->sizeHint(trans));
-
-        s = m_doc->identifier(trans).simplified();
-        if (s.isEmpty() )
-        {
-          s.setNum(trans);
-          s.prepend("translation ");
+        QString entype = s = entry->translation( 0 ).type();
+        int pos = s.indexOf( QM_TYPE_DIV );
+        if ( pos >= 0 )
+            entype = s.left( pos );
+        else
+            entype = s;
+
+        if ( entype == QM_VERB && entry->translation( 0 ).conjugation().entryCount() > 0 ) {
+            KEduVocConjugation conj = entry->translation( 0 ).conjugation();
+            if ( !writeConjugEntry( domDoc, domElementOriginal, conj ) )
+                return false;
+        } else if ( entype == QM_ADJ && !entry->translation( 0 ).comparison().isEmpty() ) {
+            KEduVocComparison comp = entry->translation( 0 ).comparison();
+            if ( !writeComparison( domDoc, domElementOriginal, comp ) )
+                return false;
         }
-        domElementTranslation.setAttribute(KV_LANG, s);
-        if (s == q_org)
-          domElementTranslation.setAttribute(KV_QUERY, (QString) KV_O);
-        else if (s == q_trans)
-          domElementTranslation.setAttribute(KV_QUERY, (QString) KV_T);
-      }
-
-      if (entry->translation(trans).gradeFrom(0).grade() != 0 || entry->translation(0).gradeFrom(trans).grade() != 0)
-        domElementTranslation.setAttribute(KV_GRADE, QString::number(entry->translation(trans).gradeFrom(0).grade()) + ';' + QString::number(entry->translation(0).gradeFrom(trans).grade()));
-
-      if (entry->translation(trans).gradeFrom(0).queryCount() != 0 || entry->translation(0).gradeFrom(trans).queryCount() != 0)
-        domElementTranslation.setAttribute(KV_COUNT, QString::number(entry->translation(trans).gradeFrom(0).queryCount()) + ';' + QString::number(entry->translation(0).gradeFrom(trans).queryCount()));
-
-      if (entry->translation(trans).gradeFrom(0).badCount() != 0 || entry->translation(0).gradeFrom(trans).badCount() != 0)
-        domElementTranslation.setAttribute(KV_BAD, QString::number(entry->translation(trans).gradeFrom(0).badCount()) + ';' + QString::number(entry->translation(0).gradeFrom(trans).badCount()));
-
-      if (entry->translation(trans).gradeFrom(0).queryDate().toTime_t() != 0 || entry->translation(0).gradeFrom(trans).queryDate().toTime_t() != 0)
-        domElementTranslation.setAttribute(KV_DATE, QString::number(entry->translation(trans).gradeFrom(0).queryDate().toTime_t()) + ';' + QString::number(entry->translation(0).gradeFrom(trans).queryDate().toTime_t()));
 
-      if (!entry->translation(trans).comment().isEmpty() )
-        domElementTranslation.setAttribute(KV_REMARK, entry->translation(trans).comment());
+        QDomText domTextOriginal = domDoc.createTextNode( entry->translation( 0 ).text() );
+        domElementOriginal.appendChild( domTextOriginal );
+        domElementExpression.appendChild( domElementOriginal );
 
-      if (!entry->translation(trans).falseFriend(0).isEmpty() )
-        domElementTranslation.setAttribute(KV_FAUX_AMI_F, entry->translation(trans).falseFriend(0));
+        int trans = 1;
+        while ( trans < m_doc->identifierCount() ) {
+            QDomElement domElementTranslation = domDoc.createElement( KV_TRANS );
+            if ( first_expr ) {
+                // save space, only tell language in first entry
+                QString s;
+                domElementTranslation.setAttribute( KV_SIZEHINT, m_doc->sizeHint( trans ) );
 
-      if (!entry->translation(0).falseFriend(trans).isEmpty() )
-        domElementTranslation.setAttribute(KV_FAUX_AMI_T, entry->translation(0).falseFriend(trans));
+                s = m_doc->identifier( trans ).simplified();
+                if ( s.isEmpty() ) {
+                    s.setNum( trans );
+                    s.prepend( "translation " );
+                }
+                domElementTranslation.setAttribute( KV_LANG, s );
+                if ( s == q_org )
+                    domElementTranslation.setAttribute( KV_QUERY, ( QString ) KV_O );
+                else if ( s == q_trans )
+                    domElementTranslation.setAttribute( KV_QUERY, ( QString ) KV_T );
+            }
 
-      if (!entry->translation(trans).synonym().isEmpty() )
-        domElementTranslation.setAttribute(KV_SYNONYM, entry->translation(trans).synonym());
+            if ( entry->translation( trans ).gradeFrom( 0 ).grade() != 0 || entry->translation( 0 ).gradeFrom( trans ).grade() != 0 )
+                domElementTranslation.setAttribute( KV_GRADE, QString::number( entry->translation( trans ).gradeFrom( 0 ).grade() ) + ';' + QString::number( entry->translation( 0 ).gradeFrom( trans ).grade() ) );
 
-      if (!entry->translation(trans).example().isEmpty() )
-        domElementTranslation.setAttribute(KV_EXAMPLE, entry->translation(trans).example());
+            if ( entry->translation( trans ).gradeFrom( 0 ).queryCount() != 0 || entry->translation( 0 ).gradeFrom( trans ).queryCount() != 0 )
+                domElementTranslation.setAttribute( KV_COUNT, QString::number( entry->translation( trans ).gradeFrom( 0 ).queryCount() ) + ';' + QString::number( entry->translation( 0 ).gradeFrom( trans ).queryCount() ) );
 
-///@todo enable writing of usages in old format
-/*
-      if (!entry->translation(trans).usageLabel().isEmpty() )
-        domElementTranslation.setAttribute(KV_USAGE, entry->translation(trans).usageLabel());
-*/
-      if (!entry->translation(trans).paraphrase().isEmpty() )
-        domElementTranslation.setAttribute(KV_PARAPHRASE, entry->translation(trans).paraphrase());
+            if ( entry->translation( trans ).gradeFrom( 0 ).badCount() != 0 || entry->translation( 0 ).gradeFrom( trans ).badCount() != 0 )
+                domElementTranslation.setAttribute( KV_BAD, QString::number( entry->translation( trans ).gradeFrom( 0 ).badCount() ) + ';' + QString::number( entry->translation( 0 ).gradeFrom( trans ).badCount() ) );
 
-      if (!entry->translation(trans).antonym().isEmpty() )
-        domElementTranslation.setAttribute(KV_ANTONYM, entry->translation(trans).antonym());
+            if ( entry->translation( trans ).gradeFrom( 0 ).queryDate().toTime_t() != 0 || entry->translation( 0 ).gradeFrom( trans ).queryDate().toTime_t() != 0 )
+                domElementTranslation.setAttribute( KV_DATE, QString::number( entry->translation( trans ).gradeFrom( 0 ).queryDate().toTime_t() ) + ';' + QString::number( entry->translation( 0 ).gradeFrom( trans ).queryDate().toTime_t() ) );
 
-      if (!entry->translation(trans).pronunciation().isEmpty() )
-        domElementTranslation.setAttribute(KV_PRONUNCE, entry->translation(trans).pronunciation());
+            if ( !entry->translation( trans ).comment().isEmpty() )
+                domElementTranslation.setAttribute( KV_REMARK, entry->translation( trans ).comment() );
 
-      if (!entry->translation(trans).type().isEmpty())
-        domElementTranslation.setAttribute(KV_EXPRTYPE, m_compability.oldType(entry->translation(trans).type(), entry->translation(trans).subType()));
+            if ( !entry->translation( trans ).falseFriend( 0 ).isEmpty() )
+                domElementTranslation.setAttribute( KV_FAUX_AMI_F, entry->translation( trans ).falseFriend( 0 ) );
 
-      if (!writeMultipleChoice(domDoc, domElementTranslation, entry->translation(trans).multipleChoice()))
-        return false;
+            if ( !entry->translation( 0 ).falseFriend( trans ).isEmpty() )
+                domElementTranslation.setAttribute( KV_FAUX_AMI_T, entry->translation( 0 ).falseFriend( trans ) );
 
-      QString s;
-      QString entype = s = entry->translation(0).type();
-      int pos = s.indexOf(QM_TYPE_DIV);
-      if (pos >= 0)
-        entype = s.left (pos);
-      else
-        entype = s;
+            if ( !entry->translation( trans ).synonym().isEmpty() )
+                domElementTranslation.setAttribute( KV_SYNONYM, entry->translation( trans ).synonym() );
 
-      if (entype == QM_VERB && entry->translation(trans).conjugation().entryCount() > 0)
-      {
-        KEduVocConjugation conj = entry->translation(trans).conjugation();
-        if (!writeConjugEntry(domDoc, domElementTranslation, conj))
-          return false;
-      }
+            if ( !entry->translation( trans ).example().isEmpty() )
+                domElementTranslation.setAttribute( KV_EXAMPLE, entry->translation( trans ).example() );
 
-      if (entype == QM_ADJ && !entry->translation(trans).comparison().isEmpty())
-      {
-        KEduVocComparison comp = entry->translation(trans).comparison();
-        if (!writeComparison(domDoc, domElementTranslation, comp))
-          return false;
-      }
+///@todo enable writing of usages in old format
+            /*
+                  if (!entry->translation(trans).usageLabel().isEmpty() )
+                    domElementTranslation.setAttribute(KV_USAGE, entry->translation(trans).usageLabel());
+            */
+            if ( !entry->translation( trans ).paraphrase().isEmpty() )
+                domElementTranslation.setAttribute( KV_PARAPHRASE, entry->translation( trans ).paraphrase() );
+
+            if ( !entry->translation( trans ).antonym().isEmpty() )
+                domElementTranslation.setAttribute( KV_ANTONYM, entry->translation( trans ).antonym() );
+
+            if ( !entry->translation( trans ).pronunciation().isEmpty() )
+                domElementTranslation.setAttribute( KV_PRONUNCE, entry->translation( trans ).pronunciation() );
+
+            if ( !entry->translation( trans ).type().isEmpty() )
+                domElementTranslation.setAttribute( KV_EXPRTYPE, m_compability.oldType( entry->translation( trans ).type(), entry->translation( trans ).subType() ) );
+
+            if ( !writeMultipleChoice( domDoc, domElementTranslation, entry->translation( trans ).multipleChoice() ) )
+                return false;
+
+            QString s;
+            QString entype = s = entry->translation( 0 ).type();
+            int pos = s.indexOf( QM_TYPE_DIV );
+            if ( pos >= 0 )
+                entype = s.left( pos );
+            else
+                entype = s;
+
+            if ( entype == QM_VERB && entry->translation( trans ).conjugation().entryCount() > 0 ) {
+                KEduVocConjugation conj = entry->translation( trans ).conjugation();
+                if ( !writeConjugEntry( domDoc, domElementTranslation, conj ) )
+                    return false;
+            }
+
+            if ( entype == QM_ADJ && !entry->translation( trans ).comparison().isEmpty() ) {
+                KEduVocComparison comp = entry->translation( trans ).comparison();
+                if ( !writeComparison( domDoc, domElementTranslation, comp ) )
+                    return false;
+            }
+
+            QDomText domTextTranslation = domDoc.createTextNode( entry->translation( trans ).text() );
+            domElementTranslation.appendChild( domTextTranslation );
+            domElementExpression.appendChild( domElementTranslation );
+
+            trans++;
+        }
 
-      QDomText domTextTranslation = domDoc.createTextNode(entry->translation(trans).text());
-      domElementTranslation.appendChild(domTextTranslation);
-      domElementExpression.appendChild(domElementTranslation);
+        domElementKvtml.appendChild( domElementExpression );
 
-      trans++;
+        first_expr = false;
     }
 
-    domElementKvtml.appendChild(domElementExpression);
-
-    first_expr = false;
-  }
+    domDoc.appendChild( domElementKvtml );
 
-  domDoc.appendChild(domElementKvtml);
+    QTextStream ts( m_outputFile );
+    domDoc.save( ts, 2 );
 
-  QTextStream ts(m_outputFile);
-  domDoc.save(ts, 2);
-
-  return true;
+    return true;
 }
 
 
-bool KEduVocKvtmlWriter::writeLesson(QDomDocument &domDoc, QDomElement &domElementParent)
+bool KEduVocKvtmlWriter::writeLesson( QDomDocument &domDoc, QDomElement &domElementParent )
 {
-  if (m_doc->lessonCount() == 0)
-    return true;
+    if ( m_doc->lessonCount() == 0 )
+        return true;
+
+    QDomElement domElementLesson = domDoc.createElement( KV_LESS_GRP );
+    domElementLesson.setAttribute( KV_SIZEHINT, m_doc->sizeHint( -1 ) );
+
+    const QMap<int, KEduVocLesson*> lessons = m_doc->lessons();
+    QList<int> keys = lessons.keys();
+    for ( int i = 0; i < keys.size(); ++i ) {
+        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 );
+    }
 
-  QDomElement domElementLesson = domDoc.createElement(KV_LESS_GRP);
-  domElementLesson.setAttribute(KV_SIZEHINT, m_doc->sizeHint(-1));
-
-  const QMap<int, KEduVocLesson*> lessons = m_doc->lessons();
-  QList<int> keys = lessons.keys();
-  for (int i = 0; i < keys.size(); ++i)
-  {
-    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);
-  return true;
+    domElementParent.appendChild( domElementLesson );
+    return true;
 }
 
 
-bool KEduVocKvtmlWriter::writeArticle(QDomDocument &domDoc, QDomElement &domElementParent)
+bool KEduVocKvtmlWriter::writeArticle( QDomDocument &domDoc, QDomElement &domElementParent )
 /*
  <article>
   <e l="de">    lang determines also lang order in entries !!
@@ -345,183 +332,172 @@ bool KEduVocKvtmlWriter::writeArticle(QDomDocument &domDoc, QDomElement &domElem
  </article>
 */
 {
-  if (m_doc->articleCount() == 0)
-    return true;
+    if ( m_doc->articleCount() == 0 )
+        return true;
 
-  QDomElement domElementArticle = domDoc.createElement(KV_ARTICLE_GRP);
-  QString def;
-  QString indef;
-  QString s;
+    QDomElement domElementArticle = domDoc.createElement( KV_ARTICLE_GRP );
+    QString def;
+    QString indef;
+    QString s;
 
-  for (int lfn = 0; lfn < qMin(m_doc->articleCount(), m_doc->identifierCount()); lfn++)
-  {
-    QDomElement domElementEntry = domDoc.createElement(KV_ART_ENTRY);
-    if (lfn == 0)
+    for ( int lfn = 0; lfn < qMin( m_doc->articleCount(), m_doc->identifierCount() ); lfn++ )
     {
-      s = m_doc->identifier(0).simplified();
-      if (s.isEmpty())
-        s = "original";
-    }
-    else
-    {
-      s = m_doc->identifier(lfn).simplified();
-      if (s.isEmpty())
-      {
-        s.setNum(lfn);
-        s.prepend("translation ");
-      }
-    }
-    domElementEntry.setAttribute(KV_LANG, s);
+        QDomElement domElementEntry = domDoc.createElement( KV_ART_ENTRY );
+        if ( lfn == 0 ) {
+            s = m_doc->identifier( 0 ).simplified();
+            if ( s.isEmpty() )
+                s = "original";
+        } else {
+            s = m_doc->identifier( lfn ).simplified();
+            if ( s.isEmpty() ) {
+                s.setNum( lfn );
+                s.prepend( "translation " );
+            }
+        }
+        domElementEntry.setAttribute( KV_LANG, s );
 
-    m_doc->article(lfn).getFemale(&def, &indef);
-    if (!def.isEmpty())
-    {
-      QDomElement domElementFD = domDoc.createElement(KV_ART_FD);
-      QDomText domTextFD = domDoc.createTextNode(def);
+        m_doc->article( lfn ).getFemale( &def, &indef );
+        if ( !def.isEmpty() ) {
+            QDomElement domElementFD = domDoc.createElement( KV_ART_FD );
+            QDomText domTextFD = domDoc.createTextNode( def );
 
-      domElementFD.appendChild(domTextFD);
-      domElementEntry.appendChild(domElementFD);
-    }
-    if (!indef.isEmpty())
-    {
-      QDomElement domElementFI = domDoc.createElement(KV_ART_FI);
-      QDomText domTextFI = domDoc.createTextNode(indef);
+            domElementFD.appendChild( domTextFD );
+            domElementEntry.appendChild( domElementFD );
+        }
+        if ( !indef.isEmpty() ) {
+            QDomElement domElementFI = domDoc.createElement( KV_ART_FI );
+            QDomText domTextFI = domDoc.createTextNode( indef );
 
-      domElementFI.appendChild(domTextFI);
-      domElementEntry.appendChild(domElementFI);
-    }
+            domElementFI.appendChild( domTextFI );
+            domElementEntry.appendChild( domElementFI );
+        }
 
-    m_doc->article(lfn).getMale(&def, &indef);
-    if (!def.isEmpty())
-    {
-      QDomElement domElementMD = domDoc.createElement(KV_ART_MD);
-      QDomText domTextMD = domDoc.createTextNode(def);
+        m_doc->article( lfn ).getMale( &def, &indef );
+        if ( !def.isEmpty() ) {
+            QDomElement domElementMD = domDoc.createElement( KV_ART_MD );
+            QDomText domTextMD = domDoc.createTextNode( def );
 
-      domElementMD.appendChild(domTextMD);
-      domElementEntry.appendChild(domElementMD);
-    }
-    if (!indef.isEmpty())
-    {
-      QDomElement domElementMI = domDoc.createElement(KV_ART_MI);
-      QDomText domTextMI = domDoc.createTextNode(indef);
+            domElementMD.appendChild( domTextMD );
+            domElementEntry.appendChild( domElementMD );
+        }
+        if ( !indef.isEmpty() ) {
+            QDomElement domElementMI = domDoc.createElement( KV_ART_MI );
+            QDomText domTextMI = domDoc.createTextNode( indef );
 
-      domElementMI.appendChild(domTextMI);
-      domElementEntry.appendChild(domElementMI);
-    }
+            domElementMI.appendChild( domTextMI );
+            domElementEntry.appendChild( domElementMI );
+        }
 
-    m_doc->article(lfn).getNatural(&def, &indef);
-    if (!def.isEmpty())
-    {
-      QDomElement domElementND = domDoc.createElement(KV_ART_ND);
-      QDomText domTextND = domDoc.createTextNode(def);
+        m_doc->article( lfn ).getNatural( &def, &indef );
+        if ( !def.isEmpty() ) {
+            QDomElement domElementND = domDoc.createElement( KV_ART_ND );
+            QDomText domTextND = domDoc.createTextNode( def );
 
-      domElementND.appendChild(domTextND);
-      domElementEntry.appendChild(domElementND);
-    }
-    if (!indef.isEmpty())
-    {
-      QDomElement domElementNI = domDoc.createElement(KV_ART_NI);
-      QDomText domTextNI = domDoc.createTextNode(indef);
+            domElementND.appendChild( domTextND );
+            domElementEntry.appendChild( domElementND );
+        }
+        if ( !indef.isEmpty() ) {
+            QDomElement domElementNI = domDoc.createElement( KV_ART_NI );
+            QDomText domTextNI = domDoc.createTextNode( indef );
 
-      domElementNI.appendChild(domTextNI);
-      domElementEntry.appendChild(domElementNI);
-    }
+            domElementNI.appendChild( domTextNI );
+            domElementEntry.appendChild( domElementNI );
+        }
 
-    domElementArticle.appendChild(domElementEntry);
-  }
+        domElementArticle.appendChild( domElementEntry );
+    }
 
-  domElementParent.appendChild(domElementArticle);
-  return true;
+    domElementParent.appendChild( domElementArticle );
+    return true;
 }
 
 
-bool KEduVocKvtmlWriter::writeType(QDomDocument &domDoc, QDomElement &domElementParent)
+bool KEduVocKvtmlWriter::writeType( QDomDocument &domDoc, QDomElement &domElementParent )
 {
-/** @todo port to new type handling
-  if (m_doc->typeDescriptions().count() == 0)
-    return true;
+    /** @todo port to new type handling
+      if (m_doc->typeDescriptions().count() == 0)
+        return true;
 
-  QDomElement domElementType = domDoc.createElement(KV_TYPE_GRP);
-  int count = 1;
+      QDomElement domElementType = domDoc.createElement(KV_TYPE_GRP);
+      int count = 1;
 
-  foreach(QString type, m_doc->typeDescriptions())
-  {
-    if (!(type.isNull()) )
-    {
-      QDomElement domElementDesc = domDoc.createElement(KV_TYPE_DESC);
-      QDomText domTextDesc = domDoc.createTextNode(type);
+      foreach(QString type, m_doc->typeDescriptions())
+      {
+        if (!(type.isNull()) )
+        {
+          QDomElement domElementDesc = domDoc.createElement(KV_TYPE_DESC);
+          QDomText domTextDesc = domDoc.createTextNode(type);
 
-      domElementDesc.setAttribute(KV_TYPE_NO, count);
-      domElementDesc.appendChild(domTextDesc);
-      domElementType.appendChild(domElementDesc);
-      count++;
-    }
-  }
+          domElementDesc.setAttribute(KV_TYPE_NO, count);
+          domElementDesc.appendChild(domTextDesc);
+          domElementType.appendChild(domElementDesc);
+          count++;
+        }
+      }
 
-  domElementParent.appendChild(domElementType);
-*/
-  return true;
+      domElementParent.appendChild(domElementType);
+    */
+    return true;
 }
 
 
-bool KEduVocKvtmlWriter::writeTense(QDomDocument &domDoc, QDomElement &domElementParent)
+bool KEduVocKvtmlWriter::writeTense( QDomDocument &domDoc, QDomElement &domElementParent )
 {
-  if (m_doc->tenseDescriptions().count() == 0)
-    return true;
+    if ( m_doc->tenseDescriptions().count() == 0 )
+        return true;
 
-  QDomElement domElementTense = domDoc.createElement(KV_TENSE_GRP);
-  int count = 1;
+    QDomElement domElementTense = domDoc.createElement( KV_TENSE_GRP );
+    int count = 1;
 
-  foreach(QString tense, m_doc->tenseDescriptions())
-  {
-    if (!(tense.isNull())) {
-      QDomElement domElementDesc = domDoc.createElement(KV_TENSE_DESC);
-      QDomText domTextDesc = domDoc.createTextNode(tense);
+    foreach( QString tense, m_doc->tenseDescriptions() ) {
+        if ( !( tense.isNull() ) ) {
+            QDomElement domElementDesc = domDoc.createElement( KV_TENSE_DESC );
+            QDomText domTextDesc = domDoc.createTextNode( tense );
 
-      domElementDesc.setAttribute(KV_TENSE_NO, count);
-      domElementDesc.appendChild(domTextDesc);
-      domElementTense.appendChild(domElementDesc);
-      count++;
+            domElementDesc.setAttribute( KV_TENSE_NO, count );
+            domElementDesc.appendChild( domTextDesc );
+            domElementTense.appendChild( domElementDesc );
+            count++;
+        }
     }
-  }
 
-  domElementParent.appendChild(domElementTense);
-  return true;
+    domElementParent.appendChild( domElementTense );
+    return true;
 }
 
 
-bool KEduVocKvtmlWriter::writeUsage(QDomDocument &domDoc, QDomElement &domElementParent)
+bool KEduVocKvtmlWriter::writeUsage( QDomDocument &domDoc, QDomElement &domElementParent )
 {
 
 ///@todo usages
-/*
-  if (m_doc->usageDescriptions().count() == 0)
-    return true;
+    /*
+      if (m_doc->usageDescriptions().count() == 0)
+        return true;
 
-  QDomElement domElementUsage = domDoc.createElement(KV_USAGE_GRP);
-  int count = 1;
+      QDomElement domElementUsage = domDoc.createElement(KV_USAGE_GRP);
+      int count = 1;
 
-  foreach(QString usage, m_doc->usageDescriptions())
-  {
-    if (!(usage.isNull()))
-    {
-      QDomElement domElementDesc = domDoc.createElement(KV_USAGE_DESC);
-      QDomText domTextDesc = domDoc.createTextNode(usage);
+      foreach(QString usage, m_doc->usageDescriptions())
+      {
+        if (!(usage.isNull()))
+        {
+          QDomElement domElementDesc = domDoc.createElement(KV_USAGE_DESC);
+          QDomText domTextDesc = domDoc.createTextNode(usage);
 
-      domElementDesc.setAttribute(KV_USAGE_NO, count);
-      domElementDesc.appendChild(domTextDesc);
-      domElementUsage.appendChild(domElementDesc);
-      count++;
-    }
-  }
+          domElementDesc.setAttribute(KV_USAGE_NO, count);
+          domElementDesc.appendChild(domTextDesc);
+          domElementUsage.appendChild(domElementDesc);
+          count++;
+        }
+      }
 
-  domElementParent.appendChild(domElementUsage);
-*/
-  return true;
+      domElementParent.appendChild(domElementUsage);
+    */
+    return true;
 }
 
 
-bool KEduVocKvtmlWriter::writeComparison(QDomDocument &domDoc, QDomElement &domElementParent, const KEduVocComparison &comp)
+bool KEduVocKvtmlWriter::writeComparison( QDomDocument &domDoc, QDomElement &domElementParent, const KEduVocComparison &comp )
 /*
  <comparison>
    <l1>good</l1>
@@ -530,44 +506,41 @@ bool KEduVocKvtmlWriter::writeComparison(QDomDocument &domDoc, QDomElement &domE
  </comparison>
 */
 {
-  if (comp.isEmpty())
-    return true;
+    if ( comp.isEmpty() )
+        return true;
 
-  QDomElement domElementComparison = domDoc.createElement(KV_COMPARISON_GRP);
+    QDomElement domElementComparison = domDoc.createElement( KV_COMPARISON_GRP );
 
-  if (!comp.l1().isEmpty() )
-  {
-    QDomElement domElementL1 = domDoc.createElement(KV_COMP_L1);
-    QDomText domTextL1 = domDoc.createTextNode(comp.l1());
+    if ( !comp.l1().isEmpty() ) {
+        QDomElement domElementL1 = domDoc.createElement( KV_COMP_L1 );
+        QDomText domTextL1 = domDoc.createTextNode( comp.l1() );
 
-    domElementL1.appendChild(domTextL1);
-    domElementComparison.appendChild(domElementL1);
-  }
+        domElementL1.appendChild( domTextL1 );
+        domElementComparison.appendChild( domElementL1 );
+    }
 
-  if (!comp.l2().isEmpty() )
-  {
-    QDomElement domElementL2 = domDoc.createElement(KV_COMP_L2);
-    QDomText domTextL2 = domDoc.createTextNode(comp.l2());
+    if ( !comp.l2().isEmpty() ) {
+        QDomElement domElementL2 = domDoc.createElement( KV_COMP_L2 );
+        QDomText domTextL2 = domDoc.createTextNode( comp.l2() );
 
-    domElementL2.appendChild(domTextL2);
-    domElementComparison.appendChild(domElementL2);
-  }
+        domElementL2.appendChild( domTextL2 );
+        domElementComparison.appendChild( domElementL2 );
+    }
 
-  if (!comp.l3().isEmpty() )
-  {
-    QDomElement domElementL3 = domDoc.createElement(KV_COMP_L3);
-    QDomText domTextL3 = domDoc.createTextNode(comp.l3());
+    if ( !comp.l3().isEmpty() ) {
+        QDomElement domElementL3 = domDoc.createElement( KV_COMP_L3 );
+        QDomText domTextL3 = domDoc.createTextNode( comp.l3() );
 
-    domElementL3.appendChild(domTextL3);
-    domElementComparison.appendChild(domElementL3);
-  }
+        domElementL3.appendChild( domTextL3 );
+        domElementComparison.appendChild( domElementL3 );
+    }
 
-  domElementParent.appendChild(domElementComparison);
-  return true;
+    domElementParent.appendChild( domElementComparison );
+    return true;
 }
 
 
-bool KEduVocKvtmlWriter::writeMultipleChoice(QDomDocument &domDoc, QDomElement &domElementParent, const KEduVocMultipleChoice &mc)
+bool KEduVocKvtmlWriter::writeMultipleChoice( QDomDocument &domDoc, QDomElement &domElementParent, const KEduVocMultipleChoice &mc )
 /*
  <multiplechoice>
    <mc1>good</mc1>
@@ -578,111 +551,104 @@ bool KEduVocKvtmlWriter::writeMultipleChoice(QDomDocument &domDoc, QDomElement &
  </multiplechoice>
 */
 {
-  if (mc.isEmpty())
-    return true;
+    if ( mc.isEmpty() )
+        return true;
 
-  QDomElement domElementMC = domDoc.createElement(KV_MULTIPLECHOICE_GRP);
+    QDomElement domElementMC = domDoc.createElement( KV_MULTIPLECHOICE_GRP );
 
-  if (!mc.choice(1).isEmpty() )
-  {
-    QDomElement domElementMC1 = domDoc.createElement(KV_MC_1);
-    QDomText domTextMC1 = domDoc.createTextNode(mc.choice(1));
+    if ( !mc.choice( 1 ).isEmpty() ) {
+        QDomElement domElementMC1 = domDoc.createElement( KV_MC_1 );
+        QDomText domTextMC1 = domDoc.createTextNode( mc.choice( 1 ) );
 
-    domElementMC1.appendChild(domTextMC1);
-    domElementMC.appendChild(domElementMC1);
-  }
+        domElementMC1.appendChild( domTextMC1 );
+        domElementMC.appendChild( domElementMC1 );
+    }
 
-  if (!mc.choice(2).isEmpty() )
-  {
-    QDomElement domElementMC2 = domDoc.createElement(KV_MC_2);
-    QDomText domTextMC2 = domDoc.createTextNode(mc.choice(2));
+    if ( !mc.choice( 2 ).isEmpty() ) {
+        QDomElement domElementMC2 = domDoc.createElement( KV_MC_2 );
+        QDomText domTextMC2 = domDoc.createTextNode( mc.choice( 2 ) );
 
-    domElementMC2.appendChild(domTextMC2);
-    domElementMC.appendChild(domElementMC2);
-  }
+        domElementMC2.appendChild( domTextMC2 );
+        domElementMC.appendChild( domElementMC2 );
+    }
 
-  if (!mc.choice(3).isEmpty() )
-  {
-    QDomElement domElementMC3 = domDoc.createElement(KV_MC_3);
-    QDomText domTextMC3 = domDoc.createTextNode(mc.choice(3));
+    if ( !mc.choice( 3 ).isEmpty() ) {
+        QDomElement domElementMC3 = domDoc.createElement( KV_MC_3 );
+        QDomText domTextMC3 = domDoc.createTextNode( mc.choice( 3 ) );
 
-    domElementMC3.appendChild(domTextMC3);
-    domElementMC.appendChild(domElementMC3);
-  }
+        domElementMC3.appendChild( domTextMC3 );
+        domElementMC.appendChild( domElementMC3 );
+    }
 
-  if (!mc.choice(4).isEmpty() )
-  {
-    QDomElement domElementMC4 = domDoc.createElement(KV_MC_4);
-    QDomText domTextMC4 = domDoc.createTextNode(mc.choice(4));
+    if ( !mc.choice( 4 ).isEmpty() ) {
+        QDomElement domElementMC4 = domDoc.createElement( KV_MC_4 );
+        QDomText domTextMC4 = domDoc.createTextNode( mc.choice( 4 ) );
 
-    domElementMC4.appendChild(domTextMC4);
-    domElementMC.appendChild(domElementMC4);
-  }
+        domElementMC4.appendChild( domTextMC4 );
+        domElementMC.appendChild( domElementMC4 );
+    }
 
-  if (!mc.choice(5).isEmpty() )
-  {
-    QDomElement domElementMC5 = domDoc.createElement(KV_MC_5);
-    QDomText domTextMC5 = domDoc.createTextNode(mc.choice(5));
+    if ( !mc.choice( 5 ).isEmpty() ) {
+        QDomElement domElementMC5 = domDoc.createElement( KV_MC_5 );
+        QDomText domTextMC5 = domDoc.createTextNode( mc.choice( 5 ) );
 
-    domElementMC5.appendChild(domTextMC5);
-    domElementMC.appendChild(domElementMC5);
-  }
+        domElementMC5.appendChild( domTextMC5 );
+        domElementMC.appendChild( domElementMC5 );
+    }
 
-  domElementParent.appendChild(domElementMC);
-  return true;
+    domElementParent.appendChild( domElementMC );
+    return true;
 }
 
 
-bool KEduVocKvtmlWriter::writeConjugHeader(QDomDocument &domDoc, QDomElement &domElementParent, QList<KEduVocConjugation> &curr_conjug)
+bool KEduVocKvtmlWriter::writeConjugHeader( QDomDocument &domDoc, QDomElement &domElementParent, QList<KEduVocConjugation> &curr_conjug )
 {
-/*
- <conjugation>    used in header for definiton of "prefix"
-  <e l="de">      lang determines also lang order in entries !!
-   <s1>I</s1>     which must NOT differ
-   <s2>you<2>
-   <s3f common="0">he</s3f>
-   <s3m>she</s3m>
-   <s3n>it</s3n>
-   <p1>we</p1>
-   <p2>you</p2>
-   <p3f common="1">they</p3f>
-   <p3m>they</p3m>
-   <p3n>they</p3n>
-  </e>
- </conjugation>
-
-*/
-  if (curr_conjug.size() == 0)
-    return true;
-
-  QDomElement domElementConjug = domDoc.createElement(KV_CONJUG_GRP);
-  QString s;
+    /*
    <conjugation>    used in header for definiton of "prefix"
+      <e l="de">      lang determines also lang order in entries !!
+       <s1>I</s1>     which must NOT differ
+       <s2>you<2>
+       <s3f common="0">he</s3f>
+       <s3m>she</s3m>
+       <s3n>it</s3n>
+       <p1>we</p1>
+       <p2>you</p2>
+       <p3f common="1">they</p3f>
+       <p3m>they</p3m>
+       <p3n>they</p3n>
+      </e>
    </conjugation>
+
+    */
+    if ( curr_conjug.size() == 0 )
+        return true;
+
+    QDomElement domElementConjug = domDoc.createElement( KV_CONJUG_GRP );
+    QString s;
 
-  for (int ent = 0; ent < qMin(curr_conjug.count(), m_doc->identifierCount()); ent++)
-  {
-    QDomElement domElementEntry = domDoc.createElement(KV_CON_ENTRY);
+    for ( int ent = 0; ent < qMin( curr_conjug.count(), m_doc->identifierCount() ); ent++ ) {
+        QDomElement domElementEntry = domDoc.createElement( KV_CON_ENTRY );
 
-      s = m_doc->identifier(ent).simplified();
-      if (s.isEmpty())
-      {
-        s.setNum(ent);
-        s.prepend("translation ");
-      }
+        s = m_doc->identifier( ent ).simplified();
+        if ( s.isEmpty() ) {
+            s.setNum( ent );
+            s.prepend( "translation " );
+        }
 
-    domElementEntry.setAttribute(KV_LANG, s);
+        domElementEntry.setAttribute( KV_LANG, s );
 
-    if (!writeConjug(domDoc, domElementEntry, curr_conjug[ent], CONJ_PREFIX))
-      return false;
+        if ( !writeConjug( domDoc, domElementEntry, curr_conjug[ent], CONJ_PREFIX ) )
+            return false;
 
-    domElementConjug.appendChild(domElementEntry);
-  }
+        domElementConjug.appendChild( domElementEntry );
+    }
 
-  domElementParent.appendChild(domElementConjug);
-  return true;
+    domElementParent.appendChild( domElementConjug );
+    return true;
 }
 
 
-bool KEduVocKvtmlWriter::writeConjugEntry(QDomDocument &domDoc, QDomElement &domElementParent, KEduVocConjugation &curr_conjug)
+bool KEduVocKvtmlWriter::writeConjugEntry( QDomDocument &domDoc, QDomElement &domElementParent, KEduVocConjugation &curr_conjug )
 /*
  <conjugation>    in entry for definition of tenses of (irreg.) verbs
   <t n="sipa">
@@ -700,128 +666,118 @@ bool KEduVocKvtmlWriter::writeConjugEntry(QDomDocument &domDoc, QDomElement &dom
  </conjugation>
 */
 {
-  curr_conjug.cleanUp();
-  if (curr_conjug.entryCount() == 0 )
-    return true;
+    curr_conjug.cleanUp();
+    if ( curr_conjug.entryCount() == 0 )
+        return true;
 
-  QDomElement domElementConjug = domDoc.createElement(KV_CONJUG_GRP);
-  QString type;
+    QDomElement domElementConjug = domDoc.createElement( KV_CONJUG_GRP );
+    QString type;
 
-  for (int lfn = 0; lfn < curr_conjug.entryCount(); lfn++)
-  {
-    QDomElement domElementType = domDoc.createElement(KV_CON_TYPE);
+    for ( int lfn = 0; lfn < curr_conjug.entryCount(); lfn++ )
+    {
+        QDomElement domElementType = domDoc.createElement( KV_CON_TYPE );
 
-    type = curr_conjug.getType(lfn);
-    domElementType.setAttribute(KV_CON_NAME, type);
+        type = curr_conjug.getType( lfn );
+        domElementType.setAttribute( KV_CON_NAME, type );
 
-    if (!writeConjug(domDoc, domElementType, curr_conjug, curr_conjug.getType(lfn)))
-      return false;
+        if ( !writeConjug( domDoc, domElementType, curr_conjug, curr_conjug.getType( lfn ) ) )
+            return false;
 
-    domElementConjug.appendChild(domElementType);
-  }
+        domElementConjug.appendChild( domElementType );
+    }
 
-  domElementParent.appendChild(domElementConjug);
-  return true;
+    domElementParent.appendChild( domElementConjug );
+    return true;
 }
 
 
-bool KEduVocKvtmlWriter::writeConjug(QDomDocument &domDoc, QDomElement &domElementParent, const KEduVocConjugation &curr_conjug, const QString &type)
+bool KEduVocKvtmlWriter::writeConjug( QDomDocument &domDoc, QDomElement &domElementParent, const KEduVocConjugation &curr_conjug, const QString &type )
 {
-  if (!curr_conjug.pers1Singular(type).isEmpty())
-  {
-    QDomElement domElementP1s = domDoc.createElement(KV_CON_P1S);
-    QDomText domTextP1s = domDoc.createTextNode(curr_conjug.pers1Singular(type));
-
-    domElementP1s.appendChild(domTextP1s);
-    domElementParent.appendChild(domElementP1s);
-  }
-
-  if (!curr_conjug.pers2Singular(type).isEmpty())
-  {
-    QDomElement domElementP2s = domDoc.createElement(KV_CON_P2S);
-    QDomText domTextP2s = domDoc.createTextNode(curr_conjug.pers2Singular(type));
-
-    domElementP2s.appendChild(domTextP2s);
-    domElementParent.appendChild(domElementP2s);
-  }
-
-  if (!curr_conjug.pers3FemaleSingular(type).isEmpty() || curr_conjug.pers3SingularCommon(type))
-  {
-    QDomElement domElementP3sf = domDoc.createElement(KV_CON_P3SF);
-    QDomText domTextP3sf = domDoc.createTextNode(curr_conjug.pers3FemaleSingular(type));
-
-    if (curr_conjug.pers3SingularCommon(type))
-      domElementP3sf.setAttribute(KV_CONJ_COMMON, 1);
-
-    domElementP3sf.appendChild(domTextP3sf);
-    domElementParent.appendChild(domElementP3sf);
-  }
-
-  if (!curr_conjug.pers3MaleSingular(type).isEmpty())
-  {
-    QDomElement domElementP3sm = domDoc.createElement(KV_CON_P3SM);
-    QDomText domTextP3sm = domDoc.createTextNode(curr_conjug.pers3MaleSingular(type));
-
-    domElementP3sm.appendChild(domTextP3sm);
-    domElementParent.appendChild(domElementP3sm);
-  }
-
-  if (!curr_conjug.pers3NaturalSingular(type).isEmpty())
-  {
-    QDomElement domElementP3sn = domDoc.createElement(KV_CON_P3SN);
-    QDomText domTextP3sn = domDoc.createTextNode(curr_conjug.pers3NaturalSingular(type));
-
-    domElementP3sn.appendChild(domTextP3sn);
-    domElementParent.appendChild(domElementP3sn);
-  }
-
-  if (!curr_conjug.pers1Plural(type).isEmpty())
-  {
-    QDomElement domElementP1p = domDoc.createElement(KV_CON_P1P);
-    QDomText domTextP1p = domDoc.createTextNode(curr_conjug.pers1Plural(type));
-
-    domElementP1p.appendChild(domTextP1p);
-    domElementParent.appendChild(domElementP1p);
-  }
-
-  if (!curr_conjug.pers2Plural(type).isEmpty())
-  {
-    QDomElement domElementP2p = domDoc.createElement(KV_CON_P2P);
-    QDomText domTextP2p = domDoc.createTextNode(curr_conjug.pers2Plural(type));
-
-    domElementP2p.appendChild(domTextP2p);
-    domElementParent.appendChild(domElementP2p);
-  }
-
-  if (!curr_conjug.pers3FemalePlural(type).isEmpty() || curr_conjug.pers3PluralCommon(type))
-  {
-    QDomElement domElementP3pf = domDoc.createElement(KV_CON_P3PF);
-    QDomText domTextP3pf = domDoc.createTextNode(curr_conjug.pers3FemalePlural(type));
-
-    if (curr_conjug.pers3PluralCommon(type))
-      domElementP3pf.setAttribute(KV_CONJ_COMMON, 1);
-
-    domElementP3pf.appendChild(domTextP3pf);
-    domElementParent.appendChild(domElementP3pf);
-  }
-
-  if (!curr_conjug.pers3MalePlural(type).isEmpty())
-  {
-    QDomElement domElementP3pm = domDoc.createElement(KV_CON_P3PM);
-    QDomText domTextP3pm = domDoc.createTextNode(curr_conjug.pers3MalePlural(type));
-
-    domElementP3pm.appendChild(domTextP3pm);
-    domElementParent.appendChild(domElementP3pm);
-  }
-
-  if (!curr_conjug.pers3NaturalPlural(type).isEmpty())
-  {
-    QDomElement domElementP3pn = domDoc.createElement(KV_CON_P3PN);
-    QDomText domTextP3pn = domDoc.createTextNode(curr_conjug.pers3NaturalPlural(type));
-
-    domElementP3pn.appendChild(domTextP3pn);
-    domElementParent.appendChild(domElementP3pn);
-  }
-
-  return true;
+    if ( !curr_conjug.pers1Singular( type ).isEmpty() ) {
+        QDomElement domElementP1s = domDoc.createElement( KV_CON_P1S );
+        QDomText domTextP1s = domDoc.createTextNode( curr_conjug.pers1Singular( type ) );
+
+        domElementP1s.appendChild( domTextP1s );
+        domElementParent.appendChild( domElementP1s );
+    }
+
+    if ( !curr_conjug.pers2Singular( type ).isEmpty() ) {
+        QDomElement domElementP2s = domDoc.createElement( KV_CON_P2S );
+        QDomText domTextP2s = domDoc.createTextNode( curr_conjug.pers2Singular( type ) );
+
+        domElementP2s.appendChild( domTextP2s );
+        domElementParent.appendChild( domElementP2s );
+    }
+
+    if ( !curr_conjug.pers3FemaleSingular( type ).isEmpty() || curr_conjug.pers3SingularCommon( type ) ) {
+        QDomElement domElementP3sf = domDoc.createElement( KV_CON_P3SF );
+        QDomText domTextP3sf = domDoc.createTextNode( curr_conjug.pers3FemaleSingular( type ) );
+
+        if ( curr_conjug.pers3SingularCommon( type ) )
+            domElementP3sf.setAttribute( KV_CONJ_COMMON, 1 );
+
+        domElementP3sf.appendChild( domTextP3sf );
+        domElementParent.appendChild( domElementP3sf );
+    }
+
+    if ( !curr_conjug.pers3MaleSingular( type ).isEmpty() ) {
+        QDomElement domElementP3sm = domDoc.createElement( KV_CON_P3SM );
+        QDomText domTextP3sm = domDoc.createTextNode( curr_conjug.pers3MaleSingular( type ) );
+
+        domElementP3sm.appendChild( domTextP3sm );
+        domElementParent.appendChild( domElementP3sm );
+    }
+
+    if ( !curr_conjug.pers3NaturalSingular( type ).isEmpty() ) {
+        QDomElement domElementP3sn = domDoc.createElement( KV_CON_P3SN );
+        QDomText domTextP3sn = domDoc.createTextNode( curr_conjug.pers3NaturalSingular( type ) );
+
+        domElementP3sn.appendChild( domTextP3sn );
+        domElementParent.appendChild( domElementP3sn );
+    }
+
+    if ( !curr_conjug.pers1Plural( type ).isEmpty() ) {
+        QDomElement domElementP1p = domDoc.createElement( KV_CON_P1P );
+        QDomText domTextP1p = domDoc.createTextNode( curr_conjug.pers1Plural( type ) );
+
+        domElementP1p.appendChild( domTextP1p );
+        domElementParent.appendChild( domElementP1p );
+    }
+
+    if ( !curr_conjug.pers2Plural( type ).isEmpty() ) {
+        QDomElement domElementP2p = domDoc.createElement( KV_CON_P2P );
+        QDomText domTextP2p = domDoc.createTextNode( curr_conjug.pers2Plural( type ) );
+
+        domElementP2p.appendChild( domTextP2p );
+        domElementParent.appendChild( domElementP2p );
+    }
+
+    if ( !curr_conjug.pers3FemalePlural( type ).isEmpty() || curr_conjug.pers3PluralCommon( type ) ) {
+        QDomElement domElementP3pf = domDoc.createElement( KV_CON_P3PF );
+        QDomText domTextP3pf = domDoc.createTextNode( curr_conjug.pers3FemalePlural( type ) );
+
+        if ( curr_conjug.pers3PluralCommon( type ) )
+            domElementP3pf.setAttribute( KV_CONJ_COMMON, 1 );
+
+        domElementP3pf.appendChild( domTextP3pf );
+        domElementParent.appendChild( domElementP3pf );
+    }
+
+    if ( !curr_conjug.pers3MalePlural( type ).isEmpty() ) {
+        QDomElement domElementP3pm = domDoc.createElement( KV_CON_P3PM );
+        QDomText domTextP3pm = domDoc.createTextNode( curr_conjug.pers3MalePlural( type ) );
+
+        domElementP3pm.appendChild( domTextP3pm );
+        domElementParent.appendChild( domElementP3pm );
+    }
+
+    if ( !curr_conjug.pers3NaturalPlural( type ).isEmpty() ) {
+        QDomElement domElementP3pn = domDoc.createElement( KV_CON_P3PN );
+        QDomText domTextP3pn = domDoc.createTextNode( curr_conjug.pers3NaturalPlural( type ) );
+
+        domElementP3pn.appendChild( domTextP3pn );
+        domElementParent.appendChild( domElementP3pn );
+    }
+
+    return true;
 }
index 25a0ba948a3b93c308cd43d24de0466642a12edf..585316c3ce2a2c0de19cc05f1924f85a240feefe 100644 (file)
@@ -37,27 +37,27 @@ class KEduVocDocument;
 class KEduVocKvtmlWriter
 {
 public:
-  KEduVocKvtmlWriter(QFile *file);
-
-  bool writeDoc(KEduVocDocument *doc, const QString &generator);
-
-  bool writeLesson(QDomDocument &domDoc, QDomElement &domElementParent);
-  bool writeType(QDomDocument &domDoc, QDomElement &domElementParent);
-  bool writeTense(QDomDocument &domDoc, QDomElement &domElementParent);
-  bool writeUsage(QDomDocument &domDoc, QDomElement &domElementParent);
-  bool writeOption(QDomDocument &domDoc, QDomElement &domElementParent);
-  bool writeArticle (QDomDocument &domDoc, QDomElement &domElementParent);
-  bool writeConjugHeader(QDomDocument &domDoc, QDomElement &domElementParent, QList<KEduVocConjugation> &curr_conjug);
-  bool writeConjug(QDomDocument &domDoc, QDomElement &domElementParent, const KEduVocConjugation &curr_conjug, const QString &type);
-  bool writeConjugEntry(QDomDocument &domDoc, QDomElement &domElementParent, KEduVocConjugation &curr_conjug);
-  bool writeComparison(QDomDocument &domDoc, QDomElement &domElementParent, const KEduVocComparison &comp);
-  bool writeMultipleChoice(QDomDocument &domDoc, QDomElement &domElementParent, const KEduVocMultipleChoice &mc);
+    KEduVocKvtmlWriter( QFile *file );
+
+    bool writeDoc( KEduVocDocument *doc, const QString &generator );
+
+    bool writeLesson( QDomDocument &domDoc, QDomElement &domElementParent );
+    bool writeType( QDomDocument &domDoc, QDomElement &domElementParent );
+    bool writeTense( QDomDocument &domDoc, QDomElement &domElementParent );
+    bool writeUsage( QDomDocument &domDoc, QDomElement &domElementParent );
+    bool writeOption( QDomDocument &domDoc, QDomElement &domElementParent );
+    bool writeArticle( QDomDocument &domDoc, QDomElement &domElementParent );
+    bool writeConjugHeader( QDomDocument &domDoc, QDomElement &domElementParent, QList<KEduVocConjugation> &curr_conjug );
+    bool writeConjug( QDomDocument &domDoc, QDomElement &domElementParent, const KEduVocConjugation &curr_conjug, const QString &type );
+    bool writeConjugEntry( QDomDocument &domDoc, QDomElement &domElementParent, KEduVocConjugation &curr_conjug );
+    bool writeComparison( QDomDocument &domDoc, QDomElement &domElementParent, const KEduVocComparison &comp );
+    bool writeMultipleChoice( QDomDocument &domDoc, QDomElement &domElementParent, const KEduVocMultipleChoice &mc );
 
 private:
-  QFile *m_outputFile;
-  KEduVocDocument *m_doc;
+    QFile *m_outputFile;
+    KEduVocDocument *m_doc;
 
-  KEduVocKvtmlCompability m_compability;
+    KEduVocKvtmlCompability m_compability;
 };
 
 #endif
index 93985727e993d4e400efe0c743e043a41ae5fa34..2f28628e1e6821cc50101b258c5af08afecf970c 100644 (file)
 /** private class to store information about a lesson */
 class KEduVocLesson::Private
 {
-       public:
-               QSet<int> m_entries;
-               QString m_description;
+public:
+    QSet<int> m_entries;
+    QString m_description;
 };
 
 KEduVocLesson::KEduVocLesson()
-: d(new Private)
-{
-}
+        : d( new Private )
+{}
 
-KEduVocLesson::KEduVocLesson(const KEduVocLesson &other)
-: d(new Private)
+KEduVocLesson::KEduVocLesson( const KEduVocLesson &other )
+        : d( new Private )
 {
-       d->m_entries = other.d->m_entries;
-       d->m_description = other.d->m_description;
+    d->m_entries = other.d->m_entries;
+    d->m_description = other.d->m_description;
 }
 
 KEduVocLesson::~KEduVocLesson()
 {
-       delete d;
+    delete d;
 }
 
-KEduVocLesson& KEduVocLesson::operator=(const KEduVocLesson &other)
+KEduVocLesson& KEduVocLesson::operator= ( const KEduVocLesson &other )
 {
-  d->m_entries = other.d->m_entries;
-  d->m_description = other.d->m_description;
-  return *this;
+    d->m_entries = other.d->m_entries;
+    d->m_description = other.d->m_description;
+    return *this;
 }
 
-void KEduVocLesson::setDescription(const QString &description)
+void KEduVocLesson::setDescription( const QString &description )
 {
-       d->m_description = description;
+    d->m_description = description;
 }
 
 QString KEduVocLesson::description()
 {
-       return d->m_description;
+    return d->m_description;
 }
 
 QList<int> KEduVocLesson::entries()
 {
-       return d->m_entries.toList();
+    return d->m_entries.toList();
 }
 
-void KEduVocLesson::addEntry(int entryid)
+void KEduVocLesson::addEntry( int entryid )
 {
-       d->m_entries.insert(entryid);
+    d->m_entries.insert( entryid );
 }
 
-void KEduVocLesson::removeEntry(int entryid)
+void KEduVocLesson::removeEntry( int entryid )
 {
-       d->m_entries.remove(entryid);
+    d->m_entries.remove( entryid );
 }
index 4dc2179813d3b41b790f11414ff1b2a25c06ac76..d3116f4c92dd28040d30ddd491c3dc60c23abbf1 100644 (file)
 /** class to store information about a lesson */
 class KEDUVOCDOCUMENT_EXPORT KEduVocLesson
 {
-       public:
-               /** default constructor */
-               explicit KEduVocLesson();
+public:
+    /** default constructor */
+    explicit KEduVocLesson();
 
-               /** copy constructor for d-pointer safe copying */
-               KEduVocLesson(const KEduVocLesson &other);
+    /** copy constructor for d-pointer safe copying */
+    KEduVocLesson( const KEduVocLesson &other );
 
-               /** destructor */
-               ~KEduVocLesson();
+    /** destructor */
+    ~KEduVocLesson();
 
     /** assignment operator */
-    KEduVocLesson& operator=(const KEduVocLesson&);
+    KEduVocLesson& operator= ( const KEduVocLesson& );
 
-               /** set the lesson description
-                * @param description text to set for the description
-                */
-               void setDescription(const QString &description);
+    /** set the lesson description
+     * @param description text to set for the description
+     */
+    void setDescription( const QString &description );
 
-               /** get the lesson description */
-               QString description();
+    /** get the lesson description */
+    QString description();
 
-               /** get a list of all entries in the lesson */
-               QList<int> entries();
+    /** get a list of all entries in the lesson */
+    QList<int> entries();
 
-               /** add an entry to the lesson
-                * @param entryid id of the entry to add
-                */
-               void addEntry(int entryid);
+    /** add an entry to the lesson
+     * @param entryid id of the entry to add
+     */
+    void addEntry( int entryid );
 
-               /** remove an entry from the lesson
-                * @param entryid id of the entry to remove
-                */
-               void removeEntry(int entryid);
+    /** remove an entry from the lesson
+     * @param entryid id of the entry to remove
+     */
+    void removeEntry( int entryid );
 
-       private:
-               class Private;
-               Private * const d;
+private:
+    class Private;
+    Private * const d;
 };
 
 #endif
index ac94ff9b5db0f10fc2f984d6ae43a4ecd2ff7c6a..a882d3a16ec06aa9f10c4225ee3c34fa9354ad8b 100644 (file)
 
 class KEduVocMultipleChoice::KEduVocMultipleChoicePrivate
 {
-  public:
-   QStringList m_choices;
+public:
+    QStringList m_choices;
 };
 
 KEduVocMultipleChoice::KEduVocMultipleChoice()
-  : d(new KEduVocMultipleChoicePrivate)
-{
-}
+        : d( new KEduVocMultipleChoicePrivate )
+{}
 
-KEduVocMultipleChoice::KEduVocMultipleChoice(const KEduVocMultipleChoice &other)
-  : d(new KEduVocMultipleChoicePrivate)
+KEduVocMultipleChoice::KEduVocMultipleChoice( const KEduVocMultipleChoice &other )
+        : d( new KEduVocMultipleChoicePrivate )
 {
-  d->m_choices = other.choices();
+    d->m_choices = other.choices();
 }
 
-KEduVocMultipleChoice::KEduVocMultipleChoice(const QStringList &choices)
-  : d(new KEduVocMultipleChoicePrivate)
+KEduVocMultipleChoice::KEduVocMultipleChoice( const QStringList &choices )
+        : d( new KEduVocMultipleChoicePrivate )
 {
-  setChoices(choices);
+    setChoices( choices );
 }
 
 KEduVocMultipleChoice::~KEduVocMultipleChoice()
 {
-  delete d;
+    delete d;
 }
 
-KEduVocMultipleChoice &KEduVocMultipleChoice::operator=(const KEduVocMultipleChoice &other)
+KEduVocMultipleChoice &KEduVocMultipleChoice::operator= ( const KEduVocMultipleChoice &other )
 {
-  d->m_choices = other.choices();
-  return *this;
+    d->m_choices = other.choices();
+    return *this;
 }
 
-void KEduVocMultipleChoice::setChoices (const QStringList &choices)
+void KEduVocMultipleChoice::setChoices( const QStringList &choices )
 {
-  d->m_choices = choices;
+    d->m_choices = choices;
 }
 
 QStringList KEduVocMultipleChoice::choices() const
 {
-  return d->m_choices;
+    return d->m_choices;
 }
 
 bool KEduVocMultipleChoice::isEmpty() const
 {
-  return d->m_choices.isEmpty();
+    return d->m_choices.isEmpty();
 }
 
 
 void KEduVocMultipleChoice::clear()
 {
-  d->m_choices.clear();
+    d->m_choices.clear();
 }
 
 
-QString KEduVocMultipleChoice::choice (int index) const
+QString KEduVocMultipleChoice::choice( int index ) const
 {
-  QString choice;
-  if (d->m_choices.size() > index)
-  {
-    choice = d->m_choices[index];
-  }
-  return choice;
+    QString choice;
+    if ( d->m_choices.size() > index ) {
+        choice = d->m_choices[index];
+    }
+    return choice;
 }
 
-void KEduVocMultipleChoice::setChoice(int index, const QString &s)
+void KEduVocMultipleChoice::setChoice( int index, const QString &s )
 {
-  while (d->m_choices.size() <= index)
-  {
-    d->m_choices.append(QString());
-  }
-  d->m_choices[index] = s;
+    while ( d->m_choices.size() <= index ) {
+        d->m_choices.append( QString() );
+    }
+    d->m_choices[index] = s;
 }
 
 unsigned KEduVocMultipleChoice::size() const
 {
-  return d->m_choices.size();
+    return d->m_choices.size();
 }
 
-bool KEduVocMultipleChoice::operator==(const KEduVocMultipleChoice &choice) const
+bool KEduVocMultipleChoice::operator== ( const KEduVocMultipleChoice &choice ) const
 {
-  return d->m_choices == choice.choices();
+    return d->m_choices == choice.choices();
 }
 
-void KEduVocMultipleChoice::appendChoice(const QString &s)
+void KEduVocMultipleChoice::appendChoice( const QString &s )
 {
-  d->m_choices.append(s);
+    d->m_choices.append( s );
 }
index ea186155c6b9169a337a4d1612f819f9a9fd38b0..a6cf71b463804982f9d098651b3f6807c5bd95f4 100644 (file)
 class KEDUVOCDOCUMENT_EXPORT KEduVocMultipleChoice
 {
 public:
-   KEduVocMultipleChoice();
-   KEduVocMultipleChoice(const KEduVocMultipleChoice &other);
-   KEduVocMultipleChoice (const QStringList &choices);
+    KEduVocMultipleChoice();
+    KEduVocMultipleChoice( const KEduVocMultipleChoice &other );
+    KEduVocMultipleChoice( const QStringList &choices );
 
-   ~KEduVocMultipleChoice();
+    ~KEduVocMultipleChoice();
 
-   void setChoices (const QStringList &choices);
-   QStringList choices() const;
+    void setChoices( const QStringList &choices );
+    QStringList choices() const;
 
-   void appendChoice (const QString &s);
+    void appendChoice( const QString &s );
 
-   void setChoice(int index, const QString &s);
-   QString choice (int index) const;
+    void setChoice( int index, const QString &s );
+    QString choice( int index ) const;
 
-   bool isEmpty() const;
-   void clear();
-   unsigned size() const;
+    bool isEmpty() const;
+    void clear();
+    unsigned size() const;
 
-   bool operator==(const KEduVocMultipleChoice &choice) const;
+    bool operator== ( const KEduVocMultipleChoice &choice ) const;
 
-   KEduVocMultipleChoice &operator=(const KEduVocMultipleChoice &other);
+    KEduVocMultipleChoice &operator= ( const KEduVocMultipleChoice &other );
 
 private:
     class KEduVocMultipleChoicePrivate;
index 064783c28c9382817be4034677ee5463b8adffcc..915dcfee1e1d57cab4fb60bad62daf9095dbc510 100644 (file)
 #include "keduvocexpression.h"
 #include "keduvocdocument.h"
 
-KEduVocPaukerReader::KEduVocPaukerReader(KEduVocDocument * doc)
+KEduVocPaukerReader::KEduVocPaukerReader( KEduVocDocument * doc )
 {
     m_doc = doc;
 }
 
 
-bool KEduVocPaukerReader::read(QIODevice * device)
+bool KEduVocPaukerReader::read( QIODevice * device )
 {
-    setDevice(device);
+    setDevice( device );
 
-    while (!atEnd()) {
+    while ( !atEnd() ) {
         readNext();
 
-        if (isStartElement()) {
-            if (name() == "Lesson")
+        if ( isStartElement() ) {
+            if ( name() == "Lesson" )
                 readPauker();
             else
-                raiseError(i18n("This is not a Pauker document"));
+                raiseError( i18n( "This is not a Pauker document" ) );
         }
     }
 
@@ -50,13 +50,13 @@ bool KEduVocPaukerReader::read(QIODevice * device)
 
 void KEduVocPaukerReader::readUnknownElement()
 {
-    while (!atEnd()) {
+    while ( !atEnd() ) {
         readNext();
 
-        if (isEndElement())
+        if ( isEndElement() )
             break;
 
-        if (isStartElement())
+        if ( isStartElement() )
             readUnknownElement();
     }
 }
@@ -64,21 +64,21 @@ void KEduVocPaukerReader::readUnknownElement()
 
 void KEduVocPaukerReader::readPauker()
 {
-    m_doc->setAuthor("http://pauker.sf.net");
+    m_doc->setAuthor( "http://pauker.sf.net" );
     ///Pauker does not provide any column titles
-    m_doc->appendIdentifier(i18n("Front Side"));
-    m_doc->appendIdentifier(i18n("Reverse Side"));
+    m_doc->appendIdentifier( i18n( "Front Side" ) );
+    m_doc->appendIdentifier( i18n( "Reverse Side" ) );
 
-    while (!atEnd()) {
+    while ( !atEnd() ) {
         readNext();
 
-        if (isEndElement())
+        if ( isEndElement() )
             break;
 
-        if (isStartElement()) {
-            if (name() == "Description")
-                m_doc->setDocumentRemark(readElementText());
-            else if (name() == "Batch")
+        if ( isStartElement() ) {
+            if ( name() == "Description" )
+                m_doc->setDocumentRemark( readElementText() );
+            else if ( name() == "Batch" )
                 readBatch();
             else
                 readUnknownElement();
@@ -89,14 +89,14 @@ void KEduVocPaukerReader::readPauker()
 
 void KEduVocPaukerReader::readBatch()
 {
-    while (!atEnd()) {
+    while ( !atEnd() ) {
         readNext();
 
-        if (isEndElement())
+        if ( isEndElement() )
             break;
 
-        if (isStartElement()) {
-            if (name() == "Card")
+        if ( isStartElement() ) {
+            if ( name() == "Card" )
                 readCard();
             else
                 readUnknownElement();
@@ -110,25 +110,25 @@ void KEduVocPaukerReader::readCard()
     QString front;
     QString back;
 
-    while (!atEnd()) {
+    while ( !atEnd() ) {
         readNext();
 
-        if (isEndElement())
+        if ( isEndElement() )
             break;
 
-        if (isStartElement()) {
-            if (name() == "FrontSide")
+        if ( isStartElement() ) {
+            if ( name() == "FrontSide" )
                 front = readText();
-            else if (name() == "ReverseSide")
+            else if ( name() == "ReverseSide" )
                 back = readText();
             else
                 readUnknownElement();
         }
     }
 
-    KEduVocExpression expr = KEduVocExpression(front);
-    expr.setTranslation(1, back);
-    m_doc->appendEntry(&expr);
+    KEduVocExpression expr = KEduVocExpression( front );
+    expr.setTranslation( 1, back );
+    m_doc->appendEntry( &expr );
 }
 
 
@@ -136,14 +136,14 @@ QString KEduVocPaukerReader::readText()
 {
     QString result;
 
-    while (!atEnd()) {
+    while ( !atEnd() ) {
         readNext();
 
-        if (isEndElement())
+        if ( isEndElement() )
             break;
 
-        if (isStartElement()) {
-            if (name() == "Text")
+        if ( isStartElement() ) {
+            if ( name() == "Text" )
                 result = readElementText();
             else
                 readUnknownElement();
index 32a6a5d21c43e7d0c78c233baf5fda2313898b21..c6758591b2dca228b88ee75c40bd66d916afc167 100644 (file)
@@ -25,9 +25,9 @@ class KEduVocDocument;
 class KEduVocPaukerReader : public QXmlStreamReader
 {
 public:
-    KEduVocPaukerReader(KEduVocDocument *doc);
+    KEduVocPaukerReader( KEduVocDocument *doc );
 
-    bool read(QIODevice *device);
+    bool read( QIODevice *device );
 
 private:
     void readUnknownElement();
index 67b2a099b5217dac834bbae8f04e855607bd9b9d..d4df09c38393dfd04d10e4c2d3a750202189a742 100644 (file)
@@ -26,15 +26,15 @@ class KEduVocTranslation::KEduVocTranslationPrivate
 {
 public:
 
-    KEduVocTranslationPrivate () // ( KEduVocTranslation* qq )
-            //: q ( qq )
+    KEduVocTranslationPrivate()  // ( KEduVocTranslation* qq )
+    //: q ( qq )
     {
         init();
     }
 
     void init();
 
-    KEduVocTranslationPrivate& operator=(const KEduVocTranslationPrivate &translation);
+    KEduVocTranslationPrivate& operator= ( const KEduVocTranslationPrivate &translation );
     bool operator== ( const KEduVocTranslationPrivate &p ) const;
 
     //KEduVocTranslation* q;
@@ -79,39 +79,38 @@ void KEduVocTranslation::KEduVocTranslationPrivate::init()
 
 bool KEduVocTranslation::KEduVocTranslationPrivate::operator== ( const KEduVocTranslation::KEduVocTranslationPrivate &other ) const
 {
-    return     m_translation == other.m_translation &&
-               m_type == other.m_type &&
-        m_subType == other.m_subType &&
-               m_usages == other.m_usages &&
-               m_comment == other.m_comment &&
-               m_paraphrase == other.m_paraphrase &&
-               m_synonym == other.m_synonym &&
-               m_example == other.m_example &&
-               m_antonym == other.m_antonym &&
-               m_pronunciation == other.m_pronunciation &&
-               m_conjugation == other.m_conjugation &&
-               m_comparison == other.m_comparison &&
-               m_multipleChoice == other.m_multipleChoice &&
-               m_grades.keys() == other.m_grades.keys() &&
-               // uncomment this when grade class has an operator== defined
-               //m_grades.values() == other.m_grades.values() &&
-               m_falseFriends.keys() == other.m_falseFriends.keys() &&
-               m_falseFriends.values() == other.m_falseFriends.values();
+    return  m_translation == other.m_translation &&
+            m_type == other.m_type &&
+            m_subType == other.m_subType &&
+            m_usages == other.m_usages &&
+            m_comment == other.m_comment &&
+            m_paraphrase == other.m_paraphrase &&
+            m_synonym == other.m_synonym &&
+            m_example == other.m_example &&
+            m_antonym == other.m_antonym &&
+            m_pronunciation == other.m_pronunciation &&
+            m_conjugation == other.m_conjugation &&
+            m_comparison == other.m_comparison &&
+            m_multipleChoice == other.m_multipleChoice &&
+            m_grades.keys() == other.m_grades.keys() &&
+            // uncomment this when grade class has an operator== defined
+            //m_grades.values() == other.m_grades.values() &&
+            m_falseFriends.keys() == other.m_falseFriends.keys() &&
+            m_falseFriends.values() == other.m_falseFriends.values();
 }
 
-KEduVocTranslation::KEduVocTranslation() : d ( new KEduVocTranslationPrivate )
-{
-}
+KEduVocTranslation::KEduVocTranslation() : d( new KEduVocTranslationPrivate )
+{}
 
 
-KEduVocTranslation::KEduVocTranslation( const QString &translation ) : d ( new KEduVocTranslationPrivate )
+KEduVocTranslation::KEduVocTranslation( const QString &translation ) : d( new KEduVocTranslationPrivate )
 {
     d->m_translation = translation.simplified();
 }
 
-KEduVocTranslation::KEduVocTranslation( const KEduVocTranslation &other) : d ( new KEduVocTranslationPrivate )
+KEduVocTranslation::KEduVocTranslation( const KEduVocTranslation &other ) : d( new KEduVocTranslationPrivate )
 {
-       d->m_translation = other.d->m_translation;
+    d->m_translation = other.d->m_translation;
     d->m_type = other.d->m_type;
     d->m_subType = other.d->m_subType;
     d->m_usages = other.d->m_usages;
@@ -121,11 +120,11 @@ KEduVocTranslation::KEduVocTranslation( const KEduVocTranslation &other) : d ( n
     d->m_example = other.d->m_example;
     d->m_antonym = other.d->m_antonym;
     d->m_pronunciation = other.d->m_pronunciation;
-       d->m_conjugation = other.d->m_conjugation;
+    d->m_conjugation = other.d->m_conjugation;
     d->m_comparison = other.d->m_comparison;
     d->m_multipleChoice = other.d->m_multipleChoice;
     d->m_grades = other.d->m_grades;
-       d->m_falseFriends = other.d->m_falseFriends;
+    d->m_falseFriends = other.d->m_falseFriends;
 }
 
 KEduVocTranslation::~KEduVocTranslation()
@@ -133,67 +132,67 @@ KEduVocTranslation::~KEduVocTranslation()
     delete d;
 }
 
-QString KEduVocTranslation::text ( ) const
+QString KEduVocTranslation::text() const
 {
     return d->m_translation;
 }
 
 
-void KEduVocTranslation::setText ( const QString & expr )
+void KEduVocTranslation::setText( const QString & expr )
 {
     d->m_translation = expr.simplified();
 }
 
 
-QString KEduVocTranslation::comment ( ) const
+QString KEduVocTranslation::comment() const
 {
     return d->m_comment;
 }
 
 
-void KEduVocTranslation::setComment ( const QString & expr )
+void KEduVocTranslation::setComment( const QString & expr )
 {
     d->m_comment = expr.simplified();
 }
 
 
-void KEduVocTranslation::setFalseFriend ( int indexFrom, const QString & expr )
+void KEduVocTranslation::setFalseFriend( int indexFrom, const QString & expr )
 {
     d->m_falseFriends[indexFrom] = expr.simplified();
 }
 
 
-QString KEduVocTranslation::falseFriend ( int indexFrom ) const
+QString KEduVocTranslation::falseFriend( int indexFrom ) const
 {
-    return d->m_falseFriends.value(indexFrom);
+    return d->m_falseFriends.value( indexFrom );
 }
 
 
-void KEduVocTranslation::setSynonym (  const QString & expr )
+void KEduVocTranslation::setSynonym( const QString & expr )
 {
     d->m_synonym = expr.simplified();
 }
 
 
-QString KEduVocTranslation::synonym ( ) const
+QString KEduVocTranslation::synonym() const
 {
     return d->m_synonym;
 }
 
 
-void KEduVocTranslation::setExample (  const QString & expr )
+void KEduVocTranslation::setExample( const QString & expr )
 {
-   d->m_example = expr.simplified();
+    d->m_example = expr.simplified();
 }
 
 
-QString KEduVocTranslation::example ( ) const
+QString KEduVocTranslation::example() const
 {
     return d->m_example;
 }
 
 
-void KEduVocTranslation::setUsages (  const QSet<QString> & usages )
+void KEduVocTranslation::setUsages( const QSet<QString> & usages )
 {
     d->m_usages = usages;
 }
@@ -205,73 +204,73 @@ QSet<QString>& KEduVocTranslation::usages()
 }
 
 
-void KEduVocTranslation::setParaphrase (  const QString & expr )
+void KEduVocTranslation::setParaphrase( const QString & expr )
 {
     d->m_paraphrase = expr.simplified();
 }
 
 
-QString KEduVocTranslation::paraphrase ( ) const
+QString KEduVocTranslation::paraphrase() const
 {
     return d->m_paraphrase;
 }
 
 
-void KEduVocTranslation::setAntonym (  const QString & expr )
+void KEduVocTranslation::setAntonym( const QString & expr )
 {
     d->m_antonym = expr.simplified();
 }
 
 
-QString KEduVocTranslation::antonym ( ) const
+QString KEduVocTranslation::antonym() const
 {
     return d->m_antonym;
 }
 
 
-void KEduVocTranslation::setConjugation ( const KEduVocConjugation &con )
+void KEduVocTranslation::setConjugation( const KEduVocConjugation &con )
 {
     d->m_conjugation = con;
 }
 
 
-KEduVocConjugation KEduVocTranslation::conjugation ( ) const
+KEduVocConjugation KEduVocTranslation::conjugation() const
 {
     return d->m_conjugation;
 }
 
 
-void KEduVocTranslation::setComparison (  const KEduVocComparison &con )
+void KEduVocTranslation::setComparison( const KEduVocComparison &con )
 {
     d->m_comparison = con;
 }
 
 
-KEduVocComparison & KEduVocTranslation::comparison ( )
+KEduVocComparison & KEduVocTranslation::comparison()
 {
     return d->m_comparison;
 }
 
 
-void KEduVocTranslation::setMultipleChoice (  const KEduVocMultipleChoice &mc )
+void KEduVocTranslation::setMultipleChoice( const KEduVocMultipleChoice &mc )
 {
     d->m_multipleChoice = mc;
 }
 
 
-KEduVocMultipleChoice & KEduVocTranslation::multipleChoice ( )
+KEduVocMultipleChoice & KEduVocTranslation::multipleChoice()
 {
     return d->m_multipleChoice;
 }
 
 
-QString KEduVocTranslation::pronunciation ( ) const
+QString KEduVocTranslation::pronunciation() const
 {
     return d->m_pronunciation;
 }
 
 
-void KEduVocTranslation::setPronunciation (  const QString & expr )
+void KEduVocTranslation::setPronunciation( const QString & expr )
 {
     d->m_pronunciation = expr.simplified();
 }
@@ -283,7 +282,7 @@ QString KEduVocTranslation::type() const
 }
 
 
-void KEduVocTranslation::setType (  const QString &type )
+void KEduVocTranslation::setType( const QString &type )
 {
     d->m_type = type;
 }
@@ -294,12 +293,13 @@ QString KEduVocTranslation::subType() const
 }
 
 
-void KEduVocTranslation::setSubType (  const QString &type )
+void KEduVocTranslation::setSubType( const QString &type )
 {
     d->m_subType = type;
 }
 
-void KEduVocTranslation::resetGrades(){
+void KEduVocTranslation::resetGrades()
+{
     d->m_grades.clear();
 }
 
@@ -309,28 +309,28 @@ QList< int > KEduVocTranslation::conjugationTenses() const
     return m_conjugations.keys();
 }*/
 
-bool KEduVocTranslation::operator ==(const KEduVocTranslation & translation) const
+bool KEduVocTranslation::operator == ( const KEduVocTranslation & translation ) const
 {
     return d->m_translation == translation.d->m_translation &&
-        d->m_type == translation.d->m_type &&
-        d->m_subType == translation.d->m_subType &&
-        d->m_usages == translation.d->m_usages &&
-        d->m_comment == translation.d->m_comment &&
-        d->m_paraphrase == translation.d->m_paraphrase &&
-        d->m_synonym == translation.d->m_synonym &&
-        d->m_example == translation.d->m_example &&
-        d->m_antonym == translation.d->m_antonym &&
-        d->m_pronunciation == translation.d->m_pronunciation &&
-        d->m_comparison == translation.d->m_comparison &&
-        d->m_multipleChoice == translation.d->m_multipleChoice &&
-        d->m_falseFriends == translation.d->m_falseFriends
-        /// @todo m_grades == translation.m_grades &&
-        /// @todo m_conjugations == translation.m_conjugations
-        ;
-}
-
-
-KEduVocTranslation & KEduVocTranslation::operator =(const KEduVocTranslation & translation)
+           d->m_type == translation.d->m_type &&
+           d->m_subType == translation.d->m_subType &&
+           d->m_usages == translation.d->m_usages &&
+           d->m_comment == translation.d->m_comment &&
+           d->m_paraphrase == translation.d->m_paraphrase &&
+           d->m_synonym == translation.d->m_synonym &&
+           d->m_example == translation.d->m_example &&
+           d->m_antonym == translation.d->m_antonym &&
+           d->m_pronunciation == translation.d->m_pronunciation &&
+           d->m_comparison == translation.d->m_comparison &&
+           d->m_multipleChoice == translation.d->m_multipleChoice &&
+           d->m_falseFriends == translation.d->m_falseFriends
+           /// @todo m_grades == translation.m_grades &&
+           /// @todo m_conjugations == translation.m_conjugations
+           ;
+}
+
+
+KEduVocTranslation & KEduVocTranslation::operator = ( const KEduVocTranslation & translation )
 {
     d->m_translation = translation.d->m_translation;
     d->m_type = translation.d->m_type;
@@ -350,7 +350,7 @@ KEduVocTranslation & KEduVocTranslation::operator =(const KEduVocTranslation & t
     return *this;
 }
 
-KEduVocGrade & KEduVocTranslation::gradeFrom(int indexFrom)
+KEduVocGrade & KEduVocTranslation::gradeFrom( int indexFrom )
 {
     return d->m_grades[indexFrom];
 }
index 02a7ba8f44552d43edc94d84b2b3e5e60b05730e..705559a9cb07238528ba08c74bf7a9a6d2fa5fcf 100644 (file)
@@ -28,7 +28,7 @@
 class KEduVocGrade;
 
 /**
      @author Frederik Gladhorn <frederik.gladhorn@kdemail.net>
+ @author Frederik Gladhorn <frederik.gladhorn@kdemail.net>
 */
 class KEDUVOCDOCUMENT_EXPORT KEduVocTranslation
 {
@@ -36,16 +36,16 @@ public:
     /**
      * Default constructor for an empty translation.
      */
-    KEduVocTranslation( );
+    KEduVocTranslation();
 
-       /**
-     * Constructor
-     * @param translation is used as translation
-     */
+    /**
+        * Constructor
+        * @param translation is used as translation
+        */
     KEduVocTranslation( const QString &translation );
 
-       /** copy constructor for d-pointer safet */
-       KEduVocTranslation( const KEduVocTranslation &other);
+    /** copy constructor for d-pointer safet */
+    KEduVocTranslation( const KEduVocTranslation &other );
 
     /**
      * Destructor
@@ -56,19 +56,19 @@ public:
      * The translation as string (the word itself)
      * @return the translation
      */
-    QString text () const;
+    QString text() const;
 
     /**
      * Sets the translation
      * @param expr
      */
-    void setText ( const QString & expr );
+    void setText( const QString & expr );
 
 
     /** sets the pronunciation of this expression
     * @param expression       pronunciation of this index
     */
-    void setPronunciation( const QString & expression);
+    void setPronunciation( const QString & expression );
 
     /** returns the pronunciation of this expression
     * @return                 pronunciation or "" if none available
@@ -83,7 +83,7 @@ public:
     /** sets comment of this expression
     * @param expr             comment of this index
     */
-    void setComment( const QString & expr);
+    void setComment( const QString & expr );
 
     /** sets false friend of this expression
     * @param indexFrom        index of original translation
@@ -96,12 +96,12 @@ public:
     * @param indexFrom index of original translation
     * @return false friend or "" if no string available
     */
-    QString falseFriend( int indexFrom) const;
+    QString falseFriend( int indexFrom ) const;
 
     /** sets synonym this expression
     * @param expression       synonym of this index
     */
-    void setSynonym( const QString & expression);
+    void setSynonym( const QString & expression );
 
     /** returns synonym of this expression
     * @return                 synonym or "" if no string available
@@ -111,7 +111,7 @@ public:
     /** sets example this expression
     * @param expression       example of this index
     */
-    void setExample( const QString & expression);
+    void setExample( const QString & expression );
 
     /** returns example of this expression
     * @return                 example or "" if no string available
@@ -122,7 +122,7 @@ public:
     /** sets usages this expression
     * @param usage            usage labels of this index
     */
-    void setUsages( const QSet<QString> & usage);
+    void setUsages( const QSet<QString> & usage );
 
 
     /** returns usages of this expression
@@ -133,7 +133,7 @@ public:
     /** sets paraphrase of this expression
     * @param expression       paraphrase of this index
     */
-    void setParaphrase( const QString & expression);
+    void setParaphrase( const QString & expression );
 
     /** returns paraphrase of this expression
     * @return                 paraphrase or "" if no string available
@@ -143,7 +143,7 @@ public:
     /** sets antonym this expression
     * @param expression       antonym of this index
     */
-    void setAntonym( const QString & expression);
+    void setAntonym( const QString & expression );
 
     /** returns antonym of this expression
     * @return                 antonym or "" if no string available
@@ -159,7 +159,7 @@ public:
     /** sets type of this expression
     * @param type             type of this expression ("" = none)
     */
-    void setType( const QString &type);
+    void setType( const QString &type );
 
     /** returns subtype of this expression
     *
@@ -170,7 +170,7 @@ public:
     /** sets subtype of this expression
     * @param type             type of this expression ("" = none)
     */
-    void setSubType( const QString &type);
+    void setSubType( const QString &type );
 
     /** reset the grades for this translation */
     void resetGrades();
@@ -188,25 +188,25 @@ public:
     /** sets conjugations
     * @param conjugation      conjugation block
     */
-    void setConjugation(const KEduVocConjugation & conjugation);
+    void setConjugation( const KEduVocConjugation & conjugation );
 
-  /** returns comparison if available
-   */
-  KEduVocComparison & comparison();
+    /** returns comparison if available
+     */
+    KEduVocComparison & comparison();
 
-  /** sets comparison
-   * @param comparison       comparison block
-   */
-  void setComparison( const KEduVocComparison & comparison);
+    /** sets comparison
+     * @param comparison       comparison block
+     */
+    void setComparison( const KEduVocComparison & comparison );
 
-  /** returns multiple choice if available
-    */
-  KEduVocMultipleChoice & multipleChoice();
+    /** returns multiple choice if available
+      */
+    KEduVocMultipleChoice & multipleChoice();
 
-  /** sets multiple choice
-   * @param mc               multiple choice block
-    */
-  void setMultipleChoice( const KEduVocMultipleChoice &mc);
+    /** sets multiple choice
+     * @param mc               multiple choice block
+      */
+    void setMultipleChoice( const KEduVocMultipleChoice &mc );
 
 
     /**
@@ -214,16 +214,16 @@ public:
      * @param translation translation to be copied
      * @return reference to the new translation
      */
-    KEduVocTranslation& operator=(const KEduVocTranslation &translation);
+    KEduVocTranslation& operator= ( const KEduVocTranslation &translation );
     /**
      * Compare two translations, including word type etc.
      * @param translation
      * @return true if equal
      */
-    bool operator==(const KEduVocTranslation &translation) const;
+    bool operator== ( const KEduVocTranslation &translation ) const;
 
 private:
-       class KEduVocTranslationPrivate;
+    class KEduVocTranslationPrivate;
     KEduVocTranslationPrivate* const d;
 };
 
index ef8c16f461bfdfb81e58578171e7b9f8c3c623ca..af0ff5824f83985fad0988477e4f464df60ad112 100644 (file)
 #include "keduvocexpression.h"
 #include "keduvocgrade.h"
 
-KEduVocVokabelnReader::KEduVocVokabelnReader(QIODevice *file)
+KEduVocVokabelnReader::KEduVocVokabelnReader( QIODevice *file )
 {
-  // the file must be already open
-  m_inputFile = file;
-  m_errorMessage = "";
+    // the file must be already open
+    m_inputFile = file;
+    m_errorMessage = "";
 }
 
 
-bool KEduVocVokabelnReader::readDoc(KEduVocDocument *doc)
+bool KEduVocVokabelnReader::readDoc( KEduVocDocument *doc )
 {
-  m_doc = doc;
-
-  m_doc->setAuthor("http://www.vokabeln.de");
-
-  QTextStream inputStream(m_inputFile);
-  inputStream.setCodec("ISO-8851-1");
-  inputStream.setAutoDetectUnicode(false);
-  inputStream.seek(0);
-
-  QString title,
-          lang1,
-          lang2,
-          expression,
-          original,
-          translation,
-          lessonDescr,
-          temp;
+    m_doc = doc;
+
+    m_doc->setAuthor( "http://www.vokabeln.de" );
+
+    QTextStream inputStream( m_inputFile );
+    inputStream.setCodec( "ISO-8851-1" );
+    inputStream.setAutoDetectUnicode( false );
+    inputStream.seek( 0 );
+
+    QString title,
+    lang1,
+    lang2,
+    expression,
+    original,
+    translation,
+    lessonDescr,
+    temp;
+
+    int     i,
+    wordCount,
+    lesson;
+
+    int lines = 10000;
+
+    QStringList titles,
+    languages,
+    words;
+
+    bool keepGoing = true;
+
+    while ( keepGoing ) {
+        temp = inputStream.readLine();
+        keepGoing = !( temp.indexOf( "\"," ) > 0 );
+        title.append( temp );
+        if ( keepGoing )
+            title.append( " " );
+    }
 
-  int     i,
-          wordCount,
-          lesson;
+    titles = title.split( "\"," );
+    m_doc->setTitle( titles[0].mid( 1 ) );
+    wordCount = titles[1].section( ',', 0, 0 ).toInt();
 
-  int lines = 10000;
+    inputStream.readLine();
+    inputStream.readLine();
 
-  QStringList titles,
-              languages,
-              words;
+    lang1 = inputStream.readLine();
+    languages = lang1.split( "\"," );
 
-  bool keepGoing = true;
+    m_doc->appendIdentifier( languages[0].mid( 1 ) );
+    m_doc->appendIdentifier( languages[1].mid( 1 ) );
 
-  while (keepGoing)
-  {
-    temp = inputStream.readLine();
-    keepGoing = !(temp.indexOf("\",") > 0);
-    title.append(temp);
-    if (keepGoing)
-      title.append(" ");
-  }
+    keepGoing = true;
+    while ( keepGoing )
+        keepGoing = !( inputStream.readLine().indexOf( "8. Lernhilfe" ) > 0 ); //DO NOT translate
 
-  titles = title.split("\",");
-  m_doc->setTitle(titles[0].mid(1));
-  wordCount = titles[1].section(',', 0, 0).toInt();
+    for ( i = 0; i <= 14; i++ )
+        inputStream.readLine();
 
-  inputStream.readLine();
-  inputStream.readLine();
+    for ( i = 0; i < wordCount - 1; i++ ) {
+        int c = 0;
+        expression.resize( 0 );
 
-  lang1 = inputStream.readLine();
-  languages = lang1.split("\",");
+        while ( c < 2 ) {
+            temp = inputStream.readLine();
+            c+= temp.count( "\",", Qt::CaseSensitive );
+            expression.append( temp );
+            if ( c < 2 )
+                expression.append( " " );
+        }
 
-  m_doc->appendIdentifier(languages[0].mid(1));
-  m_doc->appendIdentifier(languages[1].mid(1));
+        words = expression.split( "\"," );
+        original = words[0].mid( 1 );
+        translation = words[1].mid( 1 );
+        lesson = words[2].toInt();
 
-  keepGoing = true;
-  while (keepGoing)
-    keepGoing = !(inputStream.readLine().indexOf("8. Lernhilfe") > 0); //DO NOT translate
+        KEduVocExpression kve;
+        kve.setTranslation( 0, original );
+        kve.setTranslation( 1, translation );
+        kve.translation( 1 ).gradeFrom( 0 ).setGrade( 0 );
+        kve.translation( 0 ).gradeFrom( 1 ).setGrade( 0 );
+        kve.setLesson( lesson );
 
-  for (i = 0; i <= 14; i++)
-    inputStream.readLine();
+        m_doc->appendEntry( &kve );
 
-  for (i = 0; i < wordCount - 1; i++)
-  {
-    int c = 0;
-    expression.resize(0);
-
-    while (c < 2)
-    {
-      temp = inputStream.readLine();
-      c+= temp.count("\",", Qt::CaseSensitive);
-      expression.append(temp);
-      if (c < 2)
-        expression.append(" ");
+        inputStream.readLine();
+        inputStream.readLine();
     }
 
-    words = expression.split("\",");
-    original = words[0].mid(1);
-    translation = words[1].mid(1);
-    lesson = words[2].toInt();
-
-    KEduVocExpression kve;
-    kve.setTranslation(0, original);
-    kve.setTranslation(1, translation);
-    kve.translation(1).gradeFrom(0).setGrade(0);
-    kve.translation(0).gradeFrom(1).setGrade(0);
-    kve.setLesson(lesson);
-
-    m_doc->appendEntry(&kve);
-
     inputStream.readLine();
     inputStream.readLine();
-  }
-
-  inputStream.readLine();
-  inputStream.readLine();
-  inputStream.readLine();
-
-  for (int i = 0; !inputStream.atEnd() && i < lines; i++)
-  {
-    lessonDescr = inputStream.readLine();
-    lessonDescr = lessonDescr.mid(1, lessonDescr.length() - 2);
-    if (!lessonDescr.isEmpty())
-      m_doc->addLesson(lessonDescr);
-    else
-      break;
     inputStream.readLine();
-  }
 
-  return true;
+    for ( int i = 0; !inputStream.atEnd() && i < lines; i++ ) {
+        lessonDescr = inputStream.readLine();
+        lessonDescr = lessonDescr.mid( 1, lessonDescr.length() - 2 );
+        if ( !lessonDescr.isEmpty() )
+            m_doc->addLesson( lessonDescr );
+        else
+            break;
+        inputStream.readLine();
+    }
+
+    return true;
 }
index e04945840acbfbf7769bf5e1771e6d63c4453935..00907ca54ff832334feeadba463dce631e7d6f2a 100644 (file)
@@ -26,16 +26,19 @@ class KEduVocDocument;
 class KEduVocVokabelnReader
 {
 public:
-  KEduVocVokabelnReader(QIODevice *file);
+    KEduVocVokabelnReader( QIODevice *file );
 
-  bool readDoc(KEduVocDocument *doc);
+    bool readDoc( KEduVocDocument *doc );
 
-  QString errorMessage() const {return m_errorMessage;}
+    QString errorMessage() const
+    {
+        return m_errorMessage;
+    }
 
 private:
-  QIODevice *m_inputFile;
-  KEduVocDocument *m_doc;
-  QString m_errorMessage;
+    QIODevice *m_inputFile;
+    KEduVocDocument *m_doc;
+    QString m_errorMessage;
 };
 
 #endif
index 57fee5bc0cdde52bae22a70ab1c5c282c44e96d7..b055b06ff2ebc3900fff0c3dd1cd45ff776275e7 100644 (file)
 // #define QM_USER_TYPE  "#"   // designates number of user type
 // #define QM_TYPE_DIV   ":"   // divide main from subtype
 
-class KEduVocWordType::Private {
+class KEduVocWordType::Private
+{
 
 public:
-    struct subWordType{
+    struct subWordType
+    {
         QString m_subTypeName;
         QString m_specialType;
         QString m_specialTypeExplanation;
     };
-    struct wordType{
+    struct wordType
+    {
         QString m_typeName;
         QString m_specialType;
         QString m_specialTypeExplanation;
@@ -97,41 +100,39 @@ public:
     static const QString WORDTYPE_ADVERB_EXPLANATION;
 };
 
-const QString KEduVocWordType::Private::WORDTYPE_NOUN = QString("noun");
-const QString KEduVocWordType::Private::WORDTYPE_NOUN_MALE = QString("noun:male");
-const QString KEduVocWordType::Private::WORDTYPE_NOUN_FEMALE = QString("noun:female");
-const QString KEduVocWordType::Private::WORDTYPE_NOUN_NEUTRAL = QString("noun:neutral");
+const QString KEduVocWordType::Private::WORDTYPE_NOUN = QString( "noun" );
+const QString KEduVocWordType::Private::WORDTYPE_NOUN_MALE = QString( "noun:male" );
+const QString KEduVocWordType::Private::WORDTYPE_NOUN_FEMALE = QString( "noun:female" );
+const QString KEduVocWordType::Private::WORDTYPE_NOUN_NEUTRAL = QString( "noun:neutral" );
 
-const QString KEduVocWordType::Private::WORDTYPE_VERB = QString("verb");
-const QString KEduVocWordType::Private::WORDTYPE_VERB_REGULAR = QString("verb:regular");
-const QString KEduVocWordType::Private::WORDTYPE_VERB_IRREGULAR = QString("verb:irregular");
+const QString KEduVocWordType::Private::WORDTYPE_VERB = QString( "verb" );
+const QString KEduVocWordType::Private::WORDTYPE_VERB_REGULAR = QString( "verb:regular" );
+const QString KEduVocWordType::Private::WORDTYPE_VERB_IRREGULAR = QString( "verb:irregular" );
 
-const QString KEduVocWordType::Private::WORDTYPE_ADJECTIVE = QString("adjective");
-const QString KEduVocWordType::Private::WORDTYPE_ADVERB = QString("adverb");
+const QString KEduVocWordType::Private::WORDTYPE_ADJECTIVE = QString( "adjective" );
+const QString KEduVocWordType::Private::WORDTYPE_ADVERB = QString( "adverb" );
 
 
-const QString KEduVocWordType::Private::WORDTYPE_NOUN_EXPLANATION = QString(i18n("This holds the words of type noun. You can rename it but not delete since the article training relies on it!"));
-const QString KEduVocWordType::Private::WORDTYPE_NOUN_MALE_EXPLANATION = QString("This holds the words of type noun male. You can rename it but not delete since the article training relies on it!");
-const QString KEduVocWordType::Private::WORDTYPE_NOUN_FEMALE_EXPLANATION = QString("This holds the words of type noun female. You can rename it but not delete since the article training relies on it!");
-const QString KEduVocWordType::Private::WORDTYPE_NOUN_NEUTRAL_EXPLANATION = QString("This holds the words of type noun neutral. You can rename it but not delete since the article training relies on it!");
+const QString KEduVocWordType::Private::WORDTYPE_NOUN_EXPLANATION = QString( i18n( "This holds the words of type noun. You can rename it but not delete since the article training relies on it!" ) );
+const QString KEduVocWordType::Private::WORDTYPE_NOUN_MALE_EXPLANATION = QString( "This holds the words of type noun male. You can rename it but not delete since the article training relies on it!" );
+const QString KEduVocWordType::Private::WORDTYPE_NOUN_FEMALE_EXPLANATION = QString( "This holds the words of type noun female. You can rename it but not delete since the article training relies on it!" );
+const QString KEduVocWordType::Private::WORDTYPE_NOUN_NEUTRAL_EXPLANATION = QString( "This holds the words of type noun neutral. You can rename it but not delete since the article training relies on it!" );
 
-const QString KEduVocWordType::Private::WORDTYPE_VERB_EXPLANATION = QString("This holds the words of type verb. You can rename it but not delete since the article training relies on it!");
-const QString KEduVocWordType::Private::WORDTYPE_VERB_REGULAR_EXPLANATION = QString("This holds the words of type regular verbs. You can rename it but not delete since the article training relies on it!");
-const QString KEduVocWordType::Private::WORDTYPE_VERB_IRREGULAR_EXPLANATION = QString("This holds the words of type irregular verbs. You can rename it but not delete since the article training relies on it!");
+const QString KEduVocWordType::Private::WORDTYPE_VERB_EXPLANATION = QString( "This holds the words of type verb. You can rename it but not delete since the article training relies on it!" );
+const QString KEduVocWordType::Private::WORDTYPE_VERB_REGULAR_EXPLANATION = QString( "This holds the words of type regular verbs. You can rename it but not delete since the article training relies on it!" );
+const QString KEduVocWordType::Private::WORDTYPE_VERB_IRREGULAR_EXPLANATION = QString( "This holds the words of type irregular verbs. You can rename it but not delete since the article training relies on it!" );
 
-const QString KEduVocWordType::Private::WORDTYPE_ADJECTIVE_EXPLANATION = QString("This holds the words of type adjective. You can rename it but not delete since the article training relies on it!");
-const QString KEduVocWordType::Private::WORDTYPE_ADVERB_EXPLANATION = QString("This holds the words of type adverb. You can rename it but not delete since the article training relies on it!");
+const QString KEduVocWordType::Private::WORDTYPE_ADJECTIVE_EXPLANATION = QString( "This holds the words of type adjective. You can rename it but not delete since the article training relies on it!" );
+const QString KEduVocWordType::Private::WORDTYPE_ADVERB_EXPLANATION = QString( "This holds the words of type adverb. You can rename it but not delete since the article training relies on it!" );
 
 
 
 KEduVocWordType::KEduVocWordType()
-: d(new Private)
-{
-
-}
+        : d( new Private )
+{}
 
-KEduVocWordType::KEduVocWordType(const KEduVocWordType & other)
-: d(new Private)
+KEduVocWordType::KEduVocWordType( const KEduVocWordType & other )
+        : d( new Private )
 {
     d->m_wordTypeList = other.d->m_wordTypeList;
 }
@@ -142,7 +143,7 @@ KEduVocWordType::~KEduVocWordType()
 }
 
 
-KEduVocWordType & KEduVocWordType::operator =(const KEduVocWordType & other)
+KEduVocWordType & KEduVocWordType::operator = ( const KEduVocWordType & other )
 {
     d->m_wordTypeList = other.d->m_wordTypeList;
     return *this;
@@ -180,55 +181,55 @@ QString KEduVocWordType::oldType(const QString & mainType, const QString & subTy
 void KEduVocWordType::createDefaultWordTypes()
 {
     // first the special types which cannot be deleted:
-    addType(i18n("Noun"), d->WORDTYPE_NOUN, d->WORDTYPE_NOUN_EXPLANATION);
+    addType( i18n( "Noun" ), d->WORDTYPE_NOUN, d->WORDTYPE_NOUN_EXPLANATION );
 
-    addSubType(i18n("Noun"), i18n("Male"), d->WORDTYPE_NOUN_MALE, d->WORDTYPE_NOUN_MALE_EXPLANATION);
+    addSubType( i18n( "Noun" ), i18n( "Male" ), d->WORDTYPE_NOUN_MALE, d->WORDTYPE_NOUN_MALE_EXPLANATION );
 
-    addSubType(i18n("Noun"), i18n("Female"), d->WORDTYPE_NOUN_FEMALE, d->WORDTYPE_NOUN_FEMALE_EXPLANATION);
+    addSubType( i18n( "Noun" ), i18n( "Female" ), d->WORDTYPE_NOUN_FEMALE, d->WORDTYPE_NOUN_FEMALE_EXPLANATION );
 
-    addSubType(i18n("Noun"), i18n("Neutral"), d->WORDTYPE_NOUN_NEUTRAL, d->WORDTYPE_NOUN_NEUTRAL_EXPLANATION);
+    addSubType( i18n( "Noun" ), i18n( "Neutral" ), d->WORDTYPE_NOUN_NEUTRAL, d->WORDTYPE_NOUN_NEUTRAL_EXPLANATION );
 
-    addType(i18n("Verb"), d->WORDTYPE_VERB, d->WORDTYPE_VERB_EXPLANATION);
+    addType( i18n( "Verb" ), d->WORDTYPE_VERB, d->WORDTYPE_VERB_EXPLANATION );
 
-    addSubType(i18n("Verb"), i18n("Regular"), d->WORDTYPE_VERB_REGULAR, d->WORDTYPE_VERB_REGULAR_EXPLANATION);
+    addSubType( i18n( "Verb" ), i18n( "Regular" ), d->WORDTYPE_VERB_REGULAR, d->WORDTYPE_VERB_REGULAR_EXPLANATION );
 
-    addSubType(i18n("Verb"), i18n("Irregular"), d->WORDTYPE_VERB_IRREGULAR, d->WORDTYPE_VERB_IRREGULAR_EXPLANATION);
+    addSubType( i18n( "Verb" ), i18n( "Irregular" ), d->WORDTYPE_VERB_IRREGULAR, d->WORDTYPE_VERB_IRREGULAR_EXPLANATION );
 
-    addType(i18n("Adjective"), d->WORDTYPE_ADJECTIVE, d->WORDTYPE_ADJECTIVE_EXPLANATION);
+    addType( i18n( "Adjective" ), d->WORDTYPE_ADJECTIVE, d->WORDTYPE_ADJECTIVE_EXPLANATION );
 
-    addType(i18n("Adverb"), d->WORDTYPE_ADVERB, d->WORDTYPE_ADVERB_EXPLANATION);
+    addType( i18n( "Adverb" ), d->WORDTYPE_ADVERB, d->WORDTYPE_ADVERB_EXPLANATION );
 
-    addType(i18n("Question"));
-    addType(i18n("Name"));
-    addType(i18n("Article"));
-    addSubType(i18n("Article"), i18n("Definite"));
-    addSubType(i18n("Article"), i18n("Indefinite"));
+    addType( i18n( "Question" ) );
+    addType( i18n( "Name" ) );
+    addType( i18n( "Article" ) );
+    addSubType( i18n( "Article" ), i18n( "Definite" ) );
+    addSubType( i18n( "Article" ), i18n( "Indefinite" ) );
 
-    addType(i18n("Pronoun"));
-    addSubType(i18n("Pronoun"), i18n("Possessive"));
-    addSubType(i18n("Pronoun"), i18n("Personal"));
+    addType( i18n( "Pronoun" ) );
+    addSubType( i18n( "Pronoun" ), i18n( "Possessive" ) );
+    addSubType( i18n( "Pronoun" ), i18n( "Personal" ) );
 
-    addType(i18n("Phrase"));
-    addType(i18n("Numeral"));
-    addSubType(i18n("Numeral"), i18n("Ordinal"));
-    addSubType(i18n("Numeral"), i18n("Cardinal"));
+    addType( i18n( "Phrase" ) );
+    addType( i18n( "Numeral" ) );
+    addSubType( i18n( "Numeral" ), i18n( "Ordinal" ) );
+    addSubType( i18n( "Numeral" ), i18n( "Cardinal" ) );
 
-    addType(i18n("Conjunction"));
-    addType(i18n("Preposition"));
-    addType(i18n("Informal"));
-    addType(i18n("Figuratively"));
+    addType( i18n( "Conjunction" ) );
+    addType( i18n( "Preposition" ) );
+    addType( i18n( "Informal" ) );
+    addType( i18n( "Figuratively" ) );
 }
 
 
-QString KEduVocWordType::mainTypeName(int index) const
+QString KEduVocWordType::mainTypeName( int index ) const
 {
     return d->m_wordTypeList[index].m_typeName;
 }
 
-int KEduVocWordType::mainTypeIndex(const QString& name) const
+int KEduVocWordType::mainTypeIndex( const QString& name ) const
 {
     for ( int i=0; i < d->m_wordTypeList.count(); i++ ) {
-        if ( d->m_wordTypeList.value(i).m_typeName == name ) {
+        if ( d->m_wordTypeList.value( i ).m_typeName == name ) {
             return i;
         }
     }
@@ -238,67 +239,67 @@ int KEduVocWordType::mainTypeIndex(const QString& name) const
 QStringList KEduVocWordType::typeNameList() const
 {
     QStringList list;
-    foreach (Private::wordType wt, d->m_wordTypeList) {
-        list.append(wt.m_typeName);
+    foreach( Private::wordType wt, d->m_wordTypeList ) {
+        list.append( wt.m_typeName );
     }
     return list;
 }
 
-QStringList KEduVocWordType::subTypeNameList(const QString & mainType) const
+QStringList KEduVocWordType::subTypeNameList( const QString & mainType ) const
 {
     int mainIndex = mainTypeIndex( mainType );
-kDebug() << "Get subtypes for " << mainType << " = " << mainIndex;
+    kDebug() << "Get subtypes for " << mainType << " = " << mainIndex;
     QStringList list;
-    foreach (Private::subWordType wt, d->m_wordTypeList.value(mainIndex).m_subWordTypeList) {
-        list.append(wt.m_subTypeName);
+    foreach( Private::subWordType wt, d->m_wordTypeList.value( mainIndex ).m_subWordTypeList ) {
+        list.append( wt.m_subTypeName );
     }
     return list;
 }
 
 
-void KEduVocWordType::addType(const QString & typeName, const QString & specialType, const QString & specialTypeExplanation)
+void KEduVocWordType::addType( const QString & typeName, const QString & specialType, const QString & specialTypeExplanation )
 {
-    if (typeName.isEmpty()) {
+    if ( typeName.isEmpty() ) {
         kDebug() << "Attempting to add empty type. When opening old kvtml documents this is ok.";
         return;
     }
-    if (typeNameList().contains(typeName)) {
+    if ( typeNameList().contains( typeName ) ) {
         kDebug() << "Attempting to add type \"" << typeName << "\" twice.";
         return;
     }
-    d->m_wordTypeList.append(Private::wordType());
+    d->m_wordTypeList.append( Private::wordType() );
     d->m_wordTypeList[d->m_wordTypeList.count()-1].m_typeName = typeName;
     d->m_wordTypeList[d->m_wordTypeList.count()-1].m_specialType = specialType;
     d->m_wordTypeList[d->m_wordTypeList.count()-1].m_specialTypeExplanation = specialTypeExplanation;
 }
 
-void KEduVocWordType::addSubType(const QString & mainType, const QString & typeName, const QString & specialType, const QString & specialTypeExplanation)
+void KEduVocWordType::addSubType( const QString & mainType, const QString & typeName, const QString & specialType, const QString & specialTypeExplanation )
 {
-    int mt = mainTypeIndex(mainType);
+    int mt = mainTypeIndex( mainType );
 
-    d->m_wordTypeList[mt].m_subWordTypeList.append(Private::subWordType());
+    d->m_wordTypeList[mt].m_subWordTypeList.append( Private::subWordType() );
 
     d->m_wordTypeList[mt].m_subWordTypeList[d->m_wordTypeList[mt].m_subWordTypeList.count()-1].m_subTypeName = typeName;
     d->m_wordTypeList[mt].m_subWordTypeList[d->m_wordTypeList[mt].m_subWordTypeList.count()-1].m_specialType = specialType;
     d->m_wordTypeList[mt].m_subWordTypeList[d->m_wordTypeList[mt].m_subWordTypeList.count()-1].m_specialTypeExplanation = specialTypeExplanation;
 }
 
-void KEduVocWordType::renameType(const QString & oldTypeName, const QString & newTypeName)
+void KEduVocWordType::renameType( const QString & oldTypeName, const QString & newTypeName )
 {
     int index = mainTypeIndex( oldTypeName );
     d->m_wordTypeList[index].m_typeName= newTypeName;
 }
 
-void KEduVocWordType::renameSubType(const QString & mainTypeName, const QString & oldTypeName, const QString & newTypeName)
+void KEduVocWordType::renameSubType( const QString & mainTypeName, const QString & oldTypeName, const QString & newTypeName )
 {
-kDebug() << "Rename subtype: " << mainTypeName << oldTypeName << newTypeName;
+    kDebug() << "Rename subtype: " << mainTypeName << oldTypeName << newTypeName;
     int mainIndex = mainTypeIndex( mainTypeName );
-    if (mainIndex < 0) {
+    if ( mainIndex < 0 ) {
         kDebug() << "Renaming of subtype faild - parent not found";
         return;
     }
     int subIndex = subTypeIndex( mainTypeName, oldTypeName );
-    if (subIndex < 0) {
+    if ( subIndex < 0 ) {
         kDebug() << "Renaming of subtype faild - old subtype not found";
         return;
     }
@@ -306,7 +307,7 @@ kDebug() << "Rename subtype: " << mainTypeName << oldTypeName << newTypeName;
     d->m_wordTypeList[mainIndex].m_subWordTypeList[subIndex].m_subTypeName= newTypeName;
 }
 
-bool KEduVocWordType::removeType(const QString & typeName)
+bool KEduVocWordType::removeType( const QString & typeName )
 {
     // only if NOT special type
     int index = mainTypeIndex( typeName );
@@ -317,7 +318,7 @@ bool KEduVocWordType::removeType(const QString & typeName)
     return false;
 }
 
-bool KEduVocWordType::removeSubType(const QString & mainTypeName, const QString & typeName)
+bool KEduVocWordType::removeSubType( const QString & mainTypeName, const QString & typeName )
 {
     kDebug() << " delete subtype: " << mainTypeName << "/" << typeName;
     // only if NOT special type
@@ -331,7 +332,7 @@ bool KEduVocWordType::removeSubType(const QString & mainTypeName, const QString
     return false;
 }
 
-int KEduVocWordType::subTypeIndex(const QString & mainTypeName, const QString & subTypeName) const
+int KEduVocWordType::subTypeIndex( const QString & mainTypeName, const QString & subTypeName ) const
 {
     int main = mainTypeIndex( mainTypeName );
     if ( main < 0 ) {
@@ -339,7 +340,7 @@ int KEduVocWordType::subTypeIndex(const QString & mainTypeName, const QString &
         return -1;
     }
     for ( int i=0; i < d->m_wordTypeList[main].m_subWordTypeList.count(); i++ ) {
-        if ( d->m_wordTypeList[main].m_subWordTypeList.value(i).m_subTypeName == subTypeName ) {
+        if ( d->m_wordTypeList[main].m_subWordTypeList.value( i ).m_subTypeName == subTypeName ) {
             return i;
         }
     }
@@ -348,29 +349,29 @@ int KEduVocWordType::subTypeIndex(const QString & mainTypeName, const QString &
 
 void KEduVocWordType::printDebugWordTypes()
 {
-    foreach ( Private::wordType wt, d->m_wordTypeList ) {
+    foreach( Private::wordType wt, d->m_wordTypeList ) {
         kDebug() << wt.m_typeName;
-        foreach ( Private::subWordType swt, wt.m_subWordTypeList ) {
+        foreach( Private::subWordType swt, wt.m_subWordTypeList ) {
             kDebug() << "    " << swt.m_subTypeName;
         }
     }
 }
 
-QString KEduVocWordType::specialType(const QString & typeName)
+QString KEduVocWordType::specialType( const QString & typeName )
 {
     int index = mainTypeIndex( typeName );
-    if (index >= 0) {
+    if ( index >= 0 ) {
         return d->m_wordTypeList[index].m_specialType;
     }
     return QString();
 }
 
-QString KEduVocWordType::specialSubType(const QString & mainTypeName, const QString & subTypeName)
+QString KEduVocWordType::specialSubType( const QString & mainTypeName, const QString & subTypeName )
 {
     int mainIndex = mainTypeIndex( mainTypeName );
-    if (mainIndex >= 0) {
+    if ( mainIndex >= 0 ) {
         int subIndex = subTypeIndex( mainTypeName, subTypeName );
-        if (subIndex >= 0) {
+        if ( subIndex >= 0 ) {
             return d->m_wordTypeList[mainIndex].m_subWordTypeList[subIndex].m_specialType;
         }
     }
@@ -399,11 +400,11 @@ QString KEduVocWordType::specialTypeAdverb() const
     return d->WORDTYPE_ADVERB;
 }
 
-QString KEduVocWordType::typeOfSpecialType(const QString & specialType) const
+QString KEduVocWordType::typeOfSpecialType( const QString & specialType ) const
 {
     for ( int i=0; i < d->m_wordTypeList.count(); i++ ) {
-        if ( d->m_wordTypeList.value(i).m_specialType == specialType ) {
-            return d->m_wordTypeList.value(i).m_typeName;
+        if ( d->m_wordTypeList.value( i ).m_specialType == specialType ) {
+            return d->m_wordTypeList.value( i ).m_typeName;
         }
     }
     return QString();
index d358dbaf56e51fe0f9189a0d7f49ed540e319f3f..d8bbcc8ab3e4e9f5b7121aa7a7941ec7890fc66f 100644 (file)
     Word type handling including subtypes (noun - male/female) etc.
     Special types: To let KVocTrain decide which word type is a verb for example the
     special tag is used.
      @author Frederik Gladhorn <frederik.gladhorn@kdemail.net>
+ @author Frederik Gladhorn <frederik.gladhorn@kdemail.net>
 */
-class KEDUVOCDOCUMENT_EXPORT KEduVocWordType {
+class KEDUVOCDOCUMENT_EXPORT KEduVocWordType
+{
 
 public:
     /** default constructor */
     explicit KEduVocWordType();
 
     /** copy constructor for d-pointer safe copying */
-    KEduVocWordType(const KEduVocWordType& other);
+    KEduVocWordType( const KEduVocWordType& other );
 
     /** destructor */
     ~KEduVocWordType();
 
     /** assignment operator */
-    KEduVocWordType& operator=(const KEduVocWordType& other);
+    KEduVocWordType& operator= ( const KEduVocWordType& other );
 
     void createDefaultWordTypes();
 
@@ -58,7 +59,7 @@ public:
      * @param specialType Name of the special type - this is used internally to identify which types are use for special queries - verb query needs special == "verb" for example.
      * @param specialTypeExplanation An explanation which can be shown to the user. Since the type can be renamed if it's special, but not deleted this is necessary.
      */
-    void addType(const QString& typeName, const QString& specialType = QString(), const QString& specialTypeExplanation = QString());
+    void addType( const QString& typeName, const QString& specialType = QString(), const QString& specialTypeExplanation = QString() );
 
 
     /**
@@ -68,7 +69,7 @@ public:
      * @param specialType See above
      * @param specialTypeExplanation See above
      */
-    void addSubType(const QString& mainType, const QString& typeName, const QString& specialType = QString(), const QString& specialTypeExplanation = QString());
+    void addSubType( const QString& mainType, const QString& typeName, const QString& specialType = QString(), const QString& specialTypeExplanation = QString() );
 
     /**
      * Get a list of all known main word types.
@@ -83,21 +84,21 @@ public:
      * @param mainType The type whos subtypes are requested.
      * @return The subtypes.
      */
-    QStringList subTypeNameList(const QString& mainType) const;
+    QStringList subTypeNameList( const QString& mainType ) const;
 
     /**
      * Rename a type.
      * @param oldTypeName Old name
      * @param newTypeName New name
      */
-    void renameType( const QString& oldTypeName, const QString& newTypeName);
+    void renameType( const QString& oldTypeName, const QString& newTypeName );
     /**
      * Rename a subtype.
      * @param mainTypeName Main type
      * @param oldTypeName Old name
      * @param newTypeName New name
      */
-    void renameSubType( const QString& mainTypeName, const QString& oldTypeName, const QString& newTypeName);
+    void renameSubType( const QString& mainTypeName, const QString& oldTypeName, const QString& newTypeName );
 
     /**
      * Delete a type.
@@ -140,8 +141,8 @@ public:
 private:
 
 
-    QString mainTypeName(int index) const;
-    int mainTypeIndex(const QString& name) const;
+    QString mainTypeName( int index ) const;
+    int mainTypeIndex( const QString& name ) const;
     int subTypeIndex( const QString& mainTypeName, const QString& subTypeName ) const;
 
     class Private;
index c229c34f5b68b16bc962404490687cc622bc5d34..ba857f08251a68767829f7333ad9ffcbeaf038e2 100644 (file)
 #include "keduvocdocument.h"
 #include "keduvocexpression.h"
 
-KEduVocWqlReader::KEduVocWqlReader(QIODevice *file)
+KEduVocWqlReader::KEduVocWqlReader( QIODevice *file )
 {
-  // the file must be already open
-  m_inputFile = file;
-  m_errorMessage = "";
+    // the file must be already open
+    m_inputFile = file;
+    m_errorMessage = "";
 }
 
 
-bool KEduVocWqlReader::readDoc(KEduVocDocument *doc)
+bool KEduVocWqlReader::readDoc( KEduVocDocument *doc )
 {
-  m_doc = doc;
-
-  QTextStream inputStream(m_inputFile);
-  inputStream.setCodec("Windows-1252"); //("ISO-8851-1");
-  inputStream.setAutoDetectUnicode(false);
-  inputStream.seek(0);
-
-  QString s = "";
-  s=inputStream.readLine();
-  if (s != "WordQuiz")
-  {
-    m_errorMessage = i18n("This does not appear to be a (K)WordQuiz file");
-    return false;
-  }
-  s = inputStream.readLine();
-  s = s.left(1);
-  int iFV = s.toInt(0);
-  if (iFV != 5)
-  {
-    m_errorMessage = i18n("Only files created by WordQuiz 5.x or later can be opened");
-    return false;
-  }
-
-  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.indexOf("=", 0);
-  QString fam = s.right(s.length() - (p + 1));
-  fam = fam.mid(1, fam.length() - 2);
-
-  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.atEnd() && inputStream.readLine() != "[Grid Info]");
-  if (inputStream.atEnd())
-    return false;
-  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.atEnd() && inputStream.readLine() != "[Vocabulary]");
-  if (inputStream.atEnd())
-    return false;
-  s = inputStream.readLine();
-  p = s.indexOf("   [", 0);
-  s = s.left(p);
-  s = s.simplified();
-  m_doc->appendIdentifier(s);
-  m_doc->appendIdentifier(inputStream.readLine());
-
-  while (!s.isNull())
-  {
+    m_doc = doc;
+
+    QTextStream inputStream( m_inputFile );
+    inputStream.setCodec( "Windows-1252" ); //("ISO-8851-1");
+    inputStream.setAutoDetectUnicode( false );
+    inputStream.seek( 0 );
+
+    QString s = "";
+    s=inputStream.readLine();
+    if ( s != "WordQuiz" ) {
+        m_errorMessage = i18n( "This does not appear to be a (K)WordQuiz file" );
+        return false;
+    }
     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();
+    s = s.left( 1 );
+    int iFV = s.toInt( 0 );
+    if ( iFV != 5 ) {
+        m_errorMessage = i18n( "Only files created by WordQuiz 5.x or later can be opened" );
+        return false;
+    }
+
+    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.indexOf( "=", 0 );
+    QString fam = s.right( s.length() - ( p + 1 ) );
+    fam = fam.mid( 1, fam.length() - 2 );
+
+    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;
+    }
 
-    QString b;
-    b = inputStream.readLine();
+    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.atEnd() && inputStream.readLine() != "[Grid Info]" );
+    if ( inputStream.atEnd() )
+        return false;
+    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() );
 
-    KEduVocExpression expr = KEduVocExpression(s);
-    expr.setTranslation(1, b);
-    m_doc->appendEntry(&expr);
-  }
-  return true;
+    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.atEnd() && inputStream.readLine() != "[Vocabulary]" );
+    if ( inputStream.atEnd() )
+        return false;
+    s = inputStream.readLine();
+    p = s.indexOf( "   [", 0 );
+    s = s.left( p );
+    s = s.simplified();
+    m_doc->appendIdentifier( s );
+    m_doc->appendIdentifier( 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;
 }
index bbc6f062109678ad01b911f536726f2d3281f2ad..4b08a983b7b1196c4469e5b00f7c213f0598f617 100644 (file)
@@ -26,16 +26,19 @@ class KEduVocDocument;
 class KEduVocWqlReader
 {
 public:
-  KEduVocWqlReader(QIODevice *file);
+    KEduVocWqlReader( QIODevice *file );
 
-  bool readDoc(KEduVocDocument *doc);
+    bool readDoc( KEduVocDocument *doc );
 
-  QString errorMessage() const {return m_errorMessage;}
+    QString errorMessage() const
+    {
+        return m_errorMessage;
+    }
 
 private:
-  QIODevice *m_inputFile;
-  KEduVocDocument *m_doc;
-  QString m_errorMessage;
+    QIODevice *m_inputFile;
+    KEduVocDocument *m_doc;
+    QString m_errorMessage;
 };
 
 #endif
index 9829a38fa8315eeca5934e269ecce75959ef0464..4b7a923b952e1a7ff4eaa73523ca4a9bf8db8083 100644 (file)
 #include "keduvocexpression.h"
 #include "keduvocdocument.h"
 
-KEduVocXdxfReader::KEduVocXdxfReader(KEduVocDocument *doc)
+KEduVocXdxfReader::KEduVocXdxfReader( KEduVocDocument *doc )
 {
     m_doc = doc;
 }
 
 
-bool KEduVocXdxfReader::read(QIODevice *device)
+bool KEduVocXdxfReader::read( QIODevice *device )
 {
-    setDevice(device);
+    setDevice( device );
 
-    while (!atEnd()) {
+    while ( !atEnd() ) {
         readNext();
 
-        if (isStartElement()) {
-            if (name() == "xdxf")
+        if ( isStartElement() ) {
+            if ( name() == "xdxf" )
                 readXdxf();
             else
-                raiseError(i18n("This is not a XDXF document"));
+                raiseError( i18n( "This is not a XDXF document" ) );
         }
     }
 
@@ -50,13 +50,13 @@ bool KEduVocXdxfReader::read(QIODevice *device)
 
 void KEduVocXdxfReader::readUnknownElement()
 {
-    while (!atEnd()) {
+    while ( !atEnd() ) {
         readNext();
 
-        if (isEndElement())
+        if ( isEndElement() )
             break;
 
-        if (isStartElement())
+        if ( isStartElement() )
             readUnknownElement();
     }
 }
@@ -65,37 +65,37 @@ void KEduVocXdxfReader::readUnknownElement()
 void KEduVocXdxfReader::readXdxf()
 {
     ///The language attributes are required and should be ISO 639-2 codes, but you never know...
-    QStringRef id1 = attributes().value("lang_from");
-    if(!id1.isNull())
-        m_doc->appendIdentifier(id1.toString().toLower());
+    QStringRef id1 = attributes().value( "lang_from" );
+    if ( !id1.isNull() )
+        m_doc->appendIdentifier( id1.toString().toLower() );
     else
-        m_doc->appendIdentifier(i18nc("@title:column the original language column", "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());
+    QStringRef id2 = attributes().value( "lang_to" );
+    if ( !id2.isNull() )
+        m_doc->appendIdentifier( id2.toString().toLower() );
     else
-        m_doc->appendIdentifier(i18nc("@title:column one of the translation columns", "Translation"));
+        m_doc->appendIdentifier( i18nc( "@title:column one of the translation columns", "Translation" ) );
 
-    while (!atEnd()) {
+    while ( !atEnd() ) {
         readNext();
 
-        if (isEndElement())
+        if ( isEndElement() )
             break;
 
-        if (isStartElement()) {
-            if (name() == "description")
-                m_doc->setDocumentRemark(readElementText());
-            else if (name() == "full_name")
-                m_doc->setTitle(readElementText());
-            else if (name() == "ar")
+        if ( isStartElement() ) {
+            if ( name() == "description" )
+                m_doc->setDocumentRemark( readElementText() );
+            else if ( name() == "full_name" )
+                m_doc->setTitle( readElementText() );
+            else if ( name() == "ar" )
                 readEntry();
             else
                 readUnknownElement();
         }
     }
 
-    m_doc->setAuthor("http://xdxf.sf.net");
+    m_doc->setAuthor( "http://xdxf.sf.net" );
 }
 
 
@@ -104,15 +104,15 @@ void KEduVocXdxfReader::readEntry()
     QString front;
     QString back;
 
-    while (!(isEndElement() && name() == "ar")) {
+    while ( !( isEndElement() && name() == "ar" ) ) {
         readNext();
-        if (isStartElement() && name() == "k")
+        if ( isStartElement() && name() == "k" )
             front = readElementText();
-        else if (isCharacters() || isEntityReference())
-            back.append(text().toString());
+        else if ( isCharacters() || isEntityReference() )
+            back.append( text().toString() );
     }
 
-    KEduVocExpression expr = KEduVocExpression(front);
-    expr.setTranslation(1, back);
-    m_doc->appendEntry(&expr);
+    KEduVocExpression expr = KEduVocExpression( front );
+    expr.setTranslation( 1, back );
+    m_doc->appendEntry( &expr );
 }
index 75909e476a03343dc549ca47bf7d44580e32d150..61a45d8bc3d64dbf4d1b3ae143917132fafda5ae 100644 (file)
@@ -25,9 +25,9 @@ class KEduVocDocument;
 class KEduVocXdxfReader : public QXmlStreamReader
 {
 public:
-    KEduVocXdxfReader(KEduVocDocument *doc);
+    KEduVocXdxfReader( KEduVocDocument *doc );
 
-    bool read(QIODevice *device);
+    bool read( QIODevice *device );
 
 private:
     void readUnknownElement();
index ff119a8c0578e9710019f2d5b7ff003a1b94449c..9e347fd53a1339f229a335cbb9b236f4c3fe222b 100644 (file)
@@ -23,7 +23,7 @@
 
 /** XML tags and attribute names */
 
-static const QLatin1String KV_DOCTYPE("kvtml"); // doctype
+static const QLatin1String KV_DOCTYPE( "kvtml" ); // doctype
 #define KV_TITLE       "title"     // doc title
 #define KV_AUTHOR      "author"    // doc author
 #define KV_LICENSE     "license"   // doc license
@@ -34,8 +34,8 @@ static const QLatin1String KV_DOCTYPE("kvtml"); // doctype
 #define KV_ENCODING    "encoding"  // document encoding  (obsolete!)
 
 #define KV_EXPR        "e"         // entry for one expression
-static const QLatin1String KV_ORG("o");         // original expression in specified language
-static const QLatin1String KV_TRANS("t");       // translated expression in specified language
+static const QLatin1String KV_ORG( "o" );       // original expression in specified language
+static const QLatin1String KV_TRANS( "t" );     // translated expression in specified language
 #define KV_LANG        "l"         // language: en, de, it, fr ...
 #define KV_QUERY       "q"         // query: org or translation
 #define KV_O           "o"         // org
@@ -131,7 +131,7 @@ static const QLatin1String KV_TRANS("t");       // translated expression in spec
 */
 
 #define KV_ARTICLE_GRP "article"   // article descriptor group
-static const QLatin1String KV_ART_ENTRY("e");  // article entry
+static const QLatin1String KV_ART_ENTRY( "e" ); // article entry
 #define KV_ART_FD      "fd"        // female definite
 #define KV_ART_MD      "md"        // male definite
 #define KV_ART_ND      "nd"        // natural definite
index d2f63b2052aefd43547361679b1ba09898e6c585..5959d9c3d6f17cbfce278dfdbe01aecfc1da48c6 100644 (file)
 #include "leitnerbox.h"
 
 LeitnerBox::LeitnerBox()
-{
-}
+{}
 
 
 LeitnerBox::~LeitnerBox()
-{
-}
+{}
 
 int LeitnerBox::vocabCount() const
 {
-       return m_vocabCount;
+    return m_vocabCount;
 }
 
 void LeitnerBox::setVocabCount( int count )
 {
-       m_vocabCount = count;
+    m_vocabCount = count;
 }
 
 const QString& LeitnerBox::boxName() const
 {
-       return m_name;
+    return m_name;
 }
 
 LeitnerBox* LeitnerBox::correctWordBox()
 {
-       return m_correctWordBox;
+    return m_correctWordBox;
 }
 
 const LeitnerBox* LeitnerBox::correctWordBox() const
 {
-       return m_correctWordBox;
+    return m_correctWordBox;
 }
 
 LeitnerBox* LeitnerBox::wrongWordBox()
 {
-       return m_wrongWordBox;
+    return m_wrongWordBox;
 }
 
 const LeitnerBox* LeitnerBox::wrongWordBox() const
 {
-       return m_wrongWordBox;
+    return m_wrongWordBox;
 }
 
 void LeitnerBox::setBoxName( const QString& name )
 {
-       m_name = name;
+    m_name = name;
 }
 
 void LeitnerBox::setCorrectWordBox( LeitnerBox* correctWordBox )
 {
-       m_correctWordBox = correctWordBox;
+    m_correctWordBox = correctWordBox;
 }
 
 void LeitnerBox::setWrongWordBox( LeitnerBox* wrongWordBox )
 {
-       m_wrongWordBox = wrongWordBox;
+    m_wrongWordBox = wrongWordBox;
 }
 
-bool LeitnerBox::operator ==( const LeitnerBox& a ) const
+bool LeitnerBox::operator == ( const LeitnerBox& a ) const
 {
-       if( a.boxName() == boxName() )
-               return true;
-       else
-               return false;
+    if ( a.boxName() == boxName() )
+        return true;
+    else
+        return false;
 }
index 4fbbe6f202292a0f465b8e5866acb51792ec4364..e44fa5733941269c24fd06bcb3ca28dfaa43d438 100644 (file)
 class KEDUVOCDOCUMENT_EXPORT LeitnerBox
 {
 public:
-       /**
-        * The constructor
-        */
-       explicit LeitnerBox();
-
-       /**
-        * The destructor
-        */
-       ~LeitnerBox();
-
-       /**
-        * Sets the LeitnerBox's pointer to the correct word LeitnerBox
-        * @param correctWordBox a pointer to the LeitnerBox to be set
-        */
-       void setCorrectWordBox( LeitnerBox* correctWordBox );
-
-       /**
-        * Sets the LeitnerBox's pointer to the wrong word LeitnerBox
-        * @param wrongWordBox a pointer to the LeitnerBox to be set
-        */
-       void setWrongWordBox( LeitnerBox* wrongWordBox );
-       
-
-       /**
-        * Sets the LeitnerBox's name to name. The name is the unique identifier of a LeitnerBox.
-        * @param name a QString with the LeitnerBox's new name
-        */     
-       void setBoxName( const QString& name );
-
-       /**
-        * Returns the current name of the LeitnerBox
-        * @return a const QString with the name of the LeitnerBox
-        */
-       const QString& boxName() const;
-
-       /**
-        * Sets the LeitnerBox's vocabCount to count
-        * @param count the new vocabCount to be set
-        */
-       void setVocabCount( int count );
-
-       /**
-        * Returns the current vocabCount
-        * @return the number of cards/ vocabs that are currently assigned to the LeitnerBox.
-        */
-       int vocabCount() const;
-
-       /**
-        * Returns a pointer to the LeitnerBox correct cards of this LeitnerBox here are assigned to
-        * @return a pointer to a LeitnerBox
-        */
-       LeitnerBox* correctWordBox();
-
-       const LeitnerBox* correctWordBox() const;
-
-       /**
-        * Returns a pointer to the LeitnerBox wrong cards of this LeitnerBox here are assigned to
-        * @return a pointer to a LeitnerBox
-        */
-       LeitnerBox* wrongWordBox();
-       
-       const LeitnerBox* wrongWordBox() const;
-
-       bool operator == ( const LeitnerBox& a ) const;
+    /**
+     * The constructor
+     */
+    explicit LeitnerBox();
+
+    /**
+     * The destructor
+     */
+    ~LeitnerBox();
+
+    /**
+     * Sets the LeitnerBox's pointer to the correct word LeitnerBox
+     * @param correctWordBox a pointer to the LeitnerBox to be set
+     */
+    void setCorrectWordBox( LeitnerBox* correctWordBox );
+
+    /**
+     * Sets the LeitnerBox's pointer to the wrong word LeitnerBox
+     * @param wrongWordBox a pointer to the LeitnerBox to be set
+     */
+    void setWrongWordBox( LeitnerBox* wrongWordBox );
+
+
+    /**
+     * Sets the LeitnerBox's name to name. The name is the unique identifier of a LeitnerBox.
+     * @param name a QString with the LeitnerBox's new name
+     */
+    void setBoxName( const QString& name );
+
+    /**
+     * Returns the current name of the LeitnerBox
+     * @return a const QString with the name of the LeitnerBox
+     */
+    const QString& boxName() const;
+
+    /**
+     * Sets the LeitnerBox's vocabCount to count
+     * @param count the new vocabCount to be set
+     */
+    void setVocabCount( int count );
+
+    /**
+     * Returns the current vocabCount
+     * @return the number of cards/ vocabs that are currently assigned to the LeitnerBox.
+     */
+    int vocabCount() const;
+
+    /**
+     * Returns a pointer to the LeitnerBox correct cards of this LeitnerBox here are assigned to
+     * @return a pointer to a LeitnerBox
+     */
+    LeitnerBox* correctWordBox();
+
+    const LeitnerBox* correctWordBox() const;
+
+    /**
+     * Returns a pointer to the LeitnerBox wrong cards of this LeitnerBox here are assigned to
+     * @return a pointer to a LeitnerBox
+     */
+    LeitnerBox* wrongWordBox();
+
+    const LeitnerBox* wrongWordBox() const;
+
+    bool operator == ( const LeitnerBox& a ) const;
 
 private:
-       QString m_name;
-       int m_vocabCount;
-       LeitnerBox* m_wrongWordBox;
-       LeitnerBox* m_correctWordBox;
+    QString m_name;
+    int m_vocabCount;
+    LeitnerBox* m_wrongWordBox;
+    LeitnerBox* m_correctWordBox;
 };
 
 #endif
index f386bd9936b9af99ba305f0fdc53a177d6cd143b..bf6f9dacfaf30d04793a3721216c71879f4d24e5 100644 (file)
 
 #include <kdebug.h>
 
-LeitnerSystem::LeitnerSystem(const QList<LeitnerBox> &boxes, const QString &name)
+LeitnerSystem::LeitnerSystem( const QList<LeitnerBox> &boxes, const QString &name )
 {
-       if( !boxes.empty() )
-               m_boxes = boxes;
+    if ( !boxes.empty() )
+        m_boxes = boxes;
 
-       if( name.isNull() )
-               m_systemName = name;
+    if ( name.isNull() )
+        m_systemName = name;
 }
 
 LeitnerSystem::LeitnerSystem()
-{
-}
+{}
 
 LeitnerSystem::~LeitnerSystem()
-{
-}
+{}
 
 QStringList LeitnerSystem::getBoxNameList()
 {
-       QStringList boxNameList;
+    QStringList boxNameList;
+
+    foreach( const LeitnerBox &box, m_boxes )
+    boxNameList.append( box.boxName() );
 
-       foreach( const LeitnerBox &box, m_boxes )
-               boxNameList.append( box.boxName() );
-       
-       return boxNameList;
+    return boxNameList;
 }
 
 int LeitnerSystem::getNumberOfBoxes() const
 {
-       return m_boxes.count();
+    return m_boxes.count();
 }
 
 LeitnerBox* LeitnerSystem::boxWithNumber( int number )
 {
-       return &m_boxes[ number ];
+    return &m_boxes[ number ];
 }
 
 const LeitnerBox* LeitnerSystem::boxWithNumber( int number ) const
 {
-       return &m_boxes.at( number );
+    return &m_boxes.at( number );
 }
 
 LeitnerBox* LeitnerSystem::boxWithName( const QString& name )
 {
-       QList<LeitnerBox>::iterator it, it2;
-       it = m_boxes.begin();
-       it2 = m_boxes.end();
-       for ( ; it != it2; ++it)
-       {
-               if ( (*it).boxName() == name )
-                       return &(*it);
-       }
-
-       return 0;
+    QList<LeitnerBox>::iterator it, it2;
+    it = m_boxes.begin();
+    it2 = m_boxes.end();
+    for ( ; it != it2; ++it ) {
+        if (( *it ).boxName() == name )
+            return & ( *it );
+    }
+
+    return 0;
 }
 
 const LeitnerBox* LeitnerSystem::boxWithName( const QString& name ) const
 {
-       QList<LeitnerBox>::const_iterator it, it2;
-       it = m_boxes.begin();
-       it2 = m_boxes.end();
-       for ( ; it != it2; ++it)
-       {
-               if ( (*it).boxName() == name )
-                       return &(*it);
-       }
-
-       return 0;
+    QList<LeitnerBox>::const_iterator it, it2;
+    it = m_boxes.begin();
+    it2 = m_boxes.end();
+    for ( ; it != it2; ++it ) {
+        if (( *it ).boxName() == name )
+            return & ( *it );
+    }
+
+    return 0;
 }
 
 QString LeitnerSystem::systemName() const
 {
-       return m_systemName;
+    return m_systemName;
 }
 
 QString LeitnerSystem::nextBox( const QString& previousBox )
 {
-       Q_UNUSED( previousBox )
-       for( int i = 0; i < m_boxes.count(); i++ )
-       {
-               if( m_boxes[i].vocabCount() > 0 )
-                       return box( i );
-       }
-
-       return QString();
+    Q_UNUSED( previousBox )
+    for ( int i = 0; i < m_boxes.count(); i++ ) {
+        if ( m_boxes[i].vocabCount() > 0 )
+            return box( i );
+    }
+
+    return QString();
 }
 
 QString LeitnerSystem::correctBox( int box ) const
 {
-       return m_boxes[ box ].correctWordBox()->boxName();
+    return m_boxes[ box ].correctWordBox()->boxName();
 }
 
 QString LeitnerSystem::wrongBox( int box ) const
 {
-       return m_boxes[ box ].wrongWordBox()->boxName();
+    return m_boxes[ box ].wrongWordBox()->boxName();
 }
 
 QString LeitnerSystem::correctBox( const QString& box ) const
 {
-       return boxWithName( box )->correctWordBox()->boxName();
+    return boxWithName( box )->correctWordBox()->boxName();
 }
 
 QString LeitnerSystem::wrongBox( const QString& box ) const
 {
-       return boxWithName( box )->wrongWordBox()->boxName();
+    return boxWithName( box )->wrongWordBox()->boxName();
 }
 
 int LeitnerSystem::wrongBoxNumber( int box ) const
 {
-       return number( m_boxes[ box ].wrongWordBox() );
+    return number( m_boxes[ box ].wrongWordBox() );
 }
 
 int LeitnerSystem::correctBoxNumber( int box ) const
 {
-       return number( m_boxes[ box ].correctWordBox() );
+    return number( m_boxes[ box ].correctWordBox() );
 }
 
 void LeitnerSystem::deleteBox( int box )
 {
-       m_boxes.removeAt( box );
+    m_boxes.removeAt( box );
 }
 
 void LeitnerSystem::deleteBox( LeitnerBox* box )
 {
-       for( int i = 0; i < m_boxes.count(); i++ )
-       {
-               if( m_boxes[i].correctWordBox() == box )
-                       m_boxes[i].setCorrectWordBox( 0 );
+    for ( int i = 0; i < m_boxes.count(); i++ ) {
+        if ( m_boxes[i].correctWordBox() == box )
+            m_boxes[i].setCorrectWordBox( 0 );
 
-               if( m_boxes[i].wrongWordBox() == box )
-                       m_boxes[i].setWrongWordBox( 0 );
-       }
+        if ( m_boxes[i].wrongWordBox() == box )
+            m_boxes[i].setWrongWordBox( 0 );
+    }
 
-       m_boxes.removeAll( *box );
+    m_boxes.removeAll( *box );
 }
 
 bool LeitnerSystem::insertBox( const QString& name, int correctWordBox, int wrongWordBox )
 {
-       if( getBoxNameList().contains( name ) != 0 )
-               return false;
+    if ( getBoxNameList().contains( name ) != 0 )
+        return false;
 
-       LeitnerBox tmpBox;
-       tmpBox.setBoxName( name );
-       tmpBox.setCorrectWordBox( boxWithNumber( correctWordBox ) );
-       tmpBox.setWrongWordBox( boxWithNumber( wrongWordBox ) );
+    LeitnerBox tmpBox;
+    tmpBox.setBoxName( name );
+    tmpBox.setCorrectWordBox( boxWithNumber( correctWordBox ) );
+    tmpBox.setWrongWordBox( boxWithNumber( wrongWordBox ) );
 
-       m_boxes.append( tmpBox );
-       return true;
+    m_boxes.append( tmpBox );
+    return true;
 }
 
 void LeitnerSystem::setSystemName( const QString& name )
 {
-       m_systemName = name;
+    m_systemName = name;
 }
 
 int LeitnerSystem::number( const LeitnerBox* box ) const
 {
-       if( box == 0 )
-               return -1;
+    if ( box == 0 )
+        return -1;
 
-       return m_boxes.indexOf( *box );
+    return m_boxes.indexOf( *box );
 }
 
 bool LeitnerSystem::setBoxName( int box, const QString& name )
 {
-       if( boxWithName( name ) == 0 || boxWithName( name ) == boxWithNumber( box ) )
-       {
-               boxWithNumber( box )->setBoxName( name );
-
-               return true;
-       }
-       else
-               return false;
+    if ( boxWithName( name ) == 0 || boxWithName( name ) == boxWithNumber( box ) ) {
+        boxWithNumber( box )->setBoxName( name );
+
+        return true;
+    } else
+        return false;
 }
 
 bool LeitnerSystem::setBoxName( LeitnerBox* box, const QString& name )
 {
-       if( boxWithName( name ) == 0 || boxWithName( name ) == box )
-       {
-               box->setBoxName( name );
-
-               return true;
-       }
-       else
-               return false;
+    if ( boxWithName( name ) == 0 || boxWithName( name ) == box ) {
+        box->setBoxName( name );
+
+        return true;
+    } else
+        return false;
 }
 
 bool LeitnerSystem::insertBox( const QString& name )
 {
-       if( getBoxNameList().contains( name ) != 0 )
-               return false;
+    if ( getBoxNameList().contains( name ) != 0 )
+        return false;
 
-       LeitnerBox tmpBox;
-       tmpBox.setBoxName( name );
+    LeitnerBox tmpBox;
+    tmpBox.setBoxName( name );
 
-       m_boxes.append( tmpBox );
-       return true;
+    m_boxes.append( tmpBox );
+    return true;
 }
 
 void LeitnerSystem::setCorrectBox( const QString& box, const QString& correctWordBox )
 {
-       boxWithName( box )->setCorrectWordBox( boxWithName( correctWordBox ) );
+    boxWithName( box )->setCorrectWordBox( boxWithName( correctWordBox ) );
 }
 
 void LeitnerSystem::setWrongBox( const QString& box, const QString& wrongWordBox )
 {
-       boxWithName( box )->setWrongWordBox( boxWithName( wrongWordBox ) );
+    boxWithName( box )->setWrongWordBox( boxWithName( wrongWordBox ) );
 }
 
 QString LeitnerSystem::box( int i ) const
 {
-       return m_boxes.at( i ).boxName();
+    return m_boxes.at( i ).boxName();
 }
 
 void LeitnerSystem::setBoxVocabCount( QString& box, int vocabCount )
 {
-       boxWithName( box )->setVocabCount( vocabCount );
+    boxWithName( box )->setVocabCount( vocabCount );
 }
 
 int LeitnerSystem::boxVocabCount( QString& box )
 {
-       return boxWithName( box )->vocabCount();
+    return boxWithName( box )->vocabCount();
 }
 
 void LeitnerSystem::incrementBoxVocabCount( const QString& box )
 {
-       int tmp = boxWithName( box )->vocabCount();
-       boxWithName( box )->setVocabCount( tmp++ );
+    int tmp = boxWithName( box )->vocabCount();
+    boxWithName( box )->setVocabCount( tmp++ );
 }
 
 void LeitnerSystem::decrementBoxVocabCount( const QString& box )
 {
-       int tmp = boxWithName( box )->vocabCount();
-       boxWithName( box )->setVocabCount( tmp-- );
+    int tmp = boxWithName( box )->vocabCount();
+    boxWithName( box )->setVocabCount( tmp-- );
 }
 
index 31060a8cf08eec26e3db9e67181adbc70b040920..c3252f6dfefb6cfb27bc6befcd749b434facb6d8 100644 (file)
 class KEDUVOCDOCUMENT_EXPORT LeitnerSystem
 {
 public:
-       /**Constructor without arguments*/
-       explicit LeitnerSystem();
-
-       /**Constructor with arguments
-        * @param boxes reference to a QList of LeitnerBox
-        * @param name the new LeitnerSystems name
-        */
-       LeitnerSystem( const QList<LeitnerBox> &boxes, const QString &name );
-
-       /**Destructor*/
-       ~LeitnerSystem();
-
-       /**Returns the number of LeitnerBoxes contained by this LeitnerSystem
-        * @return the number of LeitnerBoxes as integer
-        */
-       int getNumberOfBoxes() const;
-
-       /**Returns a QStringList with all the LeitnerBoxes' names
-        * @return a QStringList with all names
-        */
-       QStringList getBoxNameList();
-
-       /**Returns the LeitnerSystem's name
-        * @return the LeitnerSystem's name as reference to QString
-        */
-       QString systemName() const;
-
-       /**Sets the LeitnerSystem's name
-   *
-        * @param name   the new name as QString
-        */
-       void setSystemName( const QString& name );
-
-       /**Returns a LeitnerBox by number
-        * @param number the number of the LeitnerBox to be returned
-        * @return a pointer to the LeitnerBox with the number
-        */
-       LeitnerBox* boxWithNumber( int number );
-
-       const LeitnerBox* boxWithNumber( int number ) const;
-
-       /**Returns a LeitnerBox by name
-        * @param name the name of the LeitnerBox to be returned
-        * @return a pointer to the LeitnerBox with the name,
-        *         or 0 if no such box exists.
-        */
-       LeitnerBox* boxWithName( const QString& name );
-
-       const LeitnerBox* boxWithName( const QString& name ) const;
-
-       /**Returns the number of the given LeitnerBox
-        * @param box a pointer to the LeitnerBox
-        * @return the number of the given LeitnerBox
-        */
-       int number( const LeitnerBox* box ) const;
-
-       /**Returns the name of the LeitnerBox with number @p i
-        * @param i the LeitnerBox's number
-        * @return the name of the LeitnerBox with number @p i
-        */
-       QString box( int i ) const;
-
-       /**Returns the LeitnerBox following @p previousBox
-        * @param previousBox the name of the LeitnerBox
-        * @return the name of the LeitnerBox following previousBox
-        */
-       QString nextBox( const QString& previousBox );
-
-       /**Returns the correct word box of "int box"
-        */
-       QString correctBox( int box ) const;
-       /**Returns the wrong word box of "int box"
-        */
-       QString wrongBox( int box ) const;
-       QString correctBox( const QString& box ) const;
-       QString wrongBox( const QString& box ) const;
-
-       int wrongBoxNumber( int box ) const;
-       int correctBoxNumber( int box ) const;
-
-       void setCorrectBox( const QString& box, const QString& correctWordBox );
-       void setWrongBox( const QString& box, const QString& wrongWordBox );
-
-       bool setBoxName( int box, const QString& name );
-       bool setBoxName( LeitnerBox* box, const QString& name );
-
-       void setBoxVocabCount( QString& box, int vocabCount );
-       int boxVocabCount( QString& box );
-
-       void incrementBoxVocabCount( const QString& box );
-       void decrementBoxVocabCount( const QString& box );
-
-       //inserts a box with number, name, correct and wrong word box
-       bool insertBox( const QString& name, int correctWordBox, int wrongWordBox );
-       bool insertBox( const QString& name );
-       void deleteBox( int box );
-       void deleteBox( LeitnerBox* box );
+    /**Constructor without arguments*/
+    explicit LeitnerSystem();
+
+    /**Constructor with arguments
+     * @param boxes reference to a QList of LeitnerBox
+     * @param name the new LeitnerSystems name
+     */
+    LeitnerSystem( const QList<LeitnerBox> &boxes, const QString &name );
+
+    /**Destructor*/
+    ~LeitnerSystem();
+
+    /**Returns the number of LeitnerBoxes contained by this LeitnerSystem
+     * @return the number of LeitnerBoxes as integer
+     */
+    int getNumberOfBoxes() const;
+
+    /**Returns a QStringList with all the LeitnerBoxes' names
+     * @return a QStringList with all names
+     */
+    QStringList getBoxNameList();
+
+    /**Returns the LeitnerSystem's name
+     * @return the LeitnerSystem's name as reference to QString
+     */
+    QString systemName() const;
+
+    /**Sets the LeitnerSystem's name
+      *
+     * @param name   the new name as QString
+     */
+    void setSystemName( const QString& name );
+
+    /**Returns a LeitnerBox by number
+     * @param number the number of the LeitnerBox to be returned
+     * @return a pointer to the LeitnerBox with the number
+     */
+    LeitnerBox* boxWithNumber( int number );
+
+    const LeitnerBox* boxWithNumber( int number ) const;
+
+    /**Returns a LeitnerBox by name
+     * @param name the name of the LeitnerBox to be returned
+     * @return a pointer to the LeitnerBox with the name,
+     *         or 0 if no such box exists.
+     */
+    LeitnerBox* boxWithName( const QString& name );
+
+    const LeitnerBox* boxWithName( const QString& name ) const;
+
+    /**Returns the number of the given LeitnerBox
+     * @param box a pointer to the LeitnerBox
+     * @return the number of the given LeitnerBox
+     */
+    int number( const LeitnerBox* box ) const;
+
+    /**Returns the name of the LeitnerBox with number @p i
+     * @param i the LeitnerBox's number
+     * @return the name of the LeitnerBox with number @p i
+     */
+    QString box( int i ) const;
+
+    /**Returns the LeitnerBox following @p previousBox
+     * @param previousBox the name of the LeitnerBox
+     * @return the name of the LeitnerBox following previousBox
+     */
+    QString nextBox( const QString& previousBox );
+
+    /**Returns the correct word box of "int box"
+     */
+    QString correctBox( int box ) const;
+    /**Returns the wrong word box of "int box"
+     */
+    QString wrongBox( int box ) const;
+    QString correctBox( const QString& box ) const;
+    QString wrongBox( const QString& box ) const;
+
+    int wrongBoxNumber( int box ) const;
+    int correctBoxNumber( int box ) const;
+
+    void setCorrectBox( const QString& box, const QString& correctWordBox );
+    void setWrongBox( const QString& box, const QString& wrongWordBox );
+
+    bool setBoxName( int box, const QString& name );
+    bool setBoxName( LeitnerBox* box, const QString& name );
+
+    void setBoxVocabCount( QString& box, int vocabCount );
+    int boxVocabCount( QString& box );
+
+    void incrementBoxVocabCount( const QString& box );
+    void decrementBoxVocabCount( const QString& box );
+
+    //inserts a box with number, name, correct and wrong word box
+    bool insertBox( const QString& name, int correctWordBox, int wrongWordBox );
+    bool insertBox( const QString& name );
+    void deleteBox( int box );
+    void deleteBox( LeitnerBox* box );
 
 private:
-       QString m_systemName;                           //the systems name
+    QString m_systemName;    //the systems name
 
-       QList<LeitnerBox> m_boxes;
+    QList<LeitnerBox> m_boxes;
 };
 
 #endif
index 4b8b91a905800b6b2f0ce16b19d152e5605c502c..5b480429bee289411638c646ed83a251e78f600a 100644 (file)
 class LeitnerSystemView::LeitnerSystemViewPrivate
 {
 public:
-       LeitnerSystemViewPrivate( LeitnerSystemView* qq )
-         : q( qq ), m_highlightedBox( -1 )
-       {
-       }
+    LeitnerSystemViewPrivate( LeitnerSystemView* qq )
+            : q( qq ), m_highlightedBox( -1 )
+    {}
 
-       LeitnerSystemView *q;
+    LeitnerSystemView *q;
 
-       LeitnerSystem* m_leitnerSystem;         //the system which is shown
+    LeitnerSystem* m_leitnerSystem;  //the system which is shown
 
-       void drawSystem(QPainter*);             //paints the boxes
-       void drawConnections(QPainter*);        //paints the arrows between the boxes
-       void calculateSize();
+    void drawSystem( QPainter* ); //paints the boxes
+    void drawConnections( QPainter* ); //paints the arrows between the boxes
+    void calculateSize();
 
-       int m_imageY;                           //high border of the images
-       int m_distPixmap;
-       int m_highlightedBox;                   //the box which is currently highlighted
+    int m_imageY;     //high border of the images
+    int m_distPixmap;
+    int m_highlightedBox;   //the box which is currently highlighted
 };
 
 
 LeitnerSystemView::LeitnerSystemView( QWidget* parent )
-  : QWidget( parent ), d( new LeitnerSystemViewPrivate( this ) )
-{
-}
+        : QWidget( parent ), d( new LeitnerSystemViewPrivate( this ) )
+{}
 
 
 LeitnerSystemView::~LeitnerSystemView()
 {
-       delete d;
+    delete d;
 }
 
 void LeitnerSystemView::LeitnerSystemViewPrivate::drawSystem( QPainter* p )
 {
-       m_imageY = q->height() / 2 - 32;
-
-       //draw the boxes' icons
-       for(int i = 0; i < m_leitnerSystem->getNumberOfBoxes(); i++)
-       {
-               if(i == m_highlightedBox)
-               {
-                       //p->drawPixmap(12 + i * 64 + i*10, m_imageY, KGlobal::iconLoader()->loadIcon("leitnerbox", K3Icon::Panel));
-                       p->drawRect(12 + i * 64 + i*10, m_imageY,64,64);
-                       p->fillRect(12 + i * 64 + i*10, m_imageY,64,64, QBrush(Qt::red));
-               }
-               else
-               {       //for each box 74 = 64(pixmap) + 10(distance between two boxes)
-                       //p->drawPixmap(12 + i * 74, m_imageY, KGlobal::iconLoader()->loadIcon("leitnerbox", K3Icon::Panel));
-                       p->drawRect(12 + i * 64 + i*10, m_imageY,64,64);
-               }
-       }
+    m_imageY = q->height() / 2 - 32;
+
+    //draw the boxes' icons
+    for ( int i = 0; i < m_leitnerSystem->getNumberOfBoxes(); i++ ) {
+        if ( i == m_highlightedBox ) {
+            //p->drawPixmap(12 + i * 64 + i*10, m_imageY, KGlobal::iconLoader()->loadIcon("leitnerbox", K3Icon::Panel));
+            p->drawRect( 12 + i * 64 + i*10, m_imageY,64,64 );
+            p->fillRect( 12 + i * 64 + i*10, m_imageY,64,64, QBrush( Qt::red ) );
+        } else { //for each box 74 = 64(pixmap) + 10(distance between two boxes)
+            //p->drawPixmap(12 + i * 74, m_imageY, KGlobal::iconLoader()->loadIcon("leitnerbox", K3Icon::Panel));
+            p->drawRect( 12 + i * 64 + i*10, m_imageY,64,64 );
+        }
+    }
 }
 
-void LeitnerSystemView::LeitnerSystemViewPrivate::drawConnections(QPainter* p)
+void LeitnerSystemView::LeitnerSystemViewPrivate::drawConnections( QPainter* p )
 {
-       //dist = number of boxes that are in between the two boxes
-       //width = width of the rect for the arc
-       int dist, width = 0;
-       int numberOfBoxes = m_leitnerSystem->getNumberOfBoxes();
-
-       p->setPen( QPen(Qt::green, 2) );
-
-       //paint the connections for the correct word boxes, above the boxes
-       for(int i = 0; i < numberOfBoxes; i++)
-       {
-               if( m_leitnerSystem->correctBoxNumber( i ) != -1 )
-               {
-                       dist = m_leitnerSystem->correctBoxNumber( i ) - i;
-
-                       if(dist <= 0)
-                       {
-                               // (dist*(-1) -1)*64 == for each box in between take 64
-                               // dist*(-1)*10 == the gaps in between
-                               // 2*22; 2*21 == the distances of the endings on the picture
-                               width = (dist*(-1) -1)*64 + dist*(-1)*10 + 2*22 + 2*21;
-
-                               p->drawArc( 12 + (dist+i)*74 + 21, m_imageY-(width/3), width, /*(height()/2 - 12-32) *2*/ width/3*2, 0, 180*16);
-                       }
-                       else
-                       {
-                               width = (dist-1)*64 + dist*10 + 2*21;
-                               p->drawArc(12 + i*74 + 21+22 ,m_imageY-(width/3) , width, /*(height()/2 - 12-32) *2*/width/3*2, 0, 180*16);
-                       }
-               }
-       }
-
-       //paint the connections for the wrong word boxes, below the boxes
-       p->setPen(QPen(Qt::red, 2));
-
-       for(int i = 0; i < numberOfBoxes; i++)
-       {
-               if( m_leitnerSystem->wrongBoxNumber( i ) != -1 )
-               {
-                       dist = m_leitnerSystem->wrongBoxNumber( i ) - i;
-
-                       if(dist <= 0)
-                       {
-                               width = (dist*(-1) -1)*64 + dist*(-1)*10 + 2*22 + 2*21;
-                               p->drawArc(12+ (dist+i)*74 + 21 ,m_imageY+64-width/3 , width, width/3*2 , 180*16, 180*16);
-                       }
-                       else
-                       {
-                               width = (dist-1)*64 + dist*10 + 2*21;
-                               p->drawArc(12 + i*74 + 21+22 ,m_imageY+64-width/3 , width, width/3*2, 180*16, 180*16);
-                       }
-               }
-       }
+    //dist = number of boxes that are in between the two boxes
+    //width = width of the rect for the arc
+    int dist, width = 0;
+    int numberOfBoxes = m_leitnerSystem->getNumberOfBoxes();
+
+    p->setPen( QPen( Qt::green, 2 ) );
+
+    //paint the connections for the correct word boxes, above the boxes
+    for ( int i = 0; i < numberOfBoxes; i++ ) {
+        if ( m_leitnerSystem->correctBoxNumber( i ) != -1 ) {
+            dist = m_leitnerSystem->correctBoxNumber( i ) - i;
+
+            if ( dist <= 0 ) {
+                // (dist*(-1) -1)*64 == for each box in between take 64
+                // dist*(-1)*10 == the gaps in between
+                // 2*22; 2*21 == the distances of the endings on the picture
+                width = ( dist* ( -1 ) -1 ) *64 + dist* ( -1 ) *10 + 2*22 + 2*21;
+
+                p->drawArc( 12 + ( dist+i ) *74 + 21, m_imageY- ( width/3 ), width, /*(height()/2 - 12-32) *2*/ width/3*2, 0, 180*16 );
+            } else {
+                width = ( dist-1 ) *64 + dist*10 + 2*21;
+                p->drawArc( 12 + i*74 + 21+22 ,m_imageY- ( width/3 ) , width, /*(height()/2 - 12-32) *2*/width/3*2, 0, 180*16 );
+            }
+        }
+    }
+
+    //paint the connections for the wrong word boxes, below the boxes
+    p->setPen( QPen( Qt::red, 2 ) );
+
+    for ( int i = 0; i < numberOfBoxes; i++ ) {
+        if ( m_leitnerSystem->wrongBoxNumber( i ) != -1 ) {
+            dist = m_leitnerSystem->wrongBoxNumber( i ) - i;
+
+            if ( dist <= 0 ) {
+                width = ( dist* ( -1 ) -1 ) *64 + dist* ( -1 ) *10 + 2*22 + 2*21;
+                p->drawArc( 12+ ( dist+i ) *74 + 21 ,m_imageY+64-width/3 , width, width/3*2 , 180*16, 180*16 );
+            } else {
+                width = ( dist-1 ) *64 + dist*10 + 2*21;
+                p->drawArc( 12 + i*74 + 21+22 ,m_imageY+64-width/3 , width, width/3*2, 180*16, 180*16 );
+            }
+        }
+    }
 }
 
 void LeitnerSystemView::setSystem( LeitnerSystem* leitnersystem )
 {
-       d->m_leitnerSystem = leitnersystem;
+    d->m_leitnerSystem = leitnersystem;
 
-       //calculate the new sizes
-       d->calculateSize();
-       update();
+    //calculate the new sizes
+    d->calculateSize();
+    update();
 }
 
-void LeitnerSystemView::highlightBox(int box)
+void LeitnerSystemView::highlightBox( int box )
 {
-       d->m_highlightedBox = box;
-       update();
+    d->m_highlightedBox = box;
+    update();
 }
 
 void LeitnerSystemView::paintEvent( QPaintEvent* )
 {
-       QPainter p( this );
-       p.eraseRect( 0, 0, width(), height() );
+    QPainter p( this );
+    p.eraseRect( 0, 0, width(), height() );
 
-       d->drawSystem( &p );
+    d->drawSystem( &p );
 
-       d->drawConnections( &p );
+    d->drawConnections( &p );
 }
 
 void LeitnerSystemView::LeitnerSystemViewPrivate::calculateSize()
 {
-       //margin = 12
-       //distance between boxes = 10
-       //boxes = 64*64
-
-       int numberOfBoxes = m_leitnerSystem->getNumberOfBoxes();
-       QString x;
-       int height, dist, tmpMaxC, tmpMaxW;
-       tmpMaxC = 0;
-       tmpMaxW = 0;
-       height = 0;
-
-       for(int i = 0; i < numberOfBoxes; i++)
-       {
-               if( m_leitnerSystem->correctBoxNumber( i ) != -1 )
-               {
-                       dist = m_leitnerSystem->correctBoxNumber( i ) - i;
-
-                       if( abs(dist) >= abs(tmpMaxC) )
-                               tmpMaxC = dist;
-               }
-
-               if( m_leitnerSystem->wrongBoxNumber( i ) != -1 )
-               {
-                       dist = m_leitnerSystem->wrongBoxNumber( i ) - i;
-
-                       if( abs(dist) >= abs(tmpMaxW) )
-                               tmpMaxW = dist;
-               }
-       }
-
-       if( tmpMaxC <= 0 )
-               height += (( abs(tmpMaxC) -1)*64 + abs(tmpMaxC)*10 + 2*22 + 2*21)/3;
-       else
-               height += ((tmpMaxC-1)*64 + tmpMaxC*10 + 2*21)/3;
-
-       if( tmpMaxW <= 0 )
-               height += (( abs(tmpMaxW) -1)*64 + abs(tmpMaxW)*10 + 2*22 + 2*21)/3;
-       else
-               height += (( tmpMaxW-1)*64 + tmpMaxW*10 + 2*21)/3;
-
-       height += 24+64;
-
-//     resizeContents( numberOfBoxes * 64 + (numberOfBoxes - 1)*10 + 2 * 12, height );
-       q->setMinimumSize( numberOfBoxes * 64 + (numberOfBoxes - 1)*10 + 2 * 12, height );
+    //margin = 12
+    //distance between boxes = 10
+    //boxes = 64*64
+
+    int numberOfBoxes = m_leitnerSystem->getNumberOfBoxes();
+    QString x;
+    int height, dist, tmpMaxC, tmpMaxW;
+    tmpMaxC = 0;
+    tmpMaxW = 0;
+    height = 0;
+
+    for ( int i = 0; i < numberOfBoxes; i++ ) {
+        if ( m_leitnerSystem->correctBoxNumber( i ) != -1 ) {
+            dist = m_leitnerSystem->correctBoxNumber( i ) - i;
+
+            if ( abs( dist ) >= abs( tmpMaxC ) )
+                tmpMaxC = dist;
+        }
+
+        if ( m_leitnerSystem->wrongBoxNumber( i ) != -1 ) {
+            dist = m_leitnerSystem->wrongBoxNumber( i ) - i;
+
+            if ( abs( dist ) >= abs( tmpMaxW ) )
+                tmpMaxW = dist;
+        }
+    }
+
+    if ( tmpMaxC <= 0 )
+        height += (( abs( tmpMaxC ) -1 ) *64 + abs( tmpMaxC ) *10 + 2*22 + 2*21 ) /3;
+    else
+        height += (( tmpMaxC-1 ) *64 + tmpMaxC*10 + 2*21 ) /3;
+
+    if ( tmpMaxW <= 0 )
+        height += (( abs( tmpMaxW ) -1 ) *64 + abs( tmpMaxW ) *10 + 2*22 + 2*21 ) /3;
+    else
+        height += (( tmpMaxW-1 ) *64 + tmpMaxW*10 + 2*21 ) /3;
+
+    height += 24+64;
+
+// resizeContents( numberOfBoxes * 64 + (numberOfBoxes - 1)*10 + 2 * 12, height );
+    q->setMinimumSize( numberOfBoxes * 64 + ( numberOfBoxes - 1 ) *10 + 2 * 12, height );
 }
 
-void LeitnerSystemView::mousePressEvent(QMouseEvent* e)
+void LeitnerSystemView::mousePressEvent( QMouseEvent* e )
 {
-       kDebug() << "mouseClick";
-       //if the user has clicked into a box
-       if( e->y() > d->m_imageY && e->y() < d->m_imageY + 64 && e->x() < width() )
-       {
-               int dd = (e->x()-12)/74;
-
-               if((e->x()-12-74*dd) <= 64)
-               {
-                       //signal for prefLeitner to set the comboboxes to the clicked box
-                       emit boxClicked( dd );
-                       d->m_highlightedBox = dd;
-
-                       update();
-               }
-       }
+    kDebug() << "mouseClick";
+    //if the user has clicked into a box
+    if ( e->y() > d->m_imageY && e->y() < d->m_imageY + 64 && e->x() < width() ) {
+        int dd = ( e->x()-12 ) /74;
+
+        if (( e->x()-12-74*dd ) <= 64 ) {
+            //signal for prefLeitner to set the comboboxes to the clicked box
+            emit boxClicked( dd );
+            d->m_highlightedBox = dd;
+
+            update();
+        }
+    }
 }
 
 #include "leitnersystemview.moc"
index 2e4406e0f302f8c243a91d77f756c8f9a715c901..23a64790f06dd013365aa318431b7fdff1b9ea5c 100644 (file)
@@ -34,42 +34,42 @@ class LeitnerSystem;
  */
 class KEDUVOCDOCUMENT_EXPORT LeitnerSystemView : public QWidget
 {
-       Q_OBJECT
+    Q_OBJECT
 
 public:
-       /**
-        * The public constructor
-        * @param parent the QWidget that is the parent widget
-        */
-       explicit LeitnerSystemView( QWidget* parent = 0 );
+    /**
+     * The public constructor
+     * @param parent the QWidget that is the parent widget
+     */
+    explicit LeitnerSystemView( QWidget* parent = 0 );
 
-       ~LeitnerSystemView();
+    ~LeitnerSystemView();
 
-       /**
-        * Sets the LeitnerSystem to be displayed in the LeitnerSystemView
-        * @param system the LeitnerSystem to be displayed
-        */
-       void setSystem( LeitnerSystem* system );
+    /**
+     * Sets the LeitnerSystem to be displayed in the LeitnerSystemView
+     * @param system the LeitnerSystem to be displayed
+     */
+    void setSystem( LeitnerSystem* system );
 
-       /**
-        * Highlight a special box to indicate that this one is selected
-        * @param box the number of the box to be highlighted
-        */
-       void highlightBox( int box );
+    /**
+     * Highlight a special box to indicate that this one is selected
+     * @param box the number of the box to be highlighted
+     */
+    void highlightBox( int box );
 
 Q_SIGNALS:
-       void boxClicked(int box);  //is emitted if the user clicks on a box
+    void boxClicked( int box ); //is emitted if the user clicks on a box
 
 protected:
-       virtual void paintEvent( QPaintEvent* );
-//     virtual void drawContents(QPainter* p, int clipx, int clipy, int clipw, int cliph);
-       virtual void mousePressEvent(QMouseEvent* e);
+    virtual void paintEvent( QPaintEvent* );
+//     virtual void drawContents(QPainter* p, int clipx, int clipy, int clipw, int cliph);
+    virtual void mousePressEvent( QMouseEvent* e );
 
 private:
-       class LeitnerSystemViewPrivate;
-       LeitnerSystemViewPrivate* const d;
+    class LeitnerSystemViewPrivate;
+    LeitnerSystemViewPrivate* const d;
 
-       Q_DISABLE_COPY( LeitnerSystemView )
+    Q_DISABLE_COPY( LeitnerSystemView )
 };
 
 #endif
index 2e000ed5fc4a714dfa72cd4a45a469955fdcf113..c5675d825c39392a0b524a6833b0b00524294a08 100644 (file)
 
 #ifndef KEDUVOCDOCUMENT_EXPORT
 # if defined(MAKE_KEDUVOCDOCUMENT_LIB)
-   /* We are building this library */ 
+/* We are building this library */
 #  define KEDUVOCDOCUMENT_EXPORT KDE_EXPORT
 # else
-   /* We are using this library */ 
+/* We are using this library */
 #  define KEDUVOCDOCUMENT_EXPORT KDE_IMPORT
 # endif
 #endif
index 35c339eed2a7c840207b2ca0e0c58e30fb5f0328..67fb2744040c7e9b886d19458b7a169cff5e3888 100644 (file)
 class PrefLeitner::PrefLeitnerPrivate
 {
 public:
-       PrefLeitnerPrivate( PrefLeitner* qq, LeitnerSystem* system )
-         : q( qq ), m_leitnerSystemView( 0 ), m_selectedSystem( system ),
-           m_selectedBox( 0 )
-       {
-               init();
-       }
+    PrefLeitnerPrivate( PrefLeitner* qq, LeitnerSystem* system )
+            : q( qq ), m_leitnerSystemView( 0 ), m_selectedSystem( system ),
+            m_selectedBox( 0 )
+    {
+        init();
+    }
 
-       PrefLeitner* q;
+    PrefLeitner* q;
 
-       LeitnerSystemView* m_leitnerSystemView; //the LeitnerSystemView which shows the selected system
-       LeitnerSystem* m_selectedSystem;        //the currently selected system to be changed
-       LeitnerBox* m_selectedBox;              //the currently selected box
+    LeitnerSystemView* m_leitnerSystemView; //the LeitnerSystemView which shows the selected system
+    LeitnerSystem* m_selectedSystem; //the currently selected system to be changed
+    LeitnerBox* m_selectedBox;  //the currently selected box
 
-       Ui::PrefLeitnerBase m_ui;
+    Ui::PrefLeitnerBase m_ui;
 
-       void init();
+    void init();
 
-       void refreshSystemView();               //refresh the LeitnerSystemView
-       void newSystem();
+    void refreshSystemView();  //refresh the LeitnerSystemView
+    void newSystem();
 
-       // slots
-       // catches the signal from the view if user clicks on a box
-       void slotBoxClicked( int );
+    // slots
+    // catches the signal from the view if user clicks on a box
+    void slotBoxClicked( int );
 };
 
 
 PrefLeitner::PrefLeitner( QWidget* parent )
-  : QDialog( parent ), d( new PrefLeitnerPrivate( this, 0 ) )
-{
-}
+        : QDialog( parent ), d( new PrefLeitnerPrivate( this, 0 ) )
+{}
 
 PrefLeitner::PrefLeitner( LeitnerSystem* system, QWidget* parent )
-  : QDialog( parent ), d( new PrefLeitnerPrivate( this, system ) )
-{
-}
+        : QDialog( parent ), d( new PrefLeitnerPrivate( this, system ) )
+{}
 
 PrefLeitner::~PrefLeitner()
 {
-       delete d;
+    delete d;
 }
 
 void PrefLeitner::PrefLeitnerPrivate::init()
 {
-       m_ui.setupUi( q );
+    m_ui.setupUi( q );
 
-       QScrollArea *helperSV = new QScrollArea( q );
+    QScrollArea *helperSV = new QScrollArea( q );
 
-       m_leitnerSystemView = new LeitnerSystemView( helperSV->viewport() );
-        m_leitnerSystemView->setObjectName( "LeitnerSystemView" );
+    m_leitnerSystemView = new LeitnerSystemView( helperSV->viewport() );
+    m_leitnerSystemView->setObjectName( "LeitnerSystemView" );
 
-        helperSV->setWidget( m_leitnerSystemView );
+    helperSV->setWidget( m_leitnerSystemView );
 
-       connect( m_leitnerSystemView, SIGNAL( boxClicked( int ) ), q, SLOT( slotBoxClicked( int ) ) );
+    connect( m_leitnerSystemView, SIGNAL( boxClicked( int ) ), q, SLOT( slotBoxClicked( int ) ) );
 
-       if ( m_selectedSystem )
-       {
-               //insert the list of box' names in the comboboxes
-               m_ui.cmbWrong->addItems( m_selectedSystem->getBoxNameList() );
-               m_ui.cmbCorrect->addItems( m_selectedSystem->getBoxNameList() );
+    if ( m_selectedSystem ) {
+        //insert the list of box' names in the comboboxes
+        m_ui.cmbWrong->addItems( m_selectedSystem->getBoxNameList() );
+        m_ui.cmbCorrect->addItems( m_selectedSystem->getBoxNameList() );
 
-               //show leitnersystem
-               m_leitnerSystemView->setSystem( m_selectedSystem );
-       }
+        //show leitnersystem
+        m_leitnerSystemView->setSystem( m_selectedSystem );
+    }
 }
 
 void PrefLeitner::slotCorrectWord( const QString& newBox )
 {
-       if( d->m_selectedBox == 0 )
-               return;
+    if ( d->m_selectedBox == 0 )
+        return;
 
-       //when the correct word box was changed in the combobox
-       d->m_selectedBox->setCorrectWordBox( d->m_selectedSystem->boxWithName( newBox ) );
-       d->refreshSystemView();
+    //when the correct word box was changed in the combobox
+    d->m_selectedBox->setCorrectWordBox( d->m_selectedSystem->boxWithName( newBox ) );
+    d->refreshSystemView();
 }
 
 void PrefLeitner::slotWrongWord( const QString& newBox )
 {
-       if( d->m_selectedBox == 0 )
-               return;
+    if ( d->m_selectedBox == 0 )
+        return;
 
-       //when the wrong word box was changed in the combobox
-       d->m_selectedBox->setWrongWordBox( d->m_selectedSystem->boxWithName( newBox ) );
-       d->refreshSystemView();
+    //when the wrong word box was changed in the combobox
+    d->m_selectedBox->setWrongWordBox( d->m_selectedSystem->boxWithName( newBox ) );
+    d->refreshSystemView();
 }
 
 void PrefLeitner::slotBoxName( const QString& newName )
 {
-       if( d->m_selectedBox == 0 )
-               return;
+    if ( d->m_selectedBox == 0 )
+        return;
 
-       //when the boxes name was changed
-       d->m_selectedSystem->setBoxName( d->m_selectedBox, newName );
+    //when the boxes name was changed
+    d->m_selectedSystem->setBoxName( d->m_selectedBox, newName );
 }
 
 void PrefLeitner::PrefLeitnerPrivate::newSystem()
 {
-       m_ui.cmbCorrect->addItems( m_selectedSystem->getBoxNameList() );
-       m_ui.cmbWrong->addItems( m_selectedSystem->getBoxNameList() );
+    m_ui.cmbCorrect->addItems( m_selectedSystem->getBoxNameList() );
+    m_ui.cmbWrong->addItems( m_selectedSystem->getBoxNameList() );
 
-       refreshSystemView();
+    refreshSystemView();
 }
 
 void PrefLeitner::PrefLeitnerPrivate::refreshSystemView()
 {
-       m_leitnerSystemView->setSystem( m_selectedSystem );
+    m_leitnerSystemView->setSystem( m_selectedSystem );
 }
 
 void PrefLeitner::PrefLeitnerPrivate::slotBoxClicked( int box )
 {
-       m_selectedBox = m_selectedSystem->boxWithNumber( box );
+    m_selectedBox = m_selectedSystem->boxWithNumber( box );
 
-       m_ui.cmbCorrect->setCurrentIndex( m_selectedSystem->correctBoxNumber( box ) );
-       m_ui.cmbWrong->setCurrentIndex( m_selectedSystem->wrongBoxNumber( box ) );
-       m_ui.lndBoxName->setText( m_selectedBox->boxName() );
+    m_ui.cmbCorrect->setCurrentIndex( m_selectedSystem->correctBoxNumber( box ) );
+    m_ui.cmbWrong->setCurrentIndex( m_selectedSystem->wrongBoxNumber( box ) );
+    m_ui.lndBoxName->setText( m_selectedBox->boxName() );
 }
 
 void PrefLeitner::slotAddBox()
 {
-       d->m_selectedSystem->insertBox( "New Box", 1, 1 );
-       d->refreshSystemView();
+    d->m_selectedSystem->insertBox( "New Box", 1, 1 );
+    d->refreshSystemView();
 }
 
 void PrefLeitner::slotDeleteBox()
 {
-       d->m_selectedSystem->deleteBox( d->m_selectedBox );
-       d->m_selectedBox = 0;
+    d->m_selectedSystem->deleteBox( d->m_selectedBox );
+    d->m_selectedBox = 0;
 
-       d->refreshSystemView();
+    d->refreshSystemView();
 }
 
 void PrefLeitner::slotApply()
 {
-       setResult( QDialog::Accepted );
-       close();
+    setResult( QDialog::Accepted );
+    close();
 }
 
 void PrefLeitner::slotDiscard()
 {
-       setResult( QDialog::Rejected );
-       close();
+    setResult( QDialog::Rejected );
+    close();
 }
 
 LeitnerSystem* PrefLeitner::system()
 {
-       return d->m_selectedSystem;
+    return d->m_selectedSystem;
 }
 
 #include "prefleitner.moc"
index 2b1f3328bc92a2efc35f87fdfd0e951dbf899031..0be0ccdea9f26708413106c3898209c71ba9a46c 100644 (file)
@@ -33,54 +33,54 @@ class LeitnerSystem;
  */
 class KEDUVOCDOCUMENT_EXPORT PrefLeitner : public QDialog
 {
-       Q_OBJECT
+    Q_OBJECT
 
 public:
-       /**
-        * The public contructor
-        * @param parent the widget's parent
-        */
-       explicit PrefLeitner( QWidget* parent = 0 );
+    /**
+     * The public contructor
+     * @param parent the widget's parent
+     */
+    explicit PrefLeitner( QWidget* parent = 0 );
 
-       /**
-        * The public contructur which sets also the LeitnerSystem
-        * @param parent is the parent widget
-        * @param system a pointer to the LeitnerSystem to configure
-        */
-       explicit PrefLeitner( LeitnerSystem* system, QWidget* parent = 0 );
+    /**
+     * The public contructur which sets also the LeitnerSystem
+     * @param parent is the parent widget
+     * @param system a pointer to the LeitnerSystem to configure
+     */
+    explicit PrefLeitner( LeitnerSystem* system, QWidget* parent = 0 );
 
-       /**
-        * The public destructor
-        */
-       ~PrefLeitner();
+    /**
+     * The public destructor
+     */
+    ~PrefLeitner();
 
-       /**
-        * Sets the LeitnerSystem for the dialog
-        * @param system a pointer to the LeitnerSystem to configure
-        */
-       void setLeitnerSystem( LeitnerSystem* system );
+    /**
+     * Sets the LeitnerSystem for the dialog
+     * @param system a pointer to the LeitnerSystem to configure
+     */
+    void setLeitnerSystem( LeitnerSystem* system );
 
-       /**
-        * Get the LeitnerSystem that is set to the dialog
-        * @return a pointer to the actual set LeitnerSystem
-        */
-       LeitnerSystem* system();
+    /**
+     * Get the LeitnerSystem that is set to the dialog
+     * @return a pointer to the actual set LeitnerSystem
+     */
+    LeitnerSystem* system();
 
 public Q_SLOTS:
-       void slotCorrectWord( const QString& newBox );
-       void slotWrongWord( const QString& newBox );
-       void slotBoxName( const QString& newName );
-       void slotAddBox();
-       void slotDeleteBox();
-       void slotDiscard();
-       void slotApply();
+    void slotCorrectWord( const QString& newBox );
+    void slotWrongWord( const QString& newBox );
+    void slotBoxName( const QString& newName );
+    void slotAddBox();
+    void slotDeleteBox();
+    void slotDiscard();
+    void slotApply();
 
 private:
-       class PrefLeitnerPrivate;
-       PrefLeitnerPrivate* const d;
+    class PrefLeitnerPrivate;
+    PrefLeitnerPrivate* const d;
 
-       Q_DISABLE_COPY( PrefLeitner )
-       Q_PRIVATE_SLOT( d, void slotBoxClicked( int ) )
+    Q_DISABLE_COPY( PrefLeitner )
+    Q_PRIVATE_SLOT( d, void slotBoxClicked( int ) )
 };
 
 #endif //PREFLEITNER_H
index abb5582702e65c430922a5d88912c85a8c22f4bc..b1ac0dc7101c4b485f1508b8e6fb0b19f4eb07e0 100644 (file)
 
 class SharedKvtmlFilesPrivate
 {
-  public:
+public:
     /** default constructor calls rescan*/
-       SharedKvtmlFilesPrivate()
-       {
-               rescan();
-       }
-       
-       /** default destructor */
-       ~SharedKvtmlFilesPrivate()
-       {
-       }
-       
-       /** scan the folder for documents, and record what is found */
-       void rescan();
+    SharedKvtmlFilesPrivate()
+    {
+        rescan();
+    }
+
+    /** default destructor */
+    ~SharedKvtmlFilesPrivate()
+    {}
+
+    /** scan the folder for documents, and record what is found */
+    void rescan();
 
     /** list of all files found */
     QStringList m_fileList;
-       
-       /** list of all files titles found */
-       QStringList m_titleList;
-       
-       /** list of file comments */
-       QStringList m_commentList;
-       
-       /** map of files by language key */
-       QMap<QString, QStringList> m_filesByLang;
+
+    /** list of all files titles found */
+    QStringList m_titleList;
+
+    /** list of file comments */
+    QStringList m_commentList;
+
+    /** map of files by language key */
+    QMap<QString, QStringList> m_filesByLang;
 };
 
-K_GLOBAL_STATIC(SharedKvtmlFilesPrivate, sharedKvtmlFilesPrivate)
+K_GLOBAL_STATIC( SharedKvtmlFilesPrivate, sharedKvtmlFilesPrivate )
 
 void SharedKvtmlFilesPrivate::rescan()
 {
-       this->m_titleList.clear();
-       this->m_commentList.clear();
-       this->m_filesByLang.clear();
+    this->m_titleList.clear();
+    this->m_commentList.clear();
+    this->m_filesByLang.clear();
     this->m_fileList.clear();
-       
+
     QStringList locales;
-    
-    QStringList dataPaths = KGlobal::dirs()->findDirs("data", "kvtml/");
-    for (int i = 0; i < dataPaths.size(); ++i)
-    {
-        locales += QDir(dataPaths[i]).entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
+
+    QStringList dataPaths = KGlobal::dirs()->findDirs( "data", "kvtml/" );
+    for ( int i = 0; i < dataPaths.size(); ++i ) {
+        locales += QDir( dataPaths[i] ).entryList( QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name );
     }
-    
+
     // remove duplicates
     locales = locales.toSet().toList();
-    
-    for (int i = 0; i < locales.size(); ++i)
-    {
+
+    for ( int i = 0; i < locales.size(); ++i ) {
         // get all files for this language
-        QStringList thisLangFiles = KGlobal::dirs()->findAllResources("data", 
-                QString("kvtml/%1/*.kvtml").arg(QDir(locales[i]).dirName()));
+        QStringList thisLangFiles = KGlobal::dirs()->findAllResources( "data",
+                                    QString( "kvtml/%1/*.kvtml" ).arg( QDir( locales[i] ).dirName() ) );
         // add them to the big list
         this->m_fileList << thisLangFiles;
-        
+
         // then add them to their respective language maps
-        for (int j = 0; j < thisLangFiles.size(); ++j)
-        {
-            this->m_filesByLang[locales[i]].append(thisLangFiles[j]);
+        for ( int j = 0; j < thisLangFiles.size(); ++j ) {
+            this->m_filesByLang[locales[i]].append( thisLangFiles[j] );
         }
     }
-    
-       KEduVocDocument *doc = new KEduVocDocument();
-    for (int i = 0; i < this->m_fileList.size(); ++i)
-    {
+
+    KEduVocDocument *doc = new KEduVocDocument();
+    for ( int i = 0; i < this->m_fileList.size(); ++i ) {
         // open the file
-        doc->open(KUrl::fromPath(this->m_fileList[i]));
-        
+        doc->open( KUrl::fromPath( this->m_fileList[i] ) );
+
         // add it's title to the title list
-        this->m_titleList.append(doc->title());
-        
+        this->m_titleList.append( doc->title() );
+
         // add it's comment to the comment list
-        this->m_commentList.append(doc->documentRemark());
+        this->m_commentList.append( doc->documentRemark() );
     }
-       // plug a memory leak
-       delete doc;
+    // plug a memory leak
+    delete doc;
 }
 
 void SharedKvtmlFiles::rescan()
 {
-       sharedKvtmlFilesPrivate->rescan();
+    sharedKvtmlFilesPrivate->rescan();
 }
 
 QStringList SharedKvtmlFiles::languages()
 {
-       return sharedKvtmlFilesPrivate->m_filesByLang.keys();
+    return sharedKvtmlFilesPrivate->m_filesByLang.keys();
 }
 
-QStringList SharedKvtmlFiles::fileNames(const QString &language)
+QStringList SharedKvtmlFiles::fileNames( const QString &language )
 {
-       // return files by language for given language if it's not empty
-       // otherwise return all filenames
-       return language.isEmpty() ? sharedKvtmlFilesPrivate->m_fileList : sharedKvtmlFilesPrivate->m_filesByLang.value(language);
+    // return files by language for given language if it's not empty
+    // otherwise return all filenames
+    return language.isEmpty() ? sharedKvtmlFilesPrivate->m_fileList : sharedKvtmlFilesPrivate->m_filesByLang.value( language );
 }
 
-QStringList SharedKvtmlFiles::titles(const QString &language)
+QStringList SharedKvtmlFiles::titles( const QString &language )
 {
-       QStringList retlist;
-
-       if (language.isEmpty())
-       {
-               retlist = sharedKvtmlFilesPrivate->m_titleList;
-       }
-       else
-       {
-               QStringList filenames = sharedKvtmlFilesPrivate->m_filesByLang.value(language);
-               for (int i = 0; i < filenames.size(); ++i)
-               {
-                       retlist.append(sharedKvtmlFilesPrivate->m_titleList[sharedKvtmlFilesPrivate->m_fileList.indexOf(filenames[i])]);
-               }
-       }
-
-       return retlist;
+    QStringList retlist;
+
+    if ( language.isEmpty() ) {
+        retlist = sharedKvtmlFilesPrivate->m_titleList;
+    } else {
+        QStringList filenames = sharedKvtmlFilesPrivate->m_filesByLang.value( language );
+        for ( int i = 0; i < filenames.size(); ++i ) {
+            retlist.append( sharedKvtmlFilesPrivate->m_titleList[sharedKvtmlFilesPrivate->m_fileList.indexOf( filenames[i] )] );
+        }
+    }
+
+    return retlist;
 }
 
-QStringList SharedKvtmlFiles::comments(const QString &language)
+QStringList SharedKvtmlFiles::comments( const QString &language )
 {
-       QStringList retlist;
-
-       if (language.isEmpty())
-       {
-               retlist = sharedKvtmlFilesPrivate->m_commentList;
-       }
-       else
-       {
-               QStringList filenames = sharedKvtmlFilesPrivate->m_filesByLang.value(language);
-               for (int i = 0; i < filenames.size(); ++i)
-               {
-                       retlist.append(sharedKvtmlFilesPrivate->m_commentList[sharedKvtmlFilesPrivate->m_fileList.indexOf(filenames[i])]);
-               }
-       }
-
-       return retlist;
+    QStringList retlist;
+
+    if ( language.isEmpty() ) {
+        retlist = sharedKvtmlFilesPrivate->m_commentList;
+    } else {
+        QStringList filenames = sharedKvtmlFilesPrivate->m_filesByLang.value( language );
+        for ( int i = 0; i < filenames.size(); ++i ) {
+            retlist.append( sharedKvtmlFilesPrivate->m_commentList[sharedKvtmlFilesPrivate->m_fileList.indexOf( filenames[i] )] );
+        }
+    }
+
+    return retlist;
 }
 
 void SharedKvtmlFiles::sortDownloadedFiles()
 {
-       QStringList unsortedFiles = KGlobal::dirs()->findAllResources("data", 
-               QString("kvtml/*.kvtml"));
-       
-       KEduVocDocument *doc = new KEduVocDocument();
-
-       while (unsortedFiles.size() > 0)
-       {
-               KUrl fileUrl(KUrl::fromPath(unsortedFiles.first()));
-               // find the file's locale
+    QStringList unsortedFiles = KGlobal::dirs()->findAllResources( "data",
+                                QString( "kvtml/*.kvtml" ) );
+
+    KEduVocDocument *doc = new KEduVocDocument();
+
+    while ( unsortedFiles.size() > 0 ) {
+        KUrl fileUrl( KUrl::fromPath( unsortedFiles.first() ) );
+        // find the file's locale
         // open the file
-        doc->open(fileUrl);
-
-               QString locale = doc->identifier(0);
-
-               // make sure the locale sub-folder exists
-               KUrl pathUrl(fileUrl);
-               pathUrl.setFileName(QString());
-               pathUrl.addPath(locale);
-               KIO::mkdir(pathUrl);
-               
-               // move the file into the locale sub-folder
-               KIO::move(fileUrl, pathUrl);
-               
-               // take off the one we just did
-               unsortedFiles.removeFirst();
-       }
-       
-       rescan();
+        doc->open( fileUrl );
+
+        QString locale = doc->identifier( 0 );
+
+        // make sure the locale sub-folder exists
+        KUrl pathUrl( fileUrl );
+        pathUrl.setFileName( QString() );
+        pathUrl.addPath( locale );
+        KIO::mkdir( pathUrl );
+
+        // move the file into the locale sub-folder
+        KIO::move( fileUrl, pathUrl );
+
+        // take off the one we just did
+        unsortedFiles.removeFirst();
+    }
+
+    rescan();
 }
index b272d599eed2d3cacef59f149b5aeb2205859824..2acc6bad83fff9f03ecc82ac1ba99ac014f26991 100644 (file)
  */
 namespace SharedKvtmlFiles
 {
-  /** get list of all languages found in any files */
-  KEDUVOCDOCUMENT_EXPORT QStringList languages();
-
-  /** get list of filenames found of given language 
-   *@param language language requested QString() for all languages
-   *@return a list of filenames with words in language
-   */
-  KEDUVOCDOCUMENT_EXPORT QStringList fileNames(const QString &language = QString());
-
-  /** get the list of document titles found of a given language
-   *@param language requested language QString() for all titles
-   *@return a list of document titles with words in language
-   */
-  KEDUVOCDOCUMENT_EXPORT QStringList titles(const QString &language = QString());
-
-  /** get the list of document remarts found of a given language
-   *@param language requested language QString() for all comments
-   *@return a list of document remarks with words in language
-   */
-  KEDUVOCDOCUMENT_EXPORT QStringList comments(const QString &language = QString());
-
-  /** rescan the shared kvtml locations */
-  KEDUVOCDOCUMENT_EXPORT void rescan();
-       
-  /** sort files downloaded to kvtml top-level dir into locale sub-folders */
-  KEDUVOCDOCUMENT_EXPORT void sortDownloadedFiles();
+    /** get list of all languages found in any files */
+    KEDUVOCDOCUMENT_EXPORT QStringList languages();
+
+    /** get list of filenames found of given language
+     *@param language language requested QString() for all languages
+     *@return a list of filenames with words in language
+     */
+    KEDUVOCDOCUMENT_EXPORT QStringList fileNames( const QString &language = QString() );
+
+    /** get the list of document titles found of a given language
+     *@param language requested language QString() for all titles
+     *@return a list of document titles with words in language
+     */
+    KEDUVOCDOCUMENT_EXPORT QStringList titles( const QString &language = QString() );
+
+    /** get the list of document remarts found of a given language
+     *@param language requested language QString() for all comments
+     *@return a list of document remarks with words in language
+     */
+    KEDUVOCDOCUMENT_EXPORT QStringList comments( const QString &language = QString() );
+
+    /** rescan the shared kvtml locations */
+    KEDUVOCDOCUMENT_EXPORT void rescan();
+
+    /** sort files downloaded to kvtml top-level dir into locale sub-folders */
+    KEDUVOCDOCUMENT_EXPORT void sortDownloadedFiles();
 }
 
 #endif
index 44386fe9372cae4d64a2fd2e67d44524c60f0b5d..2d3360318a2653db16adefc6d49c285490d7cb58 100644 (file)
 #include <KDebug>
 #include <KUrl>
 
-int main (int argc, char ** argv)
+int main( int argc, char ** argv )
 {
-       KAboutData about("converter", 0, ki18n("Converter"), "0.1", ki18n("kvtml file converter"), KAboutData::License_GPL, ki18n("© 2007 Jeremy Whiting"));
-  KCmdLineOptions options;
-  options.add("+infile");
-  options.add("+outfile");
+    KAboutData about( "converter", 0, ki18n( "Converter" ), "0.1", ki18n( "kvtml file converter" ), KAboutData::License_GPL, ki18n( "Ã\82© 2007 Jeremy Whiting" ) );
+    KCmdLineOptions options;
+    options.add( "+infile" );
+    options.add( "+outfile" );
 
-  KCmdLineArgs::init(argc, argv, &about);
-  KCmdLineArgs::addCmdLineOptions(options);
-  QCoreApplication app(KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv());
+    KCmdLineArgs::init( argc, argv, &about );
+    KCmdLineArgs::addCmdLineOptions( options );
+    QCoreApplication app( KCmdLineArgs::qtArgc(), KCmdLineArgs::qtArgv() );
 
-  KCmdLineArgs * arguments = KCmdLineArgs::parsedArgs();
-  if (arguments != NULL && arguments->count() > 0)
-  {
-    KUrl infile(arguments->url(0));
-    if (arguments->count() > 1)
-    {
-      KUrl outfile(arguments->url(1));
-      
-      KEduVocDocument document;
-      kDebug() << "Reading " << infile;
-      document.open(infile);
-      kDebug() << "Writing to " << outfile;
-      document.saveAs(outfile, KEduVocDocument::Kvtml, "converter");
+    KCmdLineArgs * arguments = KCmdLineArgs::parsedArgs();
+    if ( arguments != NULL && arguments->count() > 0 ) {
+        KUrl infile( arguments->url( 0 ) );
+        if ( arguments->count() > 1 ) {
+            KUrl outfile( arguments->url( 1 ) );
+
+            KEduVocDocument document;
+            kDebug() << "Reading " << infile;
+            document.open( infile );
+            kDebug() << "Writing to " << outfile;
+            document.saveAs( outfile, KEduVocDocument::Kvtml, "converter" );
+        }
     }
-  }
-  
-  arguments->clear();
-  
-  return 0;
+
+    arguments->clear();
+
+    return 0;
 }
index 8d793ca4d86aabce85aa08f9f265c57385d196cc..3864d4bb5bdb4d9d12865a57d65194d0eb4668a1 100644 (file)
@@ -1,7 +1,7 @@
 
-int main (void)
+int main( void )
 {
 
 
-  return 0;
+    return 0;
 }