modules: adapt to changes in network manager
This commit is contained in:
parent
8ebba4fcff
commit
6ba8d9fd7d
@ -547,7 +547,7 @@ Config::startGeoIP()
|
||||
{
|
||||
if ( m_geoip && m_geoip->isValid() )
|
||||
{
|
||||
auto& network = Calamares::Network::Manager::instance();
|
||||
Calamares::Network::Manager network;
|
||||
if ( network.hasInternet() || network.synchronousPing( m_geoip->url() ) )
|
||||
{
|
||||
using Watcher = QFutureWatcher< Calamares::GeoIP::RegionZonePair >;
|
||||
|
@ -128,7 +128,7 @@ LoaderQueue::fetch( const QUrl& url )
|
||||
using namespace Calamares::Network;
|
||||
|
||||
cDebug() << "NetInstall loading groups from" << url;
|
||||
QNetworkReply* reply = Manager::instance().asynchronousGet(
|
||||
QNetworkReply* reply = Manager().asynchronousGet(
|
||||
url,
|
||||
RequestOptions( RequestOptions::FakeUserAgent | RequestOptions::FollowRedirect, std::chrono::seconds( 30 ) ) );
|
||||
|
||||
|
@ -113,10 +113,10 @@ TrackingInstallJob::exec()
|
||||
using Calamares::Network::RequestOptions;
|
||||
using Calamares::Network::RequestStatus;
|
||||
|
||||
auto result = Manager::instance().synchronousPing(
|
||||
QUrl( m_url ),
|
||||
RequestOptions( RequestOptions::FollowRedirect | RequestOptions::FakeUserAgent,
|
||||
RequestOptions::milliseconds( 5000 ) ) );
|
||||
auto result
|
||||
= Manager().synchronousPing( QUrl( m_url ),
|
||||
RequestOptions( RequestOptions::FollowRedirect | RequestOptions::FakeUserAgent,
|
||||
RequestOptions::milliseconds( 5000 ) ) );
|
||||
if ( result.status == RequestStatus::Timeout )
|
||||
{
|
||||
cWarning() << "install-tracking request timed out.";
|
||||
|
@ -72,7 +72,7 @@ WelcomeTests::testOneUrl()
|
||||
QVERIFY( map.contains( "requirements" ) );
|
||||
|
||||
c.setConfigurationMap( map );
|
||||
QCOMPARE( Calamares::Network::Manager::instance().getCheckInternetUrls().count(), 1 );
|
||||
QCOMPARE( Calamares::Network::Manager::getCheckInternetUrls().count(), 1 );
|
||||
}
|
||||
|
||||
void
|
||||
@ -107,17 +107,17 @@ WelcomeTests::testUrls()
|
||||
const auto map = Calamares::YAML::load( fi, &ok );
|
||||
QVERIFY( ok );
|
||||
|
||||
Calamares::Network::Manager::instance().setCheckHasInternetUrl( QVector< QUrl > {} );
|
||||
QCOMPARE( Calamares::Network::Manager::instance().getCheckInternetUrls().count(), 0 );
|
||||
Calamares::Network::Manager::setCheckHasInternetUrl( QVector< QUrl > {} );
|
||||
QCOMPARE( Calamares::Network::Manager::getCheckInternetUrls().count(), 0 );
|
||||
c.setConfigurationMap( map );
|
||||
QCOMPARE( Calamares::Network::Manager::instance().getCheckInternetUrls().count(), result );
|
||||
QCOMPARE( Calamares::Network::Manager::getCheckInternetUrls().count(), result );
|
||||
}
|
||||
|
||||
void
|
||||
WelcomeTests::testBadConfigDoesNotResetUrls()
|
||||
{
|
||||
auto& nam = Calamares::Network::Manager::instance();
|
||||
Calamares::Network::Manager::instance().setCheckHasInternetUrl( QVector< QUrl > {} );
|
||||
Calamares::Network::Manager nam;
|
||||
Calamares::Network::Manager::setCheckHasInternetUrl( QVector< QUrl > {} );
|
||||
QCOMPARE( nam.getCheckInternetUrls().count(), 0 );
|
||||
nam.setCheckHasInternetUrl( QVector< QUrl > { QUrl( "http://example.com" ), QUrl( "https://www.kde.org" ) } );
|
||||
QCOMPARE( nam.getCheckInternetUrls().count(), 2 );
|
||||
|
@ -306,12 +306,12 @@ getCheckInternetUrls( const QVariantMap& configurationMap )
|
||||
{
|
||||
cWarning() << "GeneralRequirements entry 'internetCheckUrl' contains no valid URLs, "
|
||||
<< "reverting to default (" << exampleUrl << ").";
|
||||
Calamares::Network::Manager::instance().setCheckHasInternetUrl( QUrl( exampleUrl ) );
|
||||
Calamares::Network::Manager::setCheckHasInternetUrl( QUrl( exampleUrl ) );
|
||||
incomplete = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Calamares::Network::Manager::instance().setCheckHasInternetUrl( urls );
|
||||
Calamares::Network::Manager::setCheckHasInternetUrl( urls );
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -319,7 +319,7 @@ getCheckInternetUrls( const QVariantMap& configurationMap )
|
||||
cWarning() << "GeneralRequirements entry 'internetCheckUrl' is undefined in welcome.conf, "
|
||||
"reverting to default ("
|
||||
<< exampleUrl << ").";
|
||||
Calamares::Network::Manager::instance().setCheckHasInternetUrl( QUrl( exampleUrl ) );
|
||||
Calamares::Network::Manager::setCheckHasInternetUrl( QUrl( exampleUrl ) );
|
||||
incomplete = true;
|
||||
}
|
||||
return incomplete;
|
||||
@ -504,7 +504,7 @@ GeneralRequirements::checkHasPower()
|
||||
bool
|
||||
GeneralRequirements::checkHasInternet()
|
||||
{
|
||||
auto& nam = Calamares::Network::Manager::instance();
|
||||
Calamares::Network::Manager nam;
|
||||
bool hasInternet = nam.checkHasInternet();
|
||||
Calamares::JobQueue::instance()->globalStorage()->insert( "hasInternet", hasInternet );
|
||||
return hasInternet;
|
||||
|
Loading…
Reference in New Issue
Block a user