From 7826dce5269cf0da753acdd301c125252cd8f0c0 Mon Sep 17 00:00:00 2001 From: Matthew Wong Date: Sat, 2 Jul 2016 13:36:27 -0400 Subject: [PATCH] Only clear the clipboard if we automatically copied the password to it --- .../com/zeapo/pwdstore/crypto/PgpHandler.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java index dc4d55e3..399564a1 100644 --- a/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java +++ b/app/src/main/java/com/zeapo/pwdstore/crypto/PgpHandler.java @@ -312,12 +312,15 @@ public class PgpHandler extends AppCompatActivity implements OpenPgpServiceConne @Override protected void onPostExecute(Boolean b) { - ClipData clip = ClipData.newPlainText("pgp_handler_result_pm", "MyPasswordIsDaBest!"); - clipboard.setPrimaryClip(clip); - if (settings.getBoolean("clear_clipboard_20x", false)) { - for (int i = 0; i < 19; i++) { - clip = ClipData.newPlainText(String.valueOf(i), String.valueOf(i)); - clipboard.setPrimaryClip(clip); + // only clear the clipboard if we automatically copied the password to it + if (settings.getBoolean("copy_on_decrypt", true)) { + ClipData clip = ClipData.newPlainText("pgp_handler_result_pm", "MyPasswordIsDaBest!"); + clipboard.setPrimaryClip(clip); + if (settings.getBoolean("clear_clipboard_20x", false)) { + for (int i = 0; i < 19; i++) { + clip = ClipData.newPlainText(String.valueOf(i), String.valueOf(i)); + clipboard.setPrimaryClip(clip); + } } } if (showPassword && findViewById(R.id.crypto_password_show) != null) {