fix bugs -'stop stardict when user click stop' and 'nacional char in words list'
[mdictionary] / src / plugins / stardict / StarDictPlugin.cpp
index d6df778..bf75e6a 100644 (file)
@@ -109,7 +109,8 @@ QList<Translation*> StarDictPlugin::searchWordList(QString word, int limit) {
 
     int counter = 0;
     int counterLimit = 0;
-    while(counter < wordcount && (counterLimit<limit || limit==0)) {
+    stopped=false;
+    while(counter < wordcount && (counterLimit<limit || limit==0) && !stopped) {
         counter++;
         fkey = reader->readKeyword();
         if(is32b)
@@ -161,6 +162,7 @@ QByteArray StarDictPlugin::read(QByteArray::iterator it,
 QString StarDictPlugin::interpret(QByteArray::iterator it,
         QByteArray::iterator end, QChar mode,QString key, bool last) {
     QString result;
+    qDebug()<<"****** mode:     "<<mode;
     if(mode == 'm'){
         result += "<key>" + key + "</key>";
         result += QString::fromUtf8(read(it++, end));
@@ -176,12 +178,10 @@ QString StarDictPlugin::interpret(QByteArray::iterator it,
         /* delete "small" tag  from translation*/
         int indexOfSmall=result.indexOf("<small>");
         while(indexOfSmall!=-1){
-            qDebug()<<"przed"<<result;
             int indexOfEndSmall= result.indexOf("</small>");
             if(indexOfEndSmall!=-1)
                 result.remove(indexOfSmall,indexOfEndSmall-indexOfSmall+8);
             indexOfSmall=result.indexOf("<small>");
-            qDebug()<<"po"<<result;
         }
     }
     else if(mode == 't'){
@@ -283,6 +283,7 @@ QString StarDictPlugin::search(QString key, qint64 offset, qint32 len) {
 
 
 void StarDictPlugin::stop() {
+    qDebug()<<"zatrzymanie programu";
     stopped=true;
 }