diff --git a/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.java b/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.java index c7b70ca48..c4d7eea4f 100644 --- a/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.java +++ b/app/src/main/java/com/zeapo/pwdstore/git/GitOperation.java @@ -92,7 +92,7 @@ public abstract class GitOperation { new AlertDialog.Builder(callingActivity) .setMessage(callingActivity.getResources().getString(R.string.ssh_preferences_dialog_text)) .setTitle(callingActivity.getResources().getString(R.string.ssh_preferences_dialog_title)) - .setPositiveButton(callingActivity.getResources().getString(R.string.dialog_ok), new DialogInterface.OnClickListener() { + .setPositiveButton(callingActivity.getResources().getString(R.string.ssh_preferences_dialog_import), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { try { @@ -106,12 +106,28 @@ public abstract class GitOperation { e.printStackTrace(); } } - }).setNegativeButton(callingActivity.getResources().getString(R.string.dialog_cancel), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int id) { - // Do nothing... - } - }).show(); + }) + .setNegativeButton(callingActivity.getResources().getString(R.string.ssh_preferences_dialog_generate), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + try { + // Duplicated code + Intent intent = new Intent(callingActivity.getApplicationContext(), UserPreference.class); + intent.putExtra("operation", "make_ssh_key"); + callingActivity.startActivityForResult(intent, GET_SSH_KEY_FROM_CLONE); + } catch (Exception e) { + System.out.println("Exception caught :("); + e.printStackTrace(); + } + } + }) + .setNeutralButton(callingActivity.getResources().getString(R.string.dialog_cancel), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) { + // Finish the blank GitActivity so user doesn't have to press back + callingActivity.finish(); + } + }).show(); } else { final EditText passphrase = new EditText(callingActivity); passphrase.setHint("Passphrase"); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a9b031518..e746419d9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -47,8 +47,10 @@ You are about to use a read-only repository, you will not be able to push to it Did you forget to specify a username? You have to set the information about the server before synchronizing with the server - Please import your SSH key file in the preferences + Please import or generate your SSH key file in the preferences No SSH key + Import + Generate Authenticate Please provide the passphrase for your SSH key. Leave it empty if there is no passphrase. Please provide the password for this repository @@ -95,6 +97,7 @@ username Edit git server settings Import ssh-key + Generate ssh-key Delete repository Clear repository Do you want to delete the current password store directory? This will not clear your configuration. @@ -122,6 +125,10 @@ Uppercase Ambiguous + + Copy + Provide this public key to your Git server. + OK Yes