]> Git trees. - libqmvoc.git/commitdiff
KEduVocWordType
authorFrederik Gladhorn <gladhorn@kde.org>
Sun, 26 Aug 2007 12:32:20 +0000 (12:32 +0000)
committerFrederik Gladhorn <gladhorn@kde.org>
Sun, 26 Aug 2007 12:32:20 +0000 (12:32 +0000)
 - Move const strings into the d-pointer class.
 - Rename createOldWordTypeLists to createDefaultWordTypes
Use createDefaultWordTypes when creating a new document with KVocTrain

svn path=/trunk/KDE/kdeedu/libkdeedu/; revision=704841

keduvocdocument/keduvockvtmlreader.cpp
keduvocdocument/keduvocwordtype.cpp
keduvocdocument/keduvocwordtype.h

index 0f3720154e43e5f2c68f99d7a02ea1d0a6c905bd..35a7a168aaea1ab23f1f6debc8c5ed5d503d7801 100644 (file)
@@ -154,7 +154,7 @@ bool KEduVocKvtmlReader::readBody(QDomElement &domElementParent)
   }
 
   // initialize the list of predefined types
-  m_doc->wordTypes()->createOldWordTypeLists();
+  m_doc->wordTypes()->createDefaultWordTypes();
   currentElement = domElementParent.firstChildElement(KV_TYPE_GRP);
   if (!currentElement.isNull()) {
     result = readType(currentElement);
index d903480d9f29376d30566d6114c481d928412dc3..06d4d94e239fc688e31044ce6ed519f0cbbe2e97 100644 (file)
 // #define QM_USER_TYPE  "#"   // designates number of user type
 // #define QM_TYPE_DIV   ":"   // divide main from subtype
 
-const QString KEduVocWordType::KVTML_1_TYPE_USER = QString("#");
-const QString KEduVocWordType::KVTML_1_TYPE_DIV = QString(":");
-
-
 class KEduVocWordType::Private {
 
 public:
@@ -80,8 +76,13 @@ public:
 
     QMap<QString, QString> m_oldMainTypeNames;
     QMap<QString, QString> m_oldSubTypeNames;
+
+    static const QString KVTML_1_TYPE_USER;
+    static const QString KVTML_1_TYPE_DIV;
 };
 
+const QString KEduVocWordType::Private::KVTML_1_TYPE_USER = QString("#");
+const QString KEduVocWordType::Private::KVTML_1_TYPE_DIV = QString(":");
 
 
 
@@ -118,7 +119,7 @@ QString KEduVocWordType::mainTypeFromOldFormat(const QString & typeSubtypeString
     QString mainType;
     int i;
 
-    if ((i = typeSubtypeString.indexOf(KVTML_1_TYPE_DIV)) >= 0)
+    if ((i = typeSubtypeString.indexOf(d->KVTML_1_TYPE_DIV)) >= 0)
         mainType = typeSubtypeString.left(i);
     else
         mainType = typeSubtypeString;
@@ -136,7 +137,7 @@ QString KEduVocWordType::subTypeFromOldFormat(const QString & typeSubtypeString)
 {
     int i;
     QString t = typeSubtypeString;
-    if ((i = t.indexOf(KVTML_1_TYPE_DIV)) >= 0) {
+    if ((i = t.indexOf(d->KVTML_1_TYPE_DIV)) >= 0) {
         t.remove(0, i+1);
     } else {
         return QString();
@@ -212,9 +213,8 @@ QString KEduVocWordType::oldType(const QString & mainType, const QString & subTy
 */
 
 
-void KEduVocWordType::createOldWordTypeLists()
+void KEduVocWordType::createDefaultWordTypes()
 {
-    kDebug() << "Creating word type lists for compability with kvtml-1.";
     // first the special types which cannot be deleted:
     addType("Noun", "noun", "This holds the words of type noun. You can rename it but not delete since the article training relies on it!");
 
index 00cdc7919c3b693e7e51a15b8938ca39ad42cd89..4387f5b0edc4f7b1e63f659167a691c83af91e86 100644 (file)
@@ -50,7 +50,7 @@ public:
     /** assignment operator */
     KEduVocWordType& operator=(const KEduVocWordType& other);
 
-    void createOldWordTypeLists();
+    void createDefaultWordTypes();
 
     /**
      * Create a new word type in the list of known types
@@ -103,9 +103,6 @@ public:
     QString subTypeFromOldFormat(const QString& typeSubtypeString) const;
 
 private:
-    static const QString KVTML_1_TYPE_USER;
-    static const QString KVTML_1_TYPE_DIV;
-
     void initOldTypeLists();