diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 314b3dff..3c64d39d 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -518,15 +518,6 @@ void MainWindow::init() // Load all settings reloadSettings(); -#ifdef CHECKNEWVERSION - // Check for a new version if automatic update check aren't disabled in the settings dialog - if(Settings::getValue("checkversion", "enabled").toBool()) - { - m_remoteDb->fetch("https://download.sqlitebrowser.org/currentrelease", - RemoteDatabase::RequestTypeNewVersionCheck); - } -#endif - #ifndef ENABLE_SQLCIPHER // Only show encryption menu action when SQLCipher support is enabled ui->actionEncryption->setVisible(false); diff --git a/src/RemoteDatabase.cpp b/src/RemoteDatabase.cpp index a67c989b..fb9b4537 100644 --- a/src/RemoteDatabase.cpp +++ b/src/RemoteDatabase.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -21,9 +22,21 @@ RemoteDatabase::RemoteDatabase() : m_manager(new QNetworkAccessManager), + m_configurationManager(new QNetworkConfigurationManager), m_progress(nullptr), m_dbLocal(nullptr) { + // Update network configurations + connect(m_configurationManager, &QNetworkConfigurationManager::updateCompleted, [this]() { + m_manager->setConfiguration(m_configurationManager->defaultConfiguration()); + +#ifdef CHECKNEWVERSION + // Check for a new version if automatic update check aren't disabled in the settings dialog + if(Settings::getValue("checkversion", "enabled").toBool()) + fetch("https://download.sqlitebrowser.org/currentrelease", RemoteDatabase::RequestTypeNewVersionCheck); +#endif + }); + // Set up SSL configuration m_sslConfiguration = QSslConfiguration::defaultConfiguration(); m_sslConfiguration.setPeerVerifyMode(QSslSocket::VerifyPeer); diff --git a/src/RemoteDatabase.h b/src/RemoteDatabase.h index bcba03e2..8a14a7a3 100644 --- a/src/RemoteDatabase.h +++ b/src/RemoteDatabase.h @@ -5,6 +5,7 @@ #include class QNetworkAccessManager; +class QNetworkConfigurationManager; class QString; class QNetworkReply; class QSslError; @@ -88,6 +89,7 @@ private: void clearAccessCache(const QString& clientCert); QNetworkAccessManager* m_manager; + QNetworkConfigurationManager* m_configurationManager; QProgressDialog* m_progress; QSslConfiguration m_sslConfiguration; QMap m_clientCertFiles;