diff options
-rw-r--r-- | src/webengine/webpage.cpp | 27 |
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; } |