mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-25 08:28: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);
|
mSaveKeyringParcel.mRevokeSubKeys.add(keyId);
|
||||||
}
|
}
|
||||||
break;
|
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();
|
getLoaderManager().getLoader(LOADER_ID_SUBKEYS).forceLoad();
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ import android.content.res.ColorStateList;
|
|||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.support.v4.widget.CursorAdapter;
|
import android.support.v4.widget.CursorAdapter;
|
||||||
|
import android.text.Html;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@ -142,6 +143,8 @@ public class SubkeysAdapter extends CursorAdapter {
|
|||||||
|
|
||||||
long keyId = cursor.getLong(INDEX_KEY_ID);
|
long keyId = cursor.getLong(INDEX_KEY_ID);
|
||||||
String keyIdStr = PgpKeyHelper.convertKeyIdToHex(keyId);
|
String keyIdStr = PgpKeyHelper.convertKeyIdToHex(keyId);
|
||||||
|
|
||||||
|
// may be set with additional "stripped" later on
|
||||||
String algorithmStr = PgpKeyHelper.getAlgorithmInfo(
|
String algorithmStr = PgpKeyHelper.getAlgorithmInfo(
|
||||||
context,
|
context,
|
||||||
cursor.getInt(INDEX_ALGORITHM),
|
cursor.getInt(INDEX_ALGORITHM),
|
||||||
@ -150,7 +153,10 @@ public class SubkeysAdapter extends CursorAdapter {
|
|||||||
);
|
);
|
||||||
|
|
||||||
vKeyId.setText(keyIdStr);
|
vKeyId.setText(keyIdStr);
|
||||||
// may be set with additional "stripped" later on
|
|
||||||
|
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))) {
|
switch (SecretKeyType.fromNum(cursor.getInt(INDEX_HAS_SECRET))) {
|
||||||
case GNU_DUMMY:
|
case GNU_DUMMY:
|
||||||
algorithmStr += ", " + context.getString(R.string.key_stripped);
|
algorithmStr += ", " + context.getString(R.string.key_stripped);
|
||||||
@ -166,7 +172,8 @@ public class SubkeysAdapter extends CursorAdapter {
|
|||||||
//algorithmStr += ", " + context.getString(R.string.key_unavailable);
|
//algorithmStr += ", " + context.getString(R.string.key_unavailable);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
vKeyDetails.setText(algorithmStr);
|
}
|
||||||
|
vKeyDetails.setText(Html.fromHtml(algorithmStr));
|
||||||
|
|
||||||
boolean isMasterKey = cursor.getInt(INDEX_RANK) == 0;
|
boolean isMasterKey = cursor.getInt(INDEX_RANK) == 0;
|
||||||
if (isMasterKey) {
|
if (isMasterKey) {
|
||||||
|
@ -34,6 +34,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;
|
||||||
|
|
||||||
private Messenger mMessenger;
|
private Messenger mMessenger;
|
||||||
|
|
||||||
@ -72,6 +73,9 @@ public class EditSubkeyDialogFragment extends DialogFragment {
|
|||||||
case 1:
|
case 1:
|
||||||
sendMessageToHandler(MESSAGE_REVOKE, null);
|
sendMessageToHandler(MESSAGE_REVOKE, null);
|
||||||
break;
|
break;
|
||||||
|
case 2:
|
||||||
|
sendMessageToHandler(MESSAGE_STRIP, null);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -293,6 +293,7 @@
|
|||||||
<string name="progress_modify_primaryuid">"changing primary user ID…"</string>
|
<string name="progress_modify_primaryuid">"changing primary user ID…"</string>
|
||||||
<string name="progress_modify_subkeychange">"modifying subkeys…"</string>
|
<string name="progress_modify_subkeychange">"modifying subkeys…"</string>
|
||||||
<string name="progress_modify_subkeyrevoke">"revoking 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_subkeyadd">"adding subkeys…"</string>
|
||||||
<string name="progress_modify_passphrase">"changing passphrase…"</string>
|
<string name="progress_modify_passphrase">"changing passphrase…"</string>
|
||||||
|
|
||||||
@ -490,6 +491,7 @@
|
|||||||
<string-array name="edit_key_edit_subkey">
|
<string-array name="edit_key_edit_subkey">
|
||||||
<item>"Change Expiry"</item>
|
<item>"Change Expiry"</item>
|
||||||
<item>"Revoke Subkey"</item>
|
<item>"Revoke Subkey"</item>
|
||||||
|
<item>"Strip Subkey"</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
<string name="edit_key_new_subkey">"new"</string>
|
<string name="edit_key_new_subkey">"new"</string>
|
||||||
<string name="edit_key_select_flag">"Please select at least one flag!"</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_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_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_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_success">"Keyring successfully modified"</string>
|
||||||
<string name="msg_mf_uid_add">"Adding user id %s"</string>
|
<string name="msg_mf_uid_add">"Adding user id %s"</string>
|
||||||
<string name="msg_mf_uid_primary">"Changing primary uid to %s"</string>
|
<string name="msg_mf_uid_primary">"Changing primary uid to %s"</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user