QList<Translation*> XdxfPlugin::searchWordListCache(QString word, int limit) {
- qDebug() << "search cache";
QSet<Translation*> translations;
QString cacheFilePath = _settings->value("cache_path");
db.setDatabaseName(cacheFilePath);
stopped = false;
if(word.indexOf("*")==-1)
word+="%";
- qDebug() << word;
word = word.replace("*", "%");
- qDebug() << word;
word = removeAccents(word);
- qDebug() << word;
QSqlQuery cur(db);
cur.prepare("select word from dict where word like ? limit ?");
QList<Translation*> XdxfPlugin::searchWordListFile(QString word, int limit) {
- qDebug() << "search file";
QSet<Translation*> translations;
QFile dictionaryFile(path);
QString XdxfPlugin::searchCache(QString key) {
- qDebug() << "search cache";
QString result;
QString cacheFilePath = _settings->value("cache_path");
db.setDatabaseName(cacheFilePath);
bool XdxfPlugin::makeCache(QString dir) {
+ stopped = false;
QFileInfo dictFileN(_settings->value("path"));
QString cachePathN;
cachePathN = QDir::homePath() + "/.mdictionary/"
QFile dictionaryFile(dictFileN.filePath());
- qDebug() << dictFileN.path();
if (!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
return 0;
}
- qDebug() << "OLE";
QXmlStreamReader reader(&dictionaryFile);
counter=0;
- while (!reader.atEnd()) {
+ while (!reader.atEnd() && !stopped) {
reader.readNext();
}
}
- qDebug()<<counter;
cur.exec("END;");
cur.exec("select count(*) from dict");
if(!cur.next() || countWords() != cur.value(0).toInt())