Example #1
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);
	}
	App::writeConfig();
	MTP::restart();
	emit closed();
}
Example #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();
	}
}