add check exist xdxf file
authorJakub Jaszczynski <j.j.jaszczynski@gmail.com>
Wed, 1 Sep 2010 08:49:56 +0000 (10:49 +0200)
committerJakub Jaszczynski <j.j.jaszczynski@gmail.com>
Wed, 1 Sep 2010 08:49:56 +0000 (10:49 +0200)
trunk/src/plugins/xdxf/src/xdxfplugin.cpp

index bc35951..55028a3 100644 (file)
@@ -378,7 +378,8 @@ void XdxfPlugin::setSettings(const Settings *settings) {
 
 void XdxfPlugin::getDictionaryInfo() {
     QFile dictionaryFile(_settings->value("path"));
-    if(!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
+    if(!QFile::exists(_settings->value("path"))
+                || !dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
        Q_EMIT notify(Notify::Warning,
                QString(tr("Xdxf file cannot be read dictionary")));
         qDebug()<<"Error: could not open file";
@@ -419,7 +420,8 @@ int XdxfPlugin::countWords() {
     if(_wordsCount>0)
         return _wordsCount;
     QFile dictionaryFile(_settings->value("path"));
-    if(!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
+    if(!QFile::exists(_settings->value("path"))
+                || !dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
         Q_EMIT notify(Notify::Warning,
                 QString(tr("Xdxf file cannot be read for %1 dictionary")
                 .arg(name())));
@@ -458,7 +460,8 @@ bool XdxfPlugin::makeCache(QString) {
     } while(QFile::exists(cachePathN));
 
     QFile dictionaryFile(dictFileN.filePath());
-    if (!dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
+    if (!QFile::exists(_settings->value("path"))
+                || !dictionaryFile.open(QFile::ReadOnly | QFile::Text)) {
         Q_EMIT updateCachingProgress(100, 0);
         Q_EMIT notify(Notify::Warning,
                 QString(tr("Xdxf file cannot be read for %1 dictionary")