connect(_dictDialog, SIGNAL(notify(Notify::NotifyType,QString)),
this, SIGNAL(notify(Notify::NotifyType,QString)));
- cachingDialog = new XdxfCachingDialog(this);
-
_settings->setValue("type","xdxf");
_icon = QIcon("/usr/share/mdictionary/xdxf.png");
_wordsCount = -1;
stopped = false;
- connect(cachingDialog, SIGNAL(cancelCaching()),
- this, SLOT(stop()));
- connect(this, SIGNAL(updateCachingProgress(int,int)),
- cachingDialog, SLOT(updateCachingProgress(int,int)));
initAccents();
}
XdxfPlugin::~XdxfPlugin() {
delete _settings;
- delete cachingDialog;
delete _dictDialog;
}
CommonDictInterface* XdxfPlugin::getNew(const Settings *settings) const {
XdxfPlugin *plugin = new XdxfPlugin();
+ connect(plugin, SIGNAL(notify(Notify::NotifyType,QString)),
+ this, SIGNAL(notify(Notify::NotifyType,QString)));
+
+ ((XdxfDictDialog*)plugin->dictDialog())->setLastDialogParent(_dictDialog->lastDialogParent());
+
+
+
if(settings && plugin->setSettings(settings)) {
+
+ disconnect(plugin, SIGNAL(notify(Notify::NotifyType,QString)),
+ this, SIGNAL(notify(Notify::NotifyType,QString)));
return plugin;
}
else {
+ disconnect(plugin, SIGNAL(notify(Notify::NotifyType,QString)),
+ this, SIGNAL(notify(Notify::NotifyType,QString)));
delete plugin;
return 0;
}
reader.readNextStartElement();
if(reader.name()=="full_name")
_name=reader.readElementText();
+ else
+ qDebug()<<"no full_name";
reader.readNextStartElement();
if(reader.name()=="description")
_infoNote=reader.readElementText();
+ else
+ qDebug()<<"no description";
_dictionaryInfo= _name + " [" + _langFrom + "-"
+ _langTo + "]";
bool XdxfPlugin::makeCache(QString) {
- #ifdef Q_WS_MAEMO_5
- cachingDialog->setVisible(true);
- #else
- cachingDialog->show();
- #endif
+
+ XdxfCachingDialog d(_dictDialog->lastDialogParent());
+
+ qDebug()<<_dictDialog->lastDialogParent();
+
+ connect(&d, SIGNAL(cancelCaching()),
+ this, SLOT(stop()));
+
+ connect(this, SIGNAL(updateCachingProgress(int,int)),
+ &d, SLOT(updateCachingProgress(int,int)));
+
+ d.show();
+
QCoreApplication::processEvents();
QFileInfo dictFileN(_settings->value("path"));
QString cachePathN;
/*add all words to db*/
while (!reader.atEnd() && !stopped) {
+
QCoreApplication::processEvents();
reader.readNext();
if(reader.tokenType() == QXmlStreamReader::StartElement) {
cur.exec();
counter++;
int prog = counter*100/_wordsCount;
- if(prog % 5 == 0 && lastProg != prog) {
+ if(prog % 2 == 0 && lastProg != prog) {
Q_EMIT updateCachingProgress(prog,timer.restart());
lastProg = prog;
}
}
cur.exec("END;");
cur.exec("select count(*) from dict");
- //cachingDialog->hide();
/*checke errors (wrong number of added words)*/
countWords();
_settings->setValue("cache_path", cachePathN);
_settings->setValue("cached", "true");
+
+ disconnect(&d, SIGNAL(cancelCaching()),
+ this, SLOT(stop()));
+
+ disconnect(this, SIGNAL(updateCachingProgress(int,int)),
+ &d, SLOT(updateCachingProgress(int,int)));
+
db.close();
return true;
}