mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-17 22:35:05 -05:00
confirm that empty IDs are really wanted
This commit is contained in:
parent
a38d22757c
commit
9764d3fcb9
@ -553,7 +553,7 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
|
|||||||
showPassphraseDialog(masterKeyId);
|
showPassphraseDialog(masterKeyId);
|
||||||
} else {
|
} else {
|
||||||
mCurrentPassphrase = passphrase;
|
mCurrentPassphrase = passphrase;
|
||||||
finallySaveClicked();
|
checkEmptyIDsWanted();
|
||||||
}
|
}
|
||||||
} catch (PgpGeneralException e) {
|
} catch (PgpGeneralException e) {
|
||||||
Toast.makeText(this, getString(R.string.error_message, e.getMessage()),
|
Toast.makeText(this, getString(R.string.error_message, e.getMessage()),
|
||||||
@ -564,6 +564,51 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkEmptyIDsWanted()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
ArrayList<String> userIDs = getUserIds(mUserIdsView);
|
||||||
|
List<Boolean> newIDs = mUserIdsView.getNewIDFlags();
|
||||||
|
ArrayList<String> originalIDs = mUserIdsView.getOriginalIDs();
|
||||||
|
int curID = 0;
|
||||||
|
for (String userID : userIDs) {
|
||||||
|
if ( userID.equals("") && (!userID.equals(originalIDs.get(curID)) || newIDs.get(curID) ) ) {
|
||||||
|
AlertDialog.Builder alert = new AlertDialog.Builder(
|
||||||
|
EditKeyActivity.this);
|
||||||
|
|
||||||
|
alert.setIcon(android.R.drawable.ic_dialog_alert);
|
||||||
|
alert.setTitle(R.string.warning);
|
||||||
|
alert.setMessage(EditKeyActivity.this.getString(R.string.ask_empty_id_ok));
|
||||||
|
|
||||||
|
alert.setPositiveButton(EditKeyActivity.this.getString(android.R.string.yes),
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
dialog.dismiss();
|
||||||
|
finallySaveClicked();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
alert.setNegativeButton(this.getString(android.R.string.no),
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
alert.setCancelable(false);
|
||||||
|
alert.create().show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
curID++;
|
||||||
|
}
|
||||||
|
} catch (PgpGeneralException e) {
|
||||||
|
Log.e(Constants.TAG, getString(R.string.error_message, e.getMessage()));
|
||||||
|
Toast.makeText(this, getString(R.string.error_message, e.getMessage()),
|
||||||
|
Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
finallySaveClicked();
|
||||||
|
}
|
||||||
|
|
||||||
private boolean[] toPrimitiveArray(final List<Boolean> booleanList) {
|
private boolean[] toPrimitiveArray(final List<Boolean> booleanList) {
|
||||||
final boolean[] primitives = new boolean[booleanList.size()];
|
final boolean[] primitives = new boolean[booleanList.size()];
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
@ -225,6 +225,7 @@
|
|||||||
<string name="key_deletion_confirmation_multi">Do you really want to delete all selected keys?\nYou can\'t undo this!</string>
|
<string name="key_deletion_confirmation_multi">Do you really want to delete all selected keys?\nYou can\'t undo this!</string>
|
||||||
<string name="secret_key_deletion_confirmation">Do you really want to delete the SECRET key \'%s\'?\nYou can\'t undo this!</string>
|
<string name="secret_key_deletion_confirmation">Do you really want to delete the SECRET key \'%s\'?\nYou can\'t undo this!</string>
|
||||||
<string name="ask_save_changed_key">You have made changes to the keyring, would you like to save it?</string>
|
<string name="ask_save_changed_key">You have made changes to the keyring, would you like to save it?</string>
|
||||||
|
<string name="ask_empty_id_ok">"You have added an empty user ID, are you sure you want to continue?"</string>
|
||||||
<string name="public_key_deletetion_confirmation">Do you really want to delete the PUBLIC key \'%s\'?\nYou can\'t undo this!</string>
|
<string name="public_key_deletetion_confirmation">Do you really want to delete the PUBLIC key \'%s\'?\nYou can\'t undo this!</string>
|
||||||
<string name="secret_key_delete_text">Delete Secret Keys ?</string>
|
<string name="secret_key_delete_text">Delete Secret Keys ?</string>
|
||||||
<string name="also_export_secret_keys">Also export secret keys?</string>
|
<string name="also_export_secret_keys">Also export secret keys?</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user