Add notifying about downloading errors in xdxf downloader
[mdictionary] / src / plugins / xdxf / XdxfDictDownloader.cpp
index 6e96c98..38066f4 100644 (file)
@@ -48,6 +48,8 @@ XdxfDictDownloader::XdxfDictDownloader(QObject *parent) :
 
     progressDialog = 0;
     connect(&http, SIGNAL(finished()), this, SLOT(processFinished()));
+    connect(&http, SIGNAL(error(QString)),
+            this, SLOT(downloadingError(QString)));
 }
 
 void XdxfDictDownloader::download(QWidget *parent) {
@@ -69,6 +71,11 @@ QString XdxfDictDownloader::downloadedFile() {
 }
 
 
+void XdxfDictDownloader::downloadingError(QString error) {
+    breakDownloading();
+    Q_EMIT notify(Notify::Error, error);
+}
+
 void XdxfDictDownloader::breakDownloading() {
     //if user cancel downloading we kill all running processes, hide progress dialog and set flag that user cancel downloading.
     aborted = true;
@@ -115,9 +122,9 @@ void XdxfDictDownloader::downloadComplete() {
 }
 
 void XdxfDictDownloader::dictListReceived(QNetworkReply *reply) {
-
-    if(aborted) return;
     progressDialog->accept();
+    if(aborted) return;
+
 
     if(reply->error() != QNetworkReply::NoError) {
         Q_EMIT notify(Notify::Error, reply->errorString());