mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-26 00:48:51 -05:00
Make EditKeyActivity's uri handling (more) sane
This activity didn't actually use the uri for anything, but just chopped off the last path segment and interpreted it as row id. What the hell.
This commit is contained in:
parent
8c6cb8b0ab
commit
191c5b8130
@ -451,13 +451,13 @@ public class ProviderHelper {
|
|||||||
*/
|
*/
|
||||||
public static boolean getSecretMasterKeyCanSign(Context context, long keyRingRowId) {
|
public static boolean getSecretMasterKeyCanSign(Context context, long keyRingRowId) {
|
||||||
Uri queryUri = KeyRings.buildSecretKeyRingsUri(String.valueOf(keyRingRowId));
|
Uri queryUri = KeyRings.buildSecretKeyRingsUri(String.valueOf(keyRingRowId));
|
||||||
return getMasterKeyCanSign(context, queryUri, keyRingRowId);
|
return getMasterKeyCanSign(context, queryUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private helper method to get master key private empty status of keyring by its row id
|
* Private helper method to get master key private empty status of keyring by its row id
|
||||||
*/
|
*/
|
||||||
private static boolean getMasterKeyCanSign(Context context, Uri queryUri, long keyRingRowId) {
|
public static boolean getMasterKeyCanSign(Context context, Uri queryUri) {
|
||||||
String[] projection = new String[]{
|
String[] projection = new String[]{
|
||||||
KeyRings.MASTER_KEY_ID,
|
KeyRings.MASTER_KEY_ID,
|
||||||
"(SELECT COUNT(sign_keys." + Keys._ID + ") FROM " + Tables.KEYS
|
"(SELECT COUNT(sign_keys." + Keys._ID + ") FROM " + Tables.KEYS
|
||||||
|
@ -265,12 +265,10 @@ public class EditKeyActivity extends ActionBarActivity {
|
|||||||
} else {
|
} else {
|
||||||
Log.d(Constants.TAG, "uri: " + mDataUri);
|
Log.d(Constants.TAG, "uri: " + mDataUri);
|
||||||
|
|
||||||
long keyRingRowId = Long.valueOf(mDataUri.getLastPathSegment());
|
|
||||||
|
|
||||||
// get master key id using row id
|
// get master key id using row id
|
||||||
long masterKeyId = ProviderHelper.getSecretMasterKeyId(this, keyRingRowId);
|
long masterKeyId = ProviderHelper.getMasterKeyId(this, mDataUri);
|
||||||
|
|
||||||
masterCanSign = ProviderHelper.getSecretMasterKeyCanSign(this, keyRingRowId);
|
masterCanSign = ProviderHelper.getMasterKeyCanSign(this, mDataUri);
|
||||||
finallyEdit(masterKeyId, masterCanSign);
|
finallyEdit(masterKeyId, masterCanSign);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user