mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 19:22:14 -05:00
ask for save
This commit is contained in:
parent
aee4ec6d1f
commit
fd33a67645
@ -46,8 +46,10 @@ import org.sufficientlysecure.keychain.ui.widget.Editor.EditorListener;
|
|||||||
import org.sufficientlysecure.keychain.util.IterableIterator;
|
import org.sufficientlysecure.keychain.util.IterableIterator;
|
||||||
import org.sufficientlysecure.keychain.util.Log;
|
import org.sufficientlysecure.keychain.util.Log;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@ -604,8 +606,35 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void cancelClicked() {
|
private void cancelClicked() {
|
||||||
setResult(RESULT_CANCELED);
|
if (mNeedsSaving && masterCanSign) { //ask if we want to save
|
||||||
finish();
|
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_save_changed_key));
|
||||||
|
|
||||||
|
alert.setPositiveButton(EditKeyActivity.this.getString(android.R.string.yes),
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
dialog.dismiss();
|
||||||
|
saveClicked();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
alert.setNegativeButton(this.getString(android.R.string.no),
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
dialog.dismiss();
|
||||||
|
setResult(RESULT_CANCELED);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
alert.setCancelable(false);
|
||||||
|
alert.create().show();
|
||||||
|
} else {
|
||||||
|
setResult(RESULT_CANCELED);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -204,6 +204,7 @@
|
|||||||
<string name="key_deletion_confirmation">Do you really want to delete the key \'%s\'?\nYou can\'t undo this!</string>
|
<string name="key_deletion_confirmation">Do you really want to delete the key \'%s\'?\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="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>
|
||||||
|
|
||||||
<plurals name="keys_added_and_updated_1">
|
<plurals name="keys_added_and_updated_1">
|
||||||
<item quantity="one">Successfully added %d key</item>
|
<item quantity="one">Successfully added %d key</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user