clean();
this->path=path;
_settings->setValue("path",path);
- //getDictionaryInfo();
}
CommonDictInterface* XdxfPlugin::getNew(const Settings *settings) const {
}
-
void XdxfPlugin::setHash(uint _hash) {
this->_hash=_hash;
}
-
uint XdxfPlugin::hash() const {
return _hash;
}
-
Settings* XdxfPlugin::settings() {
return _settings;
}
-
bool XdxfPlugin::isCached() {
if(_settings->value("cached") == "true")
return true;
}
-
void XdxfPlugin::setSettings(Settings *settings) {
if(settings)
{
+ qDebug()<<"\n\n ustawienie ustawien";
+
+ bool isPathChange=false;
QString oldPath = _settings->value("path");
if(oldPath != settings->value("path")) {
setPath(settings->value("path"));
+ isPathChange=true;
}
- foreach(QString key, settings->keys())
+ foreach(QString key, settings->keys()) {
if(key != "generateCache")
_settings->setValue(key, settings->value(key));
+ }
+
+ if(isPathChange) {
+ _settings->setValue("cached","false");
+ _wordsCount=0;
+ }
if((_settings->value("cached") == "false" ||
- _settings->value("cached").isEmpty()) &&
- settings->value("generateCache") == "true") {
+ _settings->value("cached").isEmpty()) &&
+ settings->value("generateCache") == "true") {
makeCache("");
}
else if (settings->value("generateCache") != "true") {
- _settings->setValue("cached", "false");
+ _settings->setValue("cached", "false");
}
getDictionaryInfo();
}
-
void XdxfPlugin::getDictionaryInfo() {
QFile dictionaryFile(path);
if(!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
}
int XdxfPlugin::countWords() {
- if(_wordsCount > 0)
+ if(_wordsCount>0)
return _wordsCount;
-
QFile dictionaryFile(path);
if(!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
Q_EMIT notify(Notify::Warning,
cur.exec("END;");
cur.exec("select count(*) from dict");
-// settings()->setValue("strip_accents", stripAcc);
countWords();
cachingDialog->setVisible(false);
if(!cur.next() || countWords() != cur.value(0).toInt())
{
+ qDebug()<<"tu??";
Q_EMIT updateCachingProgress(100, timer.restart());
Q_EMIT notify(Notify::Warning,
QString(tr("Database caching error, please try againg.")));