Fixed caching from settings widget
[mdictionary] / trunk / src / plugins / xdxf / src / xdxfplugin.cpp
index d3af1ea..d59c673 100644 (file)
@@ -301,6 +301,9 @@ void XdxfPlugin::setSettings(Settings *settings) {
        settings->value("generateCache") == "true") {
         makeCache("");
     }
+    else {
+       _settings->setValue("cached", "false");
+    }
 
     emit settingsChanged();
 }
@@ -419,6 +422,8 @@ bool XdxfPlugin::makeCache(QString dir) {
     timer.start();
     countWords();
 
+    int lastProg = -1;
+
 
     counter=0;
     while (!reader.atEnd() && !stopped) {
@@ -451,8 +456,11 @@ bool XdxfPlugin::makeCache(QString dir) {
                 cur.exec();
                 counter++;
                 int prog = counter*100/_wordsCount;
-                if(prog % 5 == 0)
-                    Q_EMIT updateCachingProgress(prog);
+                if(prog % 5 == 0 && lastProg != prog) {
+                    Q_EMIT updateCachingProgress(prog,
+                                                 timer.restart());
+                    lastProg = prog;
+                }
             }
 
         }