aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain/src
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2014-04-01 19:00:14 +0200
committerDominik Schürmann <dominik@dominikschuermann.de>2014-04-01 19:00:14 +0200
commitc414dd2fe94575deb157504fb0445df26b02feec (patch)
tree3926569ae5f8f7a62368d7e3679b3d53ad7ca9d7 /OpenPGP-Keychain/src
parent07fdd6363f06b59aeb9206d64ed719a97a87ff99 (diff)
downloadopen-keychain-c414dd2fe94575deb157504fb0445df26b02feec.tar.gz
open-keychain-c414dd2fe94575deb157504fb0445df26b02feec.tar.bz2
open-keychain-c414dd2fe94575deb157504fb0445df26b02feec.zip
Dont show encrypted data before decryption from clipboard
Diffstat (limited to 'OpenPGP-Keychain/src')
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptMessageFragment.java21
1 files changed, 14 insertions, 7 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptMessageFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptMessageFragment.java
index d7a22038d..c7a56449b 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptMessageFragment.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptMessageFragment.java
@@ -47,10 +47,14 @@ import java.util.regex.Matcher;
public class DecryptMessageFragment extends DecryptFragment {
public static final String ARG_CIPHERTEXT = "ciphertext";
+ // view
private EditText mMessage;
private BootstrapButton mDecryptButton;
private BootstrapButton mDecryptFromCLipboardButton;
+ // model
+ private String mCiphertext;
+
/**
* Inflate the layout for this fragment
*/
@@ -64,13 +68,13 @@ public class DecryptMessageFragment extends DecryptFragment {
mDecryptButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
- decryptStart(null);
+ decryptClicked();
}
});
mDecryptFromCLipboardButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
- decryptFromClipboard();
+ decryptFromClipboardClicked();
}
});
@@ -88,7 +92,12 @@ public class DecryptMessageFragment extends DecryptFragment {
}
}
- private void decryptFromClipboard() {
+ private void decryptClicked() {
+ mCiphertext = mMessage.getText().toString();
+ decryptStart(null);
+ }
+
+ private void decryptFromClipboardClicked() {
CharSequence clipboardText = ClipboardReflection.getClipboardText(getActivity());
// only decrypt if clipboard content is available and a pgp message or cleartext signature
@@ -98,8 +107,7 @@ public class DecryptMessageFragment extends DecryptFragment {
matcher = PgpHelper.PGP_CLEARTEXT_SIGNATURE.matcher(clipboardText);
}
if (matcher.matches()) {
- String data = matcher.group(1);
- mMessage.setText(data);
+ mCiphertext = matcher.group(1);
decryptStart(null);
} else {
AppMsg.makeText(getActivity(), R.string.error_invalid_data, AppMsg.STYLE_INFO)
@@ -125,8 +133,7 @@ public class DecryptMessageFragment extends DecryptFragment {
// data
data.putInt(KeychainIntentService.TARGET, KeychainIntentService.TARGET_BYTES);
- String message = mMessage.getText().toString();
- data.putByteArray(KeychainIntentService.DECRYPT_CIPHERTEXT_BYTES, message.getBytes());
+ data.putByteArray(KeychainIntentService.DECRYPT_CIPHERTEXT_BYTES, mCiphertext.getBytes());
data.putString(KeychainIntentService.DECRYPT_PASSPHRASE, passphrase);
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);