summaryrefslogtreecommitdiffstats
path: root/examples/network/download/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/network/download/main.cpp')
-rw-r--r--examples/network/download/main.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/network/download/main.cpp b/examples/network/download/main.cpp
index 5980ecd..1b7e54b 100644
--- a/examples/network/download/main.cpp
+++ b/examples/network/download/main.cpp
@@ -45,12 +45,19 @@
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
+#include <QSslError>
#include <QStringList>
#include <QTimer>
#include <QUrl>
#include <stdio.h>
+QT_BEGIN_NAMESPACE
+class QSslError;
+QT_END_NAMESPACE
+
+QT_USE_NAMESPACE
+
class DownloadManager: public QObject
{
Q_OBJECT
@@ -66,6 +73,7 @@ public:
public slots:
void execute();
void downloadFinished(QNetworkReply *reply);
+ void sslErrors(const QList<QSslError> &errors);
};
DownloadManager::DownloadManager()
@@ -78,6 +86,7 @@ void DownloadManager::doDownload(const QUrl &url)
{
QNetworkRequest request(url);
QNetworkReply *reply = manager.get(request);
+ connect(reply, SIGNAL(sslErrors(QList<QSslError>)), SLOT(sslErrors(QList<QSslError>)));
currentDownloads.append(reply);
}
@@ -140,6 +149,14 @@ void DownloadManager::execute()
}
}
+void DownloadManager::sslErrors(const QList<QSslError> &sslErrors)
+{
+#ifndef QT_NO_OPENSSL
+ foreach (const QSslError &error, sslErrors)
+ fprintf(stderr, "SSL error: %s\n", qPrintable(error.errorString()));
+#endif
+}
+
void DownloadManager::downloadFinished(QNetworkReply *reply)
{
QUrl url = reply->url();