aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2018-03-30 09:19:12 +0200
committerAqua-sama <aqua@iserlohn-fortress.net>2018-03-30 09:19:12 +0200
commiteae3987fe52ba78361488866bc1bf40be54c2aed (patch)
treea19f32fa83a16c2d75efcdeb55e5c301231dbffc
parentUpdate pkgbuild (diff)
downloadsmolbote-eae3987fe52ba78361488866bc1bf40be54c2aed.tar.xz
More informative SSL error message
-rw-r--r--src/webengine/webpage.cpp27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/webengine/webpage.cpp b/src/webengine/webpage.cpp
index 7a2a5e7..79bf328 100644
--- a/src/webengine/webpage.cpp
+++ b/src/webengine/webpage.cpp
@@ -7,7 +7,6 @@
*/
#include "webpage.h"
-
#include <QMessageBox>
#include <QWebEngineFullScreenRequest>
@@ -26,10 +25,28 @@ WebPage::WebPage(QWebEngineProfile *profile, QObject *parent)
bool WebPage::certificateError(const QWebEngineCertificateError &certificateError)
{
- auto resp = QMessageBox::warning(nullptr,
- tr("SSL error"),
- tr("An SSL error has occurred:<br>%1").arg(certificateError.errorDescription()),
- QMessageBox::Ignore, QMessageBox::Abort);
+ QMessageBox messageBox;
+
+ messageBox.setWindowTitle(tr("SSL Error"));
+ if(certificateError.isOverridable())
+ messageBox.setIcon(QMessageBox::Warning);
+ else
+ messageBox.setIcon(QMessageBox::Critical);
+
+ messageBox.setText(tr("An SSL error has occurred on <strong>%1</strong>").arg(certificateError.url().toString()));
+ messageBox.setInformativeText(tr("<p>%1</p>"
+ "<p>This error %2 be overridden.</p>")
+ .arg(certificateError.errorDescription(),
+ certificateError.isOverridable() ? tr("can") : tr("cannot")));
+ messageBox.setDetailedText(tr("Error code: %1").arg(certificateError.error()));
+
+ if(certificateError.isOverridable()) {
+ messageBox.setStandardButtons(QMessageBox::Ignore | QMessageBox::Abort);
+ messageBox.setDefaultButton(QMessageBox::Ignore);
+ } else
+ messageBox.setStandardButtons(QMessageBox::Abort);
+
+ auto resp = messageBox.exec();
return resp == QMessageBox::Ignore;
}