fix small bug(wildcard), and change some comments
[mdictionary] / src / plugins / stardict / StarDictPlugin.cpp
index c7a2557..b2de6bb 100644 (file)
@@ -18,8 +18,9 @@
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
-
-/*! \file stardictplugin.cpp
+/*!
+     \file StarDictPlugin.cpp
+     \author Jakub Jaszczynski
 */
 
 #include "StarDictPlugin.h"
@@ -98,12 +99,13 @@ QList<Translation*> StarDictPlugin::searchWordList(QString word, int limit) {
     QString idxPath = settings()->value("idxFileName");
     StarDictReader * reader = StarDictReaderFactory::createReader(idxPath);
     QString fkey;
-    qint64 offset = 0, len = 0;
-    QRegExp keyword(word, Qt::CaseInsensitive, QRegExp::Wildcard);
+    qint64 offset = 0,
+    len = 0;
 
     if( word.indexOf("*")==-1 && word.indexOf("?")==-1 &&
         word.indexOf("_")==-1 && word.indexOf("%")==-1)
         word+="*";
+    QRegExp keyword(word, Qt::CaseInsensitive, QRegExp::Wildcard);
 
     if((settings()->value("idxoffsetbits") == "32") ||
                          (settings()->value("idxoffsetbits") == ""))
@@ -124,7 +126,7 @@ QList<Translation*> StarDictPlugin::searchWordList(QString word, int limit) {
 
         if(keyword.exactMatch(fkey)) {
             TranslationStarDict tran(fkey, infoNote(), this);
-            qDebug() << "off/len" << offset << len;
+  //          qDebug() << "off/len" << offset << len;
             int id = translations.indexOf(tran);
             if(id == -1) {
                 tran.add(offset, len);
@@ -196,7 +198,7 @@ QString StarDictPlugin::interpret(QByteArray::iterator it,
             result+="</t>";
     }
 
-// Dont know whether mDictionary would ever handle binary stardict format
+// W & P Dont know whether mDictionary would ever handle binary stardict format
 // to be honest dont see any kind of adventages (can't find any binary dict)
  /*
     }
@@ -339,15 +341,4 @@ QIcon* StarDictPlugin::icon() {
     return &_icon;
 }
 
-
-int StarDictPlugin::countWords() {
-    return 0;
-}
-
-
-void StarDictPlugin::clean() {
-
-}
-
-
 Q_EXPORT_PLUGIN2(stardict, StarDictPlugin)