fix bugs (detect lanquage and cancel cache file )
authorJakub Jaszczynski <j.j.jaszczynski@gmail.com>
Tue, 14 Sep 2010 11:45:57 +0000 (13:45 +0200)
committerJakub Jaszczynski <j.j.jaszczynski@gmail.com>
Tue, 14 Sep 2010 11:45:57 +0000 (13:45 +0200)
src/plugins/google/GoogleDialog.cpp
src/plugins/google/TranslationGoogle.cpp
src/plugins/xdxf/xdxfplugin.cpp

index a7b83ff..75e4368 100644 (file)
@@ -106,15 +106,19 @@ void GoogleDialog::initializeUI() {
     langToComboBox = new QComboBox;
 
     int i=0;
+    int j=0;
     int actualLangTo=0;
     int actualLangFrom=0;
 
     foreach(QString langs, GooglePlugin::languages.keys()){
         if(langs==_langTo)
-            actualLangTo=i;
+            actualLangTo=j;
         if(langs==_langFrom)
             actualLangFrom=i;
-        langToComboBox->addItem(langs);
+        if(langs!="Detect langlage"){
+            langToComboBox->addItem(langs);
+            j++;
+        }
         langFromComboBox->addItem(langs);
         i++;
     }
index 2e54ea9..f0355e7 100644 (file)
@@ -57,13 +57,13 @@ QString TranslationGoogle::toXml() const {
     else
         result+="bookmark=\"false\" >";
 
-    qDebug()<<"trans: "<<_trans;
+    //qDebug()<<"trans: "<<_trans;
 
     if(_trans!="")
         return result+=_dictionaryInfo+ "</info>"+_trans +"</dict>";
 
     QList<Translation*> translations=googlePlugin->searchWordList(_key);
-    qDebug()<<"test: "<<translations.size();
+    //qDebug()<<"test: "<<translations.size();
     if(translations.size()>0 && translations.at(0))
         return translations.at(0)->toXml();
     return "";
index aad8274..7e4550c 100644 (file)
@@ -308,6 +308,7 @@ QString XdxfPlugin::searchFile(QString key) {
 
 
 void XdxfPlugin::stop() {
+   //qDebug()<<"stop";
     stopped=true;
 }
 
@@ -498,11 +499,10 @@ bool XdxfPlugin::makeCache(QString) {
 
     XdxfCachingDialog d(_dictDialog->lastDialogParent());
 
-    qDebug()<<_dictDialog->lastDialogParent();
+//    qDebug()<<_dictDialog->lastDialogParent();
 
     connect(&d, SIGNAL(cancelCaching()),
             this, SLOT(stop()));
-
     connect(this, SIGNAL(updateCachingProgress(int,int)),
             &d, SLOT(updateCachingProgress(int,int)));
 
@@ -624,24 +624,24 @@ bool XdxfPlugin::makeCache(QString) {
         Q_EMIT notify(Notify::Warning,
                 QString(tr("Database caching error, please try again.")));
         db.close();
+        _settings->setValue("cache_path", cachePathN);
+        if(stopped)
+            clean();
+        _settings->setValue("cache_path","");
         return false;
     }
 
     _settings->setValue("cache_path", cachePathN);
     _settings->setValue("cached", "true");
 
-
     disconnect(&d, SIGNAL(cancelCaching()),
             this, SLOT(stop()));
-
     disconnect(this, SIGNAL(updateCachingProgress(int,int)),
             &d, SLOT(updateCachingProgress(int,int)));
-
     db.close();
     return true;
 }
 
-
 void XdxfPlugin::clean() {
     if(QFile::exists(_settings->value("cache_path"))) {
         QFile(_settings->value("cache_path")).remove();