- String proxyType = Cache.getDefault("USE_PROXY",
- Cache.PROXYTYPE_SYSTEM);
- if (proxyType.equals(Cache.PROXYTYPE_NONE))
- {
- if (!previousProxyType.equals(proxyType))
- Cache.log.info("Setting no proxy settings");
- Cache.setProxyProperties(null, null, null, null, null, null, null,
- null);
- }
- else if (proxyType.equals(Cache.PROXYTYPE_CUSTOM))
- {
- if (!previousProxyType.equals(proxyType))
- Cache.log.info("Setting custom proxy settings");
- boolean proxyAuthSet = Cache.getDefault("PROXY_AUTH", false);
- Cache.setProxyProperties(Cache.getDefault("PROXY_SERVER", null),
- Cache.getDefault("PROXY_PORT", null),
- Cache.getDefault("PROXY_SERVER_HTTPS", null),
- Cache.getDefault("PROXY_PORT_HTTPS", null),
- proxyAuthSet ? Cache.getDefault("PROXY_AUTH_USERNAME", "")
- : null,
- proxyAuthSet ? Cache.getDefault("PROXY_AUTH_PASSWORD", "")
- : null);
- }
- else // systemProxy should be selected and is sensible default anyway
+ String newProxyType = customProxy.isSelected() ? Cache.PROXYTYPE_CUSTOM
+ : noProxy.isSelected() ? Cache.PROXYTYPE_NONE
+ : Cache.PROXYTYPE_SYSTEM;
+ Cache.applicationProperties.setProperty("USE_PROXY", newProxyType);
+ Cache.setOrRemove("PROXY_SERVER", proxyServerHttpTB.getText());
+ Cache.setOrRemove("PROXY_PORT", proxyPortHttpTB.getText());
+ Cache.setOrRemove("PROXY_SERVER_HTTPS", proxyServerHttpsTB.getText());
+ Cache.setOrRemove("PROXY_PORT_HTTPS", proxyPortHttpsTB.getText());
+ Cache.setOrRemove("PROXY_AUTH",
+ Boolean.toString(proxyAuth.isSelected()));
+ Cache.setOrRemove("PROXY_AUTH_USERNAME", proxyAuthUsernameTB.getText());
+ Cache.proxyAuthPassword = proxyAuthPasswordPB.getPassword();
+ Cache.setProxyPropertiesFromPreferences(previousProxyType);
+ if (newProxyType.equals(Cache.PROXYTYPE_CUSTOM)
+ || !newProxyType.equals(previousProxyType))