Caching dialog in xdxf is set to modal
[mdictionary] / src / plugins / xdxf / xdxfplugin.cpp
index 626e300..ad0a0bb 100644 (file)
 XdxfPlugin::XdxfPlugin(QObject *parent) : CommonDictInterface(parent),
                     _langFrom(""), _langTo(""),_name(""), _infoNote("") {
     _settings = new Settings();
-    _dictDialog = new XdxfDictDialog(this);
+    _dictDialog = new XdxfDictDialog(this, this);
+
+    connect(_dictDialog, SIGNAL(notify(Notify::NotifyType,QString)),
+            this, SIGNAL(notify(Notify::NotifyType,QString)));
+
     cachingDialog = new XdxfCachingDialog(this);
 
+
     _settings->setValue("type","xdxf");
-    _icon = QIcon(":/icons/xdxf.png");
+    _icon = QIcon("/usr/share/mdictionary/xdxf.png");
     _wordsCount = -1;
     stopped = false;
 
@@ -50,11 +55,9 @@ void XdxfPlugin::retranslate() {
 
     QTranslator *translator = new QTranslator(this);
 
-    if(locale == "pl_PL")
-        translator->load(":/translations/dict_xdxf_pl");
-    else
-        translator->load(":/translations/dict_xdxf_en");
-
+    if(!translator->load(":/xdxf/translations/" + locale)) {
+        translator->load(":/xdxf/translations/en_US");
+    }
     QCoreApplication::installTranslator(translator);
 }
 
@@ -87,7 +90,7 @@ QString XdxfPlugin::type() const {
 
 
 QString XdxfPlugin::infoNote() const {
-    return  _infoNote;
+    return _infoNote;
 }
 
 
@@ -146,7 +149,7 @@ QList<Translation*> XdxfPlugin::searchWordListCache(QString word, int limit) {
         if(ok) {  /*add key word to list*/
             translations.insert(new TranslationXdxf(
                     cur.value(0).toString().toLower(),
-                    _infoNote, this));
+                    _dictionaryInfo, this));
             i++;
         }
     }
@@ -197,7 +200,7 @@ QList<Translation*> XdxfPlugin::searchWordListFile(QString word, int limit) {
                 }
                 if(ok) {  /*add key word to list*/
                     translations<<(new TranslationXdxf(readKey.toLower(),
-                                    _infoNote,this));
+                                    _dictionaryInfo,this));
                     i++;
                 }
                 if(i>=limit && limit!=0)
@@ -323,6 +326,7 @@ DictDialog* XdxfPlugin::dictDialog() {
 
 CommonDictInterface* XdxfPlugin::getNew(const Settings *settings) const {
     XdxfPlugin *plugin = new XdxfPlugin();
+
     if(settings && plugin->setSettings(settings)) {
         return plugin;
     }
@@ -338,24 +342,7 @@ bool XdxfPlugin::isAvailable() const {
 }
 
 
-void XdxfPlugin::setHash(uint _hash) {
-    this->_hash=_hash;
-}
-
-
-uint XdxfPlugin::hash() const {
-   return _hash;
-}
-
-
 Settings* XdxfPlugin::settings() {
-/*
-    Settings *returnSettings=new Settings;
-    QStringList list = _settings->keys();
-    foreach(QString key, list)
-            returnSettings->setValue(key,_settings->value(key));
-    return returnSettings;
-*/
     return _settings;
 }
 
@@ -453,10 +440,9 @@ bool XdxfPlugin::getDictionaryInfo() {
     if(reader.name()=="description")
         _infoNote=reader.readElementText();
 
-    QString initialPath = "/usr/share/mdictionary/xdxf.png";
-
-    _infoNote=" path=\""+initialPath+"\"> \n" + _name + " [" + _langFrom + "-"
+    _dictionaryInfo= _name + " [" + _langFrom + "-"
                 + _langTo + "]";
+
     dictionaryFile.close();
     if(okFormat)
         return true;
@@ -500,7 +486,7 @@ int XdxfPlugin::countWords() {
 
 
 bool XdxfPlugin::makeCache(QString) {
-    cachingDialog->setVisible(true);
+    cachingDialog->show();
     QCoreApplication::processEvents();
     QFileInfo dictFileN(_settings->value("path"));
     QString cachePathN;
@@ -608,7 +594,7 @@ bool XdxfPlugin::makeCache(QString) {
     }
     cur.exec("END;");
     cur.exec("select count(*) from dict");
-    cachingDialog->setVisible(false);
+    //cachingDialog->hide();
 
     /*checke errors (wrong number of added words)*/
     countWords();