Merge branch 'bookmarks' of ssh://drop.maemo.org/git/mdictionary into bookmarks
[mdictionary] / trunk / src / plugins / xdxf / src / xdxfplugin.cpp
index 4d7828d..cab4493 100644 (file)
@@ -68,6 +68,9 @@ QString XdxfPlugin::infoNote() const {
 
 QList<Translation*> XdxfPlugin::searchWordList(QString word, int limit) {
     //if(_settings->value("cached") == "true")
+    if(word.indexOf("*")==-1 && word.indexOf("?")==-1 && word.indexOf("_")==-1
+       && word.indexOf("%")==-1)
+        word+="*";
     if(isCached())
         return searchWordListCache(word,limit);
     return searchWordListFile(word, limit);
@@ -111,8 +114,6 @@ QList<Translation*> XdxfPlugin::searchWordListFile(QString word, int limit) {
     word = removeAccents(word);
 
     stopped = false;
-    if(word.indexOf("*")==-1)
-        word+="*";
     QRegExp regWord(word);
     regWord.setCaseSensitivity(Qt::CaseInsensitive);
     regWord.setPatternSyntax(QRegExp::Wildcard);
@@ -135,8 +136,7 @@ QList<Translation*> XdxfPlugin::searchWordListFile(QString word, int limit) {
             if(regWord.exactMatch(removeAccents(a)) && (i<limit || limit==0)) {
                 bool ok=true;
                 Translation *tran;
-                foreach(tran,translations)
-                {
+                foreach(tran,translations) {
                     if(tran->key()==a)
                         ok=false;  /*if key word is in the dictionary more that one */
                 }
@@ -274,13 +274,11 @@ bool XdxfPlugin::isAvailable() const {
     return true;
 }
 
-void XdxfPlugin::setHash(uint _hash)
-{
+void XdxfPlugin::setHash(uint _hash) {
     this->_hash=_hash;
 }
 
-uint XdxfPlugin::hash() const
-{
+uint XdxfPlugin::hash() const {
    return _hash;
 }
 
@@ -288,8 +286,7 @@ Settings* XdxfPlugin::settings() {
     return _settings;
 }
 
-bool XdxfPlugin::isCached()
-{
+bool XdxfPlugin::isCached() {
     if(_settings->value("cached") == "true")
         return true;
     return false;
@@ -341,7 +338,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;
@@ -436,7 +432,6 @@ bool XdxfPlugin::makeCache(QString dir) {
     while (!reader.atEnd() && !stopped) {
 
         QCoreApplication::processEvents();
-        //usleep(50);
         reader.readNext();
 
         if(reader.tokenType() == QXmlStreamReader::StartElement) {