From 62c997ae7099a55c1850b7d2a45d4473d919d572 Mon Sep 17 00:00:00 2001 From: Bartosz Szatkowski Date: Fri, 13 Aug 2010 12:44:25 +0200 Subject: [PATCH] Added possibility of stopping cache process --- trunk/src/plugins/xdxf/src/xdxfplugin.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/trunk/src/plugins/xdxf/src/xdxfplugin.cpp b/trunk/src/plugins/xdxf/src/xdxfplugin.cpp index af2dd46..b33c512 100644 --- a/trunk/src/plugins/xdxf/src/xdxfplugin.cpp +++ b/trunk/src/plugins/xdxf/src/xdxfplugin.cpp @@ -69,7 +69,6 @@ QList XdxfPlugin::searchWordList(QString word, int limit) { QList XdxfPlugin::searchWordListCache(QString word, int limit) { - qDebug() << "search cache"; QSet translations; QString cacheFilePath = _settings->value("cache_path"); db.setDatabaseName(cacheFilePath); @@ -81,11 +80,8 @@ QList XdxfPlugin::searchWordListCache(QString word, int limit) { 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 ?"); @@ -101,7 +97,6 @@ QList XdxfPlugin::searchWordListCache(QString word, int limit) { QList XdxfPlugin::searchWordListFile(QString word, int limit) { - qDebug() << "search file"; QSet translations; QFile dictionaryFile(path); @@ -160,7 +155,6 @@ QString XdxfPlugin::search(QString key) { QString XdxfPlugin::searchCache(QString key) { - qDebug() << "search cache"; QString result; QString cacheFilePath = _settings->value("cache_path"); db.setDatabaseName(cacheFilePath); @@ -363,6 +357,7 @@ int XdxfPlugin::countWords() { bool XdxfPlugin::makeCache(QString dir) { + stopped = false; QFileInfo dictFileN(_settings->value("path")); QString cachePathN; cachePathN = QDir::homePath() + "/.mdictionary/" @@ -371,11 +366,9 @@ bool XdxfPlugin::makeCache(QString dir) { QFile dictionaryFile(dictFileN.filePath()); - qDebug() << dictFileN.path(); if (!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) { return 0; } - qDebug() << "OLE"; QXmlStreamReader reader(&dictionaryFile); @@ -400,7 +393,7 @@ bool XdxfPlugin::makeCache(QString dir) { counter=0; - while (!reader.atEnd()) { + while (!reader.atEnd() && !stopped) { reader.readNext(); @@ -435,7 +428,6 @@ bool XdxfPlugin::makeCache(QString dir) { } } - qDebug()<