mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-24 07:58:50 -05:00
add ui support for stripping subkeys
This commit is contained in:
parent
8f6b7e27f1
commit
4e834d7833
@ -420,6 +420,14 @@ public class EditKeyFragment extends LoaderFragment implements
|
||||
mSaveKeyringParcel.mRevokeSubKeys.add(keyId);
|
||||
}
|
||||
break;
|
||||
case EditSubkeyDialogFragment.MESSAGE_STRIP:
|
||||
// toggle
|
||||
if (mSaveKeyringParcel.mStripSubKeys.contains(keyId)) {
|
||||
mSaveKeyringParcel.mStripSubKeys.remove(keyId);
|
||||
} else {
|
||||
mSaveKeyringParcel.mStripSubKeys.add(keyId);
|
||||
}
|
||||
break;
|
||||
}
|
||||
getLoaderManager().getLoader(LOADER_ID_SUBKEYS).forceLoad();
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import android.content.res.ColorStateList;
|
||||
import android.database.Cursor;
|
||||
import android.graphics.Typeface;
|
||||
import android.support.v4.widget.CursorAdapter;
|
||||
import android.text.Html;
|
||||
import android.text.format.DateFormat;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -142,6 +143,8 @@ public class SubkeysAdapter extends CursorAdapter {
|
||||
|
||||
long keyId = cursor.getLong(INDEX_KEY_ID);
|
||||
String keyIdStr = PgpKeyHelper.convertKeyIdToHex(keyId);
|
||||
|
||||
// may be set with additional "stripped" later on
|
||||
String algorithmStr = PgpKeyHelper.getAlgorithmInfo(
|
||||
context,
|
||||
cursor.getInt(INDEX_ALGORITHM),
|
||||
@ -150,23 +153,27 @@ public class SubkeysAdapter extends CursorAdapter {
|
||||
);
|
||||
|
||||
vKeyId.setText(keyIdStr);
|
||||
// may be set with additional "stripped" later on
|
||||
switch (SecretKeyType.fromNum(cursor.getInt(INDEX_HAS_SECRET))) {
|
||||
case GNU_DUMMY:
|
||||
algorithmStr += ", " + context.getString(R.string.key_stripped);
|
||||
break;
|
||||
case DIVERT_TO_CARD:
|
||||
algorithmStr += ", " + context.getString(R.string.key_divert);
|
||||
break;
|
||||
case PASSPHRASE_EMPTY:
|
||||
algorithmStr += ", " + context.getString(R.string.key_no_passphrase);
|
||||
break;
|
||||
case UNAVAILABLE:
|
||||
// don't show this on pub keys
|
||||
//algorithmStr += ", " + context.getString(R.string.key_unavailable);
|
||||
break;
|
||||
|
||||
if (mSaveKeyringParcel != null && mSaveKeyringParcel.mStripSubKeys.contains(keyId)) {
|
||||
algorithmStr += ", <b>" + context.getString(R.string.key_stripped) + "</b>";
|
||||
} else {
|
||||
switch (SecretKeyType.fromNum(cursor.getInt(INDEX_HAS_SECRET))) {
|
||||
case GNU_DUMMY:
|
||||
algorithmStr += ", " + context.getString(R.string.key_stripped);
|
||||
break;
|
||||
case DIVERT_TO_CARD:
|
||||
algorithmStr += ", " + context.getString(R.string.key_divert);
|
||||
break;
|
||||
case PASSPHRASE_EMPTY:
|
||||
algorithmStr += ", " + context.getString(R.string.key_no_passphrase);
|
||||
break;
|
||||
case UNAVAILABLE:
|
||||
// don't show this on pub keys
|
||||
//algorithmStr += ", " + context.getString(R.string.key_unavailable);
|
||||
break;
|
||||
}
|
||||
}
|
||||
vKeyDetails.setText(algorithmStr);
|
||||
vKeyDetails.setText(Html.fromHtml(algorithmStr));
|
||||
|
||||
boolean isMasterKey = cursor.getInt(INDEX_RANK) == 0;
|
||||
if (isMasterKey) {
|
||||
|
@ -34,6 +34,7 @@ public class EditSubkeyDialogFragment extends DialogFragment {
|
||||
|
||||
public static final int MESSAGE_CHANGE_EXPIRY = 1;
|
||||
public static final int MESSAGE_REVOKE = 2;
|
||||
public static final int MESSAGE_STRIP = 3;
|
||||
|
||||
private Messenger mMessenger;
|
||||
|
||||
@ -72,6 +73,9 @@ public class EditSubkeyDialogFragment extends DialogFragment {
|
||||
case 1:
|
||||
sendMessageToHandler(MESSAGE_REVOKE, null);
|
||||
break;
|
||||
case 2:
|
||||
sendMessageToHandler(MESSAGE_STRIP, null);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -293,6 +293,7 @@
|
||||
<string name="progress_modify_primaryuid">"changing primary user ID…"</string>
|
||||
<string name="progress_modify_subkeychange">"modifying subkeys…"</string>
|
||||
<string name="progress_modify_subkeyrevoke">"revoking subkeys…"</string>
|
||||
<string name="progress_modify_subkeystrip">"stripping subkeys…"</string>
|
||||
<string name="progress_modify_subkeyadd">"adding subkeys…"</string>
|
||||
<string name="progress_modify_passphrase">"changing passphrase…"</string>
|
||||
|
||||
@ -490,6 +491,7 @@
|
||||
<string-array name="edit_key_edit_subkey">
|
||||
<item>"Change Expiry"</item>
|
||||
<item>"Revoke Subkey"</item>
|
||||
<item>"Strip Subkey"</item>
|
||||
</string-array>
|
||||
<string name="edit_key_new_subkey">"new"</string>
|
||||
<string name="edit_key_select_flag">"Please select at least one flag!"</string>
|
||||
@ -713,6 +715,7 @@
|
||||
<string name="msg_mf_subkey_new_id">"New subkey ID: %s"</string>
|
||||
<string name="msg_mf_error_past_expiry">"Expiry date cannot be in the past!"</string>
|
||||
<string name="msg_mf_subkey_revoke">"Revoking subkey %s"</string>
|
||||
<string name="msg_mf_subkey_strip">"Stripping subkey %s"</string>
|
||||
<string name="msg_mf_success">"Keyring successfully modified"</string>
|
||||
<string name="msg_mf_uid_add">"Adding user id %s"</string>
|
||||
<string name="msg_mf_uid_primary">"Changing primary uid to %s"</string>
|
||||
|
Loading…
Reference in New Issue
Block a user