mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-19 10:20:17 -06:00
Make early network accesses more reliable when using WLAN
The automatic update check is performed early during the application start. It turns out that, when using a Wifi connection, the Qt networking code is not ready yet at this point which leads to an "Network inaccessible" error. This commit delays the automatic update check until the network configuration is loaded completely. See issue #1595.
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include <QApplication>
|
||||
#include <QtNetwork/QNetworkAccessManager>
|
||||
#include <QtNetwork/QNetworkConfigurationManager>
|
||||
#include <QMessageBox>
|
||||
#include <QtNetwork/QNetworkReply>
|
||||
#include <QFile>
|
||||
@@ -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);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <QtNetwork/QSslConfiguration>
|
||||
|
||||
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<QString, QSslCertificate> m_clientCertFiles;
|
||||
|
||||
Reference in New Issue
Block a user