Merge branch 'xdxf' of ssh://drop.maemo.org/git/mdictionary into xdxf
[mdictionary] / trunk / src / plugins / xdxf / src / XdxfPlugin / xdxfplugin.cpp
index 2b74a2f..11777a5 100644 (file)
@@ -31,8 +31,10 @@ QString XdxfPlugin::infoNote() const {
 
 QList<Translation*> XdxfPlugin::searchWordList(QString word, int limit) {
     QRegExp regWord(word);
-    QList<Translation*> translations;
+    regWord.setCaseSensitivity(Qt::CaseInsensitive);
     regWord.setPatternSyntax(QRegExp::Wildcard);
+
+    QList<Translation*> translations;
     QFile dictionaryFile(path);
     if(!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
         qDebug()<<"Error: could not open file";
@@ -62,7 +64,6 @@ QList<Translation*> XdxfPlugin::searchWordList(QString word, int limit) {
             a = dictionaryReader.readElementText();
             if(regWord.exactMatch(a) && i<limit) {
                 translations.append(new TranslationXdxf(a,_infoNote,this));
-                qDebug()<<a;
                 i++;
                 if(i>=limit)
                     break;
@@ -77,7 +78,8 @@ QList<Translation*> XdxfPlugin::searchWordList(QString word, int limit) {
 QString XdxfPlugin::search(QString key) {
     QFile dictionaryFile(path);
     if(!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
-        return ""; //blad otwarcia pliku
+        qDebug()<<"Error: could not open file";
+        return "";
     }
     QXmlStreamReader dictionaryReader(&dictionaryFile);
 
@@ -92,12 +94,13 @@ QString XdxfPlugin::search(QString key) {
                     match = true;
             }
         }
-        else if(dictionaryReader.tokenType() == QXmlStreamReader::Characters)
+        else if(dictionaryReader.tokenType() == QXmlStreamReader::Characters)  {
             if(match) {
-                dictionaryFile.close();
-                qDebug()<<dictionaryReader.text().toString().replace("\n","");
-                return dictionaryReader.text().toString().replace("\n","");
+              QString temp(dictionaryReader.text().toString().replace("\n",""));
+              dictionaryFile.close();
+              return temp;
             }
+        }
     }
     return "";
 }
@@ -111,10 +114,11 @@ QDialog* XdxfPlugin::loadDialog() {
 }
 
 QDialog* XdxfPlugin::settingsDialog() {
-    ;
+    path="dict.xdxf";
 }
 
 CommonDictInterface* XdxfPlugin::getNew(const Settings*) const {
+  // CommonDictInterface *commonDictInterface= new
     ;
 }
 
@@ -122,7 +126,12 @@ bool XdxfPlugin::isAvailable() const {
     return true;
 }
 
+void XdxfPlugin::setHash(uint _hash)
+{
+    this->_hash=_hash;
+}
+
 uint XdxfPlugin::hash() const
 {
-    return 1;
+   return _hash;
 }