detect a disconect error in GooglePlugin
[mdictionary] / trunk / src / plugins / google / src / GooglePlugin.cpp
index b07c48f..bc6995c 100644 (file)
@@ -20,6 +20,7 @@
 *******************************************************************************/
 
 /*! \file GooglePlugin.cpp
+    \author Jakub Jaszczynski <j.j.jaszczynski@gmail.com>
 */
 
 #include "GooglePlugin.h"
@@ -155,7 +156,11 @@ QList<Translation*> GooglePlugin::searchWordList(QString word, int limit) {
     http->setHost("www.google.pl");
     wait=true;
     http->request(head, data);
-    while(wait);
+    QString error("");
+    while(wait && (error=="" || error=="Unknown error"))
+        error=http->errorString();
+    if(error!="" && error!="Unknown error")
+        qDebug()<<error;
 
     QString text = QString::fromUtf8(http->readAll());
     text=jsonParse(text);
@@ -170,7 +175,6 @@ QString GooglePlugin::jsonParse(QString result) {
     int pos=0,pos2=0;
     int index=0;
     int size=0;
-    qDebug()<<result;
     QString returnLang;
     QString translation;
     QString original;
@@ -218,7 +222,7 @@ QString GooglePlugin::jsonParse(QString result) {
     returnLang=list1.at(index*2+1);
     if(partOfSpeach.size()==0){
         if(translation==original){
-            qDebug()<<"This word don't exist";
+ //           qDebug()<<"This word don't exist";
             return QString("");
         }
         else