From f144dbb39bead4cd9ae1e1971e8d904f13675560 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 1 Oct 2015 17:06:26 +0200 Subject: add signal WebEngineView.windowCloseRequested Change-Id: I47919cb21e084eaafc39411c634850c2845f5acc Reviewed-by: Allan Sandfeld Jensen --- src/webengine/api/qquickwebengineview.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/webengine/api/qquickwebengineview.cpp') diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index b22b2798e..96a80a940 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -504,7 +504,8 @@ void QQuickWebEngineViewPrivate::adoptNewWindow(WebContentsAdapter *newWebConten void QQuickWebEngineViewPrivate::close() { - // Not implemented yet. + Q_Q(QQuickWebEngineView); + emit q->windowCloseRequested(); } void QQuickWebEngineViewPrivate::requestFullScreen(bool fullScreen) -- cgit v1.2.1 From 2e9c6cd0bd6789a4f46fe0bcfbd522f0dd3eb4cb Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 9 Oct 2015 10:50:56 +0200 Subject: add RequestClose web action Web pages can set the onbeforeunload handler to let the user confirm whether to leave the page or not. Until now, only when leaving the page via a link, a confirmation was shown. Before actually closing a web page, applications can now trigger the RequestClose web action. This will give the use the chance to confirm or deny the close request. If the request is confirmed, the signal windowCloseRequested is emitted. Task-number: QTBUG-36155 Change-Id: Icc1fabc37a2ac537f674c2f00bc8966e4dc4e610 Reviewed-by: Allan Sandfeld Jensen --- src/webengine/api/qquickwebengineview.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/webengine/api/qquickwebengineview.cpp') diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 96a80a940..3a05477a1 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -508,6 +508,14 @@ void QQuickWebEngineViewPrivate::close() emit q->windowCloseRequested(); } +void QQuickWebEngineViewPrivate::windowCloseRejected() +{ +#ifdef ENABLE_QML_TESTSUPPORT_API + if (m_testSupport) + Q_EMIT m_testSupport->windowCloseRejected(); +#endif +} + void QQuickWebEngineViewPrivate::requestFullScreen(bool fullScreen) { Q_Q(QQuickWebEngineView); @@ -1298,6 +1306,9 @@ void QQuickWebEngineView::triggerWebAction(WebAction action) case ExitFullScreen: d->adapter->exitFullScreen(); break; + case RequestClose: + d->adapter->requestClose(); + break; default: Q_UNREACHABLE(); } -- cgit v1.2.1