Bug fix: unable download and add xdxf dictionary more than once
authorMarcin Kaźmierczak <marcin@marcin-desktop.(none)>
Tue, 23 Nov 2010 15:46:28 +0000 (16:46 +0100)
committerMarcin Kaźmierczak <marcin@marcin-desktop.(none)>
Tue, 23 Nov 2010 15:46:28 +0000 (16:46 +0100)
src/plugins/xdxf/XdxfDictSelectDialog.cpp
src/plugins/xdxf/XdxfDictSelectDialog.h

index 8abb1f6..4b4a066 100644 (file)
@@ -50,6 +50,15 @@ XdxfDictSelectDialog::XdxfDictSelectDialog(QList<DownloadDict> dicts,
     checkBoxLayout->addWidget(langToLabel);
     checkBoxLayout->addWidget(langTo, 10);
 
+    //here removing already added dictionary
+
+    for (int i = 0; i < dicts.size(); i++){
+        if(QFile::exists(QDir::homePath() + "/.mdictionary/" + dicts[i].title() + ".xdxf")){
+            dicts.removeAt(i);
+            i--;
+        }
+    }
+
     model = new DictsModel(dicts, this);
 
     proxyModel = new DictsProxyModel;
index 9cecb39..9f19eda 100644 (file)
@@ -28,6 +28,8 @@
 
 #include <QDialog>
 #include <QtGui>
+#include <QFile>
+#include <QDir>
 #include "DownloadDict.h"
 #include "DictsModel.h"
 #include "DictsProxyModel.h"