cache key s2k type in database, for later use
This commit is contained in:
@@ -32,6 +32,7 @@ import android.widget.AdapterView.OnItemClickListener;
|
||||
import android.widget.ListView;
|
||||
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey.SecretKeyType;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.ui.adapter.SelectKeyCursorAdapter;
|
||||
|
||||
@@ -190,7 +191,7 @@ public class SelectSecretKeyFragment extends ListFragment implements
|
||||
if(mFilterCertify) {
|
||||
// Only enable if can certify
|
||||
if (cursor.getInt(mIndexCanCertify) == 0
|
||||
|| cursor.getInt(mIndexHasSecret) == 0) {
|
||||
|| !SecretKeyType.fromNum(cursor.getInt(mIndexHasSecret)).isUsable()) {
|
||||
h.status.setText(R.string.can_certify_not);
|
||||
} else {
|
||||
h.status.setText(R.string.can_certify);
|
||||
|
||||
@@ -300,7 +300,7 @@ public class ViewKeyActivity extends ActionBarActivity implements
|
||||
|
||||
exportHelper.showExportKeysDialog(
|
||||
new long[]{(Long) data.get(KeychainContract.KeyRings.MASTER_KEY_ID)},
|
||||
Constants.Path.APP_DIR_FILE, ((Long) data.get(KeychainContract.KeyRings.HAS_SECRET) == 1)
|
||||
Constants.Path.APP_DIR_FILE, ((Long) data.get(KeychainContract.KeyRings.HAS_SECRET) != 0)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import android.widget.TextView;
|
||||
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.helper.OtherHelper;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey.SecretKeyType;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.Keys;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
||||
@@ -113,7 +114,8 @@ public class SubkeysAdapter extends CursorAdapter {
|
||||
hasAnySecret = false;
|
||||
if (newCursor != null && newCursor.moveToFirst()) {
|
||||
do {
|
||||
if (newCursor.getInt(INDEX_HAS_SECRET) != 0) {
|
||||
SecretKeyType hasSecret = SecretKeyType.fromNum(newCursor.getInt(INDEX_HAS_SECRET));
|
||||
if (hasSecret.isUsable()) {
|
||||
hasAnySecret = true;
|
||||
break;
|
||||
}
|
||||
@@ -149,12 +151,21 @@ public class SubkeysAdapter extends CursorAdapter {
|
||||
|
||||
vKeyId.setText(keyIdStr);
|
||||
// may be set with additional "stripped" later on
|
||||
if (hasAnySecret && cursor.getInt(INDEX_HAS_SECRET) == 0) {
|
||||
vKeyDetails.setText(algorithmStr + ", " +
|
||||
context.getString(R.string.key_stripped));
|
||||
} else {
|
||||
vKeyDetails.setText(algorithmStr);
|
||||
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:
|
||||
algorithmStr += ", " + context.getString(R.string.key_unavailable);
|
||||
break;
|
||||
}
|
||||
vKeyDetails.setText(algorithmStr);
|
||||
|
||||
boolean isMasterKey = cursor.getInt(INDEX_RANK) == 0;
|
||||
if (isMasterKey) {
|
||||
|
||||
Reference in New Issue
Block a user