[libcalamares] Expand API for setting URLs to check

This commit is contained in:
Adriaan de Groot 2021-08-01 22:37:13 +02:00
parent b8583a1e59
commit 81fe8b1488
2 changed files with 22 additions and 4 deletions

View File

@ -203,10 +203,21 @@ Manager::checkHasInternet()
void
Manager::setCheckHasInternetUrl( const QUrl& url )
{
if ( d->m_hasInternetUrls.empty() )
{
d->m_lastCheckedUrlIndex = -1;
}
d->m_lastCheckedUrlIndex = -1;
d->m_hasInternetUrls.clear();
d->m_hasInternetUrls.append( url );
}
void
Manager::setCheckHasInternetUrl( const QVector< QUrl >& urls )
{
d->m_lastCheckedUrlIndex = -1;
d->m_hasInternetUrls = urls;
}
void
Manager::addCheckHasInternetUrl( const QUrl& url )
{
d->m_hasInternetUrls.append( url );
}

View File

@ -16,6 +16,7 @@
#include <QDebug>
#include <QObject>
#include <QUrl>
#include <QVector>
#include <chrono>
#include <memory>
@ -122,6 +123,12 @@ public:
/// @brief Set the URL which is used for the general "is there internet" check.
void setCheckHasInternetUrl( const QUrl& url );
/// @brief Adds an (extra) URL to check
void addCheckHasInternetUrl( const QUrl& url );
/// @brief Set a collection of URLs used for the general "is there internet" check.
void setCheckHasInternetUrl( const QVector< QUrl >& urls );
/** @brief Do a network request asynchronously.
*
* Returns a pointer to the reply-from-the-request.