Normalize public key uri in KeyListFragment
Find the explicit row id of the public key id given in the uri in KeyListFragment and work with that. This way, passing in uris by master key id, mail address, or any other criteria, works. Might be a good idea to add an actual check if the row id is non-zero here, but not sure how to do a "bad intent" thing
This commit is contained in:
@@ -514,6 +514,26 @@ public class ProviderHelper {
|
||||
return masterKeyId;
|
||||
}
|
||||
|
||||
public static long getRowId(Context context, Uri queryUri) {
|
||||
String[] projection = new String[]{KeyRings._ID};
|
||||
Cursor cursor = context.getContentResolver().query(queryUri, projection, null, null, null);
|
||||
|
||||
long rowId = 0;
|
||||
try {
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
int idCol = cursor.getColumnIndexOrThrow(KeyRings._ID);
|
||||
|
||||
rowId = cursor.getLong(idCol);
|
||||
}
|
||||
} finally {
|
||||
if (cursor != null) {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
return rowId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fingerprint of key
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user