diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-01-26 00:41:09 +0100 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2018-01-26 00:41:09 +0100 |
commit | 1bc3c311551d53759ffdfb11904c45f1cc2f91ce (patch) | |
tree | ca22cf2d17611dfe3aa0cfbf3ac825ecb014b9f4 /src/webengine | |
parent | Configuration class rework (diff) | |
download | smolbote-1bc3c311551d53759ffdfb11904c45f1cc2f91ce.tar.xz |
UrlLineEdit rework
- moved UrlLineEdit to src/addressbar
- added UrlLineEdit::connectWebView
- removed UrlLineEdit::pageAction
- UrlLineEdit restores the text format when losing focus
- Split off completer code into Completer class
- WebPage now displays a warning message box instead on certificate errors
Diffstat (limited to 'src/webengine')
-rw-r--r-- | src/webengine/webpage.cpp | 9 | ||||
-rw-r--r-- | src/webengine/webpage.h | 3 | ||||
-rw-r--r-- | src/webengine/webview.cpp | 8 | ||||
-rw-r--r-- | src/webengine/webview.h | 1 |
4 files changed, 8 insertions, 13 deletions
diff --git a/src/webengine/webpage.cpp b/src/webengine/webpage.cpp index b2f8c43..7a2a5e7 100644 --- a/src/webengine/webpage.cpp +++ b/src/webengine/webpage.cpp @@ -8,6 +8,7 @@ #include "webpage.h" +#include <QMessageBox> #include <QWebEngineFullScreenRequest> WebPage::WebPage(QWebEngineProfile *profile, QObject *parent) @@ -25,6 +26,10 @@ WebPage::WebPage(QWebEngineProfile *profile, QObject *parent) bool WebPage::certificateError(const QWebEngineCertificateError &certificateError) { - emit certificateErrorMessage(certificateError.errorDescription()); - return certificateError.isOverridable(); + auto resp = QMessageBox::warning(nullptr, + tr("SSL error"), + tr("An SSL error has occurred:<br>%1").arg(certificateError.errorDescription()), + QMessageBox::Ignore, QMessageBox::Abort); + + return resp == QMessageBox::Ignore; } diff --git a/src/webengine/webpage.h b/src/webengine/webpage.h index 0c7c3b9..674f278 100644 --- a/src/webengine/webpage.h +++ b/src/webengine/webpage.h @@ -17,9 +17,6 @@ class WebPage : public QWebEnginePage public: explicit WebPage(QWebEngineProfile *profile, QObject *parent = nullptr); -signals: - void certificateErrorMessage(const QString &message); - protected: bool certificateError(const QWebEngineCertificateError &certificateError); }; diff --git a/src/webengine/webview.cpp b/src/webengine/webview.cpp index fa03dd4..263fb67 100644 --- a/src/webengine/webview.cpp +++ b/src/webengine/webview.cpp @@ -30,7 +30,7 @@ #include <QStatusBar> // ssl errors -#include "lib/navigation/urllineedit.h" +#include "src/addressbar/urllineedit.h" WebView::WebView(MainWindow *parentMainWindow, QWidget *parent) : QWebEngineView(parent) @@ -144,7 +144,6 @@ void WebView::setPage(WebPage *page) // make sure the page gets cleaned up if we replace it by taking ownership page->setParent(this); connect(page, &WebPage::linkHovered, this, &WebView::handleLinkHovered); - connect(page, &WebPage::certificateErrorMessage, this, &WebView::handleCertificateError); QWebEngineView::setPage(page); } @@ -192,8 +191,3 @@ void WebView::handleLinkHovered(const QString &url) m_parent->statusBar()->showMessage(url); } } - -void WebView::handleCertificateError(const QString &message) -{ - m_parent->m_addressBar->showSslError(message); -} diff --git a/src/webengine/webview.h b/src/webengine/webview.h index 5242d0d..957d181 100644 --- a/src/webengine/webview.h +++ b/src/webengine/webview.h @@ -35,7 +35,6 @@ protected: private slots: void handleLinkHovered(const QString &url); - void handleCertificateError(const QString &message); private: MainWindow *m_parent = nullptr; |