VpnSettings: rename some fields.

Change-Id: I999b773192d167f21c4a684c1864c37b9a433390
This commit is contained in:
Chia-chi Yeh
2011-06-30 23:34:53 -07:00
parent f5f40108ad
commit 2fa9eade41
4 changed files with 30 additions and 27 deletions

View File

@@ -93,8 +93,8 @@
android:prompt="@string/vpn_ipsec_ca_cert" />
</LinearLayout>
<TextView style="@style/vpn_label" android:text="@string/vpn_domains"/>
<EditText style="@style/vpn_value" android:id="@+id/domains"
<TextView style="@style/vpn_label" android:text="@string/vpn_search_domains"/>
<EditText style="@style/vpn_value" android:id="@+id/search_domains"
android:hint="@string/vpn_not_used"/>
<!-- Not sure if we have time to make it. -->

View File

@@ -3509,7 +3509,7 @@ found in the list of installed applications.</string>
<!-- Selection label for the IPSec CA certificate of a VPN network. [CHAR LIMIT=40] -->
<string name="vpn_ipsec_ca_cert">IPSec CA certificate</string>
<!-- Input label for the DNS search domains of a VPN network. [CHAR LIMIT=40] -->
<string name="vpn_domains">DNS search domains</string>
<string name="vpn_search_domains">DNS search domains</string>
<!-- Input label for the forwarding routes of a VPN network. [CHAR LIMIT=40] -->
<string name="vpn_routes">Forwarding routes</string>
<!-- Input label for the username of a VPN network. [CHAR LIMIT=40] -->
@@ -3517,7 +3517,7 @@ found in the list of installed applications.</string>
<!-- Input label for the password of a VPN network. [CHAR LIMIT=40] -->
<string name="vpn_password">Password</string>
<!-- Checkbox label to save the username and the password for a VPN network. [CHAR LIMIT=40] -->
<string name="vpn_save_login">Save this information</string>
<string name="vpn_save_login">Save account information</string>
<!-- Hint for an optional input of a VPN network. [CHAR LIMIT=40] -->
<string name="vpn_not_used">(not used)</string>

View File

@@ -60,7 +60,7 @@ class VpnDialog extends AlertDialog implements TextWatcher, OnItemSelectedListen
private TextView mServer;
private TextView mUsername;
private TextView mPassword;
private TextView mDomains;
private TextView mSearchDomains;
private TextView mRoutes;
private CheckBox mMppe;
private TextView mL2tpSecret;
@@ -92,7 +92,7 @@ class VpnDialog extends AlertDialog implements TextWatcher, OnItemSelectedListen
mServer = (TextView) mView.findViewById(R.id.server);
mUsername = (TextView) mView.findViewById(R.id.username);
mPassword = (TextView) mView.findViewById(R.id.password);
mDomains = (TextView) mView.findViewById(R.id.domains);
mSearchDomains = (TextView) mView.findViewById(R.id.search_domains);
mRoutes = (TextView) mView.findViewById(R.id.routes);
mMppe = (CheckBox) mView.findViewById(R.id.mppe);
mL2tpSecret = (TextView) mView.findViewById(R.id.l2tp_secret);
@@ -108,7 +108,7 @@ class VpnDialog extends AlertDialog implements TextWatcher, OnItemSelectedListen
mServer.setText(mProfile.server);
mUsername.setText(mProfile.username);
mPassword.setText(getDummy(mProfile.password));
mDomains.setText(mProfile.domains);
mSearchDomains.setText(mProfile.searchDomains);
mRoutes.setText(mProfile.routes);
mMppe.setChecked(mProfile.mppe);
mL2tpSecret.setText(getDummy(mProfile.l2tpSecret));
@@ -288,7 +288,7 @@ class VpnDialog extends AlertDialog implements TextWatcher, OnItemSelectedListen
profile.server = mServer.getText().toString().trim();
profile.username = mUsername.getText().toString();
profile.password = getSecret(mProfile.password, mPassword);
profile.domains = mDomains.getText().toString().trim();
profile.searchDomains = mSearchDomains.getText().toString().trim();
profile.routes = mRoutes.getText().toString().trim();
// Then, save type-specific fields.

View File

@@ -42,14 +42,15 @@ class VpnProfile implements Cloneable {
String server = ""; // 2
String username = ""; // 3
String password = ""; // 4
String domains = ""; // 5
String routes = ""; // 6
boolean mppe = false; // 7
String l2tpSecret = ""; // 8
String ipsecIdentifier = "";// 9
String ipsecSecret = ""; // 10
String ipsecUserCert = ""; // 11
String ipsecCaCert = ""; // 12
String dnsServers = ""; // 5
String searchDomains = ""; // 6
String routes = ""; // 7
boolean mppe = false; // 8
String l2tpSecret = ""; // 9
String ipsecIdentifier = "";// 10
String ipsecSecret = ""; // 11
String ipsecUserCert = ""; // 12
String ipsecCaCert = ""; // 13
// Helper fields.
boolean saveLogin = false;
@@ -65,8 +66,8 @@ class VpnProfile implements Cloneable {
}
String[] values = new String(value, Charsets.UTF_8).split("\0", -1);
// Currently it always has 13 fields.
if (values.length < 13) {
// Currently it always has 14 fields.
if (values.length < 14) {
return null;
}
@@ -79,14 +80,15 @@ class VpnProfile implements Cloneable {
profile.server = values[2];
profile.username = values[3];
profile.password = values[4];
profile.domains = values[5];
profile.routes = values[6];
profile.mppe = Boolean.valueOf(values[7]);
profile.l2tpSecret = values[8];
profile.ipsecIdentifier = values[9];
profile.ipsecSecret = values[10];
profile.ipsecUserCert = values[11];
profile.ipsecCaCert = values[12];
profile.dnsServers = values[5];
profile.searchDomains = values[6];
profile.routes = values[7];
profile.mppe = Boolean.valueOf(values[8]);
profile.l2tpSecret = values[9];
profile.ipsecIdentifier = values[10];
profile.ipsecSecret = values[11];
profile.ipsecUserCert = values[12];
profile.ipsecCaCert = values[13];
profile.saveLogin = !profile.username.isEmpty() || !profile.password.isEmpty();
return profile;
@@ -102,7 +104,8 @@ class VpnProfile implements Cloneable {
builder.append('\0').append(server);
builder.append('\0').append(saveLogin ? username : "");
builder.append('\0').append(saveLogin ? password : "");
builder.append('\0').append(domains);
builder.append('\0').append(dnsServers);
builder.append('\0').append(searchDomains);
builder.append('\0').append(routes);
builder.append('\0').append(mppe);
builder.append('\0').append(l2tpSecret);