aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-09-11 22:50:44 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-09-11 22:50:44 +0200
commit4e834d78335d8d375a8918be05ccd89a86d50863 (patch)
treede5557758caefb474cfc0c96dac485e19d1dea8f /OpenKeychain/src
parent8f6b7e27f1bda9606da35afee05b675f55b25a8e (diff)
downloadopen-keychain-4e834d78335d8d375a8918be05ccd89a86d50863.tar.gz
open-keychain-4e834d78335d8d375a8918be05ccd89a86d50863.tar.bz2
open-keychain-4e834d78335d8d375a8918be05ccd89a86d50863.zip
add ui support for stripping subkeys
Diffstat (limited to 'OpenKeychain/src')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java8
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SubkeysAdapter.java39
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/EditSubkeyDialogFragment.java4
-rw-r--r--OpenKeychain/src/main/res/values/strings.xml3
4 files changed, 38 insertions, 16 deletions
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 703755457..8feef5e46 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyFragment.java
@@ -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();
}
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SubkeysAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SubkeysAdapter.java
index 78bbf80dd..f25c49508 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SubkeysAdapter.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SubkeysAdapter.java
@@ -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) {
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/EditSubkeyDialogFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/EditSubkeyDialogFragment.java
index 9fef88a78..9568312f5 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/EditSubkeyDialogFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/EditSubkeyDialogFragment.java
@@ -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;
}
diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml
index 64affdfde..a450b36f8 100644
--- a/OpenKeychain/src/main/res/values/strings.xml
+++ b/OpenKeychain/src/main/res/values/strings.xml
@@ -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>