mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
w32: implement "system proxy" settings. This uses the IE setting by reading its values from the registry. Make system proxy the default value if no configuration file is found.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14827 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a1a4575740
commit
74154436a5
2 changed files with 64 additions and 8 deletions
|
|
@ -32,9 +32,17 @@
|
|||
#include "uninstallwindow.h"
|
||||
#include "browseof.h"
|
||||
|
||||
#ifdef __linux
|
||||
#if defined(Q_OS_LINUX)
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#if defined(Q_OS_WIN32)
|
||||
#if defined(UNICODE)
|
||||
#define _UNICODE
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <tchar.h>
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
|
||||
{
|
||||
|
|
@ -935,11 +943,29 @@ void RbUtilQt::updateInfo()
|
|||
|
||||
QUrl RbUtilQt::proxy()
|
||||
{
|
||||
if(userSettings->value("proxytype") == "manual")
|
||||
if(userSettings->value("proxytype", "system").toString() == "manual")
|
||||
return QUrl(userSettings->value("proxy").toString());
|
||||
#ifdef __linux
|
||||
#if defined(Q_OS_LINUX)
|
||||
else if(userSettings->value("proxytype") == "system")
|
||||
return QUrl(getenv("http_proxy"));
|
||||
#endif
|
||||
#if defined(Q_OS_WIN32)
|
||||
HKEY hk;
|
||||
wchar_t proxyval[80];
|
||||
DWORD buflen = 80;
|
||||
long ret;
|
||||
|
||||
ret = RegOpenKeyEx(HKEY_CURRENT_USER, _TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"),
|
||||
0, KEY_QUERY_VALUE, &hk);
|
||||
if(ret != ERROR_SUCCESS) return QUrl("");
|
||||
|
||||
ret = RegQueryValueEx(hk, _TEXT("ProxyServer"), NULL, NULL, (LPBYTE)proxyval, &buflen);
|
||||
if(ret != ERROR_SUCCESS) return QUrl("");
|
||||
|
||||
RegCloseKey(hk);
|
||||
qDebug() << QString::fromWCharArray(proxyval);
|
||||
return QUrl("http://" + QString::fromWCharArray(proxyval));
|
||||
|
||||
#endif
|
||||
return QUrl("");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue