detect a disconect error in GooglePlugin
[mdictionary] / trunk / src / plugins / xdxf / src / TranslationXdxf.cpp
index c0ae5d9..b220398 100644 (file)
     Copyright 2010 Comarch S.A.
 
 *******************************************************************************/
+/*! \file TranslationXdxf.cpp
+    \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
+*/
+
 
 #include "TranslationXdxf.h"
 #include <QDebug>
 
-TranslationXdxf::TranslationXdxf() {
+TranslationXdxf::TranslationXdxf():_key(""),_dictionaryInfo("") {
+    xdxfPlugin=0;
 }
 
-TranslationXdxf::TranslationXdxf(QString _key, QString _dictionaryInfo, XdxfPlugin *xdxfPlugin): _key(_key),_dictionaryInfo(_dictionaryInfo) {
+TranslationXdxf::TranslationXdxf(QString _key, QString _dictionaryInfo,
+         XdxfPlugin *xdxfPlugin): _key(_key),_dictionaryInfo(_dictionaryInfo) {
     this->xdxfPlugin=xdxfPlugin;
+    if(xdxfPlugin)
+        _dictHash = xdxfPlugin->hash();
+    _bookmark=0;
 }
 
 QString TranslationXdxf::key() const {
@@ -37,12 +46,17 @@ QString TranslationXdxf::dictionaryInfo() const {
     return _dictionaryInfo;
 }
 
-QString TranslationXdxf::toHtml() const {
+QString TranslationXdxf::toHtml() const { 
     QString result("");
-//    qDebug()<<xdxfPlugin->search(_key);
-    result+="<dict>" + _dictionaryInfo + "<key>" + _key + "</key>"  +xdxfPlugin->search(_key) + "</dict>";
-//    qDebug()<<result;
-    return result;
+    if(!xdxfPlugin)
+        return result;
+    result=result + "<dict>" + "<info";
+    if(isBookmark())
+        result+= " bookmark=\"true\" ";
+    else
+        result+= " bookmark=\"false\" ";
+    result+= _dictionaryInfo + "</info>" + xdxfPlugin->search(_key) + "</dict>";
+    return result.replace("&","&amp;");
 }
 
 void TranslationXdxf::setKey(QString _key) {