mirror of
https://github.com/nextcloud/desktop.git
synced 2024-10-27 06:45:49 +03:00
Network Settings: Show a warning that proxy settings do not apply to localhost
Only show this if at least one account is detected to have an url that looks like localhost, because this could otherwise be confusing Issue #7169
This commit is contained in:
parent
392d3c257c
commit
b97c0ed8a2
3 changed files with 40 additions and 9 deletions
|
@ -55,6 +55,8 @@ NetworkSettings::NetworkSettings(QWidget *parent)
|
||||||
_ui->manualSettings, &QWidget::setEnabled);
|
_ui->manualSettings, &QWidget::setEnabled);
|
||||||
connect(_ui->manualProxyRadioButton, &QAbstractButton::toggled,
|
connect(_ui->manualProxyRadioButton, &QAbstractButton::toggled,
|
||||||
_ui->typeComboBox, &QWidget::setEnabled);
|
_ui->typeComboBox, &QWidget::setEnabled);
|
||||||
|
connect(_ui->manualProxyRadioButton, &QAbstractButton::toggled,
|
||||||
|
this, &NetworkSettings::checkAccountLocalhost);
|
||||||
|
|
||||||
loadProxySettings();
|
loadProxySettings();
|
||||||
loadBWLimitSettings();
|
loadBWLimitSettings();
|
||||||
|
@ -80,6 +82,7 @@ NetworkSettings::NetworkSettings(QWidget *parent)
|
||||||
// Warn about empty proxy host
|
// Warn about empty proxy host
|
||||||
connect(_ui->hostLineEdit, &QLineEdit::textChanged, this, &NetworkSettings::checkEmptyProxyHost);
|
connect(_ui->hostLineEdit, &QLineEdit::textChanged, this, &NetworkSettings::checkEmptyProxyHost);
|
||||||
checkEmptyProxyHost();
|
checkEmptyProxyHost();
|
||||||
|
checkAccountLocalhost();
|
||||||
}
|
}
|
||||||
|
|
||||||
NetworkSettings::~NetworkSettings()
|
NetworkSettings::~NetworkSettings()
|
||||||
|
@ -233,8 +236,27 @@ void NetworkSettings::showEvent(QShowEvent *event)
|
||||||
checkEmptyProxyHost();
|
checkEmptyProxyHost();
|
||||||
saveProxySettings();
|
saveProxySettings();
|
||||||
}
|
}
|
||||||
|
checkAccountLocalhost();
|
||||||
|
|
||||||
QWidget::showEvent(event);
|
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
|
} // namespace OCC
|
||||||
|
|
|
@ -44,6 +44,8 @@ private slots:
|
||||||
/// Red marking of host field if empty and enabled
|
/// Red marking of host field if empty and enabled
|
||||||
void checkEmptyProxyHost();
|
void checkEmptyProxyHost();
|
||||||
|
|
||||||
|
void checkAccountLocalhost();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent *event) override;
|
void showEvent(QShowEvent *event) override;
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>516</width>
|
<width>623</width>
|
||||||
<height>444</height>
|
<height>581</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -23,6 +23,13 @@
|
||||||
<string>Proxy Settings</string>
|
<string>Proxy Settings</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QComboBox" name="typeComboBox">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QRadioButton" name="noProxyRadioButton">
|
<widget class="QRadioButton" name="noProxyRadioButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -56,13 +63,6 @@
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QComboBox" name="typeComboBox">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0" colspan="2">
|
<item row="3" column="0" colspan="2">
|
||||||
<widget class="QWidget" name="manualSettings" native="true">
|
<widget class="QWidget" name="manualSettings" native="true">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
|
@ -170,6 +170,13 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelLocalhost">
|
||||||
|
<property name="text">
|
||||||
|
<string>Note: proxy settings have no effects for accounts on localhost</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in a new issue