summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-01-18 16:56:06 +0100
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-01-18 16:56:06 +0100
commit440fbed83646f16bf002749f7cecf6ad6fc59bbf (patch)
tree231874f011a96d23061822d97bf70f52fc23617d /src
parentbc315ce05298cf500f45f3a897b0f7c0408fd611 (diff)
parentc506d1d867f827dbff405d8e789ab4810410079a (diff)
Merge branch '5.6' into dev
Diffstat (limited to 'src')
-rw-r--r--src/core/api/qwebenginecookiestore.cpp138
-rw-r--r--src/core/api/qwebenginecookiestore.h21
-rw-r--r--src/core/api/qwebenginecookiestore_p.h3
-rw-r--r--src/core/browser_context_adapter.cpp18
-rw-r--r--src/core/cookie_monster_delegate_qt.cpp6
-rw-r--r--src/core/location_provider_qt.cpp9
-rw-r--r--src/core/url_request_custom_job.cpp16
-rw-r--r--src/core/url_request_custom_job.h3
-rw-r--r--src/core/web_event_factory.cpp37
-rw-r--r--src/webengine/api/qquickwebenginehistory.cpp10
-rw-r--r--src/webengine/api/qquickwebenginesingleton.cpp2
-rw-r--r--src/webengine/doc/src/qtwebengine-overview.qdoc9
-rw-r--r--src/webengine/ui_delegates_manager.cpp5
-rw-r--r--src/webenginewidgets/api/qwebenginepage.cpp56
14 files changed, 144 insertions, 189 deletions
diff --git a/src/core/api/qwebenginecookiestore.cpp b/src/core/api/qwebenginecookiestore.cpp
index 2938eddbd..c0a3f3208 100644
--- a/src/core/api/qwebenginecookiestore.cpp
+++ b/src/core/api/qwebenginecookiestore.cpp
@@ -175,20 +175,6 @@ void QWebEngineCookieStorePrivate::onCookieChanged(const QNetworkCookie &cookie,
Q_EMIT q->cookieAdded(cookie);
}
-bool QWebEngineCookieStorePrivate::canSetCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &url)
-{
- if (filterCallback) {
- QWebEngineCookieStore::FilterRequest request;
- request.accepted = true;
- request.firstPartyUrl = firstPartyUrl;
- request.cookieLine = cookieLine;
- request.cookieSource = url;
- callbackDirectory.invokeDirectly<QWebEngineCookieStore::FilterRequest&>(filterCallback, request);
- return request.accepted;
- }
- return true;
-}
-
/*!
\class QWebEngineCookieStore
\inmodule QtWebEngineCore
@@ -268,41 +254,26 @@ QWebEngineCookieStore::~QWebEngineCookieStore()
}
/*!
- \fn void setCookieWithCallback(const QNetworkCookie &cookie, FunctorOrLambda resultCallback, const QUrl &origin = QUrl())
-
- Adds \a cookie to the cookie store. When the operation finishes, \a resultCallback will be executed
- on the caller thread.
- It is possible to provide an optional \a origin URL argument to limit the scope of the cookie.
- The provided URL should also include the scheme.
-
- \sa setCookie()
-*/
-
-void QWebEngineCookieStore::setCookieWithCallback(const QNetworkCookie &cookie, const QWebEngineCallback<bool> &resultCallback, const QUrl &origin)
-{
- Q_D(QWebEngineCookieStore);
- d->setCookie(resultCallback, cookie, origin);
-}
-
-/*!
- Adds \a cookie to the cookie store. This function is provided for convenience and is
- equivalent to calling setCookieWithCallback() with an empty callback.
+ Adds \a cookie to the cookie store.
It is possible to provide an optional \a origin URL argument to limit the scope of the cookie.
The provided URL should also include the scheme.
- \sa setCookieWithCallback()
+ \note This operation is asynchronous.
*/
void QWebEngineCookieStore::setCookie(const QNetworkCookie &cookie, const QUrl &origin)
{
- setCookieWithCallback(cookie, QWebEngineCallback<bool>(), origin);
+ //TODO: use callbacks or delete dummy ones
+ Q_D(QWebEngineCookieStore);
+ d->setCookie(QWebEngineCallback<bool>(), cookie, origin);
}
/*!
Deletes \a cookie from the cookie store.
It is possible to provide an optional \a origin URL argument to limit the scope of the
cookie to be deleted.
- The provided URL should also include the scheme.
+
+ \note This operation is asynchronous.
*/
void QWebEngineCookieStore::deleteCookie(const QNetworkCookie &cookie, const QUrl &origin)
@@ -312,104 +283,57 @@ void QWebEngineCookieStore::deleteCookie(const QNetworkCookie &cookie, const QUr
}
/*!
- \fn void QWebEngineCookieStore::getAllCookies(FunctorOrLambda resultCallback)
+ Loads all the cookies into the cookie store. The cookieAdded() signal is emitted on every
+ loaded cookie. Cookies are loaded automatically when the store gets initialized, which
+ in most cases happens on loading the first URL. However, calling this function is useful
+ if cookies should be listed before entering the web content.
- Requests all the cookies in the cookie store. When the asynchronous operation finishes,
- \a resultCallback will be called with a QByteArray as the argument containing the cookies.
- This QByteArray can be parsed using QNetworkCookie::parseCookies().
-
- \sa deleteCookie()
+ \note This operation is asynchronous.
*/
-void QWebEngineCookieStore::getAllCookies(const QWebEngineCallback<const QByteArray&> &resultCallback)
+void QWebEngineCookieStore::loadAllCookies()
{
+ //TODO: use callbacks or delete dummy ones
Q_D(QWebEngineCookieStore);
- if (d->m_getAllCookiesPending) {
- d->callbackDirectory.invokeEmpty(resultCallback);
+ if (d->m_getAllCookiesPending)
return;
- }
- d->callbackDirectory.registerCallback(CallbackDirectory::GetAllCookiesCallbackId, resultCallback);
+ d->callbackDirectory.registerCallback(CallbackDirectory::GetAllCookiesCallbackId, QWebEngineCallback<const QByteArray&>());
+ //this will trigger cookieAdded signal
d->getAllCookies();
}
/*!
- \fn void QWebEngineCookieStore::deleteSessionCookiesWithCallback(FunctorOrLambda resultCallback)
-
Deletes all the session cookies in the cookie store. Session cookies do not have an
expiration date assigned to them.
- When the asynchronous operation finishes, \a resultCallback will be called with the
- number of cookies deleted as the argument.
-*/
-void QWebEngineCookieStore::deleteSessionCookiesWithCallback(const QWebEngineCallback<int> &resultCallback)
-{
- Q_D(QWebEngineCookieStore);
- if (d->m_deleteAllCookiesPending || d->m_deleteSessionCookiesPending) {
- d->callbackDirectory.invokeEmpty(resultCallback);
- return;
- }
- d->callbackDirectory.registerCallback(CallbackDirectory::DeleteSessionCookiesCallbackId, resultCallback);
- d->deleteSessionCookies();
-}
-
-/*!
- \fn void QWebEngineCookieStore::deleteAllCookiesWithCallback(FunctorOrLambda resultCallback)
-
- Deletes all the cookies in the cookie store. When the asynchronous operation finishes,
- \a resultCallback will be called with the number of cookies deleted as the argument.
-
- \sa deleteSessionCookiesWithCallback(), getAllCookies()
+ \note This operation is asynchronous.
+ \sa loadAllCookies()
*/
-void QWebEngineCookieStore::deleteAllCookiesWithCallback(const QWebEngineCallback<int> &resultCallback)
+void QWebEngineCookieStore::deleteSessionCookies()
{
+ //TODO: use callbacks or delete dummy ones
Q_D(QWebEngineCookieStore);
- if (d->m_deleteAllCookiesPending) {
- d->callbackDirectory.invokeEmpty(resultCallback);
+ if (d->m_deleteAllCookiesPending || d->m_deleteSessionCookiesPending)
return;
- }
- d->callbackDirectory.registerCallback(CallbackDirectory::DeleteAllCookiesCallbackId, resultCallback);
- d->deleteAllCookies();
-}
-
-/*!
- Deletes all the session cookies in the cookie store.
-
- \sa deleteSessionCookiesWithCallback()
-*/
-
-void QWebEngineCookieStore::deleteSessionCookies()
-{
- deleteSessionCookiesWithCallback(QWebEngineCallback<int>());
+ d->callbackDirectory.registerCallback(CallbackDirectory::DeleteSessionCookiesCallbackId, QWebEngineCallback<int>());
+ d->deleteSessionCookies();
}
/*!
Deletes all the cookies in the cookie store.
-
- \sa deleteAllCookiesWithCallback(), getAllCookies()
+ \note This operation is asynchronous.
+ \sa loadAllCookies()
*/
void QWebEngineCookieStore::deleteAllCookies()
{
- deleteAllCookiesWithCallback(QWebEngineCallback<int>());
-}
-
-/*!
- \fn void QWebEngineCookieStore::setCookieFilter(FunctorOrLambda filterCallback)
-
- Installs a cookie filter that can reject cookies before they are added to the cookie store.
- The \a filterCallback must be a lambda or functor taking FilterRequest structure. If the
- cookie is to be rejected, the filter can set FilterRequest::accepted to \c false.
-
- The callback should not be used to execute heavy tasks since it is running on the
- IO thread and therefore blocks the Chromium networking.
-
- \sa deleteAllCookiesWithCallback(), getAllCookies()
-*/
-void QWebEngineCookieStore::setCookieFilter(const QWebEngineCallback<QWebEngineCookieStore::FilterRequest&> &filter)
-{
+ //TODO: use callbacks or delete dummy ones
Q_D(QWebEngineCookieStore);
- d->filterCallback = filter;
+ if (d->m_deleteAllCookiesPending)
+ return;
+ d->callbackDirectory.registerCallback(CallbackDirectory::DeleteAllCookiesCallbackId, QWebEngineCallback<int>());
+ d->deleteAllCookies();
}
QT_END_NAMESPACE
diff --git a/src/core/api/qwebenginecookiestore.h b/src/core/api/qwebenginecookiestore.h
index b78f885ef..b1d625385 100644
--- a/src/core/api/qwebenginecookiestore.h
+++ b/src/core/api/qwebenginecookiestore.h
@@ -57,32 +57,13 @@ class QWEBENGINE_EXPORT QWebEngineCookieStore : public QObject {
Q_OBJECT
public:
- struct FilterRequest {
- bool accepted;
-
- QUrl firstPartyUrl;
- QByteArray cookieLine;
- QUrl cookieSource;
- };
virtual ~QWebEngineCookieStore();
-#ifdef Q_QDOC
- void setCookieWithCallback(const QNetworkCookie &cookie, FunctorOrLambda resultCallback, const QUrl &origin = QUrl());
- void deleteSessionCookiesWithCallback(FunctorOrLambda resultCallback);
- void deleteAllCookiesWithCallback(FunctorOrLambda resultCallback);
- void getAllCookies(FunctorOrLambda resultCallback);
- void setCookieFilter(FunctorOrLambda filterCallback);
-#else
- void setCookieWithCallback(const QNetworkCookie &cookie, const QWebEngineCallback<bool> &resultCallback, const QUrl &origin = QUrl());
- void deleteSessionCookiesWithCallback(const QWebEngineCallback<int> &resultCallback);
- void deleteAllCookiesWithCallback(const QWebEngineCallback<int> &resultCallback);
- void getAllCookies(const QWebEngineCallback<const QByteArray&> &resultCallback);
- void setCookieFilter(const QWebEngineCallback<FilterRequest&> &filterCallback);
-#endif
void setCookie(const QNetworkCookie &cookie, const QUrl &origin = QUrl());
void deleteCookie(const QNetworkCookie &cookie, const QUrl &origin = QUrl());
void deleteSessionCookies();
void deleteAllCookies();
+ void loadAllCookies();
Q_SIGNALS:
void cookieAdded(const QNetworkCookie &cookie);
diff --git a/src/core/api/qwebenginecookiestore_p.h b/src/core/api/qwebenginecookiestore_p.h
index 348dcd69f..41456cfdc 100644
--- a/src/core/api/qwebenginecookiestore_p.h
+++ b/src/core/api/qwebenginecookiestore_p.h
@@ -75,7 +75,6 @@ class QWEBENGINE_PRIVATE_EXPORT QWebEngineCookieStorePrivate : public QObjectPri
friend class QTypeInfo<CookieData>;
public:
QtWebEngineCore::CallbackDirectory callbackDirectory;
- QWebEngineCallback<QWebEngineCookieStore::FilterRequest&> filterCallback;
QVector<CookieData> m_pendingUserCookies;
quint64 m_nextCallbackId;
bool m_deleteSessionCookiesPending;
@@ -94,8 +93,6 @@ public:
void deleteAllCookies();
void getAllCookies();
- bool canSetCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &url);
-
void onGetAllCallbackResult(qint64 callbackId, const QByteArray &cookieList);
void onSetCallbackResult(qint64 callbackId, bool success);
void onDeleteCallbackResult(qint64 callbackId, int numCookies);
diff --git a/src/core/browser_context_adapter.cpp b/src/core/browser_context_adapter.cpp
index a8f704995..8f1311bb4 100644
--- a/src/core/browser_context_adapter.cpp
+++ b/src/core/browser_context_adapter.cpp
@@ -54,8 +54,6 @@
#include <QString>
#include <QStandardPaths>
-#include <numeric>
-
namespace {
inline QString buildLocationFromStandardPath(const QString &standardPath, const QString &name) {
QString location = standardPath;
@@ -363,13 +361,13 @@ bool BrowserContextAdapter::removeCustomUrlSchemeHandler(QWebEngineUrlSchemeHand
{
bool removedOneOrMore = false;
auto it = m_customUrlSchemeHandlers.begin();
- auto end = m_customUrlSchemeHandlers.end();
- for (; it != end; ++it) {
+ while (it != m_customUrlSchemeHandlers.end()) {
if (it.value() == handler) {
it = m_customUrlSchemeHandlers.erase(it);
removedOneOrMore = true;
continue;
}
+ ++it;
}
if (removedOneOrMore)
updateCustomUrlSchemeHandlers();
@@ -405,11 +403,13 @@ void BrowserContextAdapter::permissionRequestReply(const QUrl &origin, Permissio
QString BrowserContextAdapter::httpAcceptLanguageWithoutQualities() const
{
const QStringList list = m_httpAcceptLanguage.split(QLatin1Char(','));
- return std::accumulate(list.constBegin(), list.constEnd(), QString(),
- [](const QString &r, const QString &e) {
- return (r.isEmpty() ? r : r + QString(QLatin1Char(',')))
- + e.split(QLatin1Char(';')).first();
- });
+ QString out;
+ Q_FOREACH (const QString& str, list) {
+ if (!out.isEmpty())
+ out.append(QLatin1Char(','));
+ out.append(str.split(QLatin1Char(';')).first());
+ }
+ return out;
}
QString BrowserContextAdapter::httpAcceptLanguage() const
diff --git a/src/core/cookie_monster_delegate_qt.cpp b/src/core/cookie_monster_delegate_qt.cpp
index 3689d54d7..493743385 100644
--- a/src/core/cookie_monster_delegate_qt.cpp
+++ b/src/core/cookie_monster_delegate_qt.cpp
@@ -166,10 +166,8 @@ void CookieMonsterDelegateQt::setClient(QWebEngineCookieStore *client)
bool CookieMonsterDelegateQt::canSetCookie(const QUrl &firstPartyUrl, const QByteArray &cookieLine, const QUrl &url)
{
- if (!m_client)
- return true;
-
- return m_client->d_func()->canSetCookie(firstPartyUrl, cookieLine, url);
+ // TODO: should be used for FilterRequest implementation
+ return true;
}
void CookieMonsterDelegateQt::OnCookieChanged(const net::CanonicalCookie& cookie, bool removed, ChangeCause cause)
diff --git a/src/core/location_provider_qt.cpp b/src/core/location_provider_qt.cpp
index 222d15354..485ea8d94 100644
--- a/src/core/location_provider_qt.cpp
+++ b/src/core/location_provider_qt.cpp
@@ -74,6 +74,7 @@ private:
QGeoPositionInfoSource *m_positionInfoSource;
void postToLocationProvider(const base::Closure &task);
+ friend class LocationProviderQt;
};
QtPositioningHelper::QtPositioningHelper(LocationProviderQt *provider)
@@ -85,7 +86,8 @@ QtPositioningHelper::QtPositioningHelper(LocationProviderQt *provider)
QtPositioningHelper::~QtPositioningHelper()
{
- m_locationProvider->m_positioningHelper = 0;
+ if (m_locationProvider)
+ m_locationProvider->m_positioningHelper = 0;
}
static bool isHighAccuracySource(const QGeoPositionInfoSource *source)
@@ -223,7 +225,10 @@ LocationProviderQt::LocationProviderQt()
LocationProviderQt::~LocationProviderQt()
{
- m_positioningHelper->deleteLater();
+ if (m_positioningHelper) {
+ m_positioningHelper->m_locationProvider = 0;
+ m_positioningHelper->deleteLater();
+ }
}
bool LocationProviderQt::StartProvider(bool highAccuracy)
diff --git a/src/core/url_request_custom_job.cpp b/src/core/url_request_custom_job.cpp
index 0a81d04a1..1b6f1c767 100644
--- a/src/core/url_request_custom_job.cpp
+++ b/src/core/url_request_custom_job.cpp
@@ -60,7 +60,8 @@ URLRequestCustomJob::URLRequestCustomJob(URLRequest *request, NetworkDelegate *n
, m_schemeHandler(schemeHandler)
, m_error(0)
, m_started(false)
- , m_weakFactory(this)
+ , m_weakFactoryIO(this)
+ , m_weakFactoryUI(this)
{
}
@@ -78,7 +79,7 @@ URLRequestCustomJob::~URLRequestCustomJob()
void URLRequestCustomJob::Start()
{
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
- content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, base::Bind(&URLRequestCustomJob::startAsync, m_weakFactory.GetWeakPtr()));
+ content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, base::Bind(&URLRequestCustomJob::startAsync, m_weakFactoryIO.GetWeakPtr()));
}
void URLRequestCustomJob::Kill()
@@ -93,7 +94,8 @@ void URLRequestCustomJob::Kill()
if (m_device && m_device->isOpen())
m_device->close();
m_device = 0;
- m_weakFactory.InvalidateWeakPtrs();
+ m_weakFactoryIO.InvalidateWeakPtrs();
+ m_weakFactoryUI.InvalidateWeakPtrs();
URLRequestJob::Kill();
}
@@ -151,7 +153,7 @@ void URLRequestCustomJob::setReplyDevice(QIODevice *device)
m_device->open(QIODevice::ReadOnly);
if (m_device && m_device->isReadable())
- content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, base::Bind(&URLRequestCustomJob::notifyStarted, m_weakFactory.GetWeakPtr()));
+ content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, base::Bind(&URLRequestCustomJob::notifyStarted, m_weakFactoryUI.GetWeakPtr()));
else
fail(ERR_INVALID_URL);
}
@@ -179,7 +181,7 @@ void URLRequestCustomJob::redirect(const GURL &url)
QMutexLocker lock(&m_mutex);
m_redirect = url;
- content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, base::Bind(&URLRequestCustomJob::notifyStarted, m_weakFactory.GetWeakPtr()));
+ content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, base::Bind(&URLRequestCustomJob::notifyStarted, m_weakFactoryUI.GetWeakPtr()));
}
void URLRequestCustomJob::abort()
@@ -189,7 +191,7 @@ void URLRequestCustomJob::abort()
if (m_device && m_device->isOpen())
m_device->close();
m_device = 0;
- content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, base::Bind(&URLRequestCustomJob::notifyCanceled, m_weakFactory.GetWeakPtr()));
+ content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, base::Bind(&URLRequestCustomJob::notifyCanceled, m_weakFactoryUI.GetWeakPtr()));
}
void URLRequestCustomJob::notifyCanceled()
@@ -214,7 +216,7 @@ void URLRequestCustomJob::fail(int error)
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
QMutexLocker lock(&m_mutex);
m_error = error;
- content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, base::Bind(&URLRequestCustomJob::notifyFailure, m_weakFactory.GetWeakPtr()));
+ content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, base::Bind(&URLRequestCustomJob::notifyFailure, m_weakFactoryUI.GetWeakPtr()));
}
void URLRequestCustomJob::notifyFailure()
diff --git a/src/core/url_request_custom_job.h b/src/core/url_request_custom_job.h
index a994c467a..be5cae43c 100644
--- a/src/core/url_request_custom_job.h
+++ b/src/core/url_request_custom_job.h
@@ -87,7 +87,8 @@ private:
int m_error;
GURL m_redirect;
bool m_started;
- base::WeakPtrFactory<URLRequestCustomJob> m_weakFactory;
+ base::WeakPtrFactory<URLRequestCustomJob> m_weakFactoryIO;
+ base::WeakPtrFactory<URLRequestCustomJob> m_weakFactoryUI;
friend class URLRequestCustomJobDelegate;
diff --git a/src/core/web_event_factory.cpp b/src/core/web_event_factory.cpp
index 1a58ae385..2e6fde214 100644
--- a/src/core/web_event_factory.cpp
+++ b/src/core/web_event_factory.cpp
@@ -109,6 +109,8 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad)
return VK_DECIMAL; // (6E) Decimal key
case Qt::Key_Slash:
return VK_DIVIDE; // (6F) Divide key
+ case Qt::Key_Equal:
+ return VK_OEM_PLUS; // (BB) Equal key
case Qt::Key_PageUp:
return VK_PRIOR; // (21) PAGE UP key
case Qt::Key_PageDown:
@@ -264,9 +266,10 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad)
case Qt::Key_Help:
return VK_HELP; // (2F) HELP key
case Qt::Key_0:
- case Qt::Key_ParenLeft:
+ case Qt::Key_ParenRight:
return VK_0; // (30) 0) key
case Qt::Key_1:
+ case Qt::Key_Exclam:
return VK_1; // (31) 1 ! key
case Qt::Key_2:
case Qt::Key_At:
@@ -290,7 +293,7 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad)
case Qt::Key_Asterisk:
return VK_8; // (38) 8 key '*'
case Qt::Key_9:
- case Qt::Key_ParenRight:
+ case Qt::Key_ParenLeft:
return VK_9; // (39) 9 key '('
case Qt::Key_A:
return VK_A; // (41) A key case 'a': case 'A': return 0x41;
@@ -375,13 +378,22 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad)
// VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key
// VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key
// VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key
- // VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key
- // VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key
- // VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key
- // VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key
- // VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key
- // VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key
- // VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key
+
+ case Qt::Key_VolumeMute:
+ return VK_VOLUME_MUTE; // (AD) Windows 2000/XP: Volume Mute key
+ case Qt::Key_VolumeDown:
+ return VK_VOLUME_DOWN; // (AE) Windows 2000/XP: Volume Down key
+ case Qt::Key_VolumeUp:
+ return VK_VOLUME_UP; // (AF) Windows 2000/XP: Volume Up key
+ case Qt::Key_MediaNext:
+ return VK_MEDIA_NEXT_TRACK; // (B0) Windows 2000/XP: Next Track key
+ case Qt::Key_MediaPrevious:
+ return VK_MEDIA_PREV_TRACK; // (B1) Windows 2000/XP: Previous Track key
+ case Qt::Key_MediaStop:
+ return VK_MEDIA_STOP; // (B2) Windows 2000/XP: Stop Media key
+ case Qt::Key_MediaTogglePlayPause:
+ return VK_MEDIA_PLAY_PAUSE; // (B3) Windows 2000/XP: Play/Pause Media key
+
// VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key
// VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key
// VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key
@@ -428,10 +440,17 @@ static int windowsKeyCodeForKeyEvent(unsigned int keycode, bool isKeypad)
case Qt::Key_BraceRight:
return VK_OEM_6; // case ']': case '}': return 0xDD;
// VK_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key
+ case Qt::Key_Apostrophe:
case Qt::Key_QuoteDbl:
return VK_OEM_7; // case '\'': case '"': return 0xDE;
// VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard.
// VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard
+
+ case Qt::Key_AudioRewind:
+ return 0xE3; // (E3) Android/GoogleTV: Rewind media key (Windows: VK_ICO_HELP Help key on 1984 Olivetti M24 deluxe keyboard)
+ case Qt::Key_AudioForward:
+ return 0xE4; // (E4) Android/GoogleTV: Fast forward media key (Windows: VK_ICO_00 '00' key on 1984 Olivetti M24 deluxe keyboard)
+
// VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key
// VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP
// VK_ATTN (F6) Attn key
diff --git a/src/webengine/api/qquickwebenginehistory.cpp b/src/webengine/api/qquickwebenginehistory.cpp
index d790093a4..050833b28 100644
--- a/src/webengine/api/qquickwebenginehistory.cpp
+++ b/src/webengine/api/qquickwebenginehistory.cpp
@@ -54,7 +54,7 @@ QQuickWebEngineHistoryListModelPrivate::~QQuickWebEngineHistoryListModelPrivate(
int QQuickWebEngineHistoryListModelPrivate::count() const
{
if (!adapter())
- return -1;
+ return 0;
return adapter()->navigationEntryCount();
}
@@ -65,6 +65,8 @@ int QQuickWebEngineHistoryListModelPrivate::index(int index) const
int QQuickWebEngineHistoryListModelPrivate::offsetForIndex(int index) const
{
+ if (!adapter())
+ return index;
return index - adapter()->currentNavigationEntryIndex();
}
@@ -81,7 +83,7 @@ QQuickWebEngineBackHistoryListModelPrivate::QQuickWebEngineBackHistoryListModelP
int QQuickWebEngineBackHistoryListModelPrivate::count() const
{
if (!adapter())
- return -1;
+ return 0;
return adapter()->currentNavigationEntryIndex();
}
@@ -104,12 +106,14 @@ QQuickWebEngineForwardHistoryListModelPrivate::QQuickWebEngineForwardHistoryList
int QQuickWebEngineForwardHistoryListModelPrivate::count() const
{
if (!adapter())
- return -1;
+ return 0;
return adapter()->navigationEntryCount() - adapter()->currentNavigationEntryIndex() - 1;
}
int QQuickWebEngineForwardHistoryListModelPrivate::index(int i) const
{
+ if (!adapter())
+ return i + 1;
return adapter()->currentNavigationEntryIndex() + i + 1;
}
diff --git a/src/webengine/api/qquickwebenginesingleton.cpp b/src/webengine/api/qquickwebenginesingleton.cpp
index b7a8c3b69..f0f5969c2 100644
--- a/src/webengine/api/qquickwebenginesingleton.cpp
+++ b/src/webengine/api/qquickwebenginesingleton.cpp
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
\code
Component.onCompleted: {
- WebEngine.settings.javaScriptEnabled = true;
+ WebEngine.settings.pluginsEnabled = true;
}
\endcode
*/
diff --git a/src/webengine/doc/src/qtwebengine-overview.qdoc b/src/webengine/doc/src/qtwebengine-overview.qdoc
index ca60fedc2..e0c1110b3 100644
--- a/src/webengine/doc/src/qtwebengine-overview.qdoc
+++ b/src/webengine/doc/src/qtwebengine-overview.qdoc
@@ -138,6 +138,15 @@
handled by using the WebEngineView::certificateError QML method or by reimplementing the
QWebEnginePage::certificateError function.
+ \section1 Proxy Support
+
+ If QNetworkProxy::applicationProxy is set, it will also be used for Qt WebEngine. Otherwise,
+ Qt WebEngine automatically picks up the proxy configuration from OS X and Windows. On Linux,
+ it acknowledges settings from KDE and Gnome.
+
+ If a proxy requires authentication, QWebEnginePage::proxyAuthenticationRequired is emitted.
+ For Qt Quick, a dialog is shown.
+
\section1 Using WebEngine Core
Qt WebEngine Core provides an API shared by Qt WebEngine and Qt WebEngine Widgets for handling
diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp
index b9162f9b9..2d75b2383 100644
--- a/src/webengine/ui_delegates_manager.cpp
+++ b/src/webengine/ui_delegates_manager.cpp
@@ -382,8 +382,9 @@ void UIDelegatesManager::showDialog(QSharedPointer<AuthenticationDialogControlle
introMessage = tr("Connect to proxy \"%1\" using:");
introMessage = introMessage.arg(dialogController->host().toHtmlEscaped());
} else {
- introMessage = tr("Enter username and password for \"%1\" at %2");
- introMessage = introMessage.arg(dialogController->realm()).arg(dialogController->url().toString().toHtmlEscaped());
+ const QUrl url = dialogController->url();
+ introMessage = tr("Enter username and password for \"%1\" at %2://%3");
+ introMessage = introMessage.arg(dialogController->realm(), url.scheme(), url.host());
}
QQmlProperty textProp(authenticationDialog, QStringLiteral("text"));
textProp.write(introMessage);
diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp
index 23ab9a244..b13e6b2fd 100644
--- a/src/webenginewidgets/api/qwebenginepage.cpp
+++ b/src/webenginewidgets/api/qwebenginepage.cpp
@@ -1,24 +1,38 @@
-/*
- Copyright (C) 2015 The Qt Company Ltd.
- Copyright (C) 2008, 2009, 2012 Nokia Corporation and/or its subsidiary(-ies)
- Copyright (C) 2007 Staikos Computing Services Inc.
- Copyright (C) 2007 Apple Inc.
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB. If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
-*/
+/****************************************************************************
+**
+** Copyright (C) 2016 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$
+**
+****************************************************************************/
#include "qwebenginepage.h"
#include "qwebenginepage_p.h"