mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-11 03:25:05 -05:00
certs: display cert type in cert view
This commit is contained in:
parent
ed3798be8a
commit
84857df703
@ -35,6 +35,7 @@ import android.widget.ArrayAdapter;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.spongycastle.openpgp.PGPSignature;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
|
||||
@ -55,6 +56,7 @@ public class ViewKeyCertsFragment extends Fragment
|
||||
Certs._ID,
|
||||
Certs.MASTER_KEY_ID,
|
||||
Certs.VERIFIED,
|
||||
Certs.TYPE,
|
||||
Certs.RANK,
|
||||
Certs.KEY_ID_CERTIFIER,
|
||||
Certs.USER_ID,
|
||||
@ -64,8 +66,7 @@ public class ViewKeyCertsFragment extends Fragment
|
||||
// sort by our user id,
|
||||
static final String SORT_ORDER =
|
||||
Tables.CERTS + "." + Certs.RANK + " ASC, "
|
||||
+ Certs.VERIFIED + " DESC, "
|
||||
+ Certs.SIGNER_UID + " ASC";
|
||||
+ Certs.VERIFIED + " DESC, " + Certs.TYPE + " DESC, " + Certs.SIGNER_UID + " ASC";
|
||||
|
||||
public static final String ARG_DATA_URI = "data_uri";
|
||||
|
||||
@ -73,9 +74,8 @@ public class ViewKeyCertsFragment extends Fragment
|
||||
private Spinner mSpinner;
|
||||
|
||||
private CertListAdapter mAdapter;
|
||||
private boolean mUnknownShown = false;
|
||||
|
||||
private Uri mBaseUri, mDataUri;
|
||||
private Uri mDataUri;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
@ -133,7 +133,7 @@ public class ViewKeyCertsFragment extends Fragment
|
||||
}
|
||||
|
||||
Uri uri = getArguments().getParcelable(ARG_DATA_URI);
|
||||
mBaseUri = Certs.buildCertsUri(uri);
|
||||
mDataUri = Certs.buildCertsUri(uri);
|
||||
|
||||
mStickyList.setAreHeadersSticky(true);
|
||||
mStickyList.setDrawingListUnderStickyHeader(false);
|
||||
@ -155,9 +155,6 @@ public class ViewKeyCertsFragment extends Fragment
|
||||
mAdapter = new CertListAdapter(getActivity(), null);
|
||||
mStickyList.setAdapter(mAdapter);
|
||||
|
||||
// Prepare the loader. Either re-connect with an existing one,
|
||||
// or start a new one.
|
||||
mDataUri = mBaseUri;
|
||||
getLoaderManager().initLoader(0, null, this);
|
||||
|
||||
}
|
||||
@ -205,7 +202,7 @@ public class ViewKeyCertsFragment extends Fragment
|
||||
private int mIndexCertId;
|
||||
private int mIndexUserId, mIndexRank;
|
||||
private int mIndexSignerKeyId, mIndexSignerUserId;
|
||||
private int mIndexVerified;
|
||||
private int mIndexVerified, mIndexType;
|
||||
|
||||
public CertListAdapter(Context context, Cursor c) {
|
||||
super(context, c, 0);
|
||||
@ -233,6 +230,7 @@ public class ViewKeyCertsFragment extends Fragment
|
||||
mIndexCertId = cursor.getColumnIndexOrThrow(Certs.MASTER_KEY_ID);
|
||||
mIndexUserId = cursor.getColumnIndexOrThrow(Certs.USER_ID);
|
||||
mIndexRank = cursor.getColumnIndexOrThrow(Certs.RANK);
|
||||
mIndexType = cursor.getColumnIndexOrThrow(Certs.TYPE);
|
||||
mIndexVerified = cursor.getColumnIndexOrThrow(Certs.VERIFIED);
|
||||
mIndexSignerKeyId = cursor.getColumnIndexOrThrow(Certs.KEY_ID_CERTIFIER);
|
||||
mIndexSignerUserId = cursor.getColumnIndexOrThrow(Certs.SIGNER_UID);
|
||||
@ -255,11 +253,21 @@ public class ViewKeyCertsFragment extends Fragment
|
||||
|
||||
String signerKeyId = PgpKeyHelper.convertKeyIdToHex(cursor.getLong(mIndexSignerKeyId));
|
||||
String signerUserId = cursor.getString(mIndexSignerUserId);
|
||||
String signStatus = cursor.getInt(mIndexVerified) > 0 ? "ok" : "unknown";
|
||||
switch(cursor.getInt(mIndexType)) {
|
||||
case PGPSignature.DEFAULT_CERTIFICATION: // 0x10
|
||||
wSignStatus.setText(R.string.cert_default); break;
|
||||
case PGPSignature.NO_CERTIFICATION: // 0x11
|
||||
wSignStatus.setText(R.string.cert_none); break;
|
||||
case PGPSignature.CASUAL_CERTIFICATION: // 0x12
|
||||
wSignStatus.setText(R.string.cert_casual); break;
|
||||
case PGPSignature.POSITIVE_CERTIFICATION: // 0x13
|
||||
wSignStatus.setText(R.string.cert_positive); break;
|
||||
case PGPSignature.CERTIFICATION_REVOCATION: // 0x30
|
||||
wSignStatus.setText(R.string.cert_revoke); break;
|
||||
}
|
||||
|
||||
wSignerUserId.setText(signerUserId);
|
||||
wSignerKeyId.setText(signerKeyId);
|
||||
wSignStatus.setText(signStatus);
|
||||
|
||||
}
|
||||
|
||||
|
@ -507,5 +507,10 @@
|
||||
<!-- hints -->
|
||||
<string name="encrypt_content_edit_text_hint">Write message here to encrypt and/or sign…</string>
|
||||
<string name="decrypt_content_edit_text_hint">Enter ciphertext here to decrypt and/or verify…</string>
|
||||
<string name="cert_default">default</string>
|
||||
<string name="cert_none">none</string>
|
||||
<string name="cert_casual">casual</string>
|
||||
<string name="cert_positive">positive</string>
|
||||
<string name="cert_revoke">revoke</string>
|
||||
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user