From 508d7ac1973ae374fba1895dc3bac87f44415ca4 Mon Sep 17 00:00:00 2001 From: Thialfihar Date: Tue, 18 May 2010 15:02:57 +0000 Subject: [PATCH] catch ACTION_SEND intent to decrypt, allowing k9mail's "Forward (alternate)" feature to send to APG --- AndroidManifest.xml | 6 ++++++ src/org/thialfihar/android/apg/DecryptActivity.java | 13 +++++++++++++ 2 files changed, 19 insertions(+) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index fec178225..03a653c66 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -83,6 +83,12 @@ + + + + + + diff --git a/src/org/thialfihar/android/apg/DecryptActivity.java b/src/org/thialfihar/android/apg/DecryptActivity.java index 7e31e5f90..80ad13d5e 100644 --- a/src/org/thialfihar/android/apg/DecryptActivity.java +++ b/src/org/thialfihar/android/apg/DecryptActivity.java @@ -177,6 +177,19 @@ public class DecryptActivity extends BaseActivity { } catch (IOException e) { // ignore, then } + } else if (intent.getAction() != null && intent.getAction().equals(Intent.ACTION_SEND)) { + Bundle extras = intent.getExtras(); + if (extras == null) { + extras = new Bundle(); + } + String data = extras.getString(Intent.EXTRA_TEXT); + if (data != null) { + mMessage.setText(data); + } + mSubject = extras.getString(Intent.EXTRA_SUBJECT); + if (mSubject.startsWith("Fwd: ")) { + mSubject = mSubject.substring(5); + } } else if (intent.getAction() != null && intent.getAction().equals(Apg.Intent.DECRYPT)) { Bundle extras = intent.getExtras(); if (extras == null) {