Пример #1
0
void ConnectionBox::onSave() {
	if (_httpProxyRadio.checked() || _tcpProxyRadio.checked()) {
		ProxyData p;
		p.host = _hostInput.getLastText().trimmed();
		p.user = _userInput.getLastText().trimmed();
		p.password = _passwordInput.getLastText().trimmed();
		p.port = _portInput.getLastText().toInt();
		if (p.host.isEmpty()) {
			_hostInput.setFocus();
			return;
		} else if (!p.port) {
			_portInput.setFocus();
			return;
		}
		if (_httpProxyRadio.checked()) {
			Global::SetConnectionType(dbictHttpProxy);
		} else {
			Global::SetConnectionType(dbictTcpProxy);
		}
		Global::SetConnectionProxy(p);
	} else {
		Global::SetConnectionType(dbictAuto);
		Global::SetConnectionProxy(ProxyData());
#ifndef TDESKTOP_DISABLE_NETWORK_PROXY
		QNetworkProxyFactory::setUseSystemConfiguration(false);
		QNetworkProxyFactory::setUseSystemConfiguration(true);
#endif
	}
	if (cPlatform() == dbipWindows && Global::TryIPv6() != _tryIPv6.checked()) {
		Global::SetTryIPv6(_tryIPv6.checked());
		Local::writeSettings();
		Global::RefConnectionTypeChanged().notify();

		cSetRestarting(true);
		cSetRestartingToSettings(true);
		App::quit();
	} else {
		Global::SetTryIPv6(_tryIPv6.checked());
		Local::writeSettings();
		Global::RefConnectionTypeChanged().notify();

		MTP::restart();
		reinitImageLinkManager();
		reinitWebLoadManager();
		onClose();
	}
}
Пример #2
0
void ConnectionBox::onSave() {
	if (_httpProxyRadio.checked() || _tcpProxyRadio.checked()) {
		ConnectionProxy p;
		p.host = _hostInput.text().trimmed();
		p.user = _userInput.text().trimmed();
		p.password = _passwordInput.text().trimmed();
		p.port = _portInput.text().toInt();
		if (p.host.isEmpty()) {
			_hostInput.setFocus();
			return;
		} else if (!p.port) {
			_portInput.setFocus();
			return;
		}
		if (_httpProxyRadio.checked()) {
			cSetConnectionType(dbictHttpProxy);
		} else {
			cSetConnectionType(dbictTcpProxy);
		}
		cSetConnectionProxy(p);
	} else {
		cSetConnectionType(dbictAuto);
		cSetConnectionProxy(ConnectionProxy());
		QNetworkProxyFactory::setUseSystemConfiguration(false);
		QNetworkProxyFactory::setUseSystemConfiguration(true);
	}
	if (cPlatform() == dbipWindows && cTryIPv6() != _tryIPv6.checked()) {
		cSetTryIPv6(_tryIPv6.checked());
		Local::writeSettings();
		cSetRestarting(true);
		cSetRestartingToSettings(true);
		App::quit();
	} else {
		cSetTryIPv6(_tryIPv6.checked());
		Local::writeSettings();
		MTP::restart();
		reinitImageLinkManager();
		emit closed();
	}
}