diff --git a/src/gui/networksettings.cpp b/src/gui/networksettings.cpp
index d2436396dd6..2c9aa3c48df 100644
--- a/src/gui/networksettings.cpp
+++ b/src/gui/networksettings.cpp
@@ -55,6 +55,8 @@ NetworkSettings::NetworkSettings(QWidget *parent)
_ui->manualSettings, &QWidget::setEnabled);
connect(_ui->manualProxyRadioButton, &QAbstractButton::toggled,
_ui->typeComboBox, &QWidget::setEnabled);
+ connect(_ui->manualProxyRadioButton, &QAbstractButton::toggled,
+ this, &NetworkSettings::checkAccountLocalhost);
loadProxySettings();
loadBWLimitSettings();
@@ -80,6 +82,7 @@ NetworkSettings::NetworkSettings(QWidget *parent)
// Warn about empty proxy host
connect(_ui->hostLineEdit, &QLineEdit::textChanged, this, &NetworkSettings::checkEmptyProxyHost);
checkEmptyProxyHost();
+ checkAccountLocalhost();
}
NetworkSettings::~NetworkSettings()
@@ -229,8 +232,27 @@ void NetworkSettings::showEvent(QShowEvent *event)
checkEmptyProxyHost();
saveProxySettings();
}
+ checkAccountLocalhost();
QWidget::showEvent(event);
}
+
+void NetworkSettings::checkAccountLocalhost()
+{
+ bool visible = false;
+ if (_ui->manualProxyRadioButton->isChecked()) {
+ // Check if at least one account is using localhost, because Qt proxy settings have no
+ // effect for localhost (#7169)
+ for (const auto &account : AccountManager::instance()->accounts()) {
+ const auto host = account->account()->url().host();
+ // Some typical url for localhost
+ if (host == "localhost" || host.startsWith("127.") || host == "[::1]")
+ visible = true;
+ }
+ }
+ _ui->labelLocalhost->setVisible(visible);
+}
+
+
} // namespace OCC
diff --git a/src/gui/networksettings.h b/src/gui/networksettings.h
index 8d35b14dcb1..cc0d7a56233 100644
--- a/src/gui/networksettings.h
+++ b/src/gui/networksettings.h
@@ -44,6 +44,8 @@ private slots:
/// Red marking of host field if empty and enabled
void checkEmptyProxyHost();
+ void checkAccountLocalhost();
+
protected:
void showEvent(QShowEvent *event) override;
diff --git a/src/gui/networksettings.ui b/src/gui/networksettings.ui
index 60c5ae9c2d5..476079832a0 100644
--- a/src/gui/networksettings.ui
+++ b/src/gui/networksettings.ui
@@ -6,8 +6,8 @@
0
0
- 542
- 396
+ 623
+ 581
@@ -23,6 +23,13 @@
Proxy Settings
+ -
+
+
+ false
+
+
+
-
@@ -56,13 +63,6 @@
- -
-
-
- false
-
-
-
-
@@ -170,6 +170,13 @@
+ -
+
+
+ Note: proxy settings have no effects for accounts on localhost
+
+
+