Merge branch 'cache' of ssh://drop.maemo.org/git/mdictionary into cache
authorMateusz Półrola <mateusz.polrola@comarch.pl>
Fri, 13 Aug 2010 10:46:36 +0000 (12:46 +0200)
committerMateusz Półrola <mateusz.polrola@comarch.pl>
Fri, 13 Aug 2010 10:46:36 +0000 (12:46 +0200)
Conflicts:
trunk/src/plugins/xdxf/src/xdxfplugin.cpp

1  2 
trunk/src/plugins/xdxf/src/XdxfLoadDialog.cpp
trunk/src/plugins/xdxf/src/xdxfplugin.cpp

@@@ -77,7 -77,7 +77,12 @@@ void XdxfLoadDialog::selectFile() 
  
  void XdxfLoadDialog::addDictionary() {
      _generateCache = cacheCheckBox->isChecked();
--    accept();
++    if(!_dicitonaryFilePath.isEmpty()) {
++        accept();
++    }
++    else {
++        reject();
++    }
  }
  
  QString XdxfLoadDialog::dicitonaryFilePath() {
@@@ -33,14 -33,7 +33,9 @@@ XdxfPlugin::XdxfPlugin(QObject *parent
      _wordsCount = -1;
      _settings = new Settings();
      _dictDialog = new XdxfDictDialog(this, this);
 +    cachingDialog = new XdxfCachingDialog(this);
 +
      _settings->setValue("type","xdxf");
-     if(isCached())
-         _settings->setValue("cached","true");
-     else
-         _settings->setValue("cached","false");
  
      stopped = false;
  
@@@ -387,8 -357,7 +372,9 @@@ int XdxfPlugin::countWords() 
  
  
  bool XdxfPlugin::makeCache(QString dir) {
 +    cachingDialog->setVisible(true);
 +    QCoreApplication::processEvents();
+     stopped = false;
      QFileInfo dictFileN(_settings->value("path"));
      QString cachePathN;
      cachePathN = QDir::homePath() + "/.mdictionary/"
  
  
      counter=0;
-     while (!reader.atEnd()) {
+     while (!reader.atEnd() && !stopped) {
  
 +        QCoreApplication::processEvents();
 +        //usleep(50);
          reader.readNext();
  
          if(reader.tokenType() == QXmlStreamReader::StartElement) {
          }
      }
  
-     qDebug()<<counter;
      cur.exec("END;");
      cur.exec("select count(*) from dict");
 +
 +    countWords();
 +    cachingDialog->setVisible(false);
 +
      if(!cur.next() || countWords() != cur.value(0).toInt())
          return false;
      _settings->setValue("cache_path", cachePathN);