diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainProvider.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainProvider.java index 7365005e4..903c27859 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainProvider.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainProvider.java @@ -373,6 +373,7 @@ public class KeychainProvider extends ContentProvider { projectionMap.put(UserIds.USER_ID, Tables.USER_IDS + "." + UserIds.USER_ID); projectionMap.put(UserIds.RANK, Tables.USER_IDS + "." + UserIds.RANK); projectionMap.put(UserIds.IS_PRIMARY, Tables.USER_IDS + "." + UserIds.IS_PRIMARY); + projectionMap.put(UserIds.IS_REVOKED, Tables.USER_IDS + "." + UserIds.IS_REVOKED); // we take the minimum (>0) here, where "1" is "verified by known secret key" projectionMap.put(UserIds.VERIFIED, "MIN(" + Certs.VERIFIED + ") AS " + UserIds.VERIFIED); qb.setProjectionMap(projectionMap); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java index b2d41a151..78d61a521 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java @@ -301,6 +301,10 @@ public class ProviderHelper { operations.add(buildCertOperations( masterKeyId, userIdRank, item.selfCert, Certs.VERIFIED_SELF)); } + // don't bother with trusted certs if the uid is revoked, anyways + if(item.isRevoked) { + continue; + } for(int i = 0; i < item.trustedCerts.size(); i++) { operations.add(buildCertOperations( masterKeyId, userIdRank, item.trustedCerts.get(i), Certs.VERIFIED_SECRET)); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java index e275dca59..60df6970d 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java @@ -175,7 +175,8 @@ public class ViewKeyMainFragment extends Fragment implements static final int INDEX_UNIFIED_EXPIRY = 8; static final String[] USER_IDS_PROJECTION = new String[] { - UserIds._ID, UserIds.USER_ID, UserIds.RANK, UserIds.VERIFIED + UserIds._ID, UserIds.USER_ID, UserIds.RANK, + UserIds.VERIFIED, UserIds.IS_PRIMARY, UserIds.IS_REVOKED }; static final String[] KEYS_PROJECTION = new String[] { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java index ba304436b..023d3d660 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java @@ -38,7 +38,7 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter { private LayoutInflater mInflater; private int mIndexUserId, mIndexRank; - private int mVerifiedId; + private int mVerifiedId, mIsRevoked, mIsPrimary; private final ArrayList mCheckStates; @@ -86,6 +86,8 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter { mIndexUserId = cursor.getColumnIndexOrThrow(UserIds.USER_ID); mIndexRank = cursor.getColumnIndexOrThrow(UserIds.RANK); mVerifiedId = cursor.getColumnIndexOrThrow(UserIds.VERIFIED); + mIsRevoked = cursor.getColumnIndexOrThrow(UserIds.IS_REVOKED); + mIsPrimary = cursor.getColumnIndexOrThrow(UserIds.IS_PRIMARY); } } @@ -97,7 +99,11 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter { TextView vAddress = (TextView) view.findViewById(R.id.address); ImageView vVerified = (ImageView) view.findViewById(R.id.certified); - vRank.setText(Integer.toString(cursor.getInt(mIndexRank))); + if(cursor.getInt(mIsPrimary) > 0) { + vRank.setText("+"); + } else { + vRank.setText(Integer.toString(cursor.getInt(mIndexRank))); + } String[] userId = PgpKeyHelper.splitUserId(cursor.getString(mIndexUserId)); if (userId[0] != null) { @@ -107,14 +113,18 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter { } vAddress.setText(userId[1]); - int verified = cursor.getInt(mVerifiedId); - // TODO introduce own resources for this :) - if(verified == Certs.VERIFIED_SECRET) - vVerified.setImageResource(android.R.drawable.presence_online); - else if(verified == Certs.VERIFIED_SELF) - vVerified.setImageResource(android.R.drawable.presence_invisible); - else - vVerified.setImageResource(android.R.drawable.presence_busy); + if(cursor.getInt(mIsRevoked) > 0) { + vVerified.setImageResource(android.R.drawable.presence_away); + } else { + int verified = cursor.getInt(mVerifiedId); + // TODO introduce own resources for this :) + if(verified == Certs.VERIFIED_SECRET) + vVerified.setImageResource(android.R.drawable.presence_online); + else if(verified == Certs.VERIFIED_SELF) + vVerified.setImageResource(android.R.drawable.presence_invisible); + else + vVerified.setImageResource(android.R.drawable.presence_busy); + } // don't care further if checkboxes aren't shown if (mCheckStates == null) { diff --git a/OpenPGP-Keychain/src/main/res/layout/view_key_certs_header.xml b/OpenPGP-Keychain/src/main/res/layout/view_key_certs_header.xml index de481c1cc..04e7b8097 100644 --- a/OpenPGP-Keychain/src/main/res/layout/view_key_certs_header.xml +++ b/OpenPGP-Keychain/src/main/res/layout/view_key_certs_header.xml @@ -10,7 +10,7 @@ android:layout_gravity="start|left" android:padding="8dp" android:textColor="@color/emphasis" - android:textSize="17sp" + android:textSize="14sp" android:textStyle="bold" android:text="header text" />