diff options
| author | Ivan Solovev <ivan.solovev@qt.io> | 2024-12-16 15:23:27 +0100 |
|---|---|---|
| committer | Ivan Solovev <ivan.solovev@qt.io> | 2024-12-19 09:31:19 +0100 |
| commit | 2b1e3419c5ef43e964f40dbe79d7a7da0de5aa57 (patch) | |
| tree | 41b134f7ed12c796cacf20bfb9cddf3f4d4512fc /src/oauth/qoauth2deviceauthorizationflow.cpp | |
| parent | 13d2e25da470494e0b8e668b6ef225b8f1c3dbb4 (diff) | |
Qt 7: add QAbstractOAuth2::refreshTokens() virtual slot
The base class already contains all properties and signals related to
access token refreshing. However, we can not add a new virtual slot
during Qt 6 lifetime.
This patch pre-programs the addition of this slot to Qt 7 and adjusts
the refresh token logic to call the new slot directly from the base
class. This eliminates the need to manually implement auto-refresh
logic in the derived classes.
The name of the new slot is different from the pre-existing slots in
the derived classes, so this patch also pre-programs the renaming
of the relevant slots.
The patch also pre-programs documentation changes by providing Qt 7
versions of the relevant docs.
Picking this change to 6.9 to minimize the amount of merge conflict
resolutions.
Task-number: QTBUG-132106
Pick-to: 6.9
Change-Id: I453e9aae096abbfddcb8076f808d4a055850f7e0
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
Diffstat (limited to 'src/oauth/qoauth2deviceauthorizationflow.cpp')
| -rw-r--r-- | src/oauth/qoauth2deviceauthorizationflow.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/oauth/qoauth2deviceauthorizationflow.cpp b/src/oauth/qoauth2deviceauthorizationflow.cpp index 5eb7170..92f4645 100644 --- a/src/oauth/qoauth2deviceauthorizationflow.cpp +++ b/src/oauth/qoauth2deviceauthorizationflow.cpp @@ -551,6 +551,7 @@ void QOAuth2DeviceAuthorizationFlowPrivate::handleTokenSuccessResponse(const QJs stopTokenPolling(); } +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) void QOAuth2DeviceAuthorizationFlowPrivate::initializeAutoRefresh() { Q_Q(QOAuth2DeviceAuthorizationFlow); @@ -559,6 +560,7 @@ void QOAuth2DeviceAuthorizationFlowPrivate::initializeAutoRefresh() q->refreshAccessToken(); }); } +#endif /*! Constructs a QOAuth2DeviceAuthorizationFlow object. @@ -586,7 +588,9 @@ QOAuth2DeviceAuthorizationFlow::QOAuth2DeviceAuthorizationFlow(QNetworkAccessMan : QAbstractOAuth2(*new QOAuth2DeviceAuthorizationFlowPrivate(manager), parent) { Q_D(QOAuth2DeviceAuthorizationFlow); +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) d->initializeAutoRefresh(); +#endif d->tokenPollingTimer.setInterval(d->defaultPollingInterval); d->tokenPollingTimer.setSingleShot(false); connect(&d->tokenPollingTimer, &QChronoTimer::timeout, this, [d]() { @@ -726,7 +730,11 @@ void QOAuth2DeviceAuthorizationFlow::grant() \sa QAbstractOAuth::requestFailed() */ +#if QT_VERSION < QT_VERSION_CHECK(7, 0, 0) void QOAuth2DeviceAuthorizationFlow::refreshAccessToken() +#else +void QOAuth2DeviceAuthorizationFlow::refreshTokens() +#endif { Q_D(QOAuth2DeviceAuthorizationFlow); if (d->status == Status::RefreshingToken && d->currentTokenReply) { |
