usr/lib/mdictionary/plugins/eng-thai.xdxf
usr/share/mdictionary/xdxf.png
usr/share/mdictionary/css/
-usr/share/applications/mdictionary.desktop
+usr/share/applications/hildon/mdictionary.desktop
#include "StarDialog.h"
#include <QDebug>
+#include <QFile>
StarDialog::StarDialog(StarDictPlugin *plugin,
StarDialogType type,
if (!fileName.isEmpty()) {
infoLabel->setText(tr("Dictionary file: %1").arg(fileName));
_dictionaryFilePath = fileName;
+ if (_dictionaryFilePath.endsWith(".tar.bz2")){
+ _isCompressed = true;
+ }
+ else {
+ _isCompressed = false;
+ }
updateGeometry();
}
}
}
else {
_settings->setValue("path", _dictionaryFilePath);
+ _settings->setValue("ifoFileName", _dictName + ".ifo");
+ _settings->setValue("idxFileName", _dictName + ".idx");
+ _settings->setValue("dictFileName", _dictName + ".dict");
+ if (QFile::exists(_dictName + ".syn") == true) {
+ _settings->setValue("synFileName", _dictName + ".syn");
+ }
}
if(_accents)
_settings->setValue("strip_accents", "true");
return;
}
+ if(type == New && !_dictionaryFilePath.isEmpty() && !checkFiles()) {
+ Q_EMIT notify(Notify::Warning, tr("Dictionary files are not complete"));
+ return;
+ }
+
saveSettings();
QDialog::accept();
}
+bool StarDialog::checkFiles() {
+ if (!_isCompressed){
+ _dictName = _dictionaryFilePath.left(_dictionaryFilePath.lastIndexOf("."));
+ if (QFile::exists(_dictName + ".idx") == false && QFile::exists(_dictName + ".idx.gz") == false) {
+ return false;
+ }
+ if (QFile::exists(_dictName + ".dict") == false && QFile::exists(_dictName + ".dict.dz") == false) {
+ return false;
+ }
+ return true;
+ }
+ else {
+ //TODO: untar files (?)
+ return false;
+ }
+}
+
Settings* StarDialog::getSettings() {
return _settings;
}
#include "XdxfDictDownloader.h"
#include "XdxfDictDownloadProgressDialog.h"
#include <QDebug>
+#include <QProcess>
+
#include <bzlib.h>
#include <libtar.h>
fclose(archive);
// Extracting tar
+ #ifndef Q_WS_MAEMO_5
TAR *t;
char * tarfname = new char[file.replace(QRegExp(".bz2%"), "").size()+1];
strcpy(tarfname, file.replace(QRegExp(".bz2%"), "").toStdString().c_str());
return false;
}
tar_close(t);
+ #else
+ QProcess tar;
+ tar.start("tar -xvf " + file.replace(QRegExp(".bz2%"), "") + " -C /tmp/mdict");
+ tar.waitForFinished(-1);
+ #endif
return true;
}