Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjv committed Jun 21, 2024
1 parent 317b2c9 commit 9d8dd74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/gui/accountsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ void AccountSettings::slotAccountStateChanged()
{
const AccountState::State state = _accountState->state();
const AccountPtr account = _accountState->account();

qDebug()<<"*** account state changed to"<<state;
// in 2023 there should never be credentials encoded in the url, but we never know...
const auto safeUrl = account->url().adjusted(QUrl::RemoveUserInfo);

Expand Down Expand Up @@ -473,7 +473,7 @@ void AccountSettings::slotAccountStateChanged()
case AccountState::Connecting:
if (NetworkInformation::instance()->isBehindCaptivePortal()) {
showConnectionLabel(tr("Captive portal prevents connections to %1.").arg(server));
} else if (NetworkInformation::instance()->isMetered()) {
} else if (NetworkInformation::instance()->isMetered() && ConfigFile().pauseSyncWhenMetered()) {
showConnectionLabel(tr("Sync to %1 is paused due to metered internet connection.").arg(server));
} else {
showConnectionLabel(tr("Connecting to: %1.").arg(server));
Expand Down
4 changes: 3 additions & 1 deletion src/gui/networkinformation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void loadQNetworkInformationBackend()
qCDebug(lcNetInfo) << "Available backends:" << QNetworkInformation::availableBackends().join(QStringLiteral(", "));
if (auto qni = QNetworkInformation::instance()) {
QObject::connect(qni, &QNetworkInformation::reachabilityChanged,
[](QNetworkInformation::Reachability reachability) { qCInfo(lcNetInfo) << "Connection Status changed to:" << reachability; });
[qni](QNetworkInformation::Reachability reachability) { qCInfo(lcNetInfo) << "Connection Status changed to:" << reachability << "captive portal status:" << qni->isBehindCaptivePortal(); });
}
}

Expand Down Expand Up @@ -123,6 +123,8 @@ bool NetworkInformation::isBehindCaptivePortal() const

void NetworkInformation::slotIsBehindCaptivePortalChanged(bool state)
{
qCDebug(lcNetInfo) << "OS signals behind captive portal changed to" << state << "forced captive portal flag:" << _forcedCaptivePortal;

if (!_forcedCaptivePortal) {
Q_EMIT isBehindCaptivePortalChanged(state);
}
Expand Down

0 comments on commit 9d8dd74

Please sign in to comment.