From 198225983df9f402bb368b449f1abeea95ff0dce Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 11 Oct 2017 18:42:32 -0700 Subject: QShortcut: Fall back to cross platform code in absence of QPA menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On macOS, absence of a QPA menu means that we should be using our own internal logic since there's no entity on the QCocoaMenuDelegate to take care of the shortcuts. Change-Id: I35ed8f0b55445f61d0528709d4debb636a502002 Task-number: QTBUG-61039 Reviewed-by: Tor Arne Vestbø Reviewed-by: Shawn Rutledge --- src/widgets/kernel/qshortcut.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp index 0585a59e89..f944a7097b 100644 --- a/src/widgets/kernel/qshortcut.cpp +++ b/src/widgets/kernel/qshortcut.cpp @@ -289,8 +289,10 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge // not the QMenu.) Since we can also reach this code by climbing the menu // hierarchy (see below), or when the shortcut is not a key-equivalent, we // need to check whether the QPA menu is actually disabled. + // When there is no QPA menu, there will be no QCocoaMenuDelegate checking + // for the actual shortcuts. We can then fallback to our own logic. QPlatformMenu *pm = menu->platformMenu(); - if (!pm || !pm->isEnabled()) + if (pm && !pm->isEnabled()) continue; #endif QAction *a = menu->menuAction(); -- cgit v1.2.3 From 127483b5e30de6c1905ea3280dd45a0b7d6a3813 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 16 Oct 2017 15:34:35 +0200 Subject: Windows QPA: Fix reporting of TabletLeaveProximity events Move the check for totalPacks below; it prevents leave notifications from being handled. Task-number: QTBUG-53628 Change-Id: I2436c51308803337e6d48ef958e03123283d4a1d Reviewed-by: Shawn Rutledge --- .../platforms/windows/qwindowstabletsupport.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.cpp b/src/plugins/platforms/windows/qwindowstabletsupport.cpp index 7e1017426f..5fe58fbfa5 100644 --- a/src/plugins/platforms/windows/qwindowstabletsupport.cpp +++ b/src/plugins/platforms/windows/qwindowstabletsupport.cpp @@ -352,16 +352,26 @@ bool QWindowsTabletSupport::translateTabletProximityEvent(WPARAM /* wParam */, L { PACKET proximityBuffer[1]; // we are only interested in the first packet in this case const int totalPacks = QWindowsTabletSupport::m_winTab32DLL.wTPacketsGet(m_context, 1, proximityBuffer); - if (!totalPacks) - return false; + if (!LOWORD(lParam)) { qCDebug(lcQpaTablet) << "leave proximity for device #" << m_currentDevice; - QWindowSystemInterface::handleTabletLeaveProximityEvent(proximityBuffer[0].pkTime, - m_devices.at(m_currentDevice).currentDevice, - m_devices.at(m_currentDevice).currentPointerType, - m_devices.at(m_currentDevice).uniqueId); + if (totalPacks > 0) { + QWindowSystemInterface::handleTabletLeaveProximityEvent(proximityBuffer[0].pkTime, + m_devices.at(m_currentDevice).currentDevice, + m_devices.at(m_currentDevice).currentPointerType, + m_devices.at(m_currentDevice).uniqueId); + } else { + QWindowSystemInterface::handleTabletLeaveProximityEvent(m_devices.at(m_currentDevice).currentDevice, + m_devices.at(m_currentDevice).currentPointerType, + m_devices.at(m_currentDevice).uniqueId); + + } return true; } + + if (!totalPacks) + return false; + const UINT currentCursor = proximityBuffer[0].pkCursor; UINT physicalCursorId; QWindowsTabletSupport::m_winTab32DLL.wTInfo(WTI_CURSORS + currentCursor, CSR_PHYSID, &physicalCursorId); -- cgit v1.2.3 From 8fcf171b421cb71f97589e19b548a5eaa996cf72 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Fri, 29 Sep 2017 10:52:36 +0200 Subject: Android Accessibility: protect from accessing invalid interfaces MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I am not sure if this is going to help, but it is required that the bridge checks that the interfaces it accesses are valid, since that protects from accessing them when they are in the destructor. This should be done, whether it fixes the issue or not. Task-number: QTBUG-45855 Change-Id: I2b96999ca4043f8b33607c864d1d178695d03192 Reviewed-by: Jan Arve Sæther --- .../platforms/android/androidjniaccessibility.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/android/androidjniaccessibility.cpp b/src/plugins/platforms/android/androidjniaccessibility.cpp index 06624415d3..e4d670239f 100644 --- a/src/plugins/platforms/android/androidjniaccessibility.cpp +++ b/src/plugins/platforms/android/androidjniaccessibility.cpp @@ -104,11 +104,11 @@ namespace QtAndroidAccessibility static jintArray childIdListForAccessibleObject(JNIEnv *env, jobject /*thiz*/, jint objectId) { QAccessibleInterface *iface = interfaceFromId(objectId); - if (iface) { + if (iface && iface->isValid()) { jintArray jArray = env->NewIntArray(jsize(iface->childCount())); for (int i = 0; i < iface->childCount(); ++i) { QAccessibleInterface *child = iface->child(i); - if (child) { + if (child && child->isValid()) { QAccessible::Id ifaceId = QAccessible::uniqueId(child); jint jid = ifaceId; env->SetIntArrayRegion(jArray, i, 1, &jid); @@ -123,9 +123,9 @@ namespace QtAndroidAccessibility static jint parentId(JNIEnv */*env*/, jobject /*thiz*/, jint objectId) { QAccessibleInterface *iface = interfaceFromId(objectId); - if (iface) { + if (iface && iface->isValid()) { QAccessibleInterface *parent = iface->parent(); - if (parent) { + if (parent && parent->isValid()) { if (parent->role() == QAccessible::Application) return -1; return QAccessible::uniqueId(parent); @@ -151,7 +151,7 @@ namespace QtAndroidAccessibility static jint hitTest(JNIEnv */*env*/, jobject /*thiz*/, jfloat x, jfloat y) { QAccessibleInterface *root = interfaceFromId(-1); - if (root) { + if (root && root->isValid()) { QPoint pos = QHighDpi::fromNativePixels(QPoint(int(x), int(y)), root->window()); QAccessibleInterface *child = root->childAt(pos.x(), pos.y()); @@ -170,7 +170,7 @@ namespace QtAndroidAccessibility { // qDebug() << "A11Y: CLICK: " << objectId; QAccessibleInterface *iface = interfaceFromId(objectId); - if (iface && iface->actionInterface()) { + if (iface && iface->isValid() && iface->actionInterface()) { if (iface->actionInterface()->actionNames().contains(QAccessibleActionInterface::pressAction())) iface->actionInterface()->doAction(QAccessibleActionInterface::pressAction()); else @@ -182,13 +182,17 @@ namespace QtAndroidAccessibility static jboolean scrollForward(JNIEnv */*env*/, jobject /*thiz*/, jint objectId) { QAccessibleInterface *iface = interfaceFromId(objectId); - return QAccessibleBridgeUtils::performEffectiveAction(iface, QAccessibleActionInterface::increaseAction()); + if (iface && iface->isValid()) + return QAccessibleBridgeUtils::performEffectiveAction(iface, QAccessibleActionInterface::increaseAction()); + return false; } static jboolean scrollBackward(JNIEnv */*env*/, jobject /*thiz*/, jint objectId) { QAccessibleInterface *iface = interfaceFromId(objectId); - return QAccessibleBridgeUtils::performEffectiveAction(iface, QAccessibleActionInterface::decreaseAction()); + if (iface && iface->isValid()) + return QAccessibleBridgeUtils::performEffectiveAction(iface, QAccessibleActionInterface::decreaseAction()); + return false; } -- cgit v1.2.3 From 574c8ec13c89056f9a10c347b455ec6bfe864531 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 12 Oct 2017 11:11:32 +0200 Subject: Doc: State that qDebug and friends are thread-safe There's a common misconception that qDebug and friends are not thread-safe, so let's explicitly state this. Change-Id: I48d4ab8983017a9f2e7c9932a49ed573baa22929 Reviewed-by: Leena Miettinen Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/global/qglobal.cpp | 4 ++++ src/corelib/io/qloggingcategory.cpp | 8 ++++++++ 2 files changed, 12 insertions(+) (limited to 'src') diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index b5cc88534e..8d614b4f91 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -4298,6 +4298,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) /*! \macro qDebug(const char *message, ...) \relates + \threadsafe Calls the message handler with the debug message \a message. If no message handler has been installed, the message is printed to @@ -4334,6 +4335,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) /*! \macro qInfo(const char *message, ...) \relates + \threadsafe \since 5.5 Calls the message handler with the informational message \a message. If no @@ -4371,6 +4373,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) /*! \macro qWarning(const char *message, ...) \relates + \threadsafe Calls the message handler with the warning message \a message. If no message handler has been installed, the message is printed to @@ -4405,6 +4408,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters) /*! \macro qCritical(const char *message, ...) \relates + \threadsafe Calls the message handler with the critical message \a message. If no message handler has been installed, the message is printed to diff --git a/src/corelib/io/qloggingcategory.cpp b/src/corelib/io/qloggingcategory.cpp index 4256d4b6e1..b029274329 100644 --- a/src/corelib/io/qloggingcategory.cpp +++ b/src/corelib/io/qloggingcategory.cpp @@ -445,6 +445,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) /*! \macro qCDebug(category) \relates QLoggingCategory + \threadsafe \since 5.2 Returns an output stream for debug messages in the logging category @@ -469,6 +470,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) /*! \macro qCDebug(category, const char *message, ...) \relates QLoggingCategory + \threadsafe \since 5.3 Logs a debug message \a message in the logging category \a category. @@ -490,6 +492,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) /*! \macro qCInfo(category) \relates QLoggingCategory + \threadsafe \since 5.5 Returns an output stream for informational messages in the logging category @@ -514,6 +517,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) /*! \macro qCInfo(category, const char *message, ...) \relates QLoggingCategory + \threadsafe \since 5.5 Logs an informational message \a message in the logging category \a category. @@ -535,6 +539,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) /*! \macro qCWarning(category) \relates QLoggingCategory + \threadsafe \since 5.2 Returns an output stream for warning messages in the logging category @@ -559,6 +564,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) /*! \macro qCWarning(category, const char *message, ...) \relates QLoggingCategory + \threadsafe \since 5.3 Logs a warning message \a message in the logging category \a category. @@ -580,6 +586,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) /*! \macro qCCritical(category) \relates QLoggingCategory + \threadsafe \since 5.2 Returns an output stream for critical messages in the logging category @@ -604,6 +611,7 @@ void QLoggingCategory::setFilterRules(const QString &rules) /*! \macro qCCritical(category, const char *message, ...) \relates QLoggingCategory + \threadsafe \since 5.3 Logs a critical message \a message in the logging category \a category. -- cgit v1.2.3 From db333d6dba7703a67834a49e42e64c1e04b9ed3a Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 16 Oct 2017 12:32:02 +0200 Subject: QNAM (redirects) - clear 'raw' headers before sending the next request MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We already cleared 'cookedHeaders', which is a QHash for 'known headers' (enumerators as keys instead of strings), now do the same for 'rawHeaders'- not to end up with some weird mix of headers from all possible redirect responses and the final response. Task-number: QTBUG-61300 Change-Id: Ifd6655c4167840bb00d29446d36ce65ba2d5491a Reviewed-by: Mårten Nordheim Reviewed-by: Edward Welbourne --- src/network/access/qnetworkreplyhttpimpl.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 8ba2b12a46..fa60eb3564 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -1183,6 +1183,7 @@ void QNetworkReplyHttpImplPrivate::followRedirect() { Q_Q(QNetworkReplyHttpImpl); + rawHeaders.clear(); cookedHeaders.clear(); if (managerPrivate->thread) -- cgit v1.2.3 From 8a39384e907e830c907f73009f498c486b22bd20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Tue, 10 Oct 2017 15:54:04 +0200 Subject: Open a session during redirects when needed In some cases when a session isn't needed (i.e. for localhost), the session is not opened at all. If a program (e.g. our tests) redirects from localhost to a different system (e.g. the qt network test servers, or the internet) it will wait for a session forever. So, we need to check if a session is needed for the redirect-target and then open one. It is usually opened in QNetworkReplyHttpImplPrivate::_q_startOperation Change-Id: Id3b78182a3fb3f63f0235ecb1fb665df8bd0c4ca Reviewed-by: Edward Welbourne Reviewed-by: Timur Pocheptsov --- src/network/access/qnetworkreplyhttpimpl.cpp | 78 ++++++++++++++++++++-------- src/network/access/qnetworkreplyhttpimpl_p.h | 2 + 2 files changed, 59 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index fa60eb3564..9756b43108 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -165,6 +165,16 @@ static QHash parseHttpOptionHeader(const QByteArray &hea } } +#if QT_CONFIG(bearermanagement) +static bool isSessionNeeded(const QUrl &url) +{ + // Connections to the local machine does not require a session + QString host = url.host().toLower(); + return !QHostAddress(host).isLoopback() && host != QLatin1String("localhost") + && host != QSysInfo::machineHostName().toLower(); +} +#endif // bearer management + QNetworkReplyHttpImpl::QNetworkReplyHttpImpl(QNetworkAccessManager* const manager, const QNetworkRequest& request, QNetworkAccessManager::Operation& operation, @@ -1189,6 +1199,24 @@ void QNetworkReplyHttpImplPrivate::followRedirect() if (managerPrivate->thread) managerPrivate->thread->disconnect(); +#if QT_CONFIG(bearermanagement) + // If the original request didn't need a session (i.e. it was to localhost) + // then we might not have a session open, to which to redirect, if the + // new URL is remote. When this happens, we need to open the session now: + if (managerPrivate && isSessionNeeded(url)) { + if (auto session = managerPrivate->getNetworkSession()) { + if (session->state() != QNetworkSession::State::Connected || !session->isOpen()) { + startWaitForSession(session); + // Need to set 'request' to the redirectRequest so that when QNAM restarts + // the request after the session starts it will not repeat the previous request. + request = redirectRequest; + // Return now, QNAM will start the request when the session has started. + return; + } + } + } +#endif // bearer management + QMetaObject::invokeMethod(q, "start", Qt::QueuedConnection, Q_ARG(QNetworkRequest, redirectRequest)); } @@ -1770,10 +1798,8 @@ bool QNetworkReplyHttpImplPrivate::start(const QNetworkRequest &newHttpRequest) } // This is not ideal. - const QString host = url.host(); - if (host == QLatin1String("localhost") || - QHostAddress(host).isLoopback()) { - // Don't need an open session for localhost access. + if (!isSessionNeeded(url)) { + // Don't need to check for an open session if we don't need one. postRequest(newHttpRequest); return true; } @@ -1797,6 +1823,32 @@ bool QNetworkReplyHttpImplPrivate::start(const QNetworkRequest &newHttpRequest) #endif } +bool QNetworkReplyHttpImplPrivate::startWaitForSession(QSharedPointer &session) +{ + Q_Q(QNetworkReplyHttpImpl); + state = WaitingForSession; + + if (session) { + QObject::connect(session.data(), SIGNAL(error(QNetworkSession::SessionError)), + q, SLOT(_q_networkSessionFailed()), Qt::QueuedConnection); + + if (!session->isOpen()) { + QVariant isBackground = request.attribute(QNetworkRequest::BackgroundRequestAttribute, + QVariant::fromValue(false)); + session->setSessionProperty(QStringLiteral("ConnectInBackground"), isBackground); + session->open(); + } + return true; + } + const Qt::ConnectionType connection = synchronous ? Qt::DirectConnection : Qt::QueuedConnection; + qWarning("Backend is waiting for QNetworkSession to connect, but there is none!"); + QMetaObject::invokeMethod(q, "_q_error", connection, + Q_ARG(QNetworkReply::NetworkError, QNetworkReply::NetworkSessionFailedError), + Q_ARG(QString, QCoreApplication::translate("QNetworkReply", "Network session error."))); + QMetaObject::invokeMethod(q, "_q_finished", connection); + return false; +} + void QNetworkReplyHttpImplPrivate::_q_startOperation() { Q_Q(QNetworkReplyHttpImpl); @@ -1824,24 +1876,8 @@ void QNetworkReplyHttpImplPrivate::_q_startOperation() // backend failed to start because the session state is not Connected. // QNetworkAccessManager will call reply->backend->start() again for us when the session // state changes. - state = WaitingForSession; - - if (session) { - QObject::connect(session.data(), SIGNAL(error(QNetworkSession::SessionError)), - q, SLOT(_q_networkSessionFailed()), Qt::QueuedConnection); - - if (!session->isOpen()) { - session->setSessionProperty(QStringLiteral("ConnectInBackground"), isBackground); - session->open(); - } - } else { - qWarning("Backend is waiting for QNetworkSession to connect, but there is none!"); - QMetaObject::invokeMethod(q, "_q_error", synchronous ? Qt::DirectConnection : Qt::QueuedConnection, - Q_ARG(QNetworkReply::NetworkError, QNetworkReply::NetworkSessionFailedError), - Q_ARG(QString, QCoreApplication::translate("QNetworkReply", "Network session error."))); - QMetaObject::invokeMethod(q, "_q_finished", synchronous ? Qt::DirectConnection : Qt::QueuedConnection); + if (!startWaitForSession(session)) return; - } } else if (session) { QObject::connect(session.data(), SIGNAL(stateChanged(QNetworkSession::State)), q, SLOT(_q_networkSessionStateChanged(QNetworkSession::State)), diff --git a/src/network/access/qnetworkreplyhttpimpl_p.h b/src/network/access/qnetworkreplyhttpimpl_p.h index 9383149124..1b702bd2ec 100644 --- a/src/network/access/qnetworkreplyhttpimpl_p.h +++ b/src/network/access/qnetworkreplyhttpimpl_p.h @@ -160,6 +160,8 @@ signals: class QNetworkReplyHttpImplPrivate: public QNetworkReplyPrivate { + bool startWaitForSession(QSharedPointer &session); + public: static QHttpNetworkRequest::Priority convert(const QNetworkRequest::Priority& prio); -- cgit v1.2.3 From c4cf90b1f739c47383672de3d66b1d9d5427f5db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Mon, 9 Oct 2017 14:57:46 +0200 Subject: Fix redirecting POST for HTTP 307 and 308 All POST requests that were redirected would previously turn into GET requests. This does not follow the standard for HTTP codes 307 and 308. Task-number: QTBUG-63142 Change-Id: Ibd25a9566066e589670a9bc34e5dc5111f8139d5 Reviewed-by: Timur Pocheptsov Reviewed-by: Edward Welbourne --- src/network/access/qhttpmultipart.cpp | 2 ++ src/network/access/qhttpnetworkconnectionchannel.cpp | 8 +++++++- src/network/access/qnetworkreplyhttpimpl.cpp | 7 ++++++- 3 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/network/access/qhttpmultipart.cpp b/src/network/access/qhttpmultipart.cpp index 5c704efeef..870e71ba1e 100644 --- a/src/network/access/qhttpmultipart.cpp +++ b/src/network/access/qhttpmultipart.cpp @@ -483,6 +483,8 @@ bool QHttpMultiPartIODevice::isSequential() const bool QHttpMultiPartIODevice::reset() { + // Reset QIODevice's data + QIODevice::reset(); for (int a = 0; a < multiPart->parts.count(); a++) if (!multiPart->parts[a].d->reset()) return false; diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index e7bb8e6619..17520d0f4c 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -560,8 +560,14 @@ void QHttpNetworkConnectionChannel::handleStatus() if (redirectUrl.isValid()) reply->setRedirectUrl(redirectUrl); - if (qobject_cast(connection)) + if ((statusCode == 307 || statusCode == 308) && !resetUploadData()) { + // Couldn't reset the upload data, which means it will be unable to POST the data - + // this would lead to a long wait until it eventually failed and then retried. + // Instead of doing that we fail here instead, resetUploadData will already have emitted + // a ContentReSendError, so we're done. + } else if (qobject_cast(connection)) { QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); + } break; } case 401: // auth required diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 9756b43108..89d552f431 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -1115,10 +1115,15 @@ QNetworkAccessManager::Operation QNetworkReplyHttpImplPrivate::getRedirectOperat switch (currentOp) { case QNetworkAccessManager::HeadOperation: return QNetworkAccessManager::HeadOperation; + case QNetworkAccessManager::PostOperation: + // We MUST keep using POST when being redirected with 307 or 308. + if (statusCode == 307 || statusCode == 308) + return QNetworkAccessManager::PostOperation; + break; default: break; } - // For now, we're always returning GET for anything other than HEAD + // Use GET for everything else. return QNetworkAccessManager::GetOperation; } -- cgit v1.2.3 From 3fd641c3141b49b334dcbdb1a25649525445b724 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 18 Oct 2017 08:22:45 +0200 Subject: network: add a QT_CONFIG(bearermanagement) guard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit for QNetworkReplyHttpImplPrivate::startWaitForSession(). This amends 8a39384e907e830c907f73009f498c486b22bd20. Task-number: QTBUG-63847 Change-Id: Ic20a4ac3ab97ed25010e0679810ef64c3ff42c05 Reviewed-by: Mårten Nordheim Reviewed-by: Timur Pocheptsov --- src/network/access/qnetworkreplyhttpimpl.cpp | 2 ++ src/network/access/qnetworkreplyhttpimpl_p.h | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src') diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 89d552f431..fa49c8e05b 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -1828,6 +1828,7 @@ bool QNetworkReplyHttpImplPrivate::start(const QNetworkRequest &newHttpRequest) #endif } +#if QT_CONFIG(bearermanagement) bool QNetworkReplyHttpImplPrivate::startWaitForSession(QSharedPointer &session) { Q_Q(QNetworkReplyHttpImpl); @@ -1853,6 +1854,7 @@ bool QNetworkReplyHttpImplPrivate::startWaitForSession(QSharedPointer &session); +#endif public: -- cgit v1.2.3 From 05219136761ddf69b0b26599ce35866c98e26010 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 16 Oct 2017 15:48:41 +0200 Subject: QTabletEvent: Add doc note about Windows drivers Recent drivers no longer contain wintab32.dll, point out a version that still has it. Change-Id: I4125a0af3c11ab739f8006b91f58899aeed54458 Reviewed-by: Andre de la Rocha Reviewed-by: Gabriel de Dietrich Reviewed-by: Shawn Rutledge --- src/gui/kernel/qevent.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index a7848b5485..06d52aa78d 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -2330,6 +2330,13 @@ QVariant QInputMethodQueryEvent::value(Qt::InputMethodQuery query) const cursor and touchpad. Qt recognizes these by their names. Otherwise, if the tablet is configured to use the evdev driver, there will be only one device and applications may not be able to distinguish the stylus from the eraser. + + \section1 Notes for Windows Users + + Tablet support currently requires the WACOM windows driver providing the DLL + \c{wintab32.dll} to be installed. It is contained in older packages, + for example \c{pentablet_5.3.5-3.exe}. + */ /*! -- cgit v1.2.3 From 37afba28b152b9c5cb1dfaa9a89df1e8103cde26 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Tue, 17 Oct 2017 12:01:12 +0200 Subject: QTableGenerator: Fix handling of illegal characters in fromBase8 again Change-Id: Iaee19f71e5b74b0d43b628739039ca3c2be60cd0 Reviewed-by: Lars Knoll --- src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp index 809aa68365..b5a0a5bbeb 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp @@ -520,7 +520,7 @@ static inline int fromBase8(const char *s, const char *end) { int result = 0; while (*s && s != end) { - if (*s <= '0' || *s >= '7') + if (*s < '0' || *s > '7') return 0; result *= 8; result += *s - '0'; -- cgit v1.2.3 From f13e75345d035ec906846aaa3540454787edbd3f Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 19 Oct 2017 11:55:32 +0700 Subject: Cocoa QPA: Remove usage of OBJECTIVE_SOURCES Change-Id: I5924ab0ddb442624f5aeeef023428be228348707 Reviewed-by: Jake Petroules --- src/plugins/platforms/cocoa/cocoa.pro | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/cocoa.pro b/src/plugins/platforms/cocoa/cocoa.pro index 13e59906ca..5a00e1b7ec 100644 --- a/src/plugins/platforms/cocoa/cocoa.pro +++ b/src/plugins/platforms/cocoa/cocoa.pro @@ -1,6 +1,6 @@ TARGET = qcocoa -OBJECTIVE_SOURCES += main.mm \ +SOURCES += main.mm \ qcocoaintegration.mm \ qcocoatheme.mm \ qcocoabackingstore.mm \ @@ -30,9 +30,8 @@ OBJECTIVE_SOURCES += main.mm \ qcocoasystemtrayicon.mm \ qcocoaintrospection.mm \ qcocoakeymapper.mm \ - qcocoamimetypes.mm - -SOURCES += messages.cpp + qcocoamimetypes.mm \ + messages.cpp HEADERS += qcocoaintegration.h \ qcocoatheme.h \ @@ -66,7 +65,7 @@ HEADERS += qcocoaintegration.h \ qcocoamimetypes.h qtConfig(opengl.*) { - OBJECTIVE_SOURCES += qcocoaglcontext.mm + SOURCES += qcocoaglcontext.mm HEADERS += qcocoaglcontext.h } @@ -85,7 +84,7 @@ CONFIG += no_app_extension_api_only qtHaveModule(widgets) { QT_FOR_CONFIG += widgets - OBJECTIVE_SOURCES += \ + SOURCES += \ qpaintengine_mac.mm \ qprintengine_mac.mm \ qcocoaprintersupport.mm \ -- cgit v1.2.3 From fc988786588bf86ebc46fdd12629efbec8ae1841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Tue, 17 Oct 2017 15:16:40 +0200 Subject: Fix cookie path matching for empty url path The path wouldn't match if the cookie's path was root ('/') and the URLs path was empty. Change-Id: I6dcd10f1fdf4f48f14e50f1b169cbdfda7005849 Reviewed-by: Thiago Macieira Reviewed-by: Timur Pocheptsov Reviewed-by: Edward Welbourne --- src/network/access/qnetworkcookiejar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp index 232c2b47a5..f62a03b11d 100644 --- a/src/network/access/qnetworkcookiejar.cpp +++ b/src/network/access/qnetworkcookiejar.cpp @@ -140,7 +140,7 @@ void QNetworkCookieJar::setAllCookies(const QList &cookieList) static inline bool isParentPath(const QString &path, const QString &reference) { - if (path.startsWith(reference)) { + if ((path.isEmpty() && reference == QLatin1String("/")) || path.startsWith(reference)) { //The cookie-path and the request-path are identical. if (path.length() == reference.length()) return true; -- cgit v1.2.3 From 6c1a2224f31be51b26634f02fc2b2cb3247a4668 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 31 Mar 2017 14:08:28 +0200 Subject: iOS: add support for adding mimetypes other than text on the clipboard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A QVariant can only be converted to a QByteArray if it has user type QMetaType::QByteArray or QMetaType::QString. The way it stood, we always tried to convert the mime data to a QByteArray, and then put the result into a QVariant. This would fail if the mime data contained e.g a QPixmap. This patch will inspect what kind of data the QMimeData contains, and convert it to a QVariant using the expected API. Backport of 6d3c483 Task-number: QTBUG-57428 Task-number: QTBUG-63660 Change-Id: I09b4a94aef7b52773e1a79c468ead71b36dfbfc5 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosclipboard.mm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/ios/qiosclipboard.mm b/src/plugins/platforms/ios/qiosclipboard.mm index ef3b453bbf..6a585c9052 100644 --- a/src/plugins/platforms/ios/qiosclipboard.mm +++ b/src/plugins/platforms/ios/qiosclipboard.mm @@ -227,7 +227,19 @@ void QIOSClipboard::setMimeData(QMimeData *mimeData, QClipboard::Mode mode) if (uti.isEmpty() || !converter->canConvert(mimeType, uti)) continue; - QByteArray byteArray = converter->convertFromMime(mimeType, mimeData->data(mimeType), uti).first(); + QVariant mimeDataAsVariant; + if (mimeData->hasImage()) { + mimeDataAsVariant = mimeData->imageData(); + } else if (mimeData->hasUrls()) { + QVariantList urlList; + for (const QUrl &url : mimeData->urls()) + urlList << url; + mimeDataAsVariant = QVariant(urlList); + } else { + mimeDataAsVariant = QVariant(mimeData->data(mimeType)); + } + + QByteArray byteArray = converter->convertFromMime(mimeType, mimeDataAsVariant, uti).first(); NSData *nsData = [NSData dataWithBytes:byteArray.constData() length:byteArray.size()]; [pbItem setValue:nsData forKey:uti.toNSString()]; break; -- cgit v1.2.3 From c99d8532c892f72f897c9e686be75d1ebba67618 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 18 Oct 2017 14:13:18 +0700 Subject: QCocoaSystemTrayIcon: Remove unused classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both QNSMenu and QSystemTrayIconQMenu aren't referenced anywhere else, including within qcocoasystemtrayicon.mm, since the QPA backend was added. Change-Id: I632c1b230226b2d08afce7f0f0019e9f7c030ba5 Reviewed-by: Morten Johan Sørvig --- .../platforms/cocoa/qcocoasystemtrayicon.mm | 31 ---------------------- 1 file changed, 31 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm index 6af22facf9..13e9d8809e 100644 --- a/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm +++ b/src/plugins/platforms/cocoa/qcocoasystemtrayicon.mm @@ -92,7 +92,6 @@ QT_USE_NAMESPACE -@class QT_MANGLE_NAMESPACE(QNSMenu); @class QT_MANGLE_NAMESPACE(QNSImageView); @interface QT_MANGLE_NAMESPACE(QNSStatusItem) : NSObject @@ -123,16 +122,8 @@ QT_USE_NAMESPACE -(void)mousePressed:(NSEvent *)mouseEvent button:(Qt::MouseButton)mouseButton; @end -@interface QT_MANGLE_NAMESPACE(QNSMenu) : NSMenu { - QPlatformMenu *qmenu; -} --(QPlatformMenu*)menu; --(id)initWithQMenu:(QPlatformMenu*)qmenu; -@end - QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSStatusItem); QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSImageView); -QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSMenu); QT_BEGIN_NAMESPACE class QSystemTrayIconSys @@ -447,26 +438,4 @@ QT_END_NAMESPACE @end -class QSystemTrayIconQMenu : public QPlatformMenu -{ -public: - void doAboutToShow() { emit aboutToShow(); } -private: - QSystemTrayIconQMenu(); -}; - -@implementation QNSMenu --(id)initWithQMenu:(QPlatformMenu*)qm { - self = [super init]; - if (self) { - self->qmenu = qm; - [self setDelegate:self]; - } - return self; -} --(QPlatformMenu*)menu { - return qmenu; -} -@end - #endif // QT_NO_SYSTEMTRAYICON -- cgit v1.2.3 From c05268222c654fec92dc904554797c0d17997bd6 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 19 Oct 2017 14:32:09 +0200 Subject: winrt: Fully initialize CREATEFILE2_EXTENDED_PARAMETERS struct Not properly initializing all members of the extended parameter struct will cause an "invalid handle specified" exception on use. Task-number: QTBUG-63883 Change-Id: Ic3a58df864c9e29ccbadc04bd71c18c8ef34374c Reviewed-by: Maurice Kalinowski --- src/corelib/io/qfilesystemengine_win.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/corelib/io/qfilesystemengine_win.cpp b/src/corelib/io/qfilesystemengine_win.cpp index 79407afefc..b01aa55756 100644 --- a/src/corelib/io/qfilesystemengine_win.cpp +++ b/src/corelib/io/qfilesystemengine_win.cpp @@ -628,6 +628,9 @@ QByteArray QFileSystemEngine::id(const QFileSystemEntry &entry) params.dwSize = sizeof(params); params.dwFileAttributes = FILE_ATTRIBUTE_NORMAL; params.dwFileFlags = FILE_FLAG_BACKUP_SEMANTICS; + params.dwSecurityQosFlags = SECURITY_ANONYMOUS; + params.lpSecurityAttributes = NULL; + params.hTemplateFile = NULL; const HANDLE handle = CreateFile2((const wchar_t*)entry.nativeFilePath().utf16(), 0, FILE_SHARE_READ, OPEN_EXISTING, ¶ms); -- cgit v1.2.3 From dcc8aa8f4e664283bf7b900bbd07d6b570797eac Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 19 Oct 2017 13:22:36 +0200 Subject: Windows/Direct2D QPA: Fix build with -no-accessibility Task-number: QTBUG-63876 Change-Id: Ib9216977dd495e05d032e679c2f23ffe6a6953a6 Reviewed-by: Frederik Gladhorn --- src/plugins/platforms/direct2d/direct2d.pro | 4 +++- src/plugins/platforms/windows/windows.pro | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/direct2d/direct2d.pro b/src/plugins/platforms/direct2d/direct2d.pro index 224f122fc4..3fe0d5e660 100644 --- a/src/plugins/platforms/direct2d/direct2d.pro +++ b/src/plugins/platforms/direct2d/direct2d.pro @@ -2,9 +2,11 @@ TARGET = qdirect2d QT += \ core-private gui-private \ - eventdispatcher_support-private accessibility_support-private \ + eventdispatcher_support-private \ fontdatabase_support-private theme_support-private +qtConfig(accessibility): QT += accessibility_support-private + LIBS += -ldwmapi -ld2d1 -ld3d11 -ldwrite -lVersion -lgdi32 include(../windows/windows.pri) diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro index 23168c10dc..c5d76c5d1d 100644 --- a/src/plugins/platforms/windows/windows.pro +++ b/src/plugins/platforms/windows/windows.pro @@ -2,9 +2,11 @@ TARGET = qwindows QT += \ core-private gui-private \ - eventdispatcher_support-private accessibility_support-private \ + eventdispatcher_support-private \ fontdatabase_support-private theme_support-private +qtConfig(accessibility): QT += accessibility_support-private + LIBS += -lgdi32 -ldwmapi include(windows.pri) -- cgit v1.2.3 From 571b11d41c9dadd5ef11e4e954c16c5ca39d718e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 19 Oct 2017 13:10:28 +0200 Subject: Windows QPA: Fix build with -no-feature-tabletevent Guard #include by QT_CONFIG. Task-number: QTBUG-63874 Change-Id: I33f4a4c4fbdae3d25874ee9cdc3f1c7e1ab783e3 Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowscontext.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index f108be96e7..cda6c99ad0 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -46,7 +46,9 @@ #include "qtwindowsglobal.h" #include "qwindowsmime.h" #include "qwindowsinputcontext.h" -#include "qwindowstabletsupport.h" +#if QT_CONFIG(tabletevent) +# include "qwindowstabletsupport.h" +#endif #include "qwindowstheme.h" #include #ifndef QT_NO_ACCESSIBILITY -- cgit v1.2.3 From 8aadfbc6572b0cbb8d435ceb7cd288c9d5cb909c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= Date: Thu, 19 Oct 2017 00:00:39 +0200 Subject: xcb: Convert synthetic mouse enter event position to native pixels Mouse position is converted from native pixels later, so we must provide native pixels for "QWindowSystemInterface::handleEnterEvent". Amends 7091be1b7999d93fe2126042161dcd1d8fd20026 Task-number: QTBUG-63865 Change-Id: I813c171f2fc1d321af702ac30eb5f2e4232e97c4 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/xcb/qxcbwindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 4acc827bf6..c4649ac818 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -907,7 +907,9 @@ void QXcbWindow::hide() if (QWindow *childWindow = childWindowAt(enterWindow, cursorPos)) enterWindow = childWindow; const QPoint localPos = enterWindow->mapFromGlobal(cursorPos); - QWindowSystemInterface::handleEnterEvent(enterWindow, localPos, cursorPos); + QWindowSystemInterface::handleEnterEvent(enterWindow, + localPos * QHighDpiScaling::factor(enterWindow), + nativePos); } } } -- cgit v1.2.3