Merge branch 'master' of ssh://drop.maemo.org/git/mdictionary
[mdictionary] / trunk / src / plugins / xdxf / src / xdxfplugin.cpp
index b544870..807937e 100644 (file)
@@ -89,6 +89,7 @@ QList<Translation*> XdxfPlugin::searchWordListCache(QString word, int limit) {
         stopped = false;
         if(word.indexOf("*")==-1 && word.indexOf("?")== 0)
             word+="%";
+        word = word.toLower();
         word = word.replace("*", "%");
         word = word.replace("?", "_");
         word = removeAccents(word);
@@ -100,8 +101,9 @@ QList<Translation*> XdxfPlugin::searchWordListCache(QString word, int limit) {
         cur.addBindValue(limit);
         cur.exec();
         while(cur.next())
-            translations.insert(new TranslationXdxf(cur.value(0).toString(),
-                                                    _infoNote, this));
+            translations.insert(new TranslationXdxf(
+                        cur.value(0).toString().toLower(),
+                        _infoNote, this));
         return translations.toList();
 }
 
@@ -111,6 +113,7 @@ QList<Translation*> XdxfPlugin::searchWordListFile(QString word, int limit) {
     QSet<Translation*> translations;
     QFile dictionaryFile(path);
 
+    word = word.toLower();
     word = removeAccents(word);
 
     stopped = false;
@@ -141,7 +144,8 @@ QList<Translation*> XdxfPlugin::searchWordListFile(QString word, int limit) {
                         ok=false;  /*if key word is in the dictionary more that one */
                 }
                 if(ok)  /*add key word to list*/
-                    translations<<(new TranslationXdxf(a,_infoNote,this));
+                    translations<<(new TranslationXdxf(a.toLower(),
+                                _infoNote,this));
                 i++;
                 if(i>=limit && limit!=0)
                     break;
@@ -167,6 +171,7 @@ QString XdxfPlugin::searchCache(QString key) {
     QString result;
     QString cacheFilePath = _settings->value("cache_path");
     db.setDatabaseName(cacheFilePath);
+    key = key.toLower();
 
     if(!db.open()) {
         qDebug() << "Database error" << db.lastError().text() << endl;
@@ -187,6 +192,7 @@ QString XdxfPlugin::searchCache(QString key) {
 
 
 QString XdxfPlugin::searchFile(QString key) {
+    key = key.toLower();
     QFile dictionaryFile(path);
     QString resultString("");
     if(!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
@@ -366,7 +372,6 @@ void XdxfPlugin::getDictionaryInfo() {
 }
 
 QString XdxfPlugin::removeAccents(QString string) {
-
     string = string.replace(QString::fromUtf8("ł"), "l", Qt::CaseInsensitive);
     QString normalized = string.normalized(QString::NormalizationForm_D);
     normalized = normalized;