Add encryption option to PPTP UI.

Also add new error dialogs for L2TP challenge error and remote server
hanging up error.
This commit is contained in:
Hung-ying Tyan
2009-07-30 19:54:13 +08:00
parent 79748b42e3
commit 7be218e7f7
4 changed files with 125 additions and 9 deletions

View File

@@ -109,6 +109,8 @@ public class VpnSettings extends PreferenceActivity implements
private static final int DIALOG_AUTH_ERROR = 3;
private static final int DIALOG_UNKNOWN_SERVER = 4;
private static final int DIALOG_SECRET_NOT_SET = 5;
private static final int DIALOG_CHALLENGE_ERROR = 6;
private static final int DIALOG_REMOTE_HUNG_UP_ERROR = 7;
private static final int NO_ERROR = 0;
@@ -204,6 +206,12 @@ public class VpnSettings extends PreferenceActivity implements
case DIALOG_AUTH_ERROR:
return createAuthErrorDialog();
case DIALOG_REMOTE_HUNG_UP_ERROR:
return createRemoteHungUpErrorDialog();
case DIALOG_CHALLENGE_ERROR:
return createChallengeErrorDialog();
case DIALOG_UNKNOWN_SERVER:
return createUnknownServerDialog();
@@ -244,17 +252,22 @@ public class VpnSettings extends PreferenceActivity implements
.setMessage(R.string.vpn_auth_error_dialog_msg)
.create();
}
private Dialog createUnknownServerDialog() {
private Dialog createRemoteHungUpErrorDialog() {
return createCommonDialogBuilder()
.setMessage(R.string.vpn_remote_hung_up_error_dialog_msg)
.create();
}
private Dialog createChallengeErrorDialog() {
return createCommonEditDialogBuilder()
.setMessage(R.string.vpn_challenge_error_dialog_msg)
.create();
}
private Dialog createUnknownServerDialog() {
return createCommonEditDialogBuilder()
.setMessage(R.string.vpn_unknown_server_dialog_msg)
.setPositiveButton(R.string.vpn_yes_button,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int w) {
VpnProfile p = mConnectingActor.getProfile();
onIdle();
startVpnEditor(p);
}
})
.create();
}
@@ -271,6 +284,18 @@ public class VpnSettings extends PreferenceActivity implements
.create();
}
private AlertDialog.Builder createCommonEditDialogBuilder() {
return createCommonDialogBuilder()
.setPositiveButton(R.string.vpn_yes_button,
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int w) {
VpnProfile p = mConnectingActor.getProfile();
onIdle();
startVpnEditor(p);
}
});
}
private AlertDialog.Builder createCommonDialogBuilder() {
return new AlertDialog.Builder(this)
.setTitle(android.R.string.dialog_alert_title)
@@ -723,6 +748,14 @@ public class VpnSettings extends PreferenceActivity implements
showDialog(DIALOG_AUTH_ERROR);
break;
case VpnManager.VPN_ERROR_REMOTE_HUNG_UP:
showDialog(DIALOG_REMOTE_HUNG_UP_ERROR);
break;
case VpnManager.VPN_ERROR_CHALLENGE:
showDialog(DIALOG_CHALLENGE_ERROR);
break;
case VpnManager.VPN_ERROR_UNKNOWN_SERVER:
showDialog(DIALOG_UNKNOWN_SERVER);
break;