certs: display uid status in uid list

This commit is contained in:
Vincent Breitmoser 2014-04-06 01:11:57 +02:00
parent 437da180fc
commit ed3798be8a
5 changed files with 28 additions and 12 deletions

View File

@ -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);

View File

@ -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));

View File

@ -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[] {

View File

@ -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<Boolean> 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);
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,6 +113,9 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter {
}
vAddress.setText(userId[1]);
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)
@ -115,6 +124,7 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter {
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) {

View File

@ -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" />