Clean and order documentation in source files. Source ready to beta 2 release
[mdictionary] / src / plugins / xdxf / XdxfDictDownloader.cpp
index 1542e32..60f01bf 100644 (file)
@@ -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 <mateusz.polrola@comarch.com>
 */
 
 #include <QDebug>
 #include <QProcess>
 #include <bzlib.h>
-#include <libtar.h>
 #include <stdio.h>
 #include <fcntl.h>
 
+#ifndef Q_WS_MAEMO_5
+    #include <libtar.h>
+#endif
+
+
 typedef void BZFILE;
 
+
 XdxfDictDownloader::XdxfDictDownloader(QObject *parent) :
     QObject(parent) {
     parentDialog = 0;
@@ -156,7 +164,7 @@ void XdxfDictDownloader::dictListReceived(QNetworkReply *reply) {
     QRegExp regInner("<tr>.*</tr>");
     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())
@@ -172,7 +180,6 @@ void XdxfDictDownloader::dictListReceived(QNetworkReply *reply) {
         progressDialog->show();
 
         QString url = selectDialog.link();
-
         _fileName = url.split('/').last();
 
         QProcess clean;
@@ -203,7 +210,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;
     }
@@ -221,7 +228,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;
     }