mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-23 17:22:16 -05:00
certs: display uid status in uid list
This commit is contained in:
parent
437da180fc
commit
ed3798be8a
@ -373,6 +373,7 @@ public class KeychainProvider extends ContentProvider {
|
|||||||
projectionMap.put(UserIds.USER_ID, Tables.USER_IDS + "." + UserIds.USER_ID);
|
projectionMap.put(UserIds.USER_ID, Tables.USER_IDS + "." + UserIds.USER_ID);
|
||||||
projectionMap.put(UserIds.RANK, Tables.USER_IDS + "." + UserIds.RANK);
|
projectionMap.put(UserIds.RANK, Tables.USER_IDS + "." + UserIds.RANK);
|
||||||
projectionMap.put(UserIds.IS_PRIMARY, Tables.USER_IDS + "." + UserIds.IS_PRIMARY);
|
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"
|
// we take the minimum (>0) here, where "1" is "verified by known secret key"
|
||||||
projectionMap.put(UserIds.VERIFIED, "MIN(" + Certs.VERIFIED + ") AS " + UserIds.VERIFIED);
|
projectionMap.put(UserIds.VERIFIED, "MIN(" + Certs.VERIFIED + ") AS " + UserIds.VERIFIED);
|
||||||
qb.setProjectionMap(projectionMap);
|
qb.setProjectionMap(projectionMap);
|
||||||
|
@ -301,6 +301,10 @@ public class ProviderHelper {
|
|||||||
operations.add(buildCertOperations(
|
operations.add(buildCertOperations(
|
||||||
masterKeyId, userIdRank, item.selfCert, Certs.VERIFIED_SELF));
|
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++) {
|
for(int i = 0; i < item.trustedCerts.size(); i++) {
|
||||||
operations.add(buildCertOperations(
|
operations.add(buildCertOperations(
|
||||||
masterKeyId, userIdRank, item.trustedCerts.get(i), Certs.VERIFIED_SECRET));
|
masterKeyId, userIdRank, item.trustedCerts.get(i), Certs.VERIFIED_SECRET));
|
||||||
|
@ -175,7 +175,8 @@ public class ViewKeyMainFragment extends Fragment implements
|
|||||||
static final int INDEX_UNIFIED_EXPIRY = 8;
|
static final int INDEX_UNIFIED_EXPIRY = 8;
|
||||||
|
|
||||||
static final String[] USER_IDS_PROJECTION = new String[] {
|
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[] {
|
static final String[] KEYS_PROJECTION = new String[] {
|
||||||
|
@ -38,7 +38,7 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter {
|
|||||||
private LayoutInflater mInflater;
|
private LayoutInflater mInflater;
|
||||||
|
|
||||||
private int mIndexUserId, mIndexRank;
|
private int mIndexUserId, mIndexRank;
|
||||||
private int mVerifiedId;
|
private int mVerifiedId, mIsRevoked, mIsPrimary;
|
||||||
|
|
||||||
private final ArrayList<Boolean> mCheckStates;
|
private final ArrayList<Boolean> mCheckStates;
|
||||||
|
|
||||||
@ -86,6 +86,8 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter {
|
|||||||
mIndexUserId = cursor.getColumnIndexOrThrow(UserIds.USER_ID);
|
mIndexUserId = cursor.getColumnIndexOrThrow(UserIds.USER_ID);
|
||||||
mIndexRank = cursor.getColumnIndexOrThrow(UserIds.RANK);
|
mIndexRank = cursor.getColumnIndexOrThrow(UserIds.RANK);
|
||||||
mVerifiedId = cursor.getColumnIndexOrThrow(UserIds.VERIFIED);
|
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);
|
TextView vAddress = (TextView) view.findViewById(R.id.address);
|
||||||
ImageView vVerified = (ImageView) view.findViewById(R.id.certified);
|
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));
|
String[] userId = PgpKeyHelper.splitUserId(cursor.getString(mIndexUserId));
|
||||||
if (userId[0] != null) {
|
if (userId[0] != null) {
|
||||||
@ -107,14 +113,18 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter {
|
|||||||
}
|
}
|
||||||
vAddress.setText(userId[1]);
|
vAddress.setText(userId[1]);
|
||||||
|
|
||||||
int verified = cursor.getInt(mVerifiedId);
|
if(cursor.getInt(mIsRevoked) > 0) {
|
||||||
// TODO introduce own resources for this :)
|
vVerified.setImageResource(android.R.drawable.presence_away);
|
||||||
if(verified == Certs.VERIFIED_SECRET)
|
} else {
|
||||||
vVerified.setImageResource(android.R.drawable.presence_online);
|
int verified = cursor.getInt(mVerifiedId);
|
||||||
else if(verified == Certs.VERIFIED_SELF)
|
// TODO introduce own resources for this :)
|
||||||
vVerified.setImageResource(android.R.drawable.presence_invisible);
|
if(verified == Certs.VERIFIED_SECRET)
|
||||||
else
|
vVerified.setImageResource(android.R.drawable.presence_online);
|
||||||
vVerified.setImageResource(android.R.drawable.presence_busy);
|
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
|
// don't care further if checkboxes aren't shown
|
||||||
if (mCheckStates == null) {
|
if (mCheckStates == null) {
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
android:layout_gravity="start|left"
|
android:layout_gravity="start|left"
|
||||||
android:padding="8dp"
|
android:padding="8dp"
|
||||||
android:textColor="@color/emphasis"
|
android:textColor="@color/emphasis"
|
||||||
android:textSize="17sp"
|
android:textSize="14sp"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:text="header text" />
|
android:text="header text" />
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user