diff --git a/DisplayManual.cpp b/DisplayManual.cpp index caea2ebc6..155c22006 100644 --- a/DisplayManual.cpp +++ b/DisplayManual.cpp @@ -49,6 +49,11 @@ public: void display (QUrl const& url, QString const& name_we) { + if (QNetworkAccessManager::Accessible != qnam_->networkAccessible ()) { + // try and recover network access for QNAM + qnam_->setNetworkAccessible (QNetworkAccessManager::Accessible); + } + // try and find a localized manual auto lang = QLocale::system ().name (); // try for language and country first diff --git a/SampleDownloader/RemoteFile.cpp b/SampleDownloader/RemoteFile.cpp index 57d33463c..295301317 100644 --- a/SampleDownloader/RemoteFile.cpp +++ b/SampleDownloader/RemoteFile.cpp @@ -109,6 +109,11 @@ bool RemoteFile::sync (QUrl const& url, bool local, bool force) void RemoteFile::download (QUrl const& url) { + if (QNetworkAccessManager::Accessible != network_manager_->networkAccessible ()) { + // try and recover network access for QNAM + network_manager_->setNetworkAccessible (QNetworkAccessManager::Accessible); + } + QNetworkRequest request {url}; request.setRawHeader ("User-Agent", "WSJT Sample Downloader"); request.setOriginatingObject (this); diff --git a/wsprnet.cpp b/wsprnet.cpp index 9685b2760..06c7943d1 100644 --- a/wsprnet.cpp +++ b/wsprnet.cpp @@ -207,14 +207,18 @@ QString WSPRNet::urlEncodeSpot(QHash const& query) void WSPRNet::work() { - if (!urlQueue.isEmpty()) { - QUrl url(urlQueue.dequeue()); - QNetworkRequest request(url); - m_outstandingRequests << networkManager->get(request); - emit uploadStatus(QString {"Uploading Spot %1/%2"}.arg (m_urlQueueSize - urlQueue.size()).arg (m_urlQueueSize)); - } else { - uploadTimer->stop(); + if (!urlQueue.isEmpty()) { + if (QNetworkAccessManager::Accessible != networkManager->networkAccessible ()) { + // try and recover network access for QNAM + networkManager->setNetworkAccessible (QNetworkAccessManager::Accessible); } + QUrl url(urlQueue.dequeue()); + QNetworkRequest request(url); + m_outstandingRequests << networkManager->get(request); + emit uploadStatus(QString {"Uploading Spot %1/%2"}.arg (m_urlQueueSize - urlQueue.size()).arg (m_urlQueueSize)); + } else { + uploadTimer->stop(); + } } void WSPRNet::abortOutstandingRequests () { @@ -222,4 +226,5 @@ void WSPRNet::abortOutstandingRequests () { for (auto& request : m_outstandingRequests) { request->abort (); } + m_urlQueueSize = 0; }