diff options
Diffstat (limited to 'OpenKeychain')
7 files changed, 42 insertions, 19 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java index 8aeae3e9b..f89027a19 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpSignEncrypt.java @@ -80,6 +80,7 @@ public class PgpSignEncrypt extends BaseOperation { private long mAdditionalEncryptId; private boolean mCleartextInput; private String mOriginalFilename; + private boolean mFailOnMissingEncryptionKeyIds; private byte[] mNfcSignedHash = null; private Date mNfcCreationTimestamp = null; @@ -116,6 +117,7 @@ public class PgpSignEncrypt extends BaseOperation { this.mNfcSignedHash = builder.mNfcSignedHash; this.mNfcCreationTimestamp = builder.mNfcCreationTimestamp; this.mOriginalFilename = builder.mOriginalFilename; + this.mFailOnMissingEncryptionKeyIds = builder.mFailOnMissingEncryptionKeyIds; } public static class Builder { @@ -142,6 +144,7 @@ public class PgpSignEncrypt extends BaseOperation { private String mOriginalFilename = ""; private byte[] mNfcSignedHash = null; private Date mNfcCreationTimestamp = null; + private boolean mFailOnMissingEncryptionKeyIds = false; public Builder(Context context, ProviderHelper providerHelper, Progressable progressable, InputData data, OutputStream outStream) { @@ -203,6 +206,11 @@ public class PgpSignEncrypt extends BaseOperation { return this; } + public Builder setFailOnMissingEncryptionKeyIds(boolean failOnMissingEncryptionKeyIds) { + mFailOnMissingEncryptionKeyIds = failOnMissingEncryptionKeyIds; + return this; + } + /** * Also encrypt with the signing keyring * @@ -380,9 +388,15 @@ public class PgpSignEncrypt extends BaseOperation { } catch (PgpKeyNotFoundException e) { log.add(LogType.MSG_SE_KEY_WARN, indent + 1, KeyFormattingUtils.convertKeyIdToHex(id)); + if (mFailOnMissingEncryptionKeyIds) { + return new SignEncryptResult(SignEncryptResult.RESULT_ERROR, log); + } } catch (ProviderHelper.NotFoundException e) { log.add(LogType.MSG_SE_KEY_UNKNOWN, indent + 1, KeyFormattingUtils.convertKeyIdToHex(id)); + if (mFailOnMissingEncryptionKeyIds) { + return new SignEncryptResult(SignEncryptResult.RESULT_ERROR, log); + } } } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java index f77328d34..a5813567a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java @@ -379,6 +379,7 @@ public class OpenPgpService extends RemoteService { .setCompressionId(accSettings.getCompression()) .setSymmetricEncryptionAlgorithm(accSettings.getEncryptionAlgorithm()) .setEncryptionMasterKeyIds(keyIds) + .setFailOnMissingEncryptionKeyIds(true) .setOriginalFilename(originalFilename) .setAdditionalEncryptId(accSettings.getKeyId()); // add acc key for encryption diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java index 621b6b7e1..af583bf89 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java @@ -384,7 +384,8 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T KeyFormattingUtils.setStatusImage(mContext, h.statusIcon, KeyFormattingUtils.STATE_VERIFIED); enabled = true; } else { - h.statusIcon.setVisibility(View.GONE); + h.statusIcon.setVisibility(View.VISIBLE); + KeyFormattingUtils.setStatusImage(mContext, h.statusIcon, KeyFormattingUtils.STATE_UNVERIFIED); enabled = true; } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java index 8b6a04b99..60c130969 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java @@ -133,11 +133,11 @@ abstract public class SelectKeyCursorAdapter extends CursorAdapter { boolean enabled; if (cursor.getInt(mIndexIsRevoked) != 0) { h.statusIcon.setVisibility(View.VISIBLE); - KeyFormattingUtils.setStatusImage(mContext, h.statusIcon, KeyFormattingUtils.STATE_REVOKED); + KeyFormattingUtils.setStatusImage(mContext, h.statusIcon, null, KeyFormattingUtils.STATE_REVOKED, true); enabled = false; } else if (cursor.getInt(mIndexIsExpiry) != 0) { h.statusIcon.setVisibility(View.VISIBLE); - KeyFormattingUtils.setStatusImage(mContext, h.statusIcon, KeyFormattingUtils.STATE_EXPIRED); + KeyFormattingUtils.setStatusImage(mContext, h.statusIcon, null, KeyFormattingUtils.STATE_EXPIRED, true); enabled = false; } else { h.statusIcon.setVisibility(View.GONE); @@ -152,10 +152,10 @@ abstract public class SelectKeyCursorAdapter extends CursorAdapter { View view = mInflater.inflate(R.layout.select_key_item, null); ViewHolderItem holder = new ViewHolderItem(); holder.view = view; - holder.mainUserId = (TextView) view.findViewById(R.id.key_list_item_name); - holder.mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest); - holder.keyId = (TextView) view.findViewById(R.id.subkey_item_key_id); - holder.statusIcon = (ImageView) view.findViewById(R.id.status_icon); + holder.mainUserId = (TextView) view.findViewById(R.id.select_key_item_name); + holder.mainUserIdRest = (TextView) view.findViewById(R.id.select_key_item_email); + holder.keyId = (TextView) view.findViewById(R.id.select_key_item_key_id); + holder.statusIcon = (ImageView) view.findViewById(R.id.select_key_item_status_icon); holder.selected = (CheckBox) view.findViewById(R.id.selected); view.setTag(holder); return view; diff --git a/OpenKeychain/src/main/res/layout/select_key_item.xml b/OpenKeychain/src/main/res/layout/select_key_item.xml index b6cbfd973..c7fa882cb 100644 --- a/OpenKeychain/src/main/res/layout/select_key_item.xml +++ b/OpenKeychain/src/main/res/layout/select_key_item.xml @@ -24,21 +24,21 @@ android:layout_gravity="center_vertical"> <TextView - android:id="@+id/mainUserId" + android:id="@+id/select_key_item_name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Alice" android:textAppearance="?android:attr/textAppearanceMedium" /> <TextView - android:id="@+id/mainUserIdRest" + android:id="@+id/select_key_item_email" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="alice@example.com" android:textAppearance="?android:attr/textAppearanceSmall" /> <TextView - android:id="@+id/subkey_item_key_id" + android:id="@+id/select_key_item_key_id" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0xBBBBBBBBBBBBBBB" @@ -46,7 +46,7 @@ </LinearLayout> <ImageView - android:id="@+id/status_icon" + android:id="@+id/select_key_item_status_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" diff --git a/OpenKeychain/src/main/res/menu/key_list_multi.xml b/OpenKeychain/src/main/res/menu/key_list_multi.xml index 087521177..3e0f87692 100644 --- a/OpenKeychain/src/main/res/menu/key_list_multi.xml +++ b/OpenKeychain/src/main/res/menu/key_list_multi.xml @@ -1,10 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> - - <item - android:id="@+id/menu_key_list_multi_export" - android:icon="@drawable/ic_action_import_export" - android:title="@string/menu_export_key" /> +<menu xmlns:tools="http://schemas.android.com/tools" + xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/menu_key_list_multi_encrypt" @@ -12,13 +8,24 @@ android:title="@string/menu_encrypt_to" /> <item + android:id="@+id/menu_key_list_multi_export" + android:icon="@drawable/ic_action_import_export" + android:showAsAction="never" + tools:ignore="AppCompatResource" + android:title="@string/menu_export_key" /> + + <item android:id="@+id/menu_key_list_multi_delete" android:icon="@drawable/ic_action_discard" + android:showAsAction="never" + tools:ignore="AppCompatResource" android:title="@string/menu_delete_key" /> <item android:id="@+id/menu_key_list_multi_select_all" android:icon="@drawable/ic_action_select_all" + android:showAsAction="never" + tools:ignore="AppCompatResource" android:title="@string/menu_select_all" /> </menu> diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index d914b4299..2d7778927 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -89,7 +89,7 @@ <string name="menu_export_key">"Export to file"</string> <string name="menu_delete_key">"Delete key"</string> <string name="menu_create_key">"Create my key"</string> - <string name="menu_import_existing_key">"Import existing key"</string> + <string name="menu_import_existing_key">"Import from file"</string> <string name="menu_search">"Search"</string> <string name="menu_beam_preferences">"Beam settings"</string> <string name="menu_key_edit_cancel">"Cancel"</string> @@ -1045,7 +1045,7 @@ <!-- First Time --> <string name="first_time_text1">"Take back your privacy with OpenKeychain!"</string> <string name="first_time_create_key">"Create my key"</string> - <string name="first_time_import_key">"Import existing key"</string> + <string name="first_time_import_key">"Import from file"</string> <string name="first_time_skip">"Skip Setup"</string> </resources> |