1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-02-09 05:14:23 +00:00

Don't uncheck Authentication checkbox when changing proxy type

Closes #12525
This commit is contained in:
thalieht 2020-04-16 22:34:33 +03:00
parent f0549b4cb2
commit 5d16379941
2 changed files with 8 additions and 17 deletions

View File

@ -1457,7 +1457,6 @@ void OptionsDialog::enableProxy(const int index)
} }
else { else {
m_ui->checkProxyAuth->setEnabled(false); m_ui->checkProxyAuth->setEnabled(false);
m_ui->checkProxyAuth->setChecked(false);
m_ui->isProxyOnlyForTorrents->setEnabled(false); m_ui->isProxyOnlyForTorrents->setEnabled(false);
m_ui->isProxyOnlyForTorrents->setChecked(true); m_ui->isProxyOnlyForTorrents->setChecked(true);
} }
@ -1471,7 +1470,6 @@ void OptionsDialog::enableProxy(const int index)
m_ui->checkProxyPeerConnecs->setEnabled(false); m_ui->checkProxyPeerConnecs->setEnabled(false);
m_ui->isProxyOnlyForTorrents->setEnabled(false); m_ui->isProxyOnlyForTorrents->setEnabled(false);
m_ui->checkProxyAuth->setEnabled(false); m_ui->checkProxyAuth->setEnabled(false);
m_ui->checkProxyAuth->setChecked(false);
} }
} }

View File

@ -1292,26 +1292,19 @@
$('peer_proxy_host_text').setProperty('disabled', !isPeerProxyTypeSelected); $('peer_proxy_host_text').setProperty('disabled', !isPeerProxyTypeSelected);
$('peer_proxy_port_value').setProperty('disabled', !isPeerProxyTypeSelected); $('peer_proxy_port_value').setProperty('disabled', !isPeerProxyTypeSelected);
$('use_peer_proxy_checkbox').setProperty('disabled', !isPeerProxyTypeSelected); $('use_peer_proxy_checkbox').setProperty('disabled', !isPeerProxyTypeSelected);
$('proxy_only_for_torrents_checkbox').setProperty('disabled', !isPeerProxyTypeSelected); const isPeerProxyAuthenticatable = ($('peer_proxy_type_select').getProperty('value') === "socks5" || $('peer_proxy_type_select').getProperty('value') === "http");
$('proxy_only_for_torrents_checkbox').setProperty('disabled', !isPeerProxyAuthenticatable);
if (isPeerProxyTypeSelected) { if ($('peer_proxy_type_select').getProperty('value') === "socks4")
const isPeerProxyTypeSocks5 = $('peer_proxy_type_select').getProperty('value') == "socks5"; $('proxy_only_for_torrents_checkbox').setProperty('checked', true);
$('peer_proxy_auth_checkbox').setProperty('disabled', !isPeerProxyTypeSocks5);
if (!isPeerProxyTypeSocks5) { $('peer_proxy_auth_checkbox').setProperty('disabled', !isPeerProxyAuthenticatable);
$('peer_proxy_auth_checkbox').setProperty('checked', isPeerProxyTypeSocks5);
updatePeerProxyAuthSettings(); updatePeerProxyAuthSettings();
}
}
else {
$('peer_proxy_auth_checkbox').setProperty('disabled', !isPeerProxyTypeSelected);
$('peer_proxy_auth_checkbox').setProperty('checked', isPeerProxyTypeSelected);
updatePeerProxyAuthSettings();
}
}; };
const updatePeerProxyAuthSettings = function() { const updatePeerProxyAuthSettings = function() {
const isPeerProxyAuthEnabled = $('peer_proxy_auth_checkbox').getProperty('checked'); const isPeerProxyAuthEnabled = (!$('peer_proxy_auth_checkbox').getProperty('disabled') && $('peer_proxy_auth_checkbox').getProperty('checked'));
$('peer_proxy_username_text').setProperty('disabled', !isPeerProxyAuthEnabled); $('peer_proxy_username_text').setProperty('disabled', !isPeerProxyAuthEnabled);
$('peer_proxy_password_text').setProperty('disabled', !isPeerProxyAuthEnabled); $('peer_proxy_password_text').setProperty('disabled', !isPeerProxyAuthEnabled);
}; };