diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java
index 6b062af59..7697f736c 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java
@@ -318,6 +318,8 @@ public class EditKeyFragment extends LoaderFragment implements
private void editUserId(final int position) {
final String userId = mUserIdsAdapter.getUserId(position);
+ final boolean isRevoked = mUserIdsAdapter.getIsRevoked(position);
+ final boolean isRevokedPending = mUserIdsAdapter.getIsRevokedPending(position);
Handler returnHandler = new Handler() {
@Override
@@ -351,8 +353,7 @@ public class EditKeyFragment extends LoaderFragment implements
DialogFragmentWorkaround.INTERFACE.runnableRunDelayed(new Runnable() {
public void run() {
EditUserIdDialogFragment dialogFragment =
- EditUserIdDialogFragment.newInstance(messenger);
-
+ EditUserIdDialogFragment.newInstance(messenger, isRevoked, isRevokedPending);
dialogFragment.show(getActivity().getSupportFragmentManager(), "editUserIdDialog");
}
});
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java
index ee3341c08..9bf47a387 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/UserIdsAdapter.java
@@ -252,6 +252,26 @@ public class UserIdsAdapter extends CursorAdapter implements AdapterView.OnItemC
return mCursor.getString(INDEX_USER_ID);
}
+ public boolean getIsRevoked(int position) {
+ mCursor.moveToPosition(position);
+ return mCursor.getInt(INDEX_IS_REVOKED) > 0;
+ }
+
+ public boolean getIsRevokedPending(int position) {
+ mCursor.moveToPosition(position);
+ String userId = mCursor.getString(INDEX_USER_ID);
+
+ boolean isRevokedPending = false;
+ if (mSaveKeyringParcel != null) {
+ if (mSaveKeyringParcel.mRevokeUserIds.contains(userId)) {
+ isRevokedPending = true;
+ }
+
+ }
+
+ return isRevokedPending;
+ }
+
@Override
public View newView(Context context, Cursor cursor, ViewGroup parent) {
View view = mInflater.inflate(R.layout.view_key_user_id_item, null);
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/EditUserIdDialogFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/EditUserIdDialogFragment.java
index 5eba3a463..8a31b7f64 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/EditUserIdDialogFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/EditUserIdDialogFragment.java
@@ -29,9 +29,14 @@ import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.util.Log;
+import java.util.Arrays;
+
public class EditUserIdDialogFragment extends DialogFragment {
private static final String ARG_MESSENGER = "messenger";
+ private static final String ARG_IS_REVOKED = "is_revoked";
+ private static final String ARG_IS_REVOKED_PENDING = "is_revoked_pending";
+
public static final int MESSAGE_CHANGE_PRIMARY_USER_ID = 1;
public static final int MESSAGE_REVOKE = 2;
@@ -40,10 +45,13 @@ public class EditUserIdDialogFragment extends DialogFragment {
/**
* Creates new instance of this dialog fragment
*/
- public static EditUserIdDialogFragment newInstance(Messenger messenger) {
+ public static EditUserIdDialogFragment newInstance(Messenger messenger, boolean isRevoked,
+ boolean isRevokedPending) {
EditUserIdDialogFragment frag = new EditUserIdDialogFragment();
Bundle args = new Bundle();
args.putParcelable(ARG_MESSENGER, messenger);
+ args.putBoolean(ARG_IS_REVOKED, isRevoked);
+ args.putBoolean(ARG_IS_REVOKED_PENDING, isRevokedPending);
frag.setArguments(args);
@@ -56,27 +64,49 @@ public class EditUserIdDialogFragment extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
mMessenger = getArguments().getParcelable(ARG_MESSENGER);
+ boolean isRevoked = getArguments().getBoolean(ARG_IS_REVOKED);
+ boolean isRevokedPending = getArguments().getBoolean(ARG_IS_REVOKED_PENDING);
CustomAlertDialogBuilder builder = new CustomAlertDialogBuilder(getActivity());
- CharSequence[] array = getResources().getStringArray(R.array.edit_key_edit_user_id);
-
builder.setTitle(R.string.edit_key_edit_user_id_title);
- builder.setItems(array, new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- switch (which) {
- case 0:
- sendMessageToHandler(MESSAGE_CHANGE_PRIMARY_USER_ID, null);
- break;
- case 1:
- sendMessageToHandler(MESSAGE_REVOKE, null);
- break;
- default:
- break;
+ if (isRevokedPending) {
+ CharSequence[] array = getResources().getStringArray(R.array.edit_key_edit_user_id_revert_revocation);
+
+ builder.setItems(array, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ switch (which) {
+ case 0:
+ sendMessageToHandler(MESSAGE_REVOKE, null);
+ break;
+ default:
+ break;
+ }
}
- }
- });
+ });
+ } else if (isRevoked) {
+ builder.setMessage(R.string.edit_key_edit_user_id_revoked);
+ } else {
+ CharSequence[] array = getResources().getStringArray(R.array.edit_key_edit_user_id);
+
+ builder.setItems(array, new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ switch (which) {
+ case 0:
+ sendMessageToHandler(MESSAGE_CHANGE_PRIMARY_USER_ID, null);
+ break;
+ case 1:
+ sendMessageToHandler(MESSAGE_REVOKE, null);
+ break;
+ default:
+ break;
+ }
+ }
+ });
+ }
+
builder.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml
index 18031e25b..f8bf68240 100644
--- a/OpenKeychain/src/main/res/values/strings.xml
+++ b/OpenKeychain/src/main/res/values/strings.xml
@@ -437,12 +437,17 @@
- Change to Primary Identity
- Revoke Identity
+
+ - Revert revocation
+
+ This identity has been revoked. This cannot be undone.
Select an action!
- Change Expiry
- Revoke Subkey
+
Upload key to keyserver
This field is required