summaryrefslogtreecommitdiffstats
path: root/src/webengine
diff options
context:
space:
mode:
Diffstat (limited to 'src/webengine')
-rw-r--r--src/webengine/api/qquickwebenginedownloaditem.cpp2
-rw-r--r--src/webengine/api/qquickwebenginehistory.cpp102
-rw-r--r--src/webengine/api/qquickwebenginenewviewrequest.cpp7
-rw-r--r--src/webengine/api/qquickwebenginenewviewrequest_p.h2
-rw-r--r--src/webengine/api/qquickwebengineprofile.cpp39
-rw-r--r--src/webengine/api/qquickwebengineprofile_p.h8
-rw-r--r--src/webengine/api/qquickwebenginesettings.cpp53
-rw-r--r--src/webengine/api/qquickwebenginesettings_p.h10
-rw-r--r--src/webengine/api/qquickwebenginesingleton.cpp36
-rw-r--r--src/webengine/api/qquickwebenginetestsupport_p.h4
-rw-r--r--src/webengine/api/qquickwebengineview.cpp371
-rw-r--r--src/webengine/api/qquickwebengineview_p.h77
-rw-r--r--src/webengine/api/qquickwebengineview_p_p.h15
-rw-r--r--src/webengine/api/qtwebengineglobal.cpp28
-rw-r--r--src/webengine/doc/images/qtwebengine-architecture.pngbin0 -> 11325 bytes
-rw-r--r--src/webengine/doc/qtwebengine.qdocconf47
-rw-r--r--src/webengine/doc/src/external-resources.qdoc48
-rw-r--r--src/webengine/doc/src/qtwebengine-devtools.qdoc58
-rw-r--r--src/webengine/doc/src/qtwebengine-examples.qdoc (renamed from src/webengine/doc/src/qtwebengine.qdoc)19
-rw-r--r--src/webengine/doc/src/qtwebengine-index.qdoc90
-rw-r--r--src/webengine/doc/src/qtwebengine-modules.qdoc45
-rw-r--r--src/webengine/doc/src/qtwebengine-overview.qdoc185
-rw-r--r--src/webengine/doc/src/qtwebengine-platform-notes.qdoc52
-rw-r--r--src/webengine/doc/src/qtwebengine-qmlmodule.qdoc39
-rw-r--r--src/webengine/doc/src/webengineview.qdoc (renamed from src/webengine/doc/src/qquickwebengineview_lgpl.qdoc)413
-rw-r--r--src/webengine/plugin/experimental/experimental.pro2
-rw-r--r--src/webengine/plugin/experimental/plugin.cpp6
-rw-r--r--src/webengine/plugin/plugin.cpp24
-rw-r--r--src/webengine/plugin/plugin.pro4
-rw-r--r--src/webengine/plugin/plugins.qmltypes99
-rw-r--r--src/webengine/plugin/testsupport/plugin.cpp2
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.cpp23
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quick.h2
-rw-r--r--src/webengine/render_widget_host_view_qt_delegate_quickwindow.h1
-rw-r--r--src/webengine/ui/AuthenticationDialog.qml105
-rw-r--r--src/webengine/ui/ui.pro2
-rw-r--r--src/webengine/ui_delegates_manager.cpp124
-rw-r--r--src/webengine/ui_delegates_manager.h32
-rw-r--r--src/webengine/webengine.pro6
39 files changed, 1818 insertions, 364 deletions
diff --git a/src/webengine/api/qquickwebenginedownloaditem.cpp b/src/webengine/api/qquickwebenginedownloaditem.cpp
index e04cff2c4..da47388ee 100644
--- a/src/webengine/api/qquickwebenginedownloaditem.cpp
+++ b/src/webengine/api/qquickwebenginedownloaditem.cpp
@@ -227,7 +227,7 @@ qint64 QQuickWebEngineDownloadItem::receivedBytes() const
The download path can only be set in the \c WebEngineProfile.onDownloadRequested
handler before the download is accepted.
- \sa WebEngineProfile::downloadRequested(WebEngineDownloadItem download), WebEngineDownloadItem::accept()
+ \sa WebEngineProfile::downloadRequested(), accept()
*/
QString QQuickWebEngineDownloadItem::path() const
diff --git a/src/webengine/api/qquickwebenginehistory.cpp b/src/webengine/api/qquickwebenginehistory.cpp
index 9a737fbbe..175b52248 100644
--- a/src/webengine/api/qquickwebenginehistory.cpp
+++ b/src/webengine/api/qquickwebenginehistory.cpp
@@ -118,6 +118,26 @@ int QQuickWebEngineForwardHistoryListModelPrivate::offsetForIndex(int index) con
return index + 1;
}
+/*!
+ \qmltype WebEngineHistoryListModel
+ \instantiates QQuickWebEngineHistoryListModel
+ \inqmlmodule QtWebEngine 1.1
+ \since QtWebEngine 1.1
+
+ \brief A data model that represents the history of a web engine page.
+
+ The WebEngineHistoryListModel type exposes the \e title, \e url, and \e offset roles. The
+ \e title and \e url specify the title and URL of the visited page. The \e offset specifies
+ the position of the page in respect to the current page (0). A positive number indicates that
+ the page was visited after the current page, whereas a negative number indicates that the page
+ was visited before the current page.
+
+ This type is uncreatable, but it can be accessed by using the
+ \l{WebEngineView::navigationHistory}{WebEngineView.navigationHistory} property.
+
+ \sa WebEngineHistory
+*/
+
QQuickWebEngineHistoryListModel::QQuickWebEngineHistoryListModel()
: QAbstractListModel()
{
@@ -185,6 +205,67 @@ QQuickWebEngineHistoryPrivate::~QQuickWebEngineHistoryPrivate()
{
}
+/*!
+ \qmltype WebEngineHistory
+ \instantiates QQuickWebEngineHistory
+ \inqmlmodule QtWebEngine 1.1
+ \since QtWebEngine 1.1
+
+ \brief Provides data models that represent the history of a web engine page.
+
+ The WebEngineHistory type can be accessed by using the
+ \l{WebEngineView::navigationHistory}{WebEngineView.navigationHistory} property.
+
+ The WebEngineHistory type providess the following WebEngineHistoryListModel data model objects:
+
+ \list
+ \li \c backItems, which contains the URLs of visited pages.
+ \li \c forwardItems, which contains the URLs of the pages that were visited after visiting
+ the current page.
+ \li \c items, which contains the URLs of the back and forward items, as well as the URL of
+ the current page.
+ \endlist
+
+ The easiest way to use these models is to use them in a ListView as illustrated by the
+ following code snippet:
+
+ \code
+ ListView {
+ id: historyItemsList
+ anchors.fill: parent
+ model: webEngineView.navigationHistory.items
+ delegate:
+ Text {
+ color: "black"
+ text: model.title + " - " + model.url + " (" + model.offset + ")"
+ }
+ }
+ \endcode
+
+ The ListView shows the content of the corresponding model. The delegate is responsible for the
+ format of the list items. The appearance of each item of the list in the delegate can be defined
+ separately (it is not web engine specific).
+
+ The model roles \e title and \e url specify the title and URL of the visited page. The \e offset
+ role specifies the position of the page in respect to the current page (0). A positive number
+ indicates that the page was visited after the current page, whereas a negative number indicates
+ that the page was visited before the current page.
+
+ The data models can also be used to create a menu, as illustrated by the following code
+ snippet:
+
+ \quotefromfile webengine/quicknanobrowser/browserwindow.qml
+ \skipto ToolBar
+ \printuntil onObjectRemoved
+ \printuntil }
+ \printuntil }
+ \printuntil }
+
+ For the complete example, see \l{WebEngine Quick Nano Browser}.
+
+ \sa WebEngineHistoryListModel
+*/
+
QQuickWebEngineHistory::QQuickWebEngineHistory(QQuickWebEngineViewPrivate *view)
: d_ptr(new QQuickWebEngineHistoryPrivate(view))
{
@@ -194,6 +275,13 @@ QQuickWebEngineHistory::~QQuickWebEngineHistory()
{
}
+/*!
+ \qmlproperty QQuickWebEngineHistoryListModel WebEngineHistory::items
+ \readonly
+ \since QtWebEngine 1.1
+
+ URLs of back items, forward items, and the current item in the history.
+*/
QQuickWebEngineHistoryListModel *QQuickWebEngineHistory::items() const
{
Q_D(const QQuickWebEngineHistory);
@@ -202,6 +290,13 @@ QQuickWebEngineHistoryListModel *QQuickWebEngineHistory::items() const
return d->m_navigationModel.data();
}
+/*!
+ \qmlproperty QQuickWebEngineHistoryListModel WebEngineHistory::backItems
+ \readonly
+ \since QtWebEngine 1.1
+
+ URLs of visited pages.
+*/
QQuickWebEngineHistoryListModel *QQuickWebEngineHistory::backItems() const
{
Q_D(const QQuickWebEngineHistory);
@@ -210,6 +305,13 @@ QQuickWebEngineHistoryListModel *QQuickWebEngineHistory::backItems() const
return d->m_backNavigationModel.data();
}
+/*!
+ \qmlproperty QQuickWebEngineHistoryListModel WebEngineHistory::forwardItems
+ \readonly
+ \since QtWebEngine 1.1
+
+ URLs of the pages that were visited after visiting the current page.
+*/
QQuickWebEngineHistoryListModel *QQuickWebEngineHistory::forwardItems() const
{
Q_D(const QQuickWebEngineHistory);
diff --git a/src/webengine/api/qquickwebenginenewviewrequest.cpp b/src/webengine/api/qquickwebenginenewviewrequest.cpp
index f66a44e5f..6e20c0a46 100644
--- a/src/webengine/api/qquickwebenginenewviewrequest.cpp
+++ b/src/webengine/api/qquickwebenginenewviewrequest.cpp
@@ -89,7 +89,7 @@ bool QQuickWebEngineNewViewRequest::isUserInitiated() const
*/
void QQuickWebEngineNewViewRequest::openIn(QQuickWebEngineView *view)
{
- if (!m_adapter) {
+ if (!m_adapter && !m_requestedUrl.isValid()) {
qWarning("Trying to open an empty request, it was either already used or was invalidated."
"\nYou must complete the request synchronously within the newViewRequested signal handler."
" If a view hasn't been adopted before returning, the request will be invalidated.");
@@ -100,6 +100,9 @@ void QQuickWebEngineNewViewRequest::openIn(QQuickWebEngineView *view)
qWarning("Trying to open a WebEngineNewViewRequest in an invalid WebEngineView.");
return;
}
- view->d_func()->adoptWebContents(m_adapter.data());
+ if (m_adapter)
+ view->d_func()->adoptWebContents(m_adapter.data());
+ else
+ view->setUrl(m_requestedUrl);
m_adapter.reset();
}
diff --git a/src/webengine/api/qquickwebenginenewviewrequest_p.h b/src/webengine/api/qquickwebenginenewviewrequest_p.h
index f9fac13e9..b408812ba 100644
--- a/src/webengine/api/qquickwebenginenewviewrequest_p.h
+++ b/src/webengine/api/qquickwebenginenewviewrequest_p.h
@@ -73,6 +73,8 @@ private:
QQuickWebEngineView::NewViewDestination m_destination;
bool m_isUserInitiated;
QExplicitlySharedDataPointer<QtWebEngineCore::WebContentsAdapter> m_adapter;
+ QUrl m_requestedUrl;
+ friend class QQuickWebEngineView;
friend class QQuickWebEngineViewPrivate;
};
diff --git a/src/webengine/api/qquickwebengineprofile.cpp b/src/webengine/api/qquickwebengineprofile.cpp
index 68884f967..a678fe5fa 100644
--- a/src/webengine/api/qquickwebengineprofile.cpp
+++ b/src/webengine/api/qquickwebengineprofile.cpp
@@ -40,6 +40,7 @@
#include "qquickwebenginedownloaditem_p_p.h"
#include "qquickwebengineprofile_p_p.h"
#include "qquickwebenginesettings_p.h"
+#include "qwebenginecookiestoreclient.h"
#include <QQmlEngine>
@@ -56,6 +57,9 @@ QQuickWebEngineProfilePrivate::QQuickWebEngineProfilePrivate(BrowserContextAdapt
{
m_browserContextRef->addClient(this);
m_settings->d_ptr->initDefaults(browserContext->isOffTheRecord());
+ // Fullscreen API was implemented before the supported setting, so we must
+ // make it default true to avoid change in default API behavior.
+ m_settings->d_ptr->setAttribute(QtWebEngineCore::WebEngineSettings::FullScreenSupportEnabled, true);
}
QQuickWebEngineProfilePrivate::~QQuickWebEngineProfilePrivate()
@@ -131,10 +135,11 @@ void QQuickWebEngineProfilePrivate::downloadUpdated(const DownloadItemInfo &info
\instantiates QQuickWebEngineProfile
\inqmlmodule QtWebEngine 1.1
\since QtWebEngine 1.1
- \brief Contains common settings for multiple web engine views.
+ \brief Contains settings, scripts, and visited links common to multiple web engine views.
- Contains settings and history shared by all the web engine views that belong
- to the profile.
+ WebEngineProfile contains settings, scripts, and the list of visited links shared by all
+ views that belong to the profile. As such, profiles can be used to isolate views
+ from each other. A typical use case is a dedicated profile for a 'private browsing' mode.
Each web engine view has an associated profile. Views that do not have a specific profile set
share a common default one.
@@ -384,6 +389,28 @@ void QQuickWebEngineProfile::setHttpCacheMaximumSize(int maximumSize)
emit httpCacheMaximumSizeChanged();
}
+/*!
+ \qmlproperty QString WebEngineProfile::httpAcceptLanguage
+
+ The value of the Accept-Language HTTP request-header field.
+
+ \since QtWebEngine 1.2
+*/
+QString QQuickWebEngineProfile::httpAcceptLanguage() const
+{
+ Q_D(const QQuickWebEngineProfile);
+ return d->browserContext()->httpAcceptLanguage();
+}
+
+void QQuickWebEngineProfile::setHttpAcceptLanguage(const QString &httpAcceptLanguage)
+{
+ Q_D(QQuickWebEngineProfile);
+ if (d->browserContext()->httpAcceptLanguage() == httpAcceptLanguage)
+ return;
+ d->browserContext()->setHttpAcceptLanguage(httpAcceptLanguage);
+ emit httpAcceptLanguageChanged();
+}
+
QQuickWebEngineProfile *QQuickWebEngineProfile::defaultProfile()
{
static QQuickWebEngineProfile *profile = new QQuickWebEngineProfile(
@@ -392,6 +419,12 @@ QQuickWebEngineProfile *QQuickWebEngineProfile::defaultProfile()
return profile;
}
+QWebEngineCookieStoreClient *QQuickWebEngineProfile::cookieStoreClient() const
+{
+ const Q_D(QQuickWebEngineProfile);
+ return d->browserContext()->cookieStoreClient();
+}
+
QQuickWebEngineSettings *QQuickWebEngineProfile::settings() const
{
const Q_D(QQuickWebEngineProfile);
diff --git a/src/webengine/api/qquickwebengineprofile_p.h b/src/webengine/api/qquickwebengineprofile_p.h
index 323721bd0..b4e0d173c 100644
--- a/src/webengine/api/qquickwebengineprofile_p.h
+++ b/src/webengine/api/qquickwebengineprofile_p.h
@@ -63,6 +63,7 @@ QT_BEGIN_NAMESPACE
class QQuickWebEngineDownloadItem;
class QQuickWebEngineProfilePrivate;
class QQuickWebEngineSettings;
+class QWebEngineCookieStoreClient;
class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineProfile : public QObject {
Q_OBJECT
@@ -74,6 +75,7 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineProfile : public QObject {
Q_PROPERTY(QString cachePath READ cachePath WRITE setCachePath NOTIFY cachePathChanged FINAL)
Q_PROPERTY(QString httpUserAgent READ httpUserAgent WRITE setHttpUserAgent NOTIFY httpUserAgentChanged FINAL)
Q_PROPERTY(HttpCacheType httpCacheType READ httpCacheType WRITE setHttpCacheType NOTIFY httpCacheTypeChanged FINAL)
+ Q_PROPERTY(QString httpAcceptLanguage READ httpAcceptLanguage WRITE setHttpAcceptLanguage NOTIFY httpAcceptLanguageChanged FINAL REVISION 1)
Q_PROPERTY(PersistentCookiesPolicy persistentCookiesPolicy READ persistentCookiesPolicy WRITE setPersistentCookiesPolicy NOTIFY persistentCookiesPolicyChanged FINAL)
Q_PROPERTY(int httpCacheMaximumSize READ httpCacheMaximumSize WRITE setHttpCacheMaximumSize NOTIFY httpCacheMaximumSizeChanged FINAL)
public:
@@ -115,8 +117,13 @@ public:
int httpCacheMaximumSize() const;
void setHttpCacheMaximumSize(int maxSize);
+ QString httpAcceptLanguage() const;
+ void setHttpAcceptLanguage(const QString &httpAcceptLanguage);
+
static QQuickWebEngineProfile *defaultProfile();
+ Q_REVISION(1) Q_INVOKABLE QWebEngineCookieStoreClient *cookieStoreClient() const;
+
signals:
void storageNameChanged();
void offTheRecordChanged();
@@ -126,6 +133,7 @@ signals:
void httpCacheTypeChanged();
void persistentCookiesPolicyChanged();
void httpCacheMaximumSizeChanged();
+ Q_REVISION(1) void httpAcceptLanguageChanged();
void downloadRequested(QQuickWebEngineDownloadItem *download);
void downloadFinished(QQuickWebEngineDownloadItem *download);
diff --git a/src/webengine/api/qquickwebenginesettings.cpp b/src/webengine/api/qquickwebenginesettings.cpp
index 248713543..8f2e1bcf2 100644
--- a/src/webengine/api/qquickwebenginesettings.cpp
+++ b/src/webengine/api/qquickwebenginesettings.cpp
@@ -54,13 +54,15 @@ QQuickWebEngineSettings::QQuickWebEngineSettings(QQuickWebEngineSettings *parent
\instantiates QQuickWebEngineSettings
\inqmlmodule QtWebEngine
\since QtWebEngine 1.1
- \brief WebEngineSettings allows configuration of browser properties and attributes.
+ \brief Allows configuration of browser properties and attributes.
- WebEngineSettings allows configuration of browser properties and generic attributes, such as
- JavaScript support, focus behavior, and access to remote content.
-
- Each WebEngineView can have individual settings.
+ The WebEngineSettings type can be used to configure browser properties and generic
+ attributes, such as JavaScript support, focus behavior, and access to remote content. This type
+ is uncreatable, but the default settings for all web engine views can be accessed by using
+ the \l [QML] {WebEngine::settings}{WebEngine.settings} property.
+ Each web engine view can have individual settings that can be accessed by using the
+ \l{WebEngineView::settings}{WebEngineView.settings} property.
*/
@@ -206,6 +208,31 @@ bool QQuickWebEngineSettings::errorPageEnabled() const
}
/*!
+ \qmlproperty bool WebEngineSettings::pluginsEnabled
+
+ Enables support for Pepper plugins, such as the Flash player.
+
+ Disabled by default.
+*/
+bool QQuickWebEngineSettings::pluginsEnabled() const
+{
+ return d_ptr->testAttribute(WebEngineSettings::PluginsEnabled);
+}
+
+/*!
+ \qmlproperty bool WebEngineSettings::fullscreenSupportEnabled
+ \since QtWebEngine 1.2
+
+ Tells the web engine whether fullscreen is supported in this application or not.
+
+ Enabled by default.
+*/
+bool QQuickWebEngineSettings::fullScreenSupportEnabled() const
+{
+ return d_ptr->testAttribute(WebEngineSettings::FullScreenSupportEnabled);
+}
+
+/*!
\qmlproperty QString WebEngineSettings::defaultTextEncoding
Sets the default encoding. The value must be a string describing an encoding such as "utf-8" or
@@ -309,6 +336,22 @@ void QQuickWebEngineSettings::setErrorPageEnabled(bool on)
Q_EMIT errorPageEnabledChanged();
}
+void QQuickWebEngineSettings::setPluginsEnabled(bool on)
+{
+ bool wasOn = d_ptr->testAttribute(WebEngineSettings::PluginsEnabled);
+ d_ptr->setAttribute(WebEngineSettings::PluginsEnabled, on);
+ if (wasOn != on)
+ Q_EMIT pluginsEnabledChanged();
+}
+
+void QQuickWebEngineSettings::setFullScreenSupportEnabled(bool on)
+{
+ bool wasOn = d_ptr->testAttribute(WebEngineSettings::FullScreenSupportEnabled);
+ d_ptr->setAttribute(WebEngineSettings::FullScreenSupportEnabled, on);
+ if (wasOn != on)
+ Q_EMIT fullScreenSupportEnabledChanged();
+}
+
void QQuickWebEngineSettings::setDefaultTextEncoding(QString encoding)
{
const QString oldDefaultTextEncoding = d_ptr->defaultTextEncoding();
diff --git a/src/webengine/api/qquickwebenginesettings_p.h b/src/webengine/api/qquickwebenginesettings_p.h
index 213505078..030762ed3 100644
--- a/src/webengine/api/qquickwebenginesettings_p.h
+++ b/src/webengine/api/qquickwebenginesettings_p.h
@@ -71,6 +71,9 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineSettings : public QObject {
Q_PROPERTY(bool localContentCanAccessFileUrls READ localContentCanAccessFileUrls WRITE setLocalContentCanAccessFileUrls NOTIFY localContentCanAccessFileUrlsChanged)
Q_PROPERTY(bool hyperlinkAuditingEnabled READ hyperlinkAuditingEnabled WRITE setHyperlinkAuditingEnabled NOTIFY hyperlinkAuditingEnabledChanged)
Q_PROPERTY(bool errorPageEnabled READ errorPageEnabled WRITE setErrorPageEnabled NOTIFY errorPageEnabledChanged)
+ Q_PROPERTY(bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled NOTIFY pluginsEnabledChanged)
+ // FIXME(QTBUG-40043): Mark fullScreenSupportEnabled with REVISION 1
+ Q_PROPERTY(bool fullScreenSupportEnabled READ fullScreenSupportEnabled WRITE setFullScreenSupportEnabled NOTIFY fullScreenSupportEnabledChanged)
Q_PROPERTY(QString defaultTextEncoding READ defaultTextEncoding WRITE setDefaultTextEncoding NOTIFY defaultTextEncodingChanged)
public:
@@ -87,6 +90,8 @@ public:
bool localContentCanAccessFileUrls() const;
bool hyperlinkAuditingEnabled() const;
bool errorPageEnabled() const;
+ bool pluginsEnabled() const;
+ bool fullScreenSupportEnabled() const;
QString defaultTextEncoding() const;
void setAutoLoadImages(bool on);
@@ -100,6 +105,8 @@ public:
void setLocalContentCanAccessFileUrls(bool on);
void setHyperlinkAuditingEnabled(bool on);
void setErrorPageEnabled(bool on);
+ void setPluginsEnabled(bool on);
+ void setFullScreenSupportEnabled(bool on);
void setDefaultTextEncoding(QString encoding);
signals:
@@ -114,6 +121,9 @@ signals:
void localContentCanAccessFileUrlsChanged();
void hyperlinkAuditingEnabledChanged();
void errorPageEnabledChanged();
+ void pluginsEnabledChanged();
+ // FIXME(QTBUG-40043): Mark fullScreenSupportEnabledChanged with Q_REVISION(1)
+ void fullScreenSupportEnabledChanged();
void defaultTextEncodingChanged();
private:
diff --git a/src/webengine/api/qquickwebenginesingleton.cpp b/src/webengine/api/qquickwebenginesingleton.cpp
index 3f0c8cb65..7ff974eb4 100644
--- a/src/webengine/api/qquickwebenginesingleton.cpp
+++ b/src/webengine/api/qquickwebenginesingleton.cpp
@@ -41,11 +41,47 @@
QT_BEGIN_NAMESPACE
+/*!
+ \qmltype WebEngine
+ \instantiates QQuickWebEngineSingleton
+ \inqmlmodule QtWebEngine 1.1
+ \since QtWebEngine 1.1
+ \brief Provides access to the default settings and profiles shared by all web engine views.
+
+ The WebEngine singleton type provides access to the default profile and the default settings
+ shared by all web engine views. It can be used to change settings globally, as illustrated by
+ the following code snippet:
+
+ \code
+ Component.onCompleted: {
+ WebEngine.settings.javaScriptEnabled = true;
+ }
+ \endcode
+*/
+
+/*!
+ \qmlproperty WebEngineSettings WebEngine::settings
+ \readonly
+ \since QtWebEngine 1.1
+
+ Default settings for all web engine views.
+
+ \sa WebEngineSettings
+*/
QQuickWebEngineSettings *QQuickWebEngineSingleton::settings() const
{
return defaultProfile()->settings();
}
+/*!
+ \qmlproperty WebEngineProfile WebEngine::defaultProfile
+ \readonly
+ \since QtWebEngine 1.1
+
+ Default profile for all web engine views.
+
+ \sa WebEngineProfile
+*/
QQuickWebEngineProfile *QQuickWebEngineSingleton::defaultProfile() const
{
return QQuickWebEngineProfile::defaultProfile();
diff --git a/src/webengine/api/qquickwebenginetestsupport_p.h b/src/webengine/api/qquickwebenginetestsupport_p.h
index 8d52dfa7c..d4b50ac2d 100644
--- a/src/webengine/api/qquickwebenginetestsupport_p.h
+++ b/src/webengine/api/qquickwebenginetestsupport_p.h
@@ -78,6 +78,10 @@ public:
QQuickWebEngineTestSupport();
QQuickWebEngineErrorPage *errorPage() const;
+Q_SIGNALS:
+ void validationMessageShown(const QString &mainText, const QString &subText);
+ void windowCloseRejected();
+
private:
QScopedPointer<QQuickWebEngineErrorPage> m_errorPage;
};
diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp
index 6c3452a6a..52245e147 100644
--- a/src/webengine/api/qquickwebengineview.cpp
+++ b/src/webengine/api/qquickwebengineview.cpp
@@ -37,8 +37,10 @@
#include "qquickwebengineview_p.h"
#include "qquickwebengineview_p_p.h"
+#include "authentication_dialog_controller.h"
#include "browser_context_adapter.h"
#include "certificate_error_controller.h"
+#include "file_picker_controller.h"
#include "javascript_dialog_controller.h"
#include "qquickwebenginehistory_p.h"
#include "qquickwebenginecertificateerror_p.h"
@@ -63,7 +65,9 @@
#include "web_engine_settings.h"
#include "web_engine_visited_links_manager.h"
+#include <QClipboard>
#include <QGuiApplication>
+#include <QMimeData>
#include <QQmlComponent>
#include <QQmlContext>
#include <QQmlEngine>
@@ -102,8 +106,10 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate()
, loadProgress(0)
, m_isFullScreen(false)
, isLoading(false)
+ , m_activeFocusOnPress(true)
, devicePixelRatio(QGuiApplication::primaryScreen()->devicePixelRatio())
, m_dpiScale(1.0)
+ , m_backgroundColor(Qt::white)
{
// The gold standard for mobile web content is 160 dpi, and the devicePixelRatio expected
// is the (possibly quantized) ratio of device dpi to 160 dpi.
@@ -175,31 +181,101 @@ bool QQuickWebEngineViewPrivate::contextMenuRequested(const WebEngineContextMenu
if (!menu)
return false;
+ contextMenuData = data;
+
// Populate our menu
MenuItemHandler *item = 0;
+ if (!data.linkText.isEmpty() && data.linkUrl.isValid()) {
+ item = new MenuItemHandler(menu);
+ QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::OpenLinkInThisWindow); });
+ ui()->addMenuItem(item, QQuickWebEngineView::tr("Follow Link"));
+ }
+
if (data.selectedText.isEmpty()) {
item = new MenuItemHandler(menu);
QObject::connect(item, &MenuItemHandler::triggered, q, &QQuickWebEngineView::goBack);
- ui()->addMenuItem(item, QObject::tr("Back"), QStringLiteral("go-previous"), q->canGoBack());
+ ui()->addMenuItem(item, QQuickWebEngineView::tr("Back"), QStringLiteral("go-previous"), q->canGoBack());
item = new MenuItemHandler(menu);
QObject::connect(item, &MenuItemHandler::triggered, q, &QQuickWebEngineView::goForward);
- ui()->addMenuItem(item, QObject::tr("Forward"), QStringLiteral("go-next"), q->canGoForward());
+ ui()->addMenuItem(item, QQuickWebEngineView::tr("Forward"), QStringLiteral("go-next"), q->canGoForward());
item = new MenuItemHandler(menu);
QObject::connect(item, &MenuItemHandler::triggered, q, &QQuickWebEngineView::reload);
- ui()->addMenuItem(item, QObject::tr("Reload"), QStringLiteral("view-refresh"));
+ ui()->addMenuItem(item, QQuickWebEngineView::tr("Reload"), QStringLiteral("view-refresh"));
} else {
- item = new CopyMenuItem(menu, data.selectedText);
- ui()->addMenuItem(item, QObject::tr("Copy..."));
+ item = new MenuItemHandler(menu);
+ QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::Copy); });
+ ui()->addMenuItem(item, QQuickWebEngineView::tr("Copy"));
}
- if (!data.linkText.isEmpty() && data.linkUrl.isValid()) {
- item = new NavigateMenuItem(menu, adapter, data.linkUrl);
- ui()->addMenuItem(item, QObject::tr("Navigate to..."));
- item = new CopyMenuItem(menu, data.linkUrl.toString());
- ui()->addMenuItem(item, QObject::tr("Copy link address"));
+ if (!contextMenuData.linkText.isEmpty() && contextMenuData.linkUrl.isValid()) {
+ item = new MenuItemHandler(menu);
+ QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::CopyLinkToClipboard); });
+ ui()->addMenuItem(item, QQuickWebEngineView::tr("Copy Link URL"));
+ item = new MenuItemHandler(menu);
+ QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::DownloadLinkToDisk); });
+ ui()->addMenuItem(item, QQuickWebEngineView::tr("Save Link"));
+ }
+ if (contextMenuData.mediaUrl.isValid()) {
+ switch (contextMenuData.mediaType) {
+ case WebEngineContextMenuData::MediaTypeImage:
+ item = new MenuItemHandler(menu);
+ QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::CopyImageUrlToClipboard); });
+ ui()->addMenuItem(item, QQuickWebEngineView::tr("Copy Image URL"));
+ item = new MenuItemHandler(menu);
+ QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::CopyImageToClipboard); });
+ ui()->addMenuItem(item, QQuickWebEngineView::tr("Copy Image"));
+ item = new MenuItemHandler(menu);
+ QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::DownloadImageToDisk); });
+ ui()->addMenuItem(item, QQuickWebEngineView::tr("Save Image"));
+ break;
+ case WebEngineContextMenuData::MediaTypeCanvas:
+ Q_UNREACHABLE(); // mediaUrl is invalid for canvases
+ break;
+ case WebEngineContextMenuData::MediaTypeAudio:
+ case WebEngineContextMenuData::MediaTypeVideo:
+ item = new MenuItemHandler(menu);
+ QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::CopyMediaUrlToClipboard); });
+ ui()->addMenuItem(item, QQuickWebEngineView::tr("Copy Media URL"));
+ item = new MenuItemHandler(menu);
+ QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::DownloadMediaToDisk); });
+ ui()->addMenuItem(item, QQuickWebEngineView::tr("Save Media"));
+ item = new MenuItemHandler(menu);
+ QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::ToggleMediaPlayPause); });
+ ui()->addMenuItem(item, QQuickWebEngineView::tr("Toggle Play/Pause"));
+ item = new MenuItemHandler(menu);
+ QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::ToggleMediaLoop); });
+ ui()->addMenuItem(item, QQuickWebEngineView::tr("Toggle Looping"));
+ if (contextMenuData.mediaFlags & WebEngineContextMenuData::MediaHasAudio) {
+ item = new MenuItemHandler(menu);
+ QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::ToggleMediaMute); });
+ ui()->addMenuItem(item, QQuickWebEngineView::tr("Toggle Mute"));
+ }
+ if (contextMenuData.mediaFlags & WebEngineContextMenuData::MediaCanToggleControls) {
+ item = new MenuItemHandler(menu);
+ QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::ToggleMediaControls); });
+ ui()->addMenuItem(item, QQuickWebEngineView::tr("Toggle Media Controls"));
+ }
+ break;
+ default:
+ break;
+ }
+ } else if (contextMenuData.mediaType == WebEngineContextMenuData::MediaTypeCanvas) {
+ item = new MenuItemHandler(menu);
+ QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::CopyImageToClipboard); });
+ ui()->addMenuItem(item, QQuickWebEngineView::tr("Copy Image"));
+ }
+ if (adapter->hasInspector()) {
+ item = new MenuItemHandler(menu);
+ QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::InspectElement); });
+ ui()->addMenuItem(item, QQuickWebEngineView::tr("Inspect Element"));
+ }
+ if (isFullScreenMode()) {
+ item = new MenuItemHandler(menu);
+ QObject::connect(item, &MenuItemHandler::triggered, [q] { q->triggerWebAction(QQuickWebEngineView::ExitFullScreen); });
+ ui()->addMenuItem(item, QQuickWebEngineView::tr("Exit Full Screen Mode"));
}
// FIXME: expose the context menu data as an attached property to make this more useful
@@ -251,9 +327,9 @@ void QQuickWebEngineViewPrivate::runGeolocationPermissionRequest(const QUrl &url
Q_EMIT q->featurePermissionRequested(url, QQuickWebEngineView::Geolocation);
}
-void QQuickWebEngineViewPrivate::runFileChooser(FileChooserMode mode, const QString &defaultFileName, const QStringList &acceptedMimeTypes)
+void QQuickWebEngineViewPrivate::runFileChooser(FilePickerController* controller)
{
- ui()->showFilePicker(mode, defaultFileName, acceptedMimeTypes, adapter);
+ ui()->showFilePicker(controller);
}
void QQuickWebEngineViewPrivate::passOnFocus(bool reverse)
@@ -310,6 +386,11 @@ qreal QQuickWebEngineViewPrivate::dpiScale() const
return m_dpiScale;
}
+QColor QQuickWebEngineViewPrivate::backgroundColor() const
+{
+ return m_backgroundColor;
+}
+
void QQuickWebEngineViewPrivate::loadStarted(const QUrl &provisionalUrl, bool isErrorPage)
{
Q_Q(QQuickWebEngineView);
@@ -423,17 +504,26 @@ void QQuickWebEngineViewPrivate::adoptNewWindow(WebContentsAdapter *newWebConten
void QQuickWebEngineViewPrivate::close()
{
- // Not implemented yet.
+ Q_Q(QQuickWebEngineView);
+ emit q->windowCloseRequested();
}
-void QQuickWebEngineViewPrivate::requestFullScreen(bool fullScreen)
+void QQuickWebEngineViewPrivate::windowCloseRejected()
+{
+#ifdef ENABLE_QML_TESTSUPPORT_API
+ if (m_testSupport)
+ Q_EMIT m_testSupport->windowCloseRejected();
+#endif
+}
+
+void QQuickWebEngineViewPrivate::requestFullScreenMode(const QUrl &origin, bool fullscreen)
{
Q_Q(QQuickWebEngineView);
- QQuickWebEngineFullScreenRequest request(this, fullScreen);
+ QQuickWebEngineFullScreenRequest request(this, origin, fullscreen);
Q_EMIT q->fullScreenRequested(request);
}
-bool QQuickWebEngineViewPrivate::isFullScreen() const
+bool QQuickWebEngineViewPrivate::isFullScreenMode() const
{
return m_isFullScreen;
}
@@ -444,6 +534,11 @@ void QQuickWebEngineViewPrivate::javaScriptConsoleMessage(JavaScriptConsoleMessa
Q_EMIT q->javaScriptConsoleMessage(static_cast<QQuickWebEngineView::JavaScriptConsoleMessageLevel>(level), message, lineNumber, sourceID);
}
+void QQuickWebEngineViewPrivate::authenticationRequired(QSharedPointer<AuthenticationDialogController> controller)
+{
+ ui()->showDialog(controller);
+}
+
void QQuickWebEngineViewPrivate::runMediaAccessPermissionRequest(const QUrl &securityOrigin, WebContentsAdapterClient::MediaRequestFlags requestFlags)
{
Q_Q(QQuickWebEngineView);
@@ -581,7 +676,7 @@ QQuickWebEngineView::QQuickWebEngineView(QQuickItem *parent)
Q_D(QQuickWebEngineView);
d->e->q_ptr = d->q_ptr = this;
this->setActiveFocusOnTab(true);
- this->setFlag(QQuickItem::ItemIsFocusScope);
+ this->setFlags(QQuickItem::ItemIsFocusScope | QQuickItem::ItemAcceptsInputMethod);
#ifndef QT_NO_ACCESSIBILITY
QQuickAccessibleAttached *accessible = QQuickAccessibleAttached::qmlAttachedProperties(this);
@@ -754,8 +849,23 @@ void QQuickWebEngineView::setTestSupport(QQuickWebEngineTestSupport *testSupport
Q_D(QQuickWebEngineView);
d->m_testSupport = testSupport;
}
+
#endif
+/*!
+ * \qmlproperty bool WebEngineView::activeFocusOnPress
+ * \since QtWebEngine 1.2
+ *
+ * This property specifies whether the view should gain active focus when pressed.
+ * The default value is true.
+ *
+ */
+bool QQuickWebEngineView::activeFocusOnPress() const
+{
+ Q_D(const QQuickWebEngineView);
+ return d->m_activeFocusOnPress;
+}
+
void QQuickWebEngineViewPrivate::didRunJavaScript(quint64 requestId, const QVariant &result)
{
Q_Q(QQuickWebEngineView);
@@ -774,6 +884,11 @@ void QQuickWebEngineViewPrivate::didFindText(quint64 requestId, int matchCount)
}
void QQuickWebEngineViewPrivate::showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText)
{
+#ifdef ENABLE_QML_TESTSUPPORT_API
+ if (m_testSupport)
+ Q_EMIT m_testSupport->validationMessageShown(mainText, subText);
+#endif
+
ui()->showMessageBubble(anchor, mainText, subText);
}
@@ -787,6 +902,14 @@ void QQuickWebEngineViewPrivate::moveValidationMessage(const QRect &anchor)
ui()->moveMessageBubble(anchor);
}
+void QQuickWebEngineViewPrivate::renderProcessTerminated(
+ RenderProcessTerminationStatus terminationStatus, int exitCode)
+{
+ Q_Q(QQuickWebEngineView);
+ Q_EMIT q->renderProcessTerminated(static_cast<QQuickWebEngineView::RenderProcessTerminationStatus>(
+ renderProcessExitStatus(terminationStatus)), exitCode);
+}
+
bool QQuickWebEngineView::isLoading() const
{
Q_D(const QQuickWebEngineView);
@@ -849,6 +972,34 @@ qreal QQuickWebEngineView::zoomFactor() const
return d->adapter->currentZoomFactor();
}
+/*!
+ \qmlproperty bool WebEngineView::backgroundColor
+ \since QtWebEngine 1.2
+
+ Sets this property to change the color of the WebEngineView's background,
+ behing the document's body. You can set it to "transparent" or to a translucent
+ color to see through the document, or you can set this color to match your
+ web content in an hybrid app to prevent the white flashes that may appear
+ during loading.
+
+ The default value is white.
+*/
+QColor QQuickWebEngineView::backgroundColor() const
+{
+ Q_D(const QQuickWebEngineView);
+ return d->m_backgroundColor;
+}
+
+void QQuickWebEngineView::setBackgroundColor(const QColor &color)
+{
+ Q_D(QQuickWebEngineView);
+ if (color == d->m_backgroundColor)
+ return;
+ d->m_backgroundColor = color;
+ d->ensureContentsAdapter();
+ d->adapter->backgroundColorChanged();
+ emit backgroundColorChanged();
+}
bool QQuickWebEngineView::isFullScreen() const
{
@@ -943,6 +1094,16 @@ void QQuickWebEngineView::grantFeaturePermission(const QUrl &securityOrigin, QQu
}
}
+void QQuickWebEngineView::setActiveFocusOnPress(bool arg)
+{
+ Q_D(QQuickWebEngineView);
+ if (d->m_activeFocusOnPress == arg)
+ return;
+
+ d->m_activeFocusOnPress = arg;
+ emit activeFocusOnPressChanged(arg);
+}
+
void QQuickWebEngineView::goBackOrForward(int offset)
{
Q_D(QQuickWebEngineView);
@@ -988,6 +1149,171 @@ void QQuickWebEngineView::itemChange(ItemChange change, const ItemChangeData &va
QQuickItem::itemChange(change, value);
}
+void QQuickWebEngineView::triggerWebAction(WebAction action)
+{
+ Q_D(QQuickWebEngineView);
+ switch (action) {
+ case Back:
+ d->adapter->navigateToOffset(-1);
+ break;
+ case Forward:
+ d->adapter->navigateToOffset(1);
+ break;
+ case Stop:
+ d->adapter->stop();
+ break;
+ case Reload:
+ d->adapter->reload();
+ break;
+ case ReloadAndBypassCache:
+ d->adapter->reloadAndBypassCache();
+ break;
+ case Cut:
+ d->adapter->cut();
+ break;
+ case Copy:
+ d->adapter->copy();
+ break;
+ case Paste:
+ d->adapter->paste();
+ break;
+ case Undo:
+ d->adapter->undo();
+ break;
+ case Redo:
+ d->adapter->redo();
+ break;
+ case SelectAll:
+ d->adapter->selectAll();
+ break;
+ case PasteAndMatchStyle:
+ d->adapter->pasteAndMatchStyle();
+ break;
+ case OpenLinkInThisWindow:
+ if (d->contextMenuData.linkUrl.isValid())
+ setUrl(d->contextMenuData.linkUrl);
+ break;
+ case OpenLinkInNewWindow:
+ if (d->contextMenuData.linkUrl.isValid()) {
+ QQuickWebEngineNewViewRequest request;
+ request.m_requestedUrl = d->contextMenuData.linkUrl;
+ request.m_isUserInitiated = true;
+ request.m_destination = NewViewInWindow;
+ Q_EMIT newViewRequested(&request);
+ }
+ break;
+ case OpenLinkInNewTab:
+ if (d->contextMenuData.linkUrl.isValid()) {
+ QQuickWebEngineNewViewRequest request;
+ request.m_requestedUrl = d->contextMenuData.linkUrl;
+ request.m_isUserInitiated = true;
+ request.m_destination = NewViewInBackgroundTab;
+ Q_EMIT newViewRequested(&request);
+ }
+ break;
+ case CopyLinkToClipboard:
+ if (d->contextMenuData.linkUrl.isValid()) {
+ QString urlString = d->contextMenuData.linkUrl.toString(QUrl::FullyEncoded);
+ QString title = d->contextMenuData.linkText.toHtmlEscaped();
+ QMimeData *data = new QMimeData();
+ data->setText(urlString);
+ QString html = QStringLiteral("<a href=\"") + urlString + QStringLiteral("\">") + title + QStringLiteral("</a>");
+ data->setHtml(html);
+ data->setUrls(QList<QUrl>() << d->contextMenuData.linkUrl);
+ qApp->clipboard()->setMimeData(data);
+ }
+ break;
+ case DownloadLinkToDisk:
+ if (d->contextMenuData.linkUrl.isValid())
+ d->adapter->download(d->contextMenuData.linkUrl, d->contextMenuData.suggestedFileName);
+ break;
+ case CopyImageToClipboard:
+ if (d->contextMenuData.hasImageContent &&
+ (d->contextMenuData.mediaType == WebEngineContextMenuData::MediaTypeImage ||
+ d->contextMenuData.mediaType == WebEngineContextMenuData::MediaTypeCanvas))
+ {
+ d->adapter->copyImageAt(d->contextMenuData.pos);
+ }
+ break;
+ case CopyImageUrlToClipboard:
+ if (d->contextMenuData.mediaUrl.isValid() && d->contextMenuData.mediaType == WebEngineContextMenuData::MediaTypeImage) {
+ QString urlString = d->contextMenuData.mediaUrl.toString(QUrl::FullyEncoded);
+ QString title = d->contextMenuData.linkText;
+ if (!title.isEmpty())
+ title = QStringLiteral(" alt=\"%1\"").arg(title.toHtmlEscaped());
+ QMimeData *data = new QMimeData();
+ data->setText(urlString);
+ QString html = QStringLiteral("<img src=\"") + urlString + QStringLiteral("\"") + title + QStringLiteral("></img>");
+ data->setHtml(html);
+ data->setUrls(QList<QUrl>() << d->contextMenuData.mediaUrl);
+ qApp->clipboard()->setMimeData(data);
+ }
+ break;
+ case DownloadImageToDisk:
+ case DownloadMediaToDisk:
+ if (d->contextMenuData.mediaUrl.isValid())
+ d->adapter->download(d->contextMenuData.mediaUrl, d->contextMenuData.suggestedFileName);
+ break;
+ case CopyMediaUrlToClipboard:
+ if (d->contextMenuData.mediaUrl.isValid() &&
+ (d->contextMenuData.mediaType == WebEngineContextMenuData::MediaTypeAudio ||
+ d->contextMenuData.mediaType == WebEngineContextMenuData::MediaTypeVideo))
+ {
+ QString urlString = d->contextMenuData.mediaUrl.toString(QUrl::FullyEncoded);
+ QMimeData *data = new QMimeData();
+ data->setText(urlString);
+ if (d->contextMenuData.mediaType == WebEngineContextMenuData::MediaTypeAudio)
+ data->setHtml(QStringLiteral("<audio src=\"") + urlString + QStringLiteral("\"></audio>"));
+ else
+ data->setHtml(QStringLiteral("<video src=\"") + urlString + QStringLiteral("\"></video>"));
+ data->setUrls(QList<QUrl>() << d->contextMenuData.mediaUrl);
+ qApp->clipboard()->setMimeData(data);
+ }
+ break;
+ case ToggleMediaControls:
+ if (d->contextMenuData.mediaUrl.isValid() && d->contextMenuData.mediaFlags & WebEngineContextMenuData::MediaCanToggleControls) {
+ bool enable = !(d->contextMenuData.mediaFlags & WebEngineContextMenuData::MediaControls);
+ d->adapter->executeMediaPlayerActionAt(d->contextMenuData.pos, WebContentsAdapter::MediaPlayerControls, enable);
+ }
+ break;
+ case ToggleMediaLoop:
+ if (d->contextMenuData.mediaUrl.isValid() &&
+ (d->contextMenuData.mediaType == WebEngineContextMenuData::MediaTypeAudio ||
+ d->contextMenuData.mediaType == WebEngineContextMenuData::MediaTypeVideo))
+ {
+ bool enable = !(d->contextMenuData.mediaFlags & WebEngineContextMenuData::MediaLoop);
+ d->adapter->executeMediaPlayerActionAt(d->contextMenuData.pos, WebContentsAdapter::MediaPlayerLoop, enable);
+ }
+ break;
+ case ToggleMediaPlayPause:
+ if (d->contextMenuData.mediaUrl.isValid() &&
+ (d->contextMenuData.mediaType == WebEngineContextMenuData::MediaTypeAudio ||
+ d->contextMenuData.mediaType == WebEngineContextMenuData::MediaTypeVideo))
+ {
+ bool enable = (d->contextMenuData.mediaFlags & WebEngineContextMenuData::MediaPaused);
+ d->adapter->executeMediaPlayerActionAt(d->contextMenuData.pos, WebContentsAdapter::MediaPlayerPlay, enable);
+ }
+ break;
+ case ToggleMediaMute:
+ if (d->contextMenuData.mediaUrl.isValid() && d->contextMenuData.mediaFlags & WebEngineContextMenuData::MediaHasAudio) {
+ bool enable = (d->contextMenuData.mediaFlags & WebEngineContextMenuData::MediaMuted);
+ d->adapter->executeMediaPlayerActionAt(d->contextMenuData.pos, WebContentsAdapter::MediaPlayerMute, enable);
+ }
+ break;
+ case InspectElement:
+ d->adapter->inspectElementAt(d->contextMenuData.pos);
+ break;
+ case ExitFullScreen:
+ d->adapter->exitFullScreen();
+ break;
+ case RequestClose:
+ d->adapter->requestClose();
+ break;
+ default:
+ Q_UNREACHABLE();
+ }
+}
+
void QQuickWebEngineViewPrivate::userScripts_append(QQmlListProperty<QQuickWebEngineScript> *p, QQuickWebEngineScript *script)
{
Q_ASSERT(p && p->data);
@@ -1036,8 +1362,9 @@ QQuickWebEngineFullScreenRequest::QQuickWebEngineFullScreenRequest()
{
}
-QQuickWebEngineFullScreenRequest::QQuickWebEngineFullScreenRequest(QQuickWebEngineViewPrivate *viewPrivate, bool toggleOn)
+QQuickWebEngineFullScreenRequest::QQuickWebEngineFullScreenRequest(QQuickWebEngineViewPrivate *viewPrivate, const QUrl &origin, bool toggleOn)
: viewPrivate(viewPrivate)
+ , m_origin(origin)
, m_toggleOn(toggleOn)
{
}
@@ -1046,10 +1373,18 @@ void QQuickWebEngineFullScreenRequest::accept()
{
if (viewPrivate && viewPrivate->m_isFullScreen != m_toggleOn) {
viewPrivate->m_isFullScreen = m_toggleOn;
+ viewPrivate->adapter->changedFullScreen();
Q_EMIT viewPrivate->q_ptr->isFullScreenChanged();
}
}
+void QQuickWebEngineFullScreenRequest::reject()
+{
+ if (viewPrivate) {
+ viewPrivate->adapter->changedFullScreen();
+ }
+}
+
QQuickWebEngineViewExperimental::QQuickWebEngineViewExperimental(QQuickWebEngineViewPrivate *viewPrivate)
: q_ptr(0)
, d_ptr(viewPrivate)
diff --git a/src/webengine/api/qquickwebengineview_p.h b/src/webengine/api/qquickwebengineview_p.h
index f85bf64ad..ddc656a58 100644
--- a/src/webengine/api/qquickwebengineview_p.h
+++ b/src/webengine/api/qquickwebengineview_p.h
@@ -71,19 +71,25 @@ class QQuickWebEngineTestSupport;
class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineFullScreenRequest {
Q_GADGET
+ Q_PROPERTY(QUrl origin READ origin)
Q_PROPERTY(bool toggleOn READ toggleOn)
public:
QQuickWebEngineFullScreenRequest();
- QQuickWebEngineFullScreenRequest(QQuickWebEngineViewPrivate *viewPrivate, bool toggleOn);
+ QQuickWebEngineFullScreenRequest(QQuickWebEngineViewPrivate *viewPrivate, const QUrl &origin, bool toggleOn);
Q_INVOKABLE void accept();
- bool toggleOn() { return m_toggleOn; }
+ Q_INVOKABLE void reject();
+ QUrl origin() const { return m_origin; }
+ bool toggleOn() const { return m_toggleOn; }
private:
QQuickWebEngineViewPrivate *viewPrivate;
- bool m_toggleOn;
+ const QUrl m_origin;
+ const bool m_toggleOn;
};
+#define LATEST_WEBENGINEVIEW_REVISION 2
+
class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem {
Q_OBJECT
Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
@@ -100,6 +106,8 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem {
Q_PROPERTY(QQuickWebEngineHistory *navigationHistory READ navigationHistory CONSTANT FINAL REVISION 1)
Q_PROPERTY(QQmlWebChannel *webChannel READ webChannel WRITE setWebChannel NOTIFY webChannelChanged REVISION 1)
Q_PROPERTY(QQmlListProperty<QQuickWebEngineScript> userScripts READ userScripts FINAL REVISION 1)
+ Q_PROPERTY(bool activeFocusOnPress READ activeFocusOnPress WRITE setActiveFocusOnPress NOTIFY activeFocusOnPressChanged REVISION 2)
+ Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged REVISION 2)
#ifdef ENABLE_QML_TESTSUPPORT_API
Q_PROPERTY(QQuickWebEngineTestSupport *testSupport READ testSupport WRITE setTestSupport FINAL)
@@ -112,7 +120,9 @@ class Q_WEBENGINE_PRIVATE_EXPORT QQuickWebEngineView : public QQuickItem {
Q_ENUMS(NewViewDestination);
Q_ENUMS(Feature);
Q_ENUMS(JavaScriptConsoleMessageLevel);
+ Q_ENUMS(RenderProcessTerminationStatus);
Q_FLAGS(FindFlags);
+ Q_ENUMS(WebAction);
public:
QQuickWebEngineView(QQuickItem *parent = 0);
@@ -129,6 +139,8 @@ public:
bool isFullScreen() const;
qreal zoomFactor() const;
void setZoomFactor(qreal arg);
+ QColor backgroundColor() const;
+ void setBackgroundColor(const QColor &color);
QQuickWebEngineViewExperimental *experimental() const;
@@ -181,6 +193,48 @@ public:
Geolocation
};
+ enum WebAction {
+ NoWebAction = - 1,
+ Back,
+ Forward,
+ Stop,
+ Reload,
+
+ Cut,
+ Copy,
+ Paste,
+
+ Undo,
+ Redo,
+ SelectAll,
+ ReloadAndBypassCache,
+
+ PasteAndMatchStyle,
+
+ OpenLinkInThisWindow,
+ OpenLinkInNewWindow,
+ OpenLinkInNewTab,
+ CopyLinkToClipboard,
+ DownloadLinkToDisk,
+
+ CopyImageToClipboard,
+ CopyImageUrlToClipboard,
+ DownloadImageToDisk,
+
+ CopyMediaUrlToClipboard,
+ ToggleMediaControls,
+ ToggleMediaLoop,
+ ToggleMediaPlayPause,
+ ToggleMediaMute,
+ DownloadMediaToDisk,
+
+ InspectElement,
+ ExitFullScreen,
+ RequestClose,
+
+ WebActionCount
+ };
+
// must match WebContentsAdapterClient::JavaScriptConsoleMessageLevel
enum JavaScriptConsoleMessageLevel {
InfoMessageLevel = 0,
@@ -188,6 +242,14 @@ public:
ErrorMessageLevel
};
+ // must match WebContentsAdapterClient::RenderProcessTerminationStatus
+ enum RenderProcessTerminationStatus {
+ NormalTerminationStatus = 0,
+ AbnormalTerminationStatus,
+ CrashedTerminationStatus,
+ KilledTerminationStatus
+ };
+
enum FindFlag {
FindBackward = 1,
FindCaseSensitively = 2,
@@ -211,6 +273,8 @@ public:
void setTestSupport(QQuickWebEngineTestSupport *testSupport);
#endif
+ bool activeFocusOnPress() const;
+
public Q_SLOTS:
void runJavaScript(const QString&, const QJSValue & = QJSValue());
void loadHtml(const QString &html, const QUrl &baseUrl = QUrl());
@@ -223,6 +287,8 @@ public Q_SLOTS:
Q_REVISION(1) void findText(const QString &subString, FindFlags options = 0, const QJSValue &callback = QJSValue());
Q_REVISION(1) void fullScreenCancelled();
Q_REVISION(1) void grantFeaturePermission(const QUrl &securityOrigin, Feature, bool granted);
+ Q_REVISION(2) void setActiveFocusOnPress(bool arg);
+ Q_REVISION(2) void triggerWebAction(WebAction action);
Q_SIGNALS:
void titleChanged();
@@ -241,7 +307,10 @@ Q_SIGNALS:
Q_REVISION(1) void zoomFactorChanged(qreal arg);
Q_REVISION(1) void profileChanged();
Q_REVISION(1) void webChannelChanged();
-
+ Q_REVISION(2) void activeFocusOnPressChanged(bool);
+ Q_REVISION(2) void backgroundColorChanged();
+ Q_REVISION(2) void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode);
+ Q_REVISION(2) void windowCloseRequested();
protected:
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry);
diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h
index 60aa0d9f4..c2210850f 100644
--- a/src/webengine/api/qquickwebengineview_p_p.h
+++ b/src/webengine/api/qquickwebengineview_p_p.h
@@ -134,6 +134,7 @@ public:
virtual void selectionChanged() Q_DECL_OVERRIDE { }
virtual QRectF viewportRect() const Q_DECL_OVERRIDE;
virtual qreal dpiScale() const Q_DECL_OVERRIDE;
+ virtual QColor backgroundColor() const Q_DECL_OVERRIDE;
virtual void loadStarted(const QUrl &provisionalUrl, bool isErrorPage = false) Q_DECL_OVERRIDE;
virtual void loadCommitted() Q_DECL_OVERRIDE;
virtual void loadVisuallyCommitted() Q_DECL_OVERRIDE;
@@ -142,19 +143,20 @@ public:
virtual void unhandledKeyEvent(QKeyEvent *event) Q_DECL_OVERRIDE;
virtual void adoptNewWindow(QtWebEngineCore::WebContentsAdapter *newWebContents, WindowOpenDisposition disposition, bool userGesture, const QRect &) Q_DECL_OVERRIDE;
virtual void close() Q_DECL_OVERRIDE;
- virtual void requestFullScreen(bool) Q_DECL_OVERRIDE;
- virtual bool isFullScreen() const Q_DECL_OVERRIDE;
+ virtual void windowCloseRejected() Q_DECL_OVERRIDE;
+ virtual void requestFullScreenMode(const QUrl &origin, bool fullscreen) Q_DECL_OVERRIDE;
+ virtual bool isFullScreenMode() const Q_DECL_OVERRIDE;
virtual bool contextMenuRequested(const QtWebEngineCore::WebEngineContextMenuData &) Q_DECL_OVERRIDE;
virtual void navigationRequested(int navigationType, const QUrl &url, int &navigationRequestAction, bool isMainFrame) Q_DECL_OVERRIDE;
virtual void javascriptDialog(QSharedPointer<QtWebEngineCore::JavaScriptDialogController>) Q_DECL_OVERRIDE;
- virtual void runFileChooser(FileChooserMode, const QString &defaultFileName, const QStringList &acceptedMimeTypes) Q_DECL_OVERRIDE;
+ virtual void runFileChooser(QtWebEngineCore::FilePickerController *controller) Q_DECL_OVERRIDE;
virtual void didRunJavaScript(quint64, const QVariant&) Q_DECL_OVERRIDE;
virtual void didFetchDocumentMarkup(quint64, const QString&) Q_DECL_OVERRIDE { }
virtual void didFetchDocumentInnerText(quint64, const QString&) Q_DECL_OVERRIDE { }
virtual void didFindText(quint64, int) Q_DECL_OVERRIDE;
virtual void passOnFocus(bool reverse) Q_DECL_OVERRIDE;
virtual void javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, const QString& message, int lineNumber, const QString& sourceID) Q_DECL_OVERRIDE;
- virtual void authenticationRequired(const QUrl&, const QString&, bool, const QString&, QString*, QString*) Q_DECL_OVERRIDE { }
+ virtual void authenticationRequired(QSharedPointer<QtWebEngineCore::AuthenticationDialogController>) Q_DECL_OVERRIDE;
virtual void runMediaAccessPermissionRequest(const QUrl &securityOrigin, MediaRequestFlags requestFlags) Q_DECL_OVERRIDE;
virtual void runMouseLockPermissionRequest(const QUrl &securityOrigin) Q_DECL_OVERRIDE;
#ifndef QT_NO_ACCESSIBILITY
@@ -166,6 +168,8 @@ public:
virtual void showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText) Q_DECL_OVERRIDE;
virtual void hideValidationMessage() Q_DECL_OVERRIDE;
virtual void moveValidationMessage(const QRect &anchor) Q_DECL_OVERRIDE;
+ virtual void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus,
+ int exitCode) Q_DECL_OVERRIDE;
virtual QtWebEngineCore::BrowserContextAdapter *browserContextAdapter() Q_DECL_OVERRIDE;
@@ -190,11 +194,13 @@ public:
QQuickWebEngineTestSupport *m_testSupport;
#endif
QQmlComponent *contextMenuExtraItems;
+ QtWebEngineCore::WebEngineContextMenuData contextMenuData;
QUrl explicitUrl;
QUrl icon;
int loadProgress;
bool m_isFullScreen;
bool isLoading;
+ bool m_activeFocusOnPress;
qreal devicePixelRatio;
QMap<quint64, QJSValue> m_callbacks;
QList<QSharedPointer<CertificateErrorController> > m_certificateErrorControllers;
@@ -203,6 +209,7 @@ private:
QScopedPointer<QtWebEngineCore::UIDelegatesManager> m_uIDelegatesManager;
QList<QQuickWebEngineScript *> m_userScripts;
qreal m_dpiScale;
+ QColor m_backgroundColor;
};
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/webengine/api/qtwebengineglobal.cpp b/src/webengine/api/qtwebengineglobal.cpp
index 1c67e710e..07561be6e 100644
--- a/src/webengine/api/qtwebengineglobal.cpp
+++ b/src/webengine/api/qtwebengineglobal.cpp
@@ -47,6 +47,17 @@ Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context();
namespace QtWebEngine {
+/*!
+ \namespace QtWebEngine
+ \inmodule QtWebEngine
+ \ingroup qtwebengine-namespaces
+ \keyword QtWebEngine Namespace
+
+ \brief Helper functions for the Qt WebEngine (Qt Quick) module
+
+ The \l[CPP]{QtWebEngine} namespace is part of the Qt WebEngine module.
+*/
+
static QOpenGLContext *shareContext;
static void deleteShareContext()
@@ -59,6 +70,16 @@ static void deleteShareContext()
// QtWebEngine::initialize was introduced first and meant to be called
// after the QGuiApplication creation, when AA_ShareOpenGLContexts fills
// the same need but the flag has to be set earlier.
+
+/*!
+ \fn QtWebEngine::initialize()
+
+ Sets up an OpenGL Context that can be shared between processes. This has to be done after
+ QGuiApplication is created, but before a Qt Quick window is created.
+
+ This has the same effect as passing Qt::AA_ShareOpenGLContexts to the QGuiApplication
+ constructor.
+*/
void initialize()
{
#ifdef Q_OS_WIN32
@@ -71,11 +92,11 @@ void initialize()
QCoreApplication *app = QCoreApplication::instance();
if (!app) {
- qFatal("QWebEngine(Widgets)::initialize() must be called after the construction of the application object.");
+ qFatal("QtWebEngine::initialize() must be called after the construction of the application object.");
return;
}
if (app->thread() != QThread::currentThread()) {
- qFatal("QWebEngine(Widgets)::initialize() must be called from the Qt gui thread.");
+ qFatal("QtWebEngine::initialize() must be called from the Qt gui thread.");
return;
}
@@ -86,6 +107,9 @@ void initialize()
shareContext->create();
qAddPostRoutine(deleteShareContext);
qt_gl_set_global_share_context(shareContext);
+
+ // Classes like QOpenGLWidget check for the attribute
+ app->setAttribute(Qt::AA_ShareOpenGLContexts);
}
} // namespace QtWebEngine
diff --git a/src/webengine/doc/images/qtwebengine-architecture.png b/src/webengine/doc/images/qtwebengine-architecture.png
new file mode 100644
index 000000000..37ca2da16
--- /dev/null
+++ b/src/webengine/doc/images/qtwebengine-architecture.png
Binary files differ
diff --git a/src/webengine/doc/qtwebengine.qdocconf b/src/webengine/doc/qtwebengine.qdocconf
index ad6898440..01485dc56 100644
--- a/src/webengine/doc/qtwebengine.qdocconf
+++ b/src/webengine/doc/qtwebengine.qdocconf
@@ -4,7 +4,7 @@ project = QtWebEngine
description = Qt WebEngine Reference Documentation
version = $QT_VERSION
-examplesinstallpath = webengine
+examplesinstallpath = qtwebengine
qhp.projects = QtWebEngine
@@ -17,23 +17,54 @@ qhp.QtWebEngine.indexRoot =
qhp.QtWebEngine.filterAttributes = qtwebengine $QT_VERSION qtrefdoc
qhp.QtWebEngine.customFilters.Qt.name = QtWebEngine $QT_VERSION
qhp.QtWebEngine.customFilters.Qt.filterAttributes = qtwebengine $QT_VERSION
-qhp.QtWebEngine.subprojects = qmltypes examples
+
+qhp.QtWebEngine.subprojects = classes qmltypes examples
+
+qhp.QtWebEngine.subprojects.classes.title = C++ Classes
+qhp.QtWebEngine.subprojects.classes.indexTitle = Qt WebEngine C++ Classes
+qhp.QtWebEngine.subprojects.classes.selectors = class doc:headerfile
+qhp.QtWebEngine.subprojects.classes.sortPages = true
+
qhp.QtWebEngine.subprojects.qmltypes.title = QML Types
qhp.QtWebEngine.subprojects.qmltypes.indexTitle = Qt WebEngine QML Types
-qhp.QtWebEngine.subprojects.qmltypes.selectors = qmlclass
+qhp.QtWebEngine.subprojects.qmltypes.selectors = qmltype
qhp.QtWebEngine.subprojects.qmltypes.sortPages = true
+
qhp.QtWebEngine.subprojects.examples.title = Examples
qhp.QtWebEngine.subprojects.examples.indexTitle = Qt WebEngine Examples
-qhp.QtWebEngine.subprojects.examples.selectors = fake:example
+qhp.QtWebEngine.subprojects.examples.selectors = doc:example
qhp.QtWebEngine.subprojects.examples.sortPages = true
tagfile = ../../../doc/qtwebengine/qtwebengine.tags
-depends += qtcore qtgui qtquick qtquickcontrols qtdoc
+depends += qtcore \
+ qtgui \
+ qtqml \
+ qtquick \
+ qtquickcontrols \
+ qtdoc \
+ qtwebchannel \
+ qtwidgets
+
+headerdirs += .. \
+ ../../core \
+ ../../webenginewidgets
-headerdirs += . ../api
-sourcedirs += . ../api
-exampledirs += ../../../examples/webengine .
+sourcedirs += .. \
+ ../../core/ \
+ ../../webenginewidgets \
+
+exampledirs += . \
+ ../../../examples \
+ snippets \
+ ../../core/doc/snippets \
+ ../../webenginewidgets/doc/snippets
+
+
+imagedirs += images
navigation.landingpage = "Qt WebEngine"
+navigation.cppclassespage = "Qt WebEngine C++ Classes"
navigation.qmltypespage = "Qt WebEngine QML Types"
+
+Cpp.ignoretokens += Q_WEBENGINE_EXPORT QWEBENGINEWIDGETS_EXPORT
diff --git a/src/webengine/doc/src/external-resources.qdoc b/src/webengine/doc/src/external-resources.qdoc
new file mode 100644
index 000000000..34a66291e
--- /dev/null
+++ b/src/webengine/doc/src/external-resources.qdoc
@@ -0,0 +1,48 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \externalpage http://www.chromium.org
+ \title Chromium Project
+*/
+
+/*!
+ \externalpage https://developers.google.com/web/tools/chrome-devtools
+ \title Chrome DevTools
+*/
+
+/*
+ This prevents autolinking of each occurrence of 'WebEngine'
+ To link to the WebEngine QML type, use explicit linking:
+ \l [QML] WebEngine
+ \sa {QtWebEngine::}{WebEngine}
+*/
+/*!
+ \externalpage nolink
+ \title WebEngine
+ \internal
+*/
diff --git a/src/webengine/doc/src/qtwebengine-devtools.qdoc b/src/webengine/doc/src/qtwebengine-devtools.qdoc
new file mode 100644
index 000000000..ee87214e1
--- /dev/null
+++ b/src/webengine/doc/src/qtwebengine-devtools.qdoc
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtwebengine-devtools.html
+ \title Qt WebEngine Web Developer Tools
+
+ The Qt WebEngine module provides web developer tools that make it easy
+ to inspect and debug layout and performance issues of any web content.
+
+ The developer tools are accessed as a local web page using a Chromium or
+ Qt WebEngine based browser, such as the Chrome browser.
+
+ To activate the developer tools, start an application that uses Qt
+ WebEngine with the command-line arguments:
+
+ \badcode
+ --remote-debugging-port=<port_number>
+ \endcode
+
+ Where \c <port_number> refers to a local network port. The web developer
+ tools can then be accessed by launching a browser at the address
+ \c http://localhost:<port_number>.
+
+ Alternatively, the environment variable QTWEBENGINE_REMOTE_DEBUGGING
+ can be set. It can be set as either just a port working similarly to
+ \c --remote-debugging-port or given both a host address and a port. The
+ latter can be used to control which network interface to export the
+ interface on, so that you can access the developer tools from a remote
+ device.
+
+ For a detailed explanation of the capabilities of developer tools, see the
+ \l {Chrome DevTools} page.
+*/
diff --git a/src/webengine/doc/src/qtwebengine.qdoc b/src/webengine/doc/src/qtwebengine-examples.qdoc
index e381178f6..ec49577e4 100644
--- a/src/webengine/doc/src/qtwebengine.qdoc
+++ b/src/webengine/doc/src/qtwebengine-examples.qdoc
@@ -24,22 +24,6 @@
*/
/*!
- \qmlmodule QtWebEngine 1.1
- \title Qt WebEngine QML Types
- \brief Provides QML types for rendering web content within a QML application
-
- The QML types can be imported into your application using the following
- import statement in your .qml file:
-
- \code
- import QtQuick 2.0
- import QtWebEngine 1.1
- \endcode
-
- \sa {Qt WebEngine Examples}
-*/
-
-/*!
\group webengine-examples
\title Qt WebEngine Examples
\brief Examples demonstrating the Qt WebEngine usage
@@ -49,5 +33,6 @@
from displaying Web pages within a QML user interface to an implementation of
a basic function Web browser.
- \sa {Qt WebEngine QML Types}
+ For widget-based applications, Qt provides an integrated Web browser component based on
+ Chromium, the popular open source browser engine.
*/
diff --git a/src/webengine/doc/src/qtwebengine-index.qdoc b/src/webengine/doc/src/qtwebengine-index.qdoc
new file mode 100644
index 000000000..e67bd43fd
--- /dev/null
+++ b/src/webengine/doc/src/qtwebengine-index.qdoc
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtwebengine-index.html
+ \title Qt WebEngine
+ \ingroup modules
+
+ \brief Provides functionality for rendering regions of dynamic web content.
+
+ \e {Qt WebEngine} provides functionality for rendering regions of dynamic web content.
+
+ The functionality in Qt WebEngine is divided into the following modules:
+
+ \annotatedlist qtwebengine-modules
+
+ For Qt Quick applications, Qt WebEngine provides the following QML modules:
+
+ \annotatedlist qtwebengine-qmlmodules
+
+ \section1 Getting Started
+
+ To include the definitions of the Qt WebEngineCore and Qt WebEngineWidgets modules' classes, use
+ the following directives:
+
+ \badcode
+ #include <QtWebEngineCore>
+ #include <QtWebEngineWidgets>
+ \endcode
+
+ To import the Qt WebEngine module's QML types, add the following import statement to your .qml
+ file:
+
+ \badcode
+ import QtWebEngine 1.2
+ \endcode
+
+ To link against the modules, add QT variables to your qmake .pro file:
+
+ \badcode
+ QT += webengine webenginecore webenginewidgets
+ \endcode
+
+ \section1 Articles and Guides
+
+ \list
+ \li \l{Qt WebEngine Overview}
+ \li \l{Qt WebEngine Platform Notes}
+ \li \l{Qt WebEngine Web Developer Tools}
+ \li \l{Porting from Qt WebKit to Qt WebEngine}
+ \endlist
+
+ \section1 Examples
+
+ \list
+ \li \l{Qt WebEngine Examples}
+ \li \l{Qt WebEngine Widgets Examples}
+ \endlist
+
+ \section1 API References
+
+ \list
+ \li \l{Qt WebEngine C++ Classes}
+ \li \l{Qt WebEngine QML Types}
+ \endlist
+*/
diff --git a/src/webengine/doc/src/qtwebengine-modules.qdoc b/src/webengine/doc/src/qtwebengine-modules.qdoc
new file mode 100644
index 000000000..8530f5d01
--- /dev/null
+++ b/src/webengine/doc/src/qtwebengine-modules.qdoc
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtwebengine-modules.html
+ \title Qt WebEngine C++ Classes
+ \brief Provides functionality for rendering regions of dynamic web content.
+
+ \e {Qt WebEngine} provides functionality for rendering regions of dynamic web content.
+
+ \section1 Namespaces
+ \annotatedlist qtwebengine-namespaces
+
+ \section1 Classes
+
+ \section2 Qt WebEngineCore Module
+ \generatelist {classesbymodule QtWebEngineCore}
+
+ \section2 Qt WebEngineWidgets Module
+ \generatelist {classesbymodule QtWebEngineWidgets}
+*/
diff --git a/src/webengine/doc/src/qtwebengine-overview.qdoc b/src/webengine/doc/src/qtwebengine-overview.qdoc
new file mode 100644
index 000000000..fa30892d3
--- /dev/null
+++ b/src/webengine/doc/src/qtwebengine-overview.qdoc
@@ -0,0 +1,185 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtwebengine-overview.html
+ \title Qt WebEngine Overview
+
+ The Qt WebEngine module provides a web browser engine that makes it easy to embed content from
+ the World Wide Web into your Qt application on platforms that do not have a native web engine.
+ The web engine is not intended to function as a \e {Web Runtime}; to display web content in a
+ QML application by using APIs native to the platform, use the \l{Qt WebView} module, instead.
+
+ Qt WebEngine provides C++ classes and QML types for rendering HTML, XHTML, and SVG documents,
+ styled using Cascading Style Sheets (CSS) and scripted with JavaScript. HTML documents can be
+ made fully editable by the user through the use of the \c{contenteditable} attribute on HTML
+ elements.
+
+ Qt WebEngine supercedes the \l{http://doc.qt.io/archives/qt-5.3/qtwebkit-index.html}{Qt WebKit}
+ module, which is based on the
+ WebKit project, but has not been actively synchronized with the upstream WebKit code since
+ Qt 5.2 and has been deprecated in Qt 5.5. For tips on how to change a Qt WebKit widgets
+ application to use Qt WebEngine widgets, see \l{Porting from Qt WebKit to Qt WebEngine}. For new
+ applications, we recommend using Qt Quick and the WebEngineView QML type.
+
+ \section1 Qt WebEngine Architecture
+
+ \image qtwebengine-architecture.png
+
+ The functionality in Qt WebEngine is divided into the following modules:
+
+ \list
+ \li \l{Qt WebEngine Widgets}, which provides a web browser engine and C++ classes to render
+ web content and to interact with it
+ \li \l{Qt WebEngine}, which provides QML types for rendering web content within a QML
+ application
+ \li \l{Qt WebEngine Core}, which provides common API used by Qt WebEngine and
+ Qt WebEngine Widgets
+ \endlist
+
+ The Qt WebEngine core is based on the \l {Chromium Project}. Chromium provides its own network
+ and painting engines and is developed tightly together with its dependent modules, and
+ therefore Qt WebEngine provides better and more reliable support for the latest HTML5
+ specification than Qt WebKit. However, Qt WebEngine is thus heavier than Qt WebKit and does
+ not provide direct access to the network stack and the HTML document through C++ APIs.
+
+ Chromium is tightly integrated to the \l{Qt Quick Scene Graph}{Qt Quick scene graph}, which is
+ based on OpenGL ES 2.0 or OpenGL 2.0 for its rendering. This provides you with one-pass
+ compositing of web content and all the Qt Quick UI. The integration to Chromium is transparent
+ to developers, who just work with Qt and JavaScript.
+
+ To expose QObjects to JavaScript, developers can use the \l {Qt WebChannel} module.
+
+ \section1 Embedding Web Content into Widget Based Applications
+
+ Use the QWebEngineView class to display web pages in the simplest way. Because it is a widget,
+ you can embed QWebEngineView into your forms and use its convenience functions to download and
+ display web sites.
+
+ \code
+ QWebEngineView *view = new QWebEngineView(parent);
+ view->load(QUrl("http://www.qt.io/"));
+ view->show();
+ \endcode
+
+ An instance of QWebEngineView has one QWebEnginePage. QWebEnginePage provides access to the
+ page's navigation history and the ability to run JavaScript code in the context of the page's
+ main frame and enables customization of handlers for specific events like showing custom
+ authentication dialogs.
+
+ \section1 Embedding Web Content into Qt Quick Applications
+
+ The WebEngineView QML type allows QML applications to render regions of dynamic web content. A
+ \e{WebEngineView} type may share the screen with other QML types or encompass the full screen
+ as specified within the QML application.
+
+ An application can load pages into the WebEngineView, using either an URL or HTML string, and
+ navigate within session history. By default, links to different pages load within the same
+ WebEngineView object, but web sites may request them to be opened as a new tab, window, or
+ dialog.
+
+ The following sample QML application loads a web page and responds to session history context:
+
+ \qml
+ import QtQuick 2.1
+ import QtQuick.Controls 1.1
+ import QtWebEngine 1.1
+
+ ApplicationWindow {
+ width: 1280
+ height: 720
+ visible: true
+ WebEngineView {
+ id: webview
+ url: "http://www.qt.io"
+ anchors.fill: parent
+ }
+ }
+ \endqml
+
+ \section1 Using WebEngine Core
+
+ Qt WebEngine Core provides an API shared by Qt WebEngine and Qt WebEngine Widgets for handling
+ URL requests issued for the networking stack of Chromium and for accessing its HTTP cookies.
+
+ Implementing the QWebEngineUrlRequestInterceptor interface and installing the interceptor on a
+ profile enables intercepting, blocking, and modifying URL requests (QWebEngineUrlRequestInfo)
+ before they reach the networking stack of Chromium.
+
+ A QWebEngineUrlSchemeHandler can be registered for a profile to add support for custom URL
+ schemes. Requests for the scheme are then issued to QWebEngineUrlSchemeHandler::requestStarted()
+ as QWebEngineUrlRequestJob objects.
+
+ The QWebEngineCookieStoreClient class provides functions for accessing HTTP cookies of Chromium.
+ The functions can be used to synchronize cookies with QNetworkAccessManager, as well as to set,
+ delete, and intercept cookies during navigation.
+
+ \section1 License Information
+
+ Qt WebEngine module is a snapshot of the integration of Chromium into Qt.
+
+ Qt Commercial Edition licensees that wish to distribute applications that
+ use the Qt WebEngine module need to be aware of their obligations under the
+ GNU Library General Public License (LGPLv2).
+
+ Developers using the Open Source Edition can choose to redistribute
+ the module under the GNU LGPLv3 or GPLv2 and up.
+
+ \legalese
+
+ Chromium is licensed under the following license:
+
+ Copyright (c) 2013 The Chromium Authors. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+ * Neither the name of Google Inc. nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+ \endlegalese
+*/
diff --git a/src/webengine/doc/src/qtwebengine-platform-notes.qdoc b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc
new file mode 100644
index 000000000..fdaa4f861
--- /dev/null
+++ b/src/webengine/doc/src/qtwebengine-platform-notes.qdoc
@@ -0,0 +1,52 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \page qtwebengine-platform-notes.html
+ \title Qt WebEngine Platform Notes
+
+ \brief Contains information about issues that are specific to the Qt WebEngine module.
+
+ \section1 Building Qt WebEngine from Source
+
+ The requirements for building Qt 5 modules from source are listed separately for each supported
+ platform:
+
+ \list
+ \li \l{Qt for Windows - Requirements}
+ \li \l{Qt for X11 Requirements}
+ \li \l{Qt for OS X - Requirements}
+ \endlist
+
+ In addition, the following tools are required for building the \l {Qt WebEngine} module:
+
+ \list
+ \li Windows: Visual Studio 2013 or Visual Studio 2015
+ \li Linux: Clang or GCC version 4.7 or later
+ \li OS X: Xcode version 5.1 or later
+ \endlist
+*/
diff --git a/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc b/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc
new file mode 100644
index 000000000..e098071b3
--- /dev/null
+++ b/src/webengine/doc/src/qtwebengine-qmlmodule.qdoc
@@ -0,0 +1,39 @@
+/*
+ Copyright (C) 2015 The Qt Company Ltd.
+ Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/*!
+ \qmlmodule QtWebEngine 1.1
+ \title Qt WebEngine QML Types
+ \brief Provides QML types for rendering web content within a QML application
+ \ingroup qtwebengine-qmlmodules
+
+ The QML types can be imported into your application using the following import statements in
+ your .qml file:
+
+ \badcode
+ import QtQuick 2.0
+ import QtWebEngine 1.1
+ \endcode
+*/
diff --git a/src/webengine/doc/src/qquickwebengineview_lgpl.qdoc b/src/webengine/doc/src/webengineview.qdoc
index 212d9010a..f230ba261 100644
--- a/src/webengine/doc/src/qquickwebengineview_lgpl.qdoc
+++ b/src/webengine/doc/src/webengineview.qdoc
@@ -24,54 +24,6 @@
// by its LGPL license.
/*!
- \page qtwebengine-index.html
- \title Qt WebEngine
-
- The Qt WebEngine module provides the WebEngineView API which allows QML applications
- to render regions of dynamic web content. A \e{WebEngineView} component may share
- the screen with other QML components or encompass the full screen as
- specified within the QML application.
-
- It allows an application to load pages into the WebEngineView, either by URL or with
- an HTML string, and navigate within session history. By default,
- links to different pages load within the same WebEngineView, but web sites may
- request them to be opened as a new tab, window or dialog.
-
- The following sample QML application loads a web page, responds to session
- history context.
-
- \code
- import QtQuick 2.1
- import QtQuick.Controls 1.1
- import QtWebEngine 1.1
-
- ApplicationWindow {
- width: 1280
- height: 720
- visible: true
- WebEngineView {
- id: webview
- url: "http://www.qt-project.org"
- anchors.fill: parent
- }
- }
- \endcode
-
- \section1 API References
-
- \list
- \li \l{Qt WebEngine QML Types}{QML Types}
- \endlist
-
- \section1 Examples
-
- There are several Qt WebEngine examples located in the
- \l{Qt WebEngine Examples} page.
-
-*/
-
-
-/*!
\qmltype WebEngineView
\instantiates QQuickWebEngineView
\inqmlmodule QtWebEngine 1.1
@@ -85,7 +37,7 @@
Go backward within the browser's session history, if possible.
This function is equivalent to the \c{window.history.back()} DOM method.
- \sa WebEngineView::canGoBack
+ \sa canGoBack
*/
/*!
@@ -103,7 +55,7 @@
pages in the current session history. If offset is negative, it goes
back. If the offset is invalid, the page is not changed.
- \sa WebEngineView::goBack, WebEngineView::goForward
+ \sa goBack(), goForward()
*/
/*!
@@ -118,32 +70,33 @@
Reloads the current page. This function is equivalent to the
\c{window.location.reload()} DOM method.
- \sa WebEngineView::reloadAndBypassCache
+ \sa reloadAndBypassCache()
*/
/*!
\qmlmethod void WebEngineView::reloadAndBypassCache()
+ \since QtWebEngine 1.1
Reloads the current page, ignoring any cached content.
- \sa WebEngineView::reload
+ \sa reload()
*/
/*!
\qmlproperty url WebEngineView::url
- The location of the currently displaying HTML page. This writable
+ The location of the currently displayed HTML page. This writable
property offers the main interface to load a page into a web view.
It functions the same as the \c{window.location} DOM property.
- \sa WebEngineView::loadHtml()
+ \sa loadHtml()
*/
/*!
\qmlproperty url WebEngineView::icon
\readonly
- This property holds the location of the currently displaying web site icon,
+ The location of the currently displayed web site icon,
also known as favicon or shortcut icon. This read-only URL corresponds to
the image used within a mobile browser application to represent a
bookmarked page on the device's home screen.
@@ -151,20 +104,20 @@
The following snippet uses the \c{icon} property to build an \c{Image}
component:
- \code
+ \qml
Image {
id: appIcon
source: webView.icon != "" ? webView.icon : "fallbackFavIcon.png";
- ...
+ // ...
}
- \endcode
+ \endqml
*/
/*!
\qmlproperty int WebEngineView::loadProgress
\readonly
- This property holds the amount of the page that has been loaded, expressed
+ The amount of data from the page that has been loaded, expressed
as an integer percentage in the range from \c{0} to \c{100}.
*/
@@ -195,7 +148,7 @@
\qmlproperty string WebEngineView::title
\readonly
- This property holds the title of the currently displaying HTML page, a
+ The title of the currently displayed HTML page. This is a
read-only value that reflects the contents of the \c{<title>} tag.
*/
@@ -206,7 +159,7 @@
Returns \c{true} if the web view is in fullscreen mode, \c{false} otherwise.
- \sa WebEngineView::fullScreenRequested, WebEngineView::fullScreenCancelled
+ \sa fullScreenRequested(), fullScreenCancelled()
*/
/*!
@@ -255,6 +208,7 @@
/*!
\qmlproperty list<WebEngineScript> WebEngineView::userScripts
\readonly
+ \since QtWebEngine 1.1
List of script objects attached to the view.
*/
@@ -269,31 +223,35 @@
/*!
\qmlmethod void WebEngineView::loadHtml(string html, url baseUrl)
- \brief Loads the specified \a html as the content of the web view.
+ Loads the specified \a html as the content of the web view.
This method offers a lower-level alternative to the \c{url} property,
which references HTML pages via URL.
- External objects such as stylesheets or images referenced in the HTML
- document should be located relative to \a baseUrl. For example, if \a html
+ External objects, such as stylesheets or images referenced in the HTML
+ document, should be located relative to \a baseUrl. For example, if \a html
is retrieved from \c http://www.example.com/documents/overview.html, which
- is the base url, then an image referenced with the relative url, \c diagram.png,
+ is the base URL, then an image referenced with the relative URL, \c diagram.png,
should be at \c{http://www.example.com/documents/diagram.png}.
- \sa WebEngineView::url
+ \sa url
*/
/*!
\qmlmethod void WebEngineView::runJavaScript(string script, variant callback)
- \brief Runs the specified \a script in the content of the web view.
+ Runs the specified \a script in the content of the web view.
- In case a callback function is provided it will be invoked after the script
- finished running.
+ In case a callback function is provided, it will be invoked after the script
+ finishes running.
\code
runJavaScript("document.title", function(result) { console.log(result); });
\endcode
+ The script will run in the same \e world as other scripts that are
+ part of the loaded site.
+
+ See WebEngineView::userScripts for an alternative API to inject scripts.
*/
/*!
@@ -336,12 +294,13 @@
*/
/*!
- \qmlmethod WebEngineView::grantFeaturePermission(url securityOrigin, Feature feature, bool granted)
+ \qmlmethod void WebEngineView::grantFeaturePermission(url securityOrigin, Feature feature, bool granted)
\since QtWebEngine 1.1
- Sets the permission for the web site identified by \a securityOrigin to use \a feature.
+ Sets or unsets the permission, depending on \a granted, for the web site
+ identified by \a securityOrigin to use \a feature.
- \sa WebEngineView::featurePermissionRequested
+ \sa featurePermissionRequested()
*/
@@ -352,7 +311,7 @@
Immediately sets \c{isFullScreen} property to \c{false}. It can be used to notify the
browser engine when the windowing system forces the application to leave fullscreen mode.
- \code
+ \qml
ApplicationWindow {
onVisibilityChanged: {
if (webEngineView.isFullScreen && visibility != Window.FullScreen)
@@ -361,30 +320,51 @@
WebEngineView {
id: webEngineView
- ...
+ // ...
}
}
- \endcode
+ \endqml
+
+ \sa isFullScreen, fullScreenRequested()
+*/
+
+/*!
+ \qmlmethod void WebEngineView::setActiveFocusOnPress(bool arg)
+ \since QtWebEngine 1.2
+
+ Sets active focus to a clicked web engine view if \a arg is \c true. By setting it to \c false,
+ a web engine view can be used to create a UI element that should not get focus. This can be
+ useful in a hybrid UI.
- \sa WebEngineView::isFullScreen, WebEngineView::fullScreenRequested
+ \sa activeFocusOnPressChanged()
+*/
+
+/*!
+ \qmlmethod void WebEngineView::triggerWebAction(WebAction action)
+ \since QtWebEngine 1.2
+
+ Triggers the web action \a action.
+
+ \sa WebAction
*/
/*!
\qmlsignal WebEngineView::featurePermissionRequested(url securityOrigin, Feature feature)
+ \since QtWebEngine 1.1
- This is signal is emitted when the web site identified by \a securityOrigin requests
+ This signal is emitted when the web site identified by \a securityOrigin requests
to make use of the resource or device identified by \a feature.
- \sa WebEngineView::grantFeaturePermission
+ \sa grantFeaturePermission()
*/
/*!
\qmlsignal WebEngineView::loadingChanged(loadRequest)
This signal is emitted when a page load begins, ends, or fails.
- The corresponding handler is onLoadingChanged.
+ The corresponding handler is \c onLoadingChanged.
- When handling the signal with onLoadingChanged, various read-only
+ When handling the signal with \c onLoadingChanged, various read-only
parameters are available on the \a loadRequest:
\table
@@ -396,10 +376,7 @@
\li The location of the resource that is loading.
\row
\li status
- \li Reflects one of four load states:
- \c{WebEngineView::LoadStartedStatus}, \c{WebEngineView::LoadStoppedStatus},
- \c{WebEngineView::LoadSucceededStatus}, or \c{WebEngineView::LoadFailedStatus}.
- See WebEngineLoadRequest::status and WebEngineView::LoadStatus.
+ \li The \l{LoadStatus}{load status} of the page.
\row
\li errorString
\li The description of load error.
@@ -408,13 +385,10 @@
\li The HTTP error code.
\row
\li errorDomain
- \li The high-level error types, one of
- \c{WebEngineView::ConnectionErrorDomain}, \c{WebEngineView::HttpErrorDomain}, \c{WebEngineView::InternalErrorDomain},
- \c{WebEngineView::DownloadErrorDomain}, or \c{WebEngineView::NoErrorDomain}. See
- \l{WebEngineView::ErrorDomain} for the full list.
+ \li The high-level \l{ErrorDomain}{error type}.
\endtable
- \sa WebEngineView::loading
+ \sa loading, LoadStatus, ErrorDomain
*/
/*!
@@ -426,14 +400,14 @@
The certificate error can be rejected by calling WebEngineCertificateError::rejectCertificate,
which will stop loading the request.
- The certificate error can be ignored by calling WebEngineCertificateError::ignoreCertificateError
- which will resume loading the request.
+ The certificate error can be ignored by calling
+ WebEngineCertificateError::ignoreCertificateError, which will resume loading the request.
It is possible to defer the decision of rejecting the given certificate by calling
WebEngineCertificateError::defer, which is useful when waiting for user input.
- By default the invalid certificate will be automatically rejected.
+ By default, the invalid certificate will be automatically rejected.
- The corresponding handler is onCertificateError.
+ The corresponding handler is \c onCertificateError.
\sa WebEngineCertificateError
*/
@@ -447,19 +421,20 @@
events that are not cancelled with \c{preventDefault()}. \a{hoveredUrl}
provides the link's location.
- The corresponding handler is onLinkHovered.
+ The corresponding handler is \c onLinkHovered.
*/
/*!
\qmlsignal WebEngineView::javaScriptConsoleMessage(JavaScriptConsoleMessageLevel level, message, lineNumber, sourceID)
This signal is emitted when a JavaScript program tries to print a \a message to the web browser's console.
- For example in case of evaluation errors the source URL may be provided in \a sourceID as well as the \a lineNumber.
+ For example, in case of evaluation errors the source URL may be provided in \a sourceID as well
+ as the \a lineNumber.
- \a level indicates the severity of the event that triggered the message, i.e. if it
+ \a level indicates the severity of the event that triggered the message, that is, whether it
was triggered by an error or a less severe event.
- The corresponding handler is onJavaScriptConsoleMessage.
+ The corresponding handler is \c onJavaScriptConsoleMessage.
*/
/*!
@@ -467,20 +442,20 @@
\since QtWebEngine 1.1
This signal is emitted when a page load is requested to happen in a separate
- WebEngineView. This can either be because the current page requested it explicitly
- through a JavaScript call to window.open, or because the user clicked on a link
- while holding Shift, Ctrl or a built-in combination that triggers the page to open
+ web engine view. This can either be because the current page requested it explicitly
+ through a JavaScript call to \c window.open, or because the user clicked on a link
+ while holding Shift, Ctrl, or a built-in combination that triggers the page to open
in a new window.
- If this signal isn't handled the requested load will fail.
+ If this signal is not handled, the requested load will fail.
An example implementation:
\snippet snippets/qtwebengine_webengineview_newviewrequested.qml 0
- The corresponding handler is onNewViewRequested.
+ The corresponding handler is \c onNewViewRequested.
- \sa WebEngineNewViewRequest, WebEngineView::NewViewDestination, {WebEngine Quick Nano Browser}
+ \sa WebEngineNewViewRequest, NewViewDestination, {WebEngine Quick Nano Browser}
*/
/*!
@@ -490,15 +465,54 @@
This signal is emitted when the web page requests fullscreen mode through the
JavaScript API.
- The corresponding handler is onFullScreenRequested.
+ The corresponding handler is \c onFullScreenRequested.
- \sa WebEngineFullScreenRequest, WebEngineView::isFullScreen
+ \sa WebEngineFullScreenRequest, isFullScreen
+*/
+
+/*!
+ \qmlsignal WebEngineView::activeFocusOnPressChanged(bool)
+ \since QtWebEngine 1.2
+
+ This signal is emitted when the ability of the web engine view to get focus when clicked
+ changes.
+
+ \sa setActiveFocusOnPress()
+*/
+
+/*!
+ \qmlsignal WebEngineView::backgroundColorChanged()
+ \since QtWebEngine 1.2
+
+ This signal is emitted when the web engine view background color changes.
+*/
+
+/*!
+ \qmlsignal WebEngineView::renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode)
+
+ \since QtWebEngine 1.2
+
+ This signal is emitted when the render process is terminated with a non-zero exit status.
+ \a terminationStatus is the termination status of the process and \a exitCode is the status code
+ with which the process terminated.
+
+ \sa RenderProcessTerminationStatus
+*/
+
+/*!
+ \qmlsignal WebEngineView::windowCloseRequested()
+ \since QtWebEngine 1.2
+
+ This signal is emitted whenever the page requests the web browser window to be closed,
+ for example through the JavaScript \c{window.close()} call.
+
+ The corresponding handler is \c onWindowCloseRequested.
*/
/*!
\qmlproperty enumeration WebEngineView::ErrorDomain
- This enumeration details various high-level error types.
+ Describes various high-level error types:
\value WebEngineView::NoErrorDomain
\value WebEngineView::InternalErrorDomain
@@ -518,68 +532,42 @@
/*!
\qmlproperty enumeration WebEngineView::JavaScriptConsoleMessageLevel
- Indicates the severity of a JavaScript console message.
+ Indicates the severity of a JavaScript console message:
- \table
-
- \header
- \li Constant
- \li Description
-
- \row
- \li InfoMessageLevel
- \li Message is purely informative and should be safe to ignore.
-
- \row
- \li WarningMessageLevel
- \li Message indicates there might be a problem that may need attention.
-
- \row
- \li ErrorMessageLevel
- \li Message indicates there has been an error.
-
- \endtable
+ \value InfoMessageLevel
+ Message is purely informative and can safely be ignored.
+ \value WarningMessageLevel
+ Message indicates there might be a problem that may need attention.
+ \value ErrorMessageLevel
+ Message indicates there has been an error.
*/
/*!
\qmlproperty enumeration WebEngineView::LoadStatus
- Reflects a page's load status.
-
- \table
-
- \header
- \li Constant
- \li Description
-
- \row
- \li LoadStartedStatus
- \li Page is currently loading.
-
- \row
- \li LoadSucceededStatus
- \li Page has successfully loaded, and is not currently loading.
-
- \row
- \li LoadFailedStatus
- \li Page has failed to load, and is not currently loading.
+ Reflects a page's load status:
- \endtable
+ \value LoadStartedStatus
+ Page is currently loading.
+ \value LoadSucceededStatus
+ Page has successfully loaded, and is not currently loading.
+ \value LoadFailedStatus
+ Page has failed to load, and is not currently loading.
*/
/*!
\qmlproperty enumeration WebEngineView::NewViewDestination
- This enumeration details the format in which a new view request should be opened.
+ Describes how to open a new view:
\value WebEngineView::NewViewInWindow
- The page expects to be opened in a separate Window.
+ In a separate Window.
\value WebEngineView::NewViewInTab
- The page expects to be opened in a tab of the same window.
+ In a tab of the same window.
\value WebEngineView::NewViewInDialog
- The page expects to be opened in a Window without any tab, tool or URL bar.
+ In a Window without a tab bar, toolbar, or URL bar.
\value WebEngineView::NewViewInBackgroundTab
- The page expects to be opened in a tab of the same window, without hiding the currently visible WebEngineView.
+ In a tab of the same window, without hiding the currently visible web engine view.
\sa WebEngineNewViewRequest::destination
*/
@@ -587,28 +575,119 @@
/*!
\qmlproperty enumeration WebEngineView::FindFlags
- This enum describes the options available to the findText() function. The options
+ Describes the options available to the findText() function. The options
can be OR-ed together from the following list:
\value FindBackward Searches backwards instead of forwards.
\value FindCaseSensitively By default findText() works case insensitive. Specifying
this option changes the behavior to a case sensitive find operation.
- \sa WebEngineView::findText()
+ \sa findText()
+*/
+
+/*!
+ \qmlproperty enumeration WebEngineView::RenderProcessTerminationStatus
+ \since QtWebEngine 1.2
+
+ Describes the status with which the render process terminated:
+
+ \value NormalTerminationStatus
+ The render process terminated normally.
+ \value AbnormalTerminationStatus
+ The render process terminated with a non-zero exit status.
+ \value CrashedTerminationStatus
+ The render process crashed, for example because of a segmentation fault.
+ \value KilledTerminationStatus
+ The render process was killed, for example by \c SIGKILL or task manager kill.
+*/
+
+/*!
+ \qmlproperty enumeration WebEngineView::WebAction
+ \since QtWebEngine 1.2
+
+ Describes the types of action that can be performed on a web page:
+
+ \value NoWebAction
+ No action is triggered.
+ \value Back
+ Navigate back in the history of navigated links.
+ \value Forward
+ Navigate forward in the history of navigated links.
+ \value Stop
+ Stop loading the current page.
+ \value Reload
+ Reload the current page.
+ \value ReloadAndBypassCache
+ Reload the current page, but do not use any local cache.
+ \value Cut
+ Cut the content currently selected into the clipboard.
+ \value Copy
+ Copy the content currently selected into the clipboard.
+ \value Paste
+ Paste content from the clipboard.
+ \value Undo
+ Undo the last editing action.
+ \value Redo
+ Redo the last editing action.
+ \value SelectAll
+ Select all content.
+ \value PasteAndMatchStyle
+ Paste content from the clipboard with current style.
+ \value OpenLinkInThisWindow
+ Open the current link in the current window. (Added in Qt 5.6)
+ \value OpenLinkInNewWindow
+ Open the current link in a new window. (Added in Qt 5.6)
+ \value OpenLinkInNewTab
+ Open the current link in a new tab. (Added in Qt 5.6)
+ \value CopyLinkToClipboard
+ Copy the current link to the clipboard. (Added in Qt 5.6)
+ \value CopyImageToClipboard
+ Copy the clicked image to the clipboard. (Added in Qt 5.6)
+ \value CopyImageUrlToClipboard
+ Copy the clicked image's URL to the clipboard. (Added in Qt 5.6)
+ \value CopyMediaUrlToClipboard
+ Copy the hovered audio or video's URL to the clipboard. (Added in Qt 5.6)
+ \value ToggleMediaControls
+ Toggle between showing and hiding the controls for the hovered audio or video element.
+ (Added in Qt 5.6)
+ \value ToggleMediaLoop
+ Toggle whether the hovered audio or video should loop on completetion or not.
+ (Added in Qt 5.6)
+ \value ToggleMediaPlayPause
+ Toggle the play/pause state of the hovered audio or video element. (Added in Qt 5.6)
+ \value ToggleMediaMute
+ Mute or unmute the hovered audio or video element. (Added in Qt 5.6)
+ \value DownloadLinkToDisk
+ Download the current link to the disk. (Added in Qt 5.6)
+ \value DownloadImageToDisk
+ Download the highlighted image to the disk. (Added in Qt 5.6)
+ \value DownloadMediaToDisk
+ Download the hovered audio or video to the disk. (Added in Qt 5.6)
+ \value InspectElement
+ Trigger any attached Web Inspector to inspect the highlighed element.
+ (Added in Qt 5.6)
+ \value ExitFullScreen
+ Exit the fullscreen mode. (Added in Qt 5.6)
+
+ \omitvalue WebActionCount
*/
/*!
\qmlproperty enumeration WebEngineView::Feature
- This enum describes the platform feature access categories that the user may be asked to grant or deny access to.
-
- \value Geolocation Access to location hardware or service
- \value MediaAudioCapture Audio capture devices such a microphones
- \value MediaVideoCapture Video devices, e.g. cameras
- \value MediaAudioVideoCapture Both Audio and Video capture devices.
+ Describes the platform feature access categories that the user may be asked to grant or deny
+ access to:
- \sa WebEngineView::featurePermissionRequested, WebEngineView::grantFeaturePermission
+ \value Geolocation
+ Location hardware or service.
+ \value MediaAudioCapture
+ Audio capture devices, such as microphones.
+ \value MediaVideoCapture
+ Video devices, such as cameras.
+ \value MediaAudioVideoCapture
+ Both audio and video capture devices.
+ \sa featurePermissionRequested(), grantFeaturePermission()
*/
/*!
@@ -617,9 +696,9 @@
\inqmlmodule QtWebEngine 1.1
\since QtWebEngine 1.1
- \brief A utility class for the WebEngineView::fullScreenRequested signal.
+ \brief A utility type for the WebEngineView::fullScreenRequested() signal.
- \sa WebEngineView::fullScreenRequested
+ \sa WebEngineView::fullScreenRequested()
*/
/*!
@@ -629,7 +708,7 @@
Returns \c{true} if the application should toggle fullscreen mode on, \c{false} otherwise.
- \sa WebEngineFullScreenRequest::accept()
+ \sa accept()
*/
/*!
@@ -637,9 +716,9 @@
\since QtWebEngine 1.1
Call this method to accept the fullscreen request. It sets the WebEngineView::isFullScreen
- property to be equal to WebEngineFullScreenRequest::toggleOn.
+ property to be equal to toggleOn.
- \code
+ \qml
ApplicationWindow {
id: window
WebEngineView {
@@ -652,7 +731,7 @@
}
}
}
- \endcode
+ \endqml
- \sa WebEngineFullScreenRequest::toggleOn
+ \sa toggleOn
*/
diff --git a/src/webengine/plugin/experimental/experimental.pro b/src/webengine/plugin/experimental/experimental.pro
index 36162e359..d1b59326a 100644
--- a/src/webengine/plugin/experimental/experimental.pro
+++ b/src/webengine/plugin/experimental/experimental.pro
@@ -6,7 +6,7 @@ IMPORT_VERSION = 1.0
QT += webengine qml quick
QT_PRIVATE += webengine-private
-INCLUDEPATH += $$QTWEBENGINE_ROOT/src/core $$QTWEBENGINE_ROOT/src/webengine $$QTWEBENGINE_ROOT/src/webengine/api
+INCLUDEPATH += $$QTWEBENGINE_ROOT/src/core $$QTWEBENGINE_ROOT/src/core/api $$QTWEBENGINE_ROOT/src/webengine $$QTWEBENGINE_ROOT/src/webengine/api
SOURCES = plugin.cpp
diff --git a/src/webengine/plugin/experimental/plugin.cpp b/src/webengine/plugin/experimental/plugin.cpp
index 29b5413f4..f9525e656 100644
--- a/src/webengine/plugin/experimental/plugin.cpp
+++ b/src/webengine/plugin/experimental/plugin.cpp
@@ -63,12 +63,12 @@ public:
qmlRegisterExtendedType<QQuickWebEngineView, QQuickWebEngineViewExperimentalExtension>(uri, 1, 0, "WebEngineView");
qmlRegisterUncreatableType<QQuickWebEngineViewExperimental>(uri, 1, 0, "WebEngineViewExperimental",
- QObject::tr("Cannot create a separate instance of WebEngineViewExperimental"));
+ tr("Cannot create a separate instance of WebEngineViewExperimental"));
qmlRegisterUncreatableType<QQuickWebEngineViewport>(uri, 1, 0, "WebEngineViewport",
- QObject::tr("Cannot create a separate instance of WebEngineViewport"));
+ tr("Cannot create a separate instance of WebEngineViewport"));
// Use the latest revision of QQuickWebEngineView when importing QtWebEngine.experimental 1.0
- qmlRegisterRevision<QQuickWebEngineView, 1>(uri, 1, 0);
+ qmlRegisterRevision<QQuickWebEngineView, LATEST_WEBENGINEVIEW_REVISION>(uri, 1, 0);
}
};
diff --git a/src/webengine/plugin/plugin.cpp b/src/webengine/plugin/plugin.cpp
index c5ef11a5e..16d36b190 100644
--- a/src/webengine/plugin/plugin.cpp
+++ b/src/webengine/plugin/plugin.cpp
@@ -65,24 +65,30 @@ public:
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWebEngine"));
qmlRegisterType<QQuickWebEngineView>(uri, 1, 0, "WebEngineView");
- qmlRegisterUncreatableType<QQuickWebEngineLoadRequest>(uri, 1, 0, "WebEngineLoadRequest", QObject::tr("Cannot create separate instance of WebEngineLoadRequest"));
- qmlRegisterUncreatableType<QQuickWebEngineNavigationRequest>(uri, 1, 0, "WebEngineNavigationRequest", QObject::tr("Cannot create separate instance of WebEngineNavigationRequest"));
+ qmlRegisterUncreatableType<QQuickWebEngineLoadRequest>(uri, 1, 0, "WebEngineLoadRequest", tr("Cannot create separate instance of WebEngineLoadRequest"));
+ qmlRegisterUncreatableType<QQuickWebEngineNavigationRequest>(uri, 1, 0, "WebEngineNavigationRequest", tr("Cannot create separate instance of WebEngineNavigationRequest"));
qmlRegisterType<QQuickWebEngineView, 1>(uri, 1, 1, "WebEngineView");
+ qmlRegisterType<QQuickWebEngineView, 2>(uri, 1, 2, "WebEngineView");
qmlRegisterType<QQuickWebEngineProfile>(uri, 1, 1, "WebEngineProfile");
+ qmlRegisterType<QQuickWebEngineProfile, 1>(uri, 1, 2, "WebEngineProfile");
qmlRegisterType<QQuickWebEngineScript>(uri, 1, 1, "WebEngineScript");
- qmlRegisterUncreatableType<QQuickWebEngineCertificateError>(uri, 1, 1, "WebEngineCertificateError", QObject::tr("Cannot create separate instance of WebEngineCertificateError"));
+ qmlRegisterUncreatableType<QQuickWebEngineCertificateError>(uri, 1, 1, "WebEngineCertificateError", tr("Cannot create separate instance of WebEngineCertificateError"));
qmlRegisterUncreatableType<QQuickWebEngineDownloadItem>(uri, 1, 1, "WebEngineDownloadItem",
- QObject::tr("Cannot create a separate instance of WebEngineDownloadItem"));
- qmlRegisterUncreatableType<QQuickWebEngineNewViewRequest>(uri, 1, 1, "WebEngineNewViewRequest", QObject::tr("Cannot create separate instance of WebEngineNewViewRequest"));
- qmlRegisterUncreatableType<QQuickWebEngineSettings>(uri, 1, 1, "WebEngineSettings", QObject::tr("Cannot create a separate instance of WebEngineSettings"));
+ tr("Cannot create a separate instance of WebEngineDownloadItem"));
+ qmlRegisterUncreatableType<QQuickWebEngineNewViewRequest>(uri, 1, 1, "WebEngineNewViewRequest", tr("Cannot create separate instance of WebEngineNewViewRequest"));
+ qmlRegisterUncreatableType<QQuickWebEngineSettings>(uri, 1, 1, "WebEngineSettings", tr("Cannot create a separate instance of WebEngineSettings"));
+ // FIXME(QTBUG-40043): qmlRegisterUncreatableType<QQuickWebEngineSettings, 1>(uri, 1, 2, "WebEngineSettings", tr("Cannot create a separate instance of WebEngineSettings"));
qmlRegisterSingletonType<QQuickWebEngineSingleton>(uri, 1, 1, "WebEngine", webEngineSingletonProvider);
qmlRegisterUncreatableType<QQuickWebEngineHistory>(uri, 1, 1, "NavigationHistory",
- QObject::tr("Cannot create a separate instance of NavigationHistory"));
+ tr("Cannot create a separate instance of NavigationHistory"));
qmlRegisterUncreatableType<QQuickWebEngineHistoryListModel>(uri, 1, 1, "NavigationHistoryListModel",
- QObject::tr("Cannot create a separate instance of NavigationHistory"));
+ tr("Cannot create a separate instance of NavigationHistory"));
qmlRegisterUncreatableType<QQuickWebEngineFullScreenRequest>(uri, 1, 1, "FullScreenRequest",
- QObject::tr("Cannot create a separate instance of FullScreenRequest"));
+ tr("Cannot create a separate instance of FullScreenRequest"));
+
+ // For now (1.x import), the latest revision matches the minor version of the import.
+ qmlRegisterRevision<QQuickWebEngineView, LATEST_WEBENGINEVIEW_REVISION>(uri, 1, LATEST_WEBENGINEVIEW_REVISION);
}
};
diff --git a/src/webengine/plugin/plugin.pro b/src/webengine/plugin/plugin.pro
index 123c45511..b6acc760f 100644
--- a/src/webengine/plugin/plugin.pro
+++ b/src/webengine/plugin/plugin.pro
@@ -1,12 +1,12 @@
CXX_MODULE = qml
TARGET = qtwebengineplugin
TARGETPATH = QtWebEngine
-IMPORT_VERSION = 1.1
+IMPORT_VERSION = 1.2
QT += webengine qml quick
QT_PRIVATE += webengine-private
-INCLUDEPATH += $$QTWEBENGINE_ROOT/src/core $$QTWEBENGINE_ROOT/src/webengine $$QTWEBENGINE_ROOT/src/webengine/api $$QTWEBENGINE_ROOT/include/QtWebEngine
+INCLUDEPATH += $$QTWEBENGINE_ROOT/src/core $$QTWEBENGINE_ROOT/src/core/api $$QTWEBENGINE_ROOT/src/webengine $$QTWEBENGINE_ROOT/src/webengine/api $$QTWEBENGINE_ROOT/include/QtWebEngine
SOURCES = plugin.cpp
diff --git a/src/webengine/plugin/plugins.qmltypes b/src/webengine/plugin/plugins.qmltypes
index 9dcded7b0..1e577bf51 100644
--- a/src/webengine/plugin/plugins.qmltypes
+++ b/src/webengine/plugin/plugins.qmltypes
@@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
-// 'qmlplugindump -nonrelocatable QtWebEngine 1.1'
+// 'qmlplugindump -nonrelocatable QtWebEngine 1.2'
Module {
dependencies: []
@@ -571,8 +571,11 @@ Module {
Component {
name: "QQuickWebEngineProfile"
prototype: "QObject"
- exports: ["QtWebEngine/WebEngineProfile 1.1"]
- exportMetaObjectRevisions: [0]
+ exports: [
+ "QtWebEngine/WebEngineProfile 1.1",
+ "QtWebEngine/WebEngineProfile 1.2"
+ ]
+ exportMetaObjectRevisions: [0, 1]
Enum {
name: "HttpCacheType"
values: {
@@ -594,8 +597,10 @@ Module {
Property { name: "cachePath"; type: "string" }
Property { name: "httpUserAgent"; type: "string" }
Property { name: "httpCacheType"; type: "HttpCacheType" }
+ Property { name: "httpAcceptLanguage"; type: "string" }
Property { name: "persistentCookiesPolicy"; type: "PersistentCookiesPolicy" }
Property { name: "httpCacheMaximumSize"; type: "int" }
+ Signal { name: "httpAcceptLanguageChanged"; revision: 1 }
Signal {
name: "downloadRequested"
Parameter { name: "download"; type: "QQuickWebEngineDownloadItem"; isPointer: true }
@@ -604,6 +609,11 @@ Module {
name: "downloadFinished"
Parameter { name: "download"; type: "QQuickWebEngineDownloadItem"; isPointer: true }
}
+ Method {
+ name: "setCookieStoreClient"
+ revision: 1
+ Parameter { name: "client"; type: "QWebEngineCookieStoreClient"; isPointer: true }
+ }
}
Component {
name: "QQuickWebEngineScript"
@@ -685,9 +695,12 @@ Module {
Component {
name: "QQuickWebEngineSettings"
prototype: "QObject"
- exports: ["QtWebEngine/WebEngineSettings 1.1"]
+ exports: [
+ "QtWebEngine/WebEngineSettings 1.1",
+ "QtWebEngine/WebEngineSettings 1.2"
+ ]
isCreatable: false
- exportMetaObjectRevisions: [0]
+ exportMetaObjectRevisions: [0, 1]
Property { name: "autoLoadImages"; type: "bool" }
Property { name: "javascriptEnabled"; type: "bool" }
Property { name: "javascriptCanOpenWindows"; type: "bool" }
@@ -699,7 +712,10 @@ Module {
Property { name: "localContentCanAccessFileUrls"; type: "bool" }
Property { name: "hyperlinkAuditingEnabled"; type: "bool" }
Property { name: "errorPageEnabled"; type: "bool" }
+ Property { name: "pluginsEnabled"; type: "bool" }
+ Property { name: "fullScreenSupportEnabled"; revision: 1; type: "bool" }
Property { name: "defaultTextEncoding"; type: "string" }
+ Signal { name: "fullScreenSupportEnabledChanged"; revision: 1 }
}
Component {
name: "QQuickWebEngineSingleton"
@@ -723,9 +739,10 @@ Module {
prototype: "QQuickItem"
exports: [
"QtWebEngine/WebEngineView 1.0",
- "QtWebEngine/WebEngineView 1.1"
+ "QtWebEngine/WebEngineView 1.1",
+ "QtWebEngine/WebEngineView 1.2"
]
- exportMetaObjectRevisions: [0, 1]
+ exportMetaObjectRevisions: [0, 1, 2]
Enum {
name: "NavigationRequestAction"
values: {
@@ -784,6 +801,41 @@ Module {
}
}
Enum {
+ name: "WebAction"
+ values: {
+ "NoWebAction": -1,
+ "Back": 0,
+ "Forward": 1,
+ "Stop": 2,
+ "Reload": 3,
+ "Cut": 4,
+ "Copy": 5,
+ "Paste": 6,
+ "Undo": 7,
+ "Redo": 8,
+ "SelectAll": 9,
+ "ReloadAndBypassCache": 10,
+ "PasteAndMatchStyle": 11,
+ "OpenLinkInThisWindow": 12,
+ "OpenLinkInNewWindow": 13,
+ "OpenLinkInNewTab": 14,
+ "CopyLinkToClipboard": 15,
+ "DownloadLinkToDisk": 16,
+ "CopyImageToClipboard": 17,
+ "CopyImageUrlToClipboard": 18,
+ "DownloadImageToDisk": 19,
+ "CopyMediaUrlToClipboard": 20,
+ "ToggleMediaControls": 21,
+ "ToggleMediaLoop": 22,
+ "ToggleMediaPlayPause": 23,
+ "ToggleMediaMute": 24,
+ "DownloadMediaToDisk": 25,
+ "InspectElement": 26,
+ "ExitFullScreen": 27,
+ "WebActionCount": 28
+ }
+ }
+ Enum {
name: "JavaScriptConsoleMessageLevel"
values: {
"InfoMessageLevel": 0,
@@ -792,6 +844,15 @@ Module {
}
}
Enum {
+ name: "RenderProcessTerminationStatus"
+ values: {
+ "NormalTerminationStatus": 0,
+ "AbnormalTerminationStatus": 1,
+ "CrashedTerminationStatus": 2,
+ "KilledTerminationStatus": 3
+ }
+ }
+ Enum {
name: "FindFlags"
values: {
"FindBackward": 1,
@@ -830,6 +891,8 @@ Module {
isList: true
isReadonly: true
}
+ Property { name: "activeFocusOnPress"; revision: 2; type: "bool" }
+ Property { name: "backgroundColor"; revision: 2; type: "QColor" }
Signal {
name: "loadingChanged"
Parameter { name: "loadRequest"; type: "QQuickWebEngineLoadRequest"; isPointer: true }
@@ -878,6 +941,18 @@ Module {
}
Signal { name: "profileChanged"; revision: 1 }
Signal { name: "webChannelChanged"; revision: 1 }
+ Signal {
+ name: "activeFocusOnPressChanged"
+ revision: 2
+ Parameter { type: "bool" }
+ }
+ Signal { name: "backgroundColorChanged"; revision: 2 }
+ Signal {
+ name: "renderProcessTerminated"
+ revision: 2
+ Parameter { name: "terminationStatus"; type: "RenderProcessTerminationStatus" }
+ Parameter { name: "exitCode"; type: "int" }
+ }
Method {
name: "runJavaScript"
Parameter { type: "string" }
@@ -932,5 +1007,15 @@ Module {
Parameter { type: "Feature" }
Parameter { name: "granted"; type: "bool" }
}
+ Method {
+ name: "setActiveFocusOnPress"
+ revision: 2
+ Parameter { name: "arg"; type: "bool" }
+ }
+ Method {
+ name: "triggerWebAction"
+ revision: 2
+ Parameter { name: "action"; type: "WebAction" }
+ }
}
}
diff --git a/src/webengine/plugin/testsupport/plugin.cpp b/src/webengine/plugin/testsupport/plugin.cpp
index 98a1d3ca6..28001db54 100644
--- a/src/webengine/plugin/testsupport/plugin.cpp
+++ b/src/webengine/plugin/testsupport/plugin.cpp
@@ -54,7 +54,7 @@ public:
qmlRegisterType<QQuickWebEngineTestSupport>(uri, 1, 0, "WebEngineTestSupport");
qmlRegisterUncreatableType<QQuickWebEngineErrorPage>(uri, 1, 0, "WebEngineErrorPage",
- QObject::tr("Cannot create a separate instance of WebEngineErrorPage"));
+ tr("Cannot create a separate instance of WebEngineErrorPage"));
}
};
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
index a3999ccab..9fc1ed3eb 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.cpp
@@ -64,10 +64,14 @@ RenderWidgetHostViewQtDelegateQuick::RenderWidgetHostViewQtDelegateQuick(RenderW
void RenderWidgetHostViewQtDelegateQuick::initAsChild(WebContentsAdapterClient* container)
{
- QQuickWebEngineViewPrivate *viewPrivate = static_cast<QQuickWebEngineViewPrivate *>(container);
- setParentItem(viewPrivate->q_func());
- setSize(viewPrivate->q_func()->boundingRect().size());
+ QQuickWebEngineView *view = static_cast<QQuickWebEngineViewPrivate *>(container)->q_func();
+ setParentItem(view);
+ setSize(view->boundingRect().size());
+ // Focus on creation if the view accepts it
+ if (view->activeFocusOnPress())
+ setFocus(true);
m_initialized = true;
+
}
void RenderWidgetHostViewQtDelegateQuick::initAsPopup(const QRect &r)
@@ -176,9 +180,11 @@ void RenderWidgetHostViewQtDelegateQuick::inputMethodStateChanged(bool editorVis
if (qApp->inputMethod()->isVisible() == editorVisible)
return;
- setFlag(QQuickItem::ItemAcceptsInputMethod, editorVisible);
- qApp->inputMethod()->update(Qt::ImQueryInput | Qt::ImEnabled | Qt::ImHints);
- qApp->inputMethod()->setVisible(editorVisible);
+ if (parentItem() && parentItem()->flags() & QQuickItem::ItemAcceptsInputMethod) {
+ qApp->inputMethod()->update(Qt::ImQueryInput | Qt::ImEnabled | Qt::ImHints);
+ qApp->inputMethod()->setVisible(editorVisible);
+ }
+
}
void RenderWidgetHostViewQtDelegateQuick::focusInEvent(QFocusEvent *event)
@@ -193,7 +199,7 @@ void RenderWidgetHostViewQtDelegateQuick::focusOutEvent(QFocusEvent *event)
void RenderWidgetHostViewQtDelegateQuick::mousePressEvent(QMouseEvent *event)
{
- if (!m_isPopup)
+ if (!m_isPopup && (parentItem() && parentItem()->property("activeFocusOnPress").toBool()))
forceActiveFocus();
m_client->forwardEvent(event);
}
@@ -225,7 +231,8 @@ void RenderWidgetHostViewQtDelegateQuick::wheelEvent(QWheelEvent *event)
void RenderWidgetHostViewQtDelegateQuick::touchEvent(QTouchEvent *event)
{
- if (event->type() == QEvent::TouchBegin && !m_isPopup)
+ if (event->type() == QEvent::TouchBegin && !m_isPopup
+ && (parentItem() && parentItem()->property("activeFocusOnPress").toBool()))
forceActiveFocus();
m_client->forwardEvent(event);
}
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quick.h b/src/webengine/render_widget_host_view_qt_delegate_quick.h
index ddd0e4d9e..eb2860b27 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quick.h
+++ b/src/webengine/render_widget_host_view_qt_delegate_quick.h
@@ -70,6 +70,8 @@ public:
virtual void move(const QPoint&) Q_DECL_OVERRIDE { }
virtual void inputMethodStateChanged(bool editorVisible) Q_DECL_OVERRIDE;
virtual void setTooltip(const QString&) Q_DECL_OVERRIDE { }
+ // The QtQuick view doesn't have a backbuffer of its own and doesn't need this
+ virtual void setClearColor(const QColor &) Q_DECL_OVERRIDE { }
protected:
virtual void focusInEvent(QFocusEvent *event) Q_DECL_OVERRIDE;
diff --git a/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h b/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h
index cda51a1ab..a4b08482f 100644
--- a/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h
+++ b/src/webengine/render_widget_host_view_qt_delegate_quickwindow.h
@@ -73,6 +73,7 @@ public:
virtual void move(const QPoint &screenPos) Q_DECL_OVERRIDE;
virtual void inputMethodStateChanged(bool) Q_DECL_OVERRIDE {}
virtual void setTooltip(const QString &tooltip) Q_DECL_OVERRIDE;
+ virtual void setClearColor(const QColor &) Q_DECL_OVERRIDE { }
private:
QScopedPointer<RenderWidgetHostViewQtDelegate> m_realDelegate;
diff --git a/src/webengine/ui/AuthenticationDialog.qml b/src/webengine/ui/AuthenticationDialog.qml
new file mode 100644
index 000000000..46e2e3151
--- /dev/null
+++ b/src/webengine/ui/AuthenticationDialog.qml
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtWebEngine module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+// FIXME: authentication missing in Qt Quick Dialogs atm. Make our own for now.
+import QtQuick.Controls 1.4
+import QtQuick.Layouts 1.0
+import QtQuick 2.5
+
+ApplicationWindow {
+ signal accepted(string user, string password);
+ signal rejected;
+ property alias text: message.text;
+
+ width: 350
+ height: 100
+ flags: Qt.Dialog
+
+ title: "Authentication Required"
+
+ function open() {
+ show();
+ }
+
+ ColumnLayout {
+ anchors.fill: parent;
+ anchors.margins: 4;
+ Text {
+ id: message;
+ Layout.fillWidth: true;
+ }
+ RowLayout {
+ Label {
+ text: "Username:"
+ }
+ TextField {
+ id: userField;
+ Layout.fillWidth: true;
+ }
+ }
+ RowLayout {
+ Label {
+ text: "Password:"
+ }
+ TextField {
+ id: passwordField;
+ Layout.fillWidth: true;
+ echoMode: TextInput.Password;
+ }
+ }
+ RowLayout {
+ Layout.alignment: Qt.AlignRight
+ spacing: 8;
+ Button {
+ text: "Log In"
+ onClicked: {
+ accepted(userField.text, passwordField.text);
+ close();
+ destroy();
+ }
+ }
+ Button {
+ text: "Cancel"
+ onClicked: {
+ rejected();
+ close();
+ destroy();
+ }
+ }
+ }
+ }
+
+}
diff --git a/src/webengine/ui/ui.pro b/src/webengine/ui/ui.pro
index fdf7a85bc..28ea691b2 100644
--- a/src/webengine/ui/ui.pro
+++ b/src/webengine/ui/ui.pro
@@ -1,6 +1,8 @@
TARGETPATH = QtWebEngine/UIDelegates
QML_FILES += \
+ # Authentication Dialog
+ AuthenticationDialog.qml \
# JS Dialogs
AlertDialog.qml \
ConfirmDialog.qml \
diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp
index d22e6546f..6c4282eb3 100644
--- a/src/webengine/ui_delegates_manager.cpp
+++ b/src/webengine/ui_delegates_manager.cpp
@@ -37,12 +37,15 @@
#include "ui_delegates_manager.h"
#include "api/qquickwebengineview_p.h"
+#include "authentication_dialog_controller.h"
+#include "file_picker_controller.h"
#include "javascript_dialog_controller.h"
#include <QAbstractListModel>
#include <QClipboard>
#include <QFileInfo>
#include <QGuiApplication>
+#include <QMimeData>
#include <QQmlContext>
#include <QQmlEngine>
#include <QQmlProperty>
@@ -57,7 +60,7 @@ namespace QtWebEngineCore {
#if defined(Q_OS_WIN)
#define FILE_NAME_CASE_STATEMENT(TYPE, COMPONENT) \
case UIDelegatesManager::TYPE:\
- return QStringLiteral(#TYPE L ##".qml");
+ return QString::fromLatin1(#TYPE ##".qml");
#else
#define FILE_NAME_CASE_STATEMENT(TYPE, COMPONENT) \
case UIDelegatesManager::TYPE:\
@@ -107,32 +110,6 @@ MenuItemHandler::MenuItemHandler(QObject *parent)
{
}
-
-CopyMenuItem::CopyMenuItem(QObject *parent, const QString &textToCopy)
- : MenuItemHandler(parent)
- , m_textToCopy(textToCopy)
-{
- connect(this, &MenuItemHandler::triggered, this, &CopyMenuItem::onTriggered);
-}
-
-void CopyMenuItem::onTriggered()
-{
- qApp->clipboard()->setText(m_textToCopy);
-}
-
-NavigateMenuItem::NavigateMenuItem(QObject *parent, const QExplicitlySharedDataPointer<WebContentsAdapter> &adapter, const QUrl &targetUrl)
- : MenuItemHandler(parent)
- , m_adapter(adapter)
- , m_targetUrl(targetUrl)
-{
- connect(this, &MenuItemHandler::triggered, this, &NavigateMenuItem::onTriggered);
-}
-
-void NavigateMenuItem::onTriggered()
-{
- m_adapter->load(m_targetUrl);
-}
-
#define COMPONENT_MEMBER_INIT(TYPE, COMPONENT) \
, COMPONENT##Component(0)
@@ -272,15 +249,19 @@ void UIDelegatesManager::showDialog(QSharedPointer<JavaScriptDialogController> d
switch (dialogController->type()) {
case WebContentsAdapterClient::AlertDialog:
dialogComponentType = AlertDialog;
- title = QObject::tr("Javascript Alert - %1").arg(m_view->url().toString());
+ title = QCoreApplication::translate("UIDelegatesManager", "Javascript Alert - %1").arg(m_view->url().toString());
break;
case WebContentsAdapterClient::ConfirmDialog:
dialogComponentType = ConfirmDialog;
- title = QObject::tr("Javascript Confirm - %1").arg(m_view->url().toString());
+ title = QCoreApplication::translate("UIDelegatesManager", "Javascript Confirm - %1").arg(m_view->url().toString());
break;
case WebContentsAdapterClient::PromptDialog:
dialogComponentType = PromptDialog;
- title = QObject::tr("Javascript Prompt - %1").arg(m_view->url().toString());
+ title = QCoreApplication::translate("UIDelegatesManager", "Javascript Prompt - %1").arg(m_view->url().toString());
+ break;
+ case WebContentsAdapterClient::UnloadDialog:
+ dialogComponentType = ConfirmDialog;
+ title = QCoreApplication::translate("UIDelegatesManager", "Are you sure you want to leave this page?");
break;
case WebContentsAdapterClient::InternalAuthorizationDialog:
dialogComponentType = ConfirmDialog;
@@ -341,50 +322,48 @@ void UIDelegatesManager::showDialog(QSharedPointer<JavaScriptDialogController> d
QMetaObject::invokeMethod(dialog, "open");
}
-namespace {
-class FilePickerController : public QObject {
- Q_OBJECT
-public:
- FilePickerController(WebContentsAdapterClient::FileChooserMode, const QExplicitlySharedDataPointer<WebContentsAdapter> &, QObject * = 0);
-
-public Q_SLOTS:
- void accepted(const QVariant &files);
- void rejected();
+void UIDelegatesManager::showDialog(QSharedPointer<AuthenticationDialogController> dialogController)
+{
+ Q_ASSERT(!dialogController.isNull());
-private:
- QExplicitlySharedDataPointer<WebContentsAdapter> m_adapter;
- WebContentsAdapterClient::FileChooserMode m_mode;
+ if (!ensureComponentLoaded(AuthenticationDialog)) {
+ // Let the controller know it couldn't be loaded
+ qWarning("Failed to load authentication dialog, rejecting.");
+ dialogController->reject();
+ return;
+ }
-};
+ QQmlContext *context = qmlContext(m_view);
+ QObject *authenticationDialog = authenticationDialogComponent->beginCreate(context);
+ authenticationDialog->setParent(m_view);
+ QString introMessage;
+ if (dialogController->isProxy()) {
+ introMessage = QObject::tr("Connect to proxy \"%1\" using:");
+ introMessage = introMessage.arg(dialogController->host().toHtmlEscaped());
+ } else {
+ introMessage = QObject::tr("Enter username and password for \"%1\" at %2");
+ introMessage = introMessage.arg(dialogController->realm()).arg(dialogController->url().toString().toHtmlEscaped());
+ }
+ QQmlProperty textProp(authenticationDialog, QStringLiteral("text"));
+ textProp.write(introMessage);
-FilePickerController::FilePickerController(WebContentsAdapterClient::FileChooserMode mode, const QExplicitlySharedDataPointer<WebContentsAdapter> &adapter, QObject *parent)
- : QObject(parent)
- , m_adapter(adapter)
- , m_mode(mode)
-{
-}
+ QQmlProperty acceptSignal(authenticationDialog, QStringLiteral("onAccepted"));
+ QQmlProperty rejectSignal(authenticationDialog, QStringLiteral("onRejected"));
+ CHECK_QML_SIGNAL_PROPERTY(acceptSignal, authenticationDialogComponent->url());
+ CHECK_QML_SIGNAL_PROPERTY(rejectSignal, authenticationDialogComponent->url());
-void FilePickerController::accepted(const QVariant &files)
-{
- QStringList stringList;
- Q_FOREACH (const QUrl &url, files.value<QList<QUrl> >())
- stringList.append(url.toLocalFile());
- m_adapter->filesSelectedInChooser(stringList, m_mode);
-}
+ static int acceptIndex = dialogController->metaObject()->indexOfSlot("accept(QString,QString)");
+ QObject::connect(authenticationDialog, acceptSignal.method(), dialogController.data(), dialogController->metaObject()->method(acceptIndex));
+ static int rejectIndex = dialogController->metaObject()->indexOfSlot("reject()");
+ QObject::connect(authenticationDialog, rejectSignal.method(), dialogController.data(), dialogController->metaObject()->method(rejectIndex));
-void FilePickerController::rejected()
-{
- m_adapter->filesSelectedInChooser(QStringList(), m_mode);
+ authenticationDialogComponent->completeCreate();
+ QMetaObject::invokeMethod(authenticationDialog, "open");
}
-} // namespace
-
-
-void UIDelegatesManager::showFilePicker(WebContentsAdapterClient::FileChooserMode mode, const QString &defaultFileName, const QStringList &acceptedMimeTypes, const QExplicitlySharedDataPointer<WebContentsAdapter> &adapter)
+void UIDelegatesManager::showFilePicker(FilePickerController *controller)
{
- Q_UNUSED(defaultFileName);
- Q_UNUSED(acceptedMimeTypes);
if (!ensureComponentLoaded(FilePicker))
return;
@@ -397,23 +376,24 @@ void UIDelegatesManager::showFilePicker(WebContentsAdapterClient::FileChooserMod
filePickerComponent->completeCreate();
// Fine-tune some properties depending on the mode.
- switch (mode) {
- case WebContentsAdapterClient::Open:
+ switch (controller->mode()) {
+ case FilePickerController::Open:
break;
- case WebContentsAdapterClient::Save:
+ case FilePickerController::Save:
filePicker->setProperty("selectExisting", false);
break;
- case WebContentsAdapterClient::OpenMultiple:
+ case FilePickerController::OpenMultiple:
filePicker->setProperty("selectMultiple", true);
break;
- case WebContentsAdapterClient::UploadFolder:
+ case FilePickerController::UploadFolder:
filePicker->setProperty("selectFolder", true);
break;
default:
Q_UNREACHABLE();
}
- FilePickerController *controller = new FilePickerController(mode, adapter, filePicker);
+ controller->setParent(filePicker);
+
QQmlProperty filesPickedSignal(filePicker, QStringLiteral("onFilesSelected"));
CHECK_QML_SIGNAL_PROPERTY(filesPickedSignal, filePickerComponent->url());
QQmlProperty rejectSignal(filePicker, QStringLiteral("onRejected"));
@@ -464,5 +444,3 @@ void UIDelegatesManager::moveMessageBubble(const QRect &anchor)
}
} // namespace QtWebEngineCore
-
-#include "ui_delegates_manager.moc"
diff --git a/src/webengine/ui_delegates_manager.h b/src/webengine/ui_delegates_manager.h
index f2b78f792..2a86b2803 100644
--- a/src/webengine/ui_delegates_manager.h
+++ b/src/webengine/ui_delegates_manager.h
@@ -55,7 +55,8 @@
F(ConfirmDialog, confirmDialog) SEPARATOR \
F(PromptDialog, promptDialog) SEPARATOR \
F(FilePicker, filePicker) SEPARATOR \
- F(MessageBubble, messageBubble) SEPARATOR
+ F(MessageBubble, messageBubble) SEPARATOR \
+ F(AuthenticationDialog, authenticationDialog) SEPARATOR
#define COMMA_SEPARATOR ,
#define SEMICOLON_SEPARATOR ;
@@ -72,7 +73,9 @@ class QQuickWebEngineView;
QT_END_NAMESPACE
namespace QtWebEngineCore {
+class AuthenticationDialogController;
class JavaScriptDialogController;
+class FilePickerController;
const char *defaultPropertyName(QObject *obj);
@@ -85,29 +88,6 @@ Q_SIGNALS:
void triggered();
};
-class CopyMenuItem : public MenuItemHandler {
- Q_OBJECT
-public:
- CopyMenuItem(QObject *parent, const QString &textToCopy);
-
-private:
- void onTriggered();
-
- QString m_textToCopy;
-};
-
-class NavigateMenuItem : public MenuItemHandler {
- Q_OBJECT
-public:
- NavigateMenuItem(QObject *parent, const QExplicitlySharedDataPointer<WebContentsAdapter> &adapter, const QUrl &targetUrl);
-
-private:
- void onTriggered();
-
- QExplicitlySharedDataPointer<WebContentsAdapter> m_adapter;
- QUrl m_targetUrl;
-};
-
class UIDelegatesManager {
public:
@@ -124,8 +104,8 @@ public:
QObject *addMenu(QObject *parentMenu, const QString &title, const QPoint &pos = QPoint());
QQmlContext *creationContextForComponent(QQmlComponent *);
void showDialog(QSharedPointer<JavaScriptDialogController>);
- void showFilePicker(WebContentsAdapterClient::FileChooserMode, const QString &defaultFileName, const QStringList &acceptedMimeTypes
- , const QExplicitlySharedDataPointer<WebContentsAdapter> &);
+ void showDialog(QSharedPointer<AuthenticationDialogController>);
+ void showFilePicker(FilePickerController *controller);
void showMessageBubble(const QRect &anchor, const QString &mainText, const QString &subText);
void hideMessageBubble();
void moveMessageBubble(const QRect &anchor);
diff --git a/src/webengine/webengine.pro b/src/webengine/webengine.pro
index 6cba9c5d9..8bb5a8e77 100644
--- a/src/webengine/webengine.pro
+++ b/src/webengine/webengine.pro
@@ -3,12 +3,12 @@ TARGET = QtWebEngine
# For our export macros
DEFINES += QT_BUILD_WEBENGINE_LIB
-QT += qml quick
-QT_PRIVATE += webenginecore quick-private gui-private core-private
+QT += qml quick webenginecore
+QT_PRIVATE += quick-private gui-private core-private
QMAKE_DOCS = $$PWD/doc/qtwebengine.qdocconf
-INCLUDEPATH += $$PWD api ../core
+INCLUDEPATH += $$PWD api ../core ../core/api
SOURCES = \
api/qquickwebenginecertificateerror.cpp \