From 98493fd3989c8ef8e332fa3dd2fc8da5df934eab Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Fri, 2 Apr 2010 10:59:38 +0000 Subject: Warn when selecting system proxy settings with invalid values. Rockbox Utility doesn't support "proxy auto-config" (aka PAC) for system proxy settings. This can result in users selecting system proxy and expecting it to work even if their system uses PAC. While the configuration dialog displays the proxy setting values retrieved from the system this is not totally obvious. Add a message telling if the retrieved system proxy values are not useable. For now this only checks if a proxy host and port are set which should catch the usual cases when PAC is used. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25435 a1c6a512-1295-4272-9138-f99709370657 --- rbutil/rbutilqt/configure.cpp | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'rbutil') diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp index 78a836bf3a..0704f0a999 100644 --- a/rbutil/rbutilqt/configure.cpp +++ b/rbutil/rbutilqt/configure.cpp @@ -55,7 +55,7 @@ Config::Config(QWidget *parent,int index) : QDialog(parent) proxyValidator->setRegExp(validate); ui.proxyPort->setValidator(proxyValidator); #if !defined(Q_OS_LINUX) && !defined(Q_OS_WIN32) - ui.radioSystemProxy->setEnabled(false); // not on macox for now + ui.radioSystemProxy->setEnabled(false); // not on OS X for now #endif // build language list and sort alphabetically QStringList langs = findLanguageFiles(); @@ -446,11 +446,10 @@ void Config::setNoProxy(bool checked) void Config::setSystemProxy(bool checked) { - bool i = !checked; - ui.proxyPort->setEnabled(i); - ui.proxyHost->setEnabled(i); - ui.proxyUser->setEnabled(i); - ui.proxyPass->setEnabled(i); + ui.proxyPort->setEnabled(!checked); + ui.proxyHost->setEnabled(!checked); + ui.proxyUser->setEnabled(!checked); + ui.proxyPass->setEnabled(!checked); if(checked) { // save values in input box proxy.setScheme("http"); @@ -460,13 +459,31 @@ void Config::setSystemProxy(bool checked) proxy.setPort(ui.proxyPort->text().toInt()); // show system values in input box QUrl envproxy = System::systemProxy(); + qDebug() << "[Config] setting system proxy" << envproxy; ui.proxyHost->setText(envproxy.host()); - ui.proxyPort->setText(QString("%1").arg(envproxy.port())); ui.proxyUser->setText(envproxy.userName()); ui.proxyPass->setText(envproxy.password()); + if(envproxy.host().isEmpty() || envproxy.port() == -1) { + qDebug() << "[Config] sytem proxy is invalid."; + QMessageBox::warning(this, tr("Proxy Detection"), + tr("The System Proxy settings are invalid!\n" + "Rockbox Utility can't work with this proxy settings. " + "Make sure the system proxy is set correctly. Note that " + "\"proxy auto-config (PAC)\" scripts are not supported by " + "Rockbox Utility. If your system uses this you need " + "to use manual proxy settings."), + QMessageBox::Ok ,QMessageBox::Ok); + // the current proxy settings are invalid. Check the saved proxy + // type again. + if(RbSettings::value(RbSettings::ProxyType).toString() == "manual") + ui.radioManualProxy->setChecked(true); + else + ui.radioNoProxy->setChecked(true); + } + } else { ui.proxyHost->setText(proxy.host()); -- cgit