Added removing accents while caching
authorBartosz Szatkowski <bulislaw@linux.com>
Wed, 25 Aug 2010 11:39:48 +0000 (13:39 +0200)
committerBartosz Szatkowski <bulislaw@linux.com>
Wed, 25 Aug 2010 11:39:48 +0000 (13:39 +0200)
trunk/src/plugins/xdxf/src/xdxfplugin.cpp

index 1b90a31..369a234 100644 (file)
@@ -133,9 +133,10 @@ QList<Translation*> XdxfPlugin::searchWordListCache(QString word, int limit) {
 
         QSqlQuery cur(db);
         if(limit !=0)
-            cur.prepare("select word from dict where word like ? limit ?");
+            cur.prepare("select word from dict where word like ? or normalized like ? limit ?");
         else
-            cur.prepare("select word from dict where word like ?");
+            cur.prepare("select word from dict where word like ? or normalized like ?");
+        cur.addBindValue(word);
         cur.addBindValue(word);
         if(limit !=0)
             cur.addBindValue(limit);
@@ -154,30 +155,6 @@ QList<Translation*> XdxfPlugin::searchWordListCache(QString word, int limit) {
                         cur.value(0).toString().toLower(),
                         _infoNote, this));
         }
-        if(!in) {
-
-            QSqlQuery cur(db);
-            if(limit !=0)
-                cur.prepare("select word from dict where normalized like ? limit ?");
-            else
-                cur.prepare("select word from dict where normalized like ?");
-            cur.addBindValue(word);
-            if(limit !=0)
-                cur.addBindValue(limit);
-            cur.exec();
-            while(cur.next()){
-                bool ok=true;
-                Translation *tran;
-                foreach(tran,translations) {
-                    if(tran->key().toLower()==cur.value(0).toString().toLower())
-                            ok=false;
-                }
-                if(ok)  /*add key word to list*/
-                    translations.insert(new TranslationXdxf(
-                            cur.value(0).toString().toLower(),
-                            _infoNote, this));
-            }
-        }
         db.close();
     return translations.toList();
 }