summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/network/kernel/qnetworkinformation.cpp33
-rw-r--r--src/network/kernel/qnetworkinformation.h13
-rw-r--r--src/network/kernel/qnetworkinformation_p.h7
-rw-r--r--src/plugins/networkinformationbackends/android/qandroidnetworkinformationbackend.cpp5
-rw-r--r--src/plugins/networkinformationbackends/networklistmanager/qnetworklistmanagernetworkinformationbackend.cpp5
-rw-r--r--src/plugins/networkinformationbackends/networkmanager/qnetworkmanagernetworkinformationbackend.cpp5
6 files changed, 18 insertions, 50 deletions
diff --git a/src/network/kernel/qnetworkinformation.cpp b/src/network/kernel/qnetworkinformation.cpp
index c1e184f961..42eb6cbb23 100644
--- a/src/network/kernel/qnetworkinformation.cpp
+++ b/src/network/kernel/qnetworkinformation.cpp
@@ -471,21 +471,6 @@ QNetworkInformationBackendFactory::~QNetworkInformationBackendFactory()
*/
/*!
- \enum QNetworkInformation::TriState
- \since 6.2
-
- A bool with a 3rd, unknown, state.
-
- \value False
- Known to be \c{false}.
- \value True
- Known to be \c{true}.
- \value Unknown
- The state cannot be determined at present, either because the query is
- not supported on this platform or because the OS lacks the information.
-*/
-
-/*!
\internal ctor
*/
QNetworkInformation::QNetworkInformation(QNetworkInformationBackend *backend)
@@ -494,7 +479,7 @@ QNetworkInformation::QNetworkInformation(QNetworkInformationBackend *backend)
connect(backend, &QNetworkInformationBackend::reachabilityChanged, this,
[this]() { emit reachabilityChanged(d_func()->backend->reachability()); });
connect(backend, &QNetworkInformationBackend::behindCaptivePortalChanged, this, [this]() {
- emit behindCaptivePortalChanged(d_func()->backend->behindCaptivePortal());
+ emit isBehindCaptivePortalChanged(d_func()->backend->behindCaptivePortal());
});
}
@@ -523,19 +508,17 @@ QNetworkInformation::Reachability QNetworkInformation::reachability() const
}
/*!
- \property QNetworkInformation::behindCaptivePortal
+ \property QNetworkInformation::isBehindCaptivePortal
\brief Lets you know if the user's device is behind a captive portal.
\since 6.2
- This property indicates if the user's device is currently behind a captive
- portal. This functionality relies on the operating system's detection of
- captive portals and is not supported on systems that don't report this.
- On systems where this is not supported this will always return
- TriState::Unknown.
-
- \sa TriState
+ This property indicates if the user's device is currently known to be
+ behind a captive portal. This functionality relies on the operating system's
+ detection of captive portals and is not supported on systems that don't
+ report this. On systems where this is not supported this will always return
+ \c{false}.
*/
-QNetworkInformation::TriState QNetworkInformation::behindCaptivePortal() const
+bool QNetworkInformation::isBehindCaptivePortal() const
{
return d_func()->backend->behindCaptivePortal();
}
diff --git a/src/network/kernel/qnetworkinformation.h b/src/network/kernel/qnetworkinformation.h
index 6e700747bb..7fa43a4187 100644
--- a/src/network/kernel/qnetworkinformation.h
+++ b/src/network/kernel/qnetworkinformation.h
@@ -55,7 +55,7 @@ class Q_NETWORK_EXPORT QNetworkInformation : public QObject
Q_OBJECT
Q_DECLARE_PRIVATE(QNetworkInformation)
Q_PROPERTY(Reachability reachability READ reachability NOTIFY reachabilityChanged)
- Q_PROPERTY(TriState behindCaptivePortal READ behindCaptivePortal NOTIFY behindCaptivePortalChanged)
+ Q_PROPERTY(bool isBehindCaptivePortal READ isBehindCaptivePortal NOTIFY isBehindCaptivePortalChanged)
public:
enum class Reachability {
Unknown,
@@ -66,13 +66,6 @@ public:
};
Q_ENUM(Reachability)
- enum class TriState {
- False,
- True,
- Unknown,
- };
- Q_ENUM(TriState)
-
enum class Feature {
Reachability = 0x1,
CaptivePortal = 0x2,
@@ -82,7 +75,7 @@ public:
Reachability reachability() const;
- TriState behindCaptivePortal() const;
+ bool isBehindCaptivePortal() const;
QString backendName() const;
@@ -95,7 +88,7 @@ public:
Q_SIGNALS:
void reachabilityChanged(Reachability newReachability);
- void behindCaptivePortalChanged(TriState state);
+ void isBehindCaptivePortalChanged(bool state);
private:
friend struct QNetworkInformationDeleter;
diff --git a/src/network/kernel/qnetworkinformation_p.h b/src/network/kernel/qnetworkinformation_p.h
index c71e7787a4..73ef96e724 100644
--- a/src/network/kernel/qnetworkinformation_p.h
+++ b/src/network/kernel/qnetworkinformation_p.h
@@ -70,7 +70,7 @@ public:
virtual QNetworkInformation::Features featuresSupported() const = 0;
QNetworkInformation::Reachability reachability() const { return m_reachability; }
- QNetworkInformation::TriState behindCaptivePortal() const { return m_behindCaptivePortal; }
+ bool behindCaptivePortal() const { return m_behindCaptivePortal; }
Q_SIGNALS:
void reachabilityChanged();
@@ -85,7 +85,7 @@ protected:
}
}
- void setBehindCaptivePortal(QNetworkInformation::TriState behindPortal)
+ void setBehindCaptivePortal(bool behindPortal)
{
if (m_behindCaptivePortal != behindPortal) {
m_behindCaptivePortal = behindPortal;
@@ -95,8 +95,7 @@ protected:
private:
QNetworkInformation::Reachability m_reachability = QNetworkInformation::Reachability::Unknown;
- QNetworkInformation::TriState m_behindCaptivePortal =
- QNetworkInformation::TriState::Unknown;
+ bool m_behindCaptivePortal = false;
Q_DISABLE_COPY_MOVE(QNetworkInformationBackend)
friend class QNetworkInformation;
diff --git a/src/plugins/networkinformationbackends/android/qandroidnetworkinformationbackend.cpp b/src/plugins/networkinformationbackends/android/qandroidnetworkinformationbackend.cpp
index 130b10d558..9eef471989 100644
--- a/src/plugins/networkinformationbackends/android/qandroidnetworkinformationbackend.cpp
+++ b/src/plugins/networkinformationbackends/android/qandroidnetworkinformationbackend.cpp
@@ -128,10 +128,7 @@ QAndroidNetworkInformationBackend::QAndroidNetworkInformationBackend()
});
connect(conman, &AndroidConnectivityManager::captivePortalChanged, this,
- [this](bool state) {
- using TriState = QNetworkInformation::TriState;
- setBehindCaptivePortal(state ? TriState::True : TriState::False);
- });
+ &QAndroidNetworkInformationBackend::setBehindCaptivePortal);
}
QT_END_NAMESPACE
diff --git a/src/plugins/networkinformationbackends/networklistmanager/qnetworklistmanagernetworkinformationbackend.cpp b/src/plugins/networkinformationbackends/networklistmanager/qnetworklistmanagernetworkinformationbackend.cpp
index ffed43aac7..d37f83832b 100644
--- a/src/plugins/networkinformationbackends/networklistmanager/qnetworklistmanagernetworkinformationbackend.cpp
+++ b/src/plugins/networkinformationbackends/networklistmanager/qnetworklistmanagernetworkinformationbackend.cpp
@@ -365,10 +365,7 @@ void QNetworkListManagerNetworkInformationBackend::setConnectivity(NLM_CONNECTIV
void QNetworkListManagerNetworkInformationBackend::checkCaptivePortal()
{
- const bool behindPortal = managerEvents->checkBehindCaptivePortal();
- using TriState = QNetworkInformation::TriState;
- const auto triState = behindPortal ? TriState::True : TriState::False;
- setBehindCaptivePortal(triState);
+ setBehindCaptivePortal(managerEvents->checkBehindCaptivePortal());
}
bool QNetworkListManagerNetworkInformationBackend::event(QEvent *event)
diff --git a/src/plugins/networkinformationbackends/networkmanager/qnetworkmanagernetworkinformationbackend.cpp b/src/plugins/networkinformationbackends/networkmanager/qnetworkmanagernetworkinformationbackend.cpp
index a22be93f6c..bfb04ae4a6 100644
--- a/src/plugins/networkinformationbackends/networkmanager/qnetworkmanagernetworkinformationbackend.cpp
+++ b/src/plugins/networkinformationbackends/networkmanager/qnetworkmanagernetworkinformationbackend.cpp
@@ -144,16 +144,15 @@ QNetworkManagerNetworkInformationBackend::QNetworkManagerNetworkInformationBacke
});
using ConnectivityState = QNetworkManagerInterface::NMConnectivityState;
- using TriState = QNetworkInformation::TriState;
const auto connectivityState = iface.connectivityState();
const bool behindPortal = (connectivityState == ConnectivityState::NM_CONNECTIVITY_PORTAL);
- setBehindCaptivePortal(behindPortal ? TriState::True : TriState::False);
+ setBehindCaptivePortal(behindPortal);
connect(&iface, &QNetworkManagerInterface::connectivityChanged, this,
[this](ConnectivityState state) {
const bool behindPortal = (state == ConnectivityState::NM_CONNECTIVITY_PORTAL);
- setBehindCaptivePortal(behindPortal ? TriState::True : TriState::False);
+ setBehindCaptivePortal(behindPortal);
});
}