Commit a862d537 authored by Ming Rui Zhang's avatar Ming Rui Zhang Committed by Andreas Traczyk

updater: handle download manager network related errors

Change-Id: Ie26928bc3fdcef2c216c7c359773cd3de3300443
parent 58cc801b
......@@ -55,7 +55,7 @@ void DownloadManager::doDownload(const QUrl& url)
downloadTime_.start();
#if QT_CONFIG(ssl)
connect(currentDownload_, SIGNAL(sslErrors(QList<QSslError>)), this, SLOT(sslErrors(QList<QSslError>)));
connect(currentDownload_, SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError>&)), this, SLOT(getsslErrors(QList<QSslError>)));
#endif
//downloadProgress() signal is emitted when data is received
connect(currentDownload_, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(downloadProgress(qint64, qint64)));
......@@ -74,7 +74,7 @@ void DownloadManager::downloadFinished()
{
// donload finished normally
statusCode_ = currentDownload_->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
if (statusCode_ == 404) {
if (statusCode_ != 200) {
QMessageBox::critical(0, "Error!", "DownLoad Failed!");
}
probar_.setMaximum(0);
......@@ -132,7 +132,7 @@ QString DownloadManager::versionOnline()
QString urlstr = "https://dl.jami.net/windows/version";
QUrl url = QUrl::fromEncoded(urlstr.toLocal8Bit());
doDownload(url);
if (statusCode_ == 404) {
if (statusCode_ != 200) {
QMessageBox::critical(0, "Version Check Error", "Version Cannot Be Verified");
return "Null";
}
......@@ -149,7 +149,7 @@ QString DownloadManager::versionOnline()
return onlineVersion;
}
void DownloadManager::sslErrors(const QList<QSslError>& sslErrors)
void DownloadManager::getsslErrors(const QList<QSslError>& sslErrors)
{
#if QT_CONFIG(ssl)
for (const QSslError& error : sslErrors)
......
......@@ -48,7 +48,7 @@ public:
int getDownloadStatus();
public slots:
void sslErrors(const QList<QSslError>& sslErrors);
void getsslErrors(const QList<QSslError>& sslErrors);
void downloadFinished();
void downloadProgress(qint64 bytesRead, qint64 totalBytes);
void httpReadyRead();
......
......@@ -35,10 +35,10 @@
#include <QTimer>
#include <QtConcurrent/QtConcurrent>
#include "downloadmanger.h"
#include "deleteaccountdialog.h"
#include "passworddialog.h"
#include "downloadmanger.h"
#include "nameregistrationdialog.h"
#include "passworddialog.h"
#include "settingskey.h"
#include "utils.h"
#include "deviceitemwidget.h"
......@@ -874,7 +874,7 @@ void SettingsWidget::checkForUpdateSlot()
QString urlstr = "https://dl.jami.net/windows/jami-x64.msi";
QUrl url = QUrl::fromEncoded(urlstr.toLocal8Bit());
manager.doDownload(url);
if (manager.getDownloadStatus() == 404) {
if (manager.getDownloadStatus() != 200) {
QMessageBox::critical(0, "Download Status", "Installer Download Failed, Please Contact Support");
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment