aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-03-08 12:00:24 +0100
committerVincent Breitmoser <valodim@mugenguild.com>2014-03-08 12:07:20 +0100
commitaa8a8f069fb978563bf8d06994cfa7ef1fe316bd (patch)
tree216b010b1ccc17b7a2f3b76925ea57fb9ee57512 /OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider
parent191c5b8130d1a6253ed715e35046db4678a16a8c (diff)
downloadopen-keychain-aa8a8f069fb978563bf8d06994cfa7ef1fe316bd.tar.gz
open-keychain-aa8a8f069fb978563bf8d06994cfa7ef1fe316bd.tar.bz2
open-keychain-aa8a8f069fb978563bf8d06994cfa7ef1fe316bd.zip
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
Diffstat (limited to 'OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider')
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java20
1 files changed, 20 insertions, 0 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 2d7558a49..ea6d3a859 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
@@ -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
*/