Disable move to card from edit screen
This commit is contained in:
@@ -437,44 +437,50 @@ public class EditKeyFragment extends CryptoOperationFragment<SaveKeyringParcel,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EditSubkeyDialogFragment.MESSAGE_KEYTOCARD: {
|
case EditSubkeyDialogFragment.MESSAGE_MOVE_KEY_TO_CARD: {
|
||||||
Activity activity = EditKeyFragment.this.getActivity();
|
// TODO: enable later when Admin PIN handling is resolved
|
||||||
SecretKeyType secretKeyType = mSubkeysAdapter.getSecretKeyType(position);
|
Notify.create(getActivity(),
|
||||||
if (secretKeyType == SecretKeyType.DIVERT_TO_CARD ||
|
"This feature will be available in an upcoming OpenKeychain version.",
|
||||||
secretKeyType == SecretKeyType.GNU_DUMMY) {
|
Notify.Style.WARN).show();
|
||||||
Notify.create(activity, R.string.edit_key_error_bad_nfc_stripped, Notify.Style.ERROR)
|
|
||||||
.show((ViewGroup) activity.findViewById(R.id.import_snackbar));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
int algorithm = mSubkeysAdapter.getAlgorithm(position);
|
|
||||||
// these are the PGP constants for RSA_GENERAL, RSA_ENCRYPT and RSA_SIGN
|
|
||||||
if (algorithm != 1 && algorithm != 2 && algorithm != 3) {
|
|
||||||
Notify.create(activity, R.string.edit_key_error_bad_nfc_algo, Notify.Style.ERROR)
|
|
||||||
.show((ViewGroup) activity.findViewById(R.id.import_snackbar));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (mSubkeysAdapter.getKeySize(position) != 2048) {
|
|
||||||
Notify.create(activity, R.string.edit_key_error_bad_nfc_size, Notify.Style.ERROR)
|
|
||||||
.show((ViewGroup) activity.findViewById(R.id.import_snackbar));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
SubkeyChange change;
|
|
||||||
change = mSaveKeyringParcel.getSubkeyChange(keyId);
|
|
||||||
if (change == null) {
|
|
||||||
mSaveKeyringParcel.mChangeSubKeys.add(
|
|
||||||
new SubkeyChange(keyId, false, true)
|
|
||||||
);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
// toggle
|
|
||||||
change.mMoveKeyToCard = !change.mMoveKeyToCard;
|
|
||||||
if (change.mMoveKeyToCard && change.mDummyStrip) {
|
|
||||||
// User had chosen to strip key, but now wants to divert it.
|
|
||||||
change.mDummyStrip = false;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Activity activity = EditKeyFragment.this.getActivity();
|
||||||
|
// SecretKeyType secretKeyType = mSubkeysAdapter.getSecretKeyType(position);
|
||||||
|
// if (secretKeyType == SecretKeyType.DIVERT_TO_CARD ||
|
||||||
|
// secretKeyType == SecretKeyType.GNU_DUMMY) {
|
||||||
|
// Notify.create(activity, R.string.edit_key_error_bad_nfc_stripped, Notify.Style.ERROR)
|
||||||
|
// .show((ViewGroup) activity.findViewById(R.id.import_snackbar));
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// int algorithm = mSubkeysAdapter.getAlgorithm(position);
|
||||||
|
// // these are the PGP constants for RSA_GENERAL, RSA_ENCRYPT and RSA_SIGN
|
||||||
|
// if (algorithm != 1 && algorithm != 2 && algorithm != 3) {
|
||||||
|
// Notify.create(activity, R.string.edit_key_error_bad_nfc_algo, Notify.Style.ERROR)
|
||||||
|
// .show((ViewGroup) activity.findViewById(R.id.import_snackbar));
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// if (mSubkeysAdapter.getKeySize(position) != 2048) {
|
||||||
|
// Notify.create(activity, R.string.edit_key_error_bad_nfc_size, Notify.Style.ERROR)
|
||||||
|
// .show((ViewGroup) activity.findViewById(R.id.import_snackbar));
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// SubkeyChange change;
|
||||||
|
// change = mSaveKeyringParcel.getSubkeyChange(keyId);
|
||||||
|
// if (change == null) {
|
||||||
|
// mSaveKeyringParcel.mChangeSubKeys.add(
|
||||||
|
// new SubkeyChange(keyId, false, true)
|
||||||
|
// );
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// // toggle
|
||||||
|
// change.mMoveKeyToCard = !change.mMoveKeyToCard;
|
||||||
|
// if (change.mMoveKeyToCard && change.mDummyStrip) {
|
||||||
|
// // User had chosen to strip key, but now wants to divert it.
|
||||||
|
// change.mDummyStrip = false;
|
||||||
|
// }
|
||||||
|
// break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getLoaderManager().getLoader(LOADER_ID_SUBKEYS).forceLoad();
|
getLoaderManager().getLoader(LOADER_ID_SUBKEYS).forceLoad();
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class EditSubkeyDialogFragment extends DialogFragment {
|
|||||||
public static final int MESSAGE_CHANGE_EXPIRY = 1;
|
public static final int MESSAGE_CHANGE_EXPIRY = 1;
|
||||||
public static final int MESSAGE_REVOKE = 2;
|
public static final int MESSAGE_REVOKE = 2;
|
||||||
public static final int MESSAGE_STRIP = 3;
|
public static final int MESSAGE_STRIP = 3;
|
||||||
public static final int MESSAGE_KEYTOCARD = 4;
|
public static final int MESSAGE_MOVE_KEY_TO_CARD = 4;
|
||||||
|
|
||||||
private Messenger mMessenger;
|
private Messenger mMessenger;
|
||||||
|
|
||||||
@@ -78,7 +78,7 @@ public class EditSubkeyDialogFragment extends DialogFragment {
|
|||||||
sendMessageToHandler(MESSAGE_STRIP, null);
|
sendMessageToHandler(MESSAGE_STRIP, null);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
sendMessageToHandler(MESSAGE_KEYTOCARD, null);
|
sendMessageToHandler(MESSAGE_MOVE_KEY_TO_CARD, null);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user