diff --git a/src/gui/application.cpp b/src/gui/application.cpp index 6ef24ef02..39b9f2ee5 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -67,6 +67,7 @@ #include #include #include +#include class QSocket; @@ -429,7 +430,7 @@ Application::Application(int &argc, char **argv) QTimer::singleShot(0, this, &Application::slotCheckConnection); // Can't use onlineStateChanged because it is always true on modern systems because of many interfaces - connect(&_networkConfigurationManager, &QNetworkConfigurationManager::configurationChanged, + connect(QNetworkInformation::instance(), &QNetworkInformation::reachabilityChanged, this, &Application::slotSystemOnlineConfigurationChanged); #if defined(BUILD_UPDATER) @@ -647,9 +648,10 @@ void Application::slotCleanup() // FIXME: This is not ideal yet since a ConnectionValidator might already be running and is in // progress of timing out in some seconds. // Maybe we need 2 validators, one triggered by timer, one by network configuration changes? -void Application::slotSystemOnlineConfigurationChanged(QNetworkConfiguration cnf) +void Application::slotSystemOnlineConfigurationChanged() { - if (cnf.state() & QNetworkConfiguration::Active) { + if (QNetworkInformation::instance()->reachability() == QNetworkInformation::Reachability::Site || + QNetworkInformation::instance()->reachability() == QNetworkInformation::Reachability::Online) { const auto list = AccountManager::instance()->accounts(); for (const auto &accountState : list) { accountState->systemOnlineConfigurationChanged(); diff --git a/src/gui/application.h b/src/gui/application.h index fb9634b5e..879ae51ef 100644 --- a/src/gui/application.h +++ b/src/gui/application.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include "qtsingleapplication.h" @@ -110,7 +110,7 @@ protected slots: void slotCleanup(); void slotAccountStateAdded(OCC::AccountState *accountState); void slotAccountStateRemoved(OCC::AccountState *accountState); - void slotSystemOnlineConfigurationChanged(QNetworkConfiguration); + void slotSystemOnlineConfigurationChanged(); void slotGuiIsShowingSettings(); private: @@ -152,7 +152,6 @@ private: ClientProxy _proxy; - QNetworkConfigurationManager _networkConfigurationManager; QTimer _checkConnectionTimer; QString _overrideServerUrl; diff --git a/src/libsync/accessmanager.cpp b/src/libsync/accessmanager.cpp index 8a3c31c3c..91c4538b4 100644 --- a/src/libsync/accessmanager.cpp +++ b/src/libsync/accessmanager.cpp @@ -20,7 +20,11 @@ #include #include #include +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #include +#else +#include +#endif #include #include "cookiejar.h" @@ -42,8 +46,8 @@ AccessManager::AccessManager(QObject *parent) setProxy(proxy); #endif -#ifndef Q_OS_LINUX - // Attempt to workaround for https://github.com/owncloud/client/issues/3969 +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) && !defined(Q_OS_LINUX) + // Atempt to workaround for https://github.com/owncloud/client/issues/3969 setConfiguration(QNetworkConfiguration()); #endif setCookieJar(new CookieJar);