diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2014-03-08 11:58:26 +0100 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2014-03-08 11:58:26 +0100 |
commit | 191c5b8130d1a6253ed715e35046db4678a16a8c (patch) | |
tree | 399a6ace28c1ec3e5f59b4bd7eb4c8e9abb05bb1 /OpenPGP-Keychain/src/main/java | |
parent | 8c6cb8b0ab9e89f9d575af829e0dd1dd9e82e401 (diff) | |
download | open-keychain-191c5b8130d1a6253ed715e35046db4678a16a8c.tar.gz open-keychain-191c5b8130d1a6253ed715e35046db4678a16a8c.tar.bz2 open-keychain-191c5b8130d1a6253ed715e35046db4678a16a8c.zip |
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.
Diffstat (limited to 'OpenPGP-Keychain/src/main/java')
2 files changed, 4 insertions, 6 deletions
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 9bee42973..2d7558a49 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 @@ -451,13 +451,13 @@ public class ProviderHelper { */ public static boolean getSecretMasterKeyCanSign(Context context, long 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 static boolean getMasterKeyCanSign(Context context, Uri queryUri, long keyRingRowId) { + public static boolean getMasterKeyCanSign(Context context, Uri queryUri) { String[] projection = new String[]{ KeyRings.MASTER_KEY_ID, "(SELECT COUNT(sign_keys." + Keys._ID + ") FROM " + Tables.KEYS diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java index 0bed6f264..e2822c898 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java @@ -265,12 +265,10 @@ public class EditKeyActivity extends ActionBarActivity { } else { Log.d(Constants.TAG, "uri: " + mDataUri); - long keyRingRowId = Long.valueOf(mDataUri.getLastPathSegment()); - // 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); } } |