diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2014-04-11 03:21:39 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2014-04-11 03:44:13 +0200 |
commit | b77fb2fcc0371248beaf86a1db092e7ad99e6446 (patch) | |
tree | 29acb0cd66761200805603c5925c626650aac6c9 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java | |
parent | 9af532880c728ccd343769078b008a9b31dc4ce1 (diff) | |
download | open-keychain-b77fb2fcc0371248beaf86a1db092e7ad99e6446.tar.gz open-keychain-b77fb2fcc0371248beaf86a1db092e7ad99e6446.tar.bz2 open-keychain-b77fb2fcc0371248beaf86a1db092e7ad99e6446.zip |
get rid of more getMasterKeyId usage, work on getKeyRingsAsArmoredString
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java index dceb9a0fc..ca26cac1c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java @@ -219,12 +219,8 @@ public class ViewKeyActivity extends ActionBarActivity { } else { // get public keyring as ascii armored string try { - long masterKeyId = ProviderHelper.getMasterKeyId(this, dataUri); - - ArrayList<String> keyringArmored = ProviderHelper.getKeyRingsAsArmoredString( - this, new long[]{masterKeyId}); - - content = keyringArmored.get(0); + Uri uri = KeychainContract.KeyRingData.buildPublicKeyRingUri(dataUri); + content = ProviderHelper.getKeyRingAsArmoredString(this, uri); // Android will fail with android.os.TransactionTooLargeException if key is too big // see http://www.lonestarprod.com/?p=34 @@ -233,8 +229,12 @@ public class ViewKeyActivity extends ActionBarActivity { AppMsg.STYLE_ALERT).show(); return; } + } catch (IOException e) { + Log.e(Constants.TAG, "error processing key!", e); + AppMsg.makeText(this, R.string.error_invalid_data, AppMsg.STYLE_ALERT).show(); } catch (ProviderHelper.NotFoundException e) { Log.e(Constants.TAG, "key not found!", e); + AppMsg.makeText(this, R.string.error_key_not_found, AppMsg.STYLE_ALERT).show(); } } @@ -259,16 +259,18 @@ public class ViewKeyActivity extends ActionBarActivity { private void copyToClipboard(Uri dataUri) { // get public keyring as ascii armored string try { - long masterKeyId = ProviderHelper.getMasterKeyId(this, dataUri); - - ArrayList<String> keyringArmored = ProviderHelper.getKeyRingsAsArmoredString( - this, new long[]{masterKeyId}); + Uri uri = KeychainContract.KeyRingData.buildPublicKeyRingUri(dataUri); + String keyringArmored = ProviderHelper.getKeyRingAsArmoredString(this, uri); - ClipboardReflection.copyToClipboard(this, keyringArmored.get(0)); + ClipboardReflection.copyToClipboard(this, keyringArmored); AppMsg.makeText(this, R.string.key_copied_to_clipboard, AppMsg.STYLE_INFO) .show(); + } catch (IOException e) { + Log.e(Constants.TAG, "error processing key!", e); + AppMsg.makeText(this, R.string.error_key_processing, AppMsg.STYLE_ALERT).show(); } catch (ProviderHelper.NotFoundException e) { Log.e(Constants.TAG, "key not found!", e); + AppMsg.makeText(this, R.string.error_key_not_found, AppMsg.STYLE_ALERT).show(); } } |