fix bug (duplication of dictionarys in xdxf downloader)
authorjakub <jakub.jaszczynski@comarch.com>
Tue, 23 Nov 2010 11:43:39 +0000 (12:43 +0100)
committerjakub <jakub.jaszczynski@comarch.com>
Tue, 23 Nov 2010 11:43:39 +0000 (12:43 +0100)
src/plugins/stardict/StarDictPlugin.cpp
src/plugins/xdxf/XdxfDictDownloader.cpp
src/plugins/xdxf/xdxfplugin.cpp

index e9036ef..4c78fe3 100644 (file)
@@ -43,7 +43,10 @@ StarDictPlugin::StarDictPlugin(QObject *parent) : CommonDictInterface(parent),
     _icon = QIcon("/usr/share/mdictionary/stardict.png");
     stopped = false;
 
+    _settings->setValue("strip_accents","true");
+
     initAccents();
+
 }
 
 
@@ -124,9 +127,9 @@ QList<Translation*> StarDictPlugin::searchWordList(QString word, int limit) {
             offset = reader->readInt64BigEndian();
         len = reader->readInt32BigEndian();
 
-        if(keyword.exactMatch(fkey)) {
+        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);
@@ -160,18 +163,18 @@ QByteArray StarDictPlugin::read(QByteArray::iterator it,
 
 
 QString StarDictPlugin::interpret(QByteArray::iterator it,
-        QByteArray::iterator end, QChar mode,QString key, bool last) {
+        QByteArray::iterator end, QChar mode,QString key, bool) {
     QString result;
 //    qDebug()<<"****** mode:     "<<mode;
-    if(mode == 'm' ||
-            mode == 'l' ||
-            mode == 'g' ||
-            mode == 't' ||
-            mode == 'y' ||
-            mode == 'k' ||
-            mode == 'w' ||
-            mode == 'h' ||
-            mode == 'r' ){
+    if(mode == 'm'
+            || mode == 'l'
+            || mode == 'g'
+            || mode == 't'
+            || mode == 'y'
+            || mode == 'k'
+            || mode == 'w'
+            || mode == 'h'
+            || mode == 'r'){
         result += "<key>" + key + "</key>";
         result += "<t>" + QString::fromUtf8(read(it++, end)) + "</t>";
     }
index 2e3517c..f212d71 100644 (file)
@@ -161,7 +161,7 @@ void XdxfDictDownloader::dictListReceived(QNetworkReply *reply) {
     QRegExp regInner("<tr>.*</tr>");
     regInner.setMinimal(true);
     int pos = 0;
-
+    dicts.clear();
     while ((pos = regInner.indexIn(page, pos)) != -1) {
         DownloadDict temp = DownloadDict(regInner.cap(0));
         if(!temp.fromLang().isEmpty())
index d571d9e..e0ca9de 100644 (file)
@@ -124,6 +124,7 @@ QList<Translation*> XdxfPlugin::searchWordListCache(QString word, int limit) {
         _settings->setValue("cached","false");
         return searchWordListFile(word, limit);
     }
+
     stopped = false;
     word = word.toLower();
     word = word.replace("*", "%");