diff --git a/syncthingconnector/syncthingconnection.h b/syncthingconnector/syncthingconnection.h index ceddf52..82bbaef 100644 --- a/syncthingconnector/syncthingconnection.h +++ b/syncthingconnector/syncthingconnection.h @@ -730,7 +730,7 @@ inline int SyncthingConnection::requestTimeout() const /*! * \brief Sets the transfer timeout for requests in milliseconds. - * \remarks Existing requests are not affected. + * \remarks Existing requests are not affected. Only effective when compiled against Qt 5.15 or higher. * \sa QNetworkRequest::setTransferTimeout() */ inline void SyncthingConnection::setRequestTimeout(int requestTimeout) diff --git a/syncthingconnector/syncthingconnection_requests.cpp b/syncthingconnector/syncthingconnection_requests.cpp index 1dddde4..bd850a3 100644 --- a/syncthingconnector/syncthingconnection_requests.cpp +++ b/syncthingconnector/syncthingconnection_requests.cpp @@ -43,7 +43,9 @@ QNetworkRequest SyncthingConnection::prepareRequest(const QString &path, const Q QNetworkRequest request(url); request.setHeader(QNetworkRequest::ContentTypeHeader, QByteArrayLiteral("application/x-www-form-urlencoded")); request.setRawHeader("X-API-Key", m_apiKey); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) request.setTransferTimeout(noTimeout ? 0 : m_requestTimeout); +#endif return request; } diff --git a/syncthingwidgets/settings/settingsdialog.cpp b/syncthingwidgets/settings/settingsdialog.cpp index 1bc14ec..65a0ba7 100644 --- a/syncthingwidgets/settings/settingsdialog.cpp +++ b/syncthingwidgets/settings/settingsdialog.cpp @@ -131,6 +131,9 @@ QWidget *ConnectionOptionPage::setupWidget() QObject::connect(ui()->upPushButton, &QPushButton::clicked, bind(&ConnectionOptionPage::moveSelectedConfigUp, this)); QObject::connect(ui()->addPushButton, &QPushButton::clicked, bind(&ConnectionOptionPage::addNewConfig, this)); QObject::connect(ui()->removePushButton, &QPushButton::clicked, bind(&ConnectionOptionPage::removeSelectedConfig, this)); +#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0)) + ui()->timeoutSpinBox->setEnabled(false); +#endif return widget; }