Searching for translation kind of working (from searching file side)
[mdictionary] / src / plugins / stardict / TranslationStarDict.cpp
index 74cc0cb..f6720d3 100644 (file)
@@ -45,6 +45,7 @@ TranslationStarDict::TranslationStarDict(const TranslationStarDict &base) {
     _dictionaryInfo = base._dictionaryInfo;
     lengths = base.lengths;
     offsets = base.offsets;
+    starDictPlugin = base.starDictPlugin;
 }
 
 
@@ -59,17 +60,24 @@ QString TranslationStarDict::key() const {
 }
 
 QString TranslationStarDict::toXml() const {
+    qDebug() << "asdf" << _dictionaryInfo;
     QString result("");
     if(!starDictPlugin)
         return result;
-
-    result=result + "<dict> <info path=\"/usr/share/mdictionary/xdxf.png\" ";
-    if(isBookmark())
-        result+= " bookmark=\"true\" > \n";
-    else
-        result+= " bookmark=\"false\" > \n";
-    result+= _dictionaryInfo + "</info>" + starDictPlugin->search(_key) + "</dict>";
-    return result.replace("&","&amp;");
+    qDebug() << "asdf";
+    for(int i = 0; i < offsets.size(); i++) {
+        result=result + "<dict> <info path=\"/usr/share/mdictionary/xdxf.png\" ";
+        if(isBookmark())
+            result+= " bookmark=\"true\" > \n";
+        else
+            result+= " bookmark=\"false\" > \n";
+    qDebug() << "!!asdf";
+        result+= _dictionaryInfo + "</info>" +
+                starDictPlugin->search(_key, offsets.at(i), lengths.at(i))
+                + "</dict>";
+    qDebug() << "!!!!asdf";
+   }
+   return result.replace("&","&amp;");
 }
 
 void TranslationStarDict::setKey(QString _key) {