summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@digia.com>2013-06-17 16:37:38 +0200
committerKarsten Heimrich <karsten.heimrich@digia.com>2013-06-18 12:31:25 +0200
commit305af595f0f1dd583296bb4a1c0d64481c6c079f (patch)
treea7913426cec850ef0b48b6f7e078384b667c0ee0
parentf4f6babf3ffcd9cfc3e9fe1ca003786ad6c68bde (diff)
Let the user decide to ignore ssl errors and continue connecting.
Change-Id: I7572be71822ad216699d6f20f72919411a62fc3e Reviewed-by: Niels Weber <niels.weber@digia.com> Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
-rw-r--r--src/libs/kdtools/kdupdaterfiledownloader.cpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/libs/kdtools/kdupdaterfiledownloader.cpp b/src/libs/kdtools/kdupdaterfiledownloader.cpp
index d8dc3d45c..b858e2301 100644
--- a/src/libs/kdtools/kdupdaterfiledownloader.cpp
+++ b/src/libs/kdtools/kdupdaterfiledownloader.cpp
@@ -1031,6 +1031,9 @@ void KDUpdater::HttpDownloader::onAuthenticationRequired(QNetworkReply *reply, Q
}
#ifndef QT_NO_OPENSSL
+
+#include "messageboxhandler.h"
+
// TODO: once we switch to Qt5, use QT_NO_SSL instead of QT_NO_OPENSSL
void KDUpdater::HttpDownloader::onSslErrors(QNetworkReply* reply, const QList<QSslError> &errors)
{
@@ -1044,7 +1047,34 @@ void KDUpdater::HttpDownloader::onSslErrors(QNetworkReply* reply, const QList<QS
}
qDebug() << errorString;
- if (!d->aborted)
- httpDone(true);
+ const QStringList arguments = QCoreApplication::arguments();
+ if (arguments.contains(QLatin1String("--script")) || arguments.contains(QLatin1String("Script"))) {
+ reply->ignoreSslErrors();
+ return;
+ }
+ // TODO: Remove above code once we have a proper implementation for message box handler supporting
+ // methods used in the following code, right now we return here cause the message box is not scriptable.
+
+ QMessageBox msgBox(MessageBoxHandler::currentBestSuitParent());
+ msgBox.setDetailedText(errorString);
+ msgBox.setIcon(QMessageBox::Warning);
+ msgBox.setWindowModality(Qt::WindowModal);
+ msgBox.setWindowTitle(tr("Secure Connection Failed"));
+ msgBox.setText(tr("There was an error during connection to: %1.").arg(url().toString()));
+ msgBox.setInformativeText(QString::fromLatin1("<ul><li>%1</li><li>%2</li></ul>").arg(tr("This could be "
+ "a problem with the server's configuration, or it could be someone trying to impersonate the "
+ "server."), tr("If you have connected to this server successfully in the past or trust this server, "
+ "the error may be temporary and you can try again.")));
+
+ msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
+ msgBox.setButtonText(QMessageBox::Yes, tr("Try again"));
+ msgBox.setDefaultButton(QMessageBox::Cancel);
+
+ if (msgBox.exec() == QMessageBox::Cancel) {
+ if (!d->aborted)
+ httpDone(true);
+ } else {
+ reply->ignoreSslErrors();
+ }
}
#endif