Skip to content
Snippets Groups Projects
Commit 37c45c27 authored by Ming Rui Zhang's avatar Ming Rui Zhang
Browse files

settings: add allow IP auto rewrite option

Change-Id: I09c24f1185b37c728eb9ce1968cca21a99b79452
parent a31fb6c0
No related branches found
No related tags found
No related merge requests found
......@@ -115,6 +115,7 @@ Item {
property string stunAdress: qsTr("STUN address")
// AdvancedPublicAddressSettings
property string allowIPAutoRewrite: qsTr("Allow IP Auto Rewrite")
property string publicAddress: qsTr("Public address")
property string useCustomAddress: qsTr("Use custom address and port")
property string address: qsTr("Address")
......
......@@ -552,6 +552,12 @@ SettingsAdapter::getAccountConfig_PublishedPort()
return getAccountConfig().publishedPort;
}
bool
SettingsAdapter::getAccountConfig_AllowIPAutoRewrite()
{
return getAccountConfig().allowIPAutoRewrite;
}
QString
SettingsAdapter::getAccountConfig_Mailbox()
{
......@@ -762,6 +768,15 @@ SettingsAdapter::setUseCustomAddressAndPort(bool state)
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->get_currentAccountId(), confProps);
}
void
SettingsAdapter::setAllowIPAutoRewrite(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->get_currentAccountId());
confProps.allowIPAutoRewrite = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->get_currentAccountId(), confProps);
}
void
SettingsAdapter::setNameServer(QString text)
{
......
......@@ -150,6 +150,7 @@ public:
Q_INVOKABLE bool getAccountConfig_PublishedSameAsLocal();
Q_INVOKABLE QString getAccountConfig_PublishedAddress();
Q_INVOKABLE int getAccountConfig_PublishedPort();
Q_INVOKABLE bool getAccountConfig_AllowIPAutoRewrite();
Q_INVOKABLE QString getAccountConfig_Mailbox();
......@@ -178,6 +179,7 @@ public:
Q_INVOKABLE void setVerifyCertificatesClient(bool state);
Q_INVOKABLE void setRequireCertificatesIncomingTLS(bool state);
Q_INVOKABLE void setUseCustomAddressAndPort(bool state);
Q_INVOKABLE void setAllowIPAutoRewrite(bool state);
Q_INVOKABLE void setNameServer(QString text);
Q_INVOKABLE void setProxyAddress(QString text);
......
......@@ -35,9 +35,16 @@ ColumnLayout {
property int itemWidth
function updatePublicAddressAccountInfos() {
checkBoxAllowIPAutoRewrite.checked = SettingsAdapter.getAccountConfig_AllowIPAutoRewrite()
checkBoxCustomAddressPort.checked = !SettingsAdapter.getAccountConfig_PublishedSameAsLocal()
lineEditSIPCustomAddress.setText(SettingsAdapter.getAccountConfig_PublishedAddress())
customPortSIPSpinBox.setValue(SettingsAdapter.getAccountConfig_PublishedPort())
if (checkBoxAllowIPAutoRewrite.checked) {
checkBoxCustomAddressPort.visible = false
lineEditSIPCustomAddress.visible = false
customPortSIPSpinBox.visible = false
}
}
Text {
......@@ -58,6 +65,20 @@ ColumnLayout {
Layout.fillWidth: true
Layout.leftMargin: JamiTheme.preferredMarginSize
ToggleSwitch {
id: checkBoxAllowIPAutoRewrite
labelText: JamiStrings.allowIPAutoRewrite
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setAllowIPAutoRewrite(checked)
checkBoxCustomAddressPort.visible = !checked
lineEditSIPCustomAddress.visible = !checked
customPortSIPSpinBox.visible = !checked
}
}
ToggleSwitch {
id: checkBoxCustomAddressPort
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment