Fixed bug in load plugin dialog
authorMateusz Półrola <mateusz.polrola@comarch.pl>
Fri, 13 Aug 2010 12:08:48 +0000 (14:08 +0200)
committerMateusz Półrola <mateusz.polrola@comarch.pl>
Fri, 13 Aug 2010 12:08:48 +0000 (14:08 +0200)
trunk/src/plugins/xdxf/src/XdxfLoadDialog.cpp
trunk/src/plugins/xdxf/src/XdxfSettingsDialog.cpp
trunk/src/plugins/xdxf/src/xdxfplugin.cpp

index 4100a45..310d63b 100644 (file)
@@ -100,10 +100,10 @@ Settings* XdxfLoadDialog::getSettings(QWidget *parent) {
     if(loadDialog.exec()==QDialog::Accepted) {
         settings->setValue("path", loadDialog.dicitonaryFilePath());
         if(loadDialog.generateCache()) {
-            settings->setValue("cached", "true");
+            settings->setValue("generateCache", "true");
         }
         else {
-            settings->setValue("cached", "false");
+            settings->setValue("generateCache", "false");
         }
 
         return settings;
index 1d88298..8d11d6f 100644 (file)
@@ -123,10 +123,10 @@ Settings* XdxfSettingsDialog::getSettings(XdxfPlugin *plugin,
         settings->setValue("path", settingsDialog.dicitonaryFilePath());
 
         if(settingsDialog.generateCache()) {
-            settings->setValue("cached", "true");
+            settings->setValue("generateCache", "true");
         }
         else {
-            settings->setValue("cached", "false");
+            settings->setValue("generateCache", "false");
         }
         plugin->setSettings(settings);
         return NULL;
index e2a8b2b..d3af1ea 100644 (file)
@@ -35,6 +35,9 @@ XdxfPlugin::XdxfPlugin(QObject *parent) : CommonDictInterface(parent),
     _dictDialog = new XdxfDictDialog(this, this);
     cachingDialog = new XdxfCachingDialog(this);
 
+    connect(cachingDialog, SIGNAL(cancelCaching()),
+            this, SLOT(stop()));
+
     _settings->setValue("type","xdxf");
 
     stopped = false;
@@ -248,10 +251,18 @@ CommonDictInterface* XdxfPlugin::getNew(const Settings *settings) const {
         foreach(QString key, list)
             plugin->settings()->setValue(key, settings->value(key));
 
+
         plugin->db_name = plugin->_settings->value("type")
                + plugin->_settings->value("path");
         plugin->db = QSqlDatabase::addDatabase("QSQLITE", plugin->db_name);
+
+        if(settings->value("cached").isEmpty() &&
+           settings->value("generateCache") == "true") {
+            plugin->makeCache("");
+        }
     }
+
+    plugin->getDictionaryInfo();
     return  plugin;
 }
 
@@ -285,13 +296,11 @@ void XdxfPlugin::setSettings(Settings *settings) {
         setPath(settings->value("path"));
     }
 
-    if(_settings->value("cached") == "false" &&
-       settings->value("cached") == "true") {
+    if((_settings->value("cached") == "false" ||
+        _settings->value("cached").isEmpty()) &&
+       settings->value("generateCache") == "true") {
         makeCache("");
     }
-    else {
-        _settings->setValue("cached", settings->value("cached"));
-    }
 
     emit settingsChanged();
 }