w32: when utilizing IE values for system proxy also honor the ProxyEnable value. In the configuration dialog, display a note when system proxy is disabled.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15962 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2007-12-23 10:11:51 +00:00
parent 383a32a7ae
commit 9d482ebb6c
2 changed files with 22 additions and 7 deletions

View file

@ -380,12 +380,16 @@ void Config::setSystemProxy(bool checked)
QUrl envproxy; QUrl envproxy;
#if defined(Q_OS_LINUX) #if defined(Q_OS_LINUX)
envproxy = QUrl(getenv("http_proxy")); envproxy = QUrl(getenv("http_proxy"));
ui.proxyHost->setText(envproxy.host());
#endif #endif
#if defined(Q_OS_WIN32) #if defined(Q_OS_WIN32)
HKEY hk; HKEY hk;
wchar_t proxyval[80]; wchar_t proxyval[80];
DWORD buflen = 80; DWORD buflen = 80;
long ret; long ret;
DWORD enable;
DWORD enalen = sizeof(DWORD);
ret = RegOpenKeyEx(HKEY_CURRENT_USER, _TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"), ret = RegOpenKeyEx(HKEY_CURRENT_USER, _TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"),
0, KEY_QUERY_VALUE, &hk); 0, KEY_QUERY_VALUE, &hk);
@ -394,15 +398,19 @@ void Config::setSystemProxy(bool checked)
ret = RegQueryValueEx(hk, _TEXT("ProxyServer"), NULL, NULL, (LPBYTE)proxyval, &buflen); ret = RegQueryValueEx(hk, _TEXT("ProxyServer"), NULL, NULL, (LPBYTE)proxyval, &buflen);
if(ret != ERROR_SUCCESS) return; if(ret != ERROR_SUCCESS) return;
ret = RegQueryValueEx(hk, _TEXT("ProxyEnable"), NULL, NULL, (LPBYTE)&enable, &enalen);
if(ret != ERROR_SUCCESS) return;
RegCloseKey(hk); RegCloseKey(hk);
envproxy = QUrl("http://" + QString::fromWCharArray(proxyval)); envproxy = QUrl("http://" + QString::fromWCharArray(proxyval));
qDebug() << envproxy; qDebug() << envproxy;
ui.proxyHost->setText(envproxy.host()); if(enable != 0) {
ui.proxyPort->setText(QString("%1").arg(envproxy.port())); ui.proxyHost->setText(envproxy.host());
ui.proxyUser->setText(envproxy.userName()); }
ui.proxyPass->setText(envproxy.password()); else {
ui.proxyHost->setText(envproxy.host() + " " + tr("(system proxy is disabled)"));
}
#endif #endif
ui.proxyHost->setText(envproxy.host());
ui.proxyPort->setText(QString("%1").arg(envproxy.port())); ui.proxyPort->setText(QString("%1").arg(envproxy.port()));
ui.proxyUser->setText(envproxy.userName()); ui.proxyUser->setText(envproxy.userName());
ui.proxyPass->setText(envproxy.password()); ui.proxyPass->setText(envproxy.password());

View file

@ -965,6 +965,8 @@ QUrl RbUtilQt::proxy()
wchar_t proxyval[80]; wchar_t proxyval[80];
DWORD buflen = 80; DWORD buflen = 80;
long ret; long ret;
DWORD enable;
DWORD enalen = sizeof(DWORD);
ret = RegOpenKeyEx(HKEY_CURRENT_USER, ret = RegOpenKeyEx(HKEY_CURRENT_USER,
_TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"), _TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"),
@ -973,10 +975,15 @@ QUrl RbUtilQt::proxy()
ret = RegQueryValueEx(hk, _TEXT("ProxyServer"), NULL, NULL, (LPBYTE)proxyval, &buflen); ret = RegQueryValueEx(hk, _TEXT("ProxyServer"), NULL, NULL, (LPBYTE)proxyval, &buflen);
if(ret != ERROR_SUCCESS) return QUrl(""); if(ret != ERROR_SUCCESS) return QUrl("");
ret = RegQueryValueEx(hk, _TEXT("ProxyEnable"), NULL, NULL, (LPBYTE)&enable, &enalen);
if(ret != ERROR_SUCCESS) return QUrl("");
RegCloseKey(hk); RegCloseKey(hk);
qDebug() << QString::fromWCharArray(proxyval);
return QUrl("http://" + QString::fromWCharArray(proxyval)); qDebug() << QString::fromWCharArray(proxyval) << QString("%1").arg(enable);
if(enable != 0)
return QUrl("http://" + QString::fromWCharArray(proxyval));
#endif #endif
return QUrl(""); return QUrl("");