detect a disconect error in GooglePlugin
[mdictionary] / trunk / src / plugins / google / src / TranslationGoogle.cpp
index 4ccd0c6..2ee8a63 100644 (file)
@@ -1,7 +1,32 @@
+/*******************************************************************************
+
+    This file is part of mDictionary.
+
+    mDictionary is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    mDictionary is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with mDictionary.  If not, see <http://www.gnu.org/licenses/>.
+
+    Copyright 2010 Comarch S.A.
+
+*******************************************************************************/
+
+/*! \file TranslationGoogle.cpp
+    \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
+*/
+
 #include "TranslationGoogle.h"
 
-TranslationGoogle::TranslationGoogle()
-{
+TranslationGoogle::TranslationGoogle():_key(""),_trans(""),_dictionaryInfo("") {
+    googlePlugin=0;
 }
 
 TranslationGoogle::TranslationGoogle(QString _key,QString _trans,
@@ -10,24 +35,27 @@ TranslationGoogle::TranslationGoogle(QString _key,QString _trans,
     this->googlePlugin=googlePlugin;
     if(googlePlugin)
         _dictHash = googlePlugin->hash();
-
+    _bookmark=0;
 }
 
 QString TranslationGoogle::key() const{
     return _key;
 }
 
-
 QString TranslationGoogle::dictionaryInfo() const {
     return _dictionaryInfo;
 }
 
-
 QString TranslationGoogle::toHtml() const {
     QString result("");
-    result+="<dict> <info bookmark=\"false\">GOOGLE TRANSLATOR </info>";
-    result+=_trans +"</dict>";
-    return result;
+    if(!googlePlugin)
+        return result;
+    result="<dict> <info path=\"\" ";
+    if(isBookmark())
+        result+="bookmark=\"true\" >";
+    else
+        result+="bookmark=\"false\" >";
+    result+=_dictionaryInfo+ "</info>"+_trans +"</dict>";
 }
 
 void TranslationGoogle::setKey(QString) {