mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-01-12 05:58:07 -05:00
display AppMsg warning when no encryption subkey is available
This commit is contained in:
parent
0bb11be749
commit
873b1be75d
@ -32,6 +32,8 @@ import android.view.ViewGroup;
|
|||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
|
import com.devspark.appmsg.AppMsg;
|
||||||
|
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.R;import org.sufficientlysecure.keychain.provider.KeychainContract;
|
import org.sufficientlysecure.keychain.R;import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||||
@ -60,6 +62,9 @@ public class ViewKeyMainFragment extends Fragment implements
|
|||||||
private static final int LOADER_ID_UNIFIED = 0;
|
private static final int LOADER_ID_UNIFIED = 0;
|
||||||
private static final int LOADER_ID_USER_IDS = 1;
|
private static final int LOADER_ID_USER_IDS = 1;
|
||||||
|
|
||||||
|
// conservative attitude
|
||||||
|
private boolean mHasEncrypt = true;
|
||||||
|
|
||||||
private ViewKeyUserIdsAdapter mUserIdsAdapter;
|
private ViewKeyUserIdsAdapter mUserIdsAdapter;
|
||||||
|
|
||||||
private Uri mDataUri;
|
private Uri mDataUri;
|
||||||
@ -203,6 +208,8 @@ public class ViewKeyMainFragment extends Fragment implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mHasEncrypt = data.getInt(INDEX_UNIFIED_HAS_ENCRYPT) != 0;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -229,6 +236,11 @@ public class ViewKeyMainFragment extends Fragment implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void encrypt(Uri dataUri) {
|
private void encrypt(Uri dataUri) {
|
||||||
|
// If there is no encryption key, don't bother.
|
||||||
|
if (!mHasEncrypt) {
|
||||||
|
AppMsg.makeText(getActivity(), R.string.error_no_encrypt_subkey, AppMsg.STYLE_ALERT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
long keyId = new ProviderHelper(getActivity()).extractOrGetMasterKeyId(dataUri);
|
long keyId = new ProviderHelper(getActivity()).extractOrGetMasterKeyId(dataUri);
|
||||||
long[] encryptionKeyIds = new long[]{keyId};
|
long[] encryptionKeyIds = new long[]{keyId};
|
||||||
|
@ -513,5 +513,6 @@
|
|||||||
<string name="title_view_cert">View Certificate Details</string>
|
<string name="title_view_cert">View Certificate Details</string>
|
||||||
<string name="unknown_algorithm">unknown</string>
|
<string name="unknown_algorithm">unknown</string>
|
||||||
<string name="can_sign_not">cannot sign</string>
|
<string name="can_sign_not">cannot sign</string>
|
||||||
|
<string name="error_no_encrypt_subkey">No encryption subkey available!</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
Reference in New Issue
Block a user