X-Git-Url: http://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fplugins%2Fxdxf%2FXdxfDictDownloader.cpp;h=57227b1ddd6c2a095f45b2ee4ebd510b86140fe1;hb=0920a54ebc21e26ea44fab232832f45b7882da19;hp=1b654080e74aa878a0b49001e4804575c3f29605;hpb=00c4970f59cd301a63e58a470619b9ad5ab075f2;p=mdictionary diff --git a/src/plugins/xdxf/XdxfDictDownloader.cpp b/src/plugins/xdxf/XdxfDictDownloader.cpp index 1b65408..57227b1 100644 --- a/src/plugins/xdxf/XdxfDictDownloader.cpp +++ b/src/plugins/xdxf/XdxfDictDownloader.cpp @@ -20,6 +20,9 @@ *******************************************************************************/ /*! \file XdxfDictDownloader.cpp + \brief XdxfDictDownloader is responsible for getting dict list from XDXF website + and other actions necessary to download and add dictionary + \author Mateusz Półrola */ @@ -28,14 +31,17 @@ #include #include #include -#ifndef Q_WS_MAEMO_5 -#include -#endif #include #include +#ifndef Q_WS_MAEMO_5 + #include +#endif + + typedef void BZFILE; + XdxfDictDownloader::XdxfDictDownloader(QObject *parent) : QObject(parent) { parentDialog = 0; @@ -65,7 +71,6 @@ void XdxfDictDownloader::download(QWidget *parent) { this, SLOT(breakDownloading())); connect(this, SIGNAL(downloadProgress(float)), progressDialog, SLOT(updateProgress(float))); - progressDialog->setText(tr("Downloading dictionaries list")); progressDialog->show(); } @@ -92,7 +97,6 @@ void XdxfDictDownloader::breakDownloading() { //if user cancel downloading we kill all running processes, hide progress dialog and set flag that user cancel downloading. aborted = true; http.kill(); - if(progressDialog && progressDialog->isVisible()) { progressDialog->accept(); } @@ -158,7 +162,7 @@ void XdxfDictDownloader::dictListReceived(QNetworkReply *reply) { QRegExp regInner(".*"); regInner.setMinimal(true); int pos = 0; - + dicts.clear(); while ((pos = regInner.indexIn(page, pos)) != -1) { DownloadDict temp = DownloadDict(regInner.cap(0)); if(!temp.fromLang().isEmpty()) @@ -169,12 +173,10 @@ void XdxfDictDownloader::dictListReceived(QNetworkReply *reply) { XdxfDictSelectDialog selectDialog(dicts, parentDialog); if(selectDialog.exec()==QDialog::Accepted) { - progressDialog->setText(tr("Downloading dictionary")); progressDialog->show(); QString url = selectDialog.link(); - _fileName = url.split('/').last(); QProcess clean; @@ -205,7 +207,7 @@ bool XdxfDictDownloader::extract(QString file) { int bufflen = 100; char buff[bufflen]; while(err == BZ_OK) { - int len = BZ2_bzRead(&err, afterbzFile, buff, bufflen); + unsigned int len = BZ2_bzRead(&err, afterbzFile, buff, bufflen); if(fwrite(buff, 1, len, tarfile) != len) return false; } @@ -223,7 +225,8 @@ bool XdxfDictDownloader::extract(QString file) { if(err == -1) return false; - err = tar_extract_all(t, "/tmp/mdict/"); + char text[]={"/tmp/mdict/"}; + err = tar_extract_all(t,text); if(err == -1) { return false; } @@ -238,3 +241,4 @@ bool XdxfDictDownloader::extract(QString file) { } +