diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2014-09-13 17:54:10 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2014-09-13 17:54:10 +0200 |
commit | 4c636a1471ac1013574a3d1446549a652c690b47 (patch) | |
tree | 516558a2ef69a535cca365d2478367eb0326cee9 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFileFragment.java | |
parent | 19252380f198555a6650654ab5e2e35905b40203 (diff) | |
download | open-keychain-4c636a1471ac1013574a3d1446549a652c690b47.tar.gz open-keychain-4c636a1471ac1013574a3d1446549a652c690b47.tar.bz2 open-keychain-4c636a1471ac1013574a3d1446549a652c690b47.zip |
introduce OperationResultParcel for PgpDecryptVerify operations (WIP)
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFileFragment.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFileFragment.java | 74 |
1 files changed, 39 insertions, 35 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFileFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFileFragment.java index 845fbfa3b..ec0f68ced 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFileFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFileFragment.java @@ -36,7 +36,7 @@ import android.widget.TextView; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.helper.FileHelper; -import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyResult; +import org.sufficientlysecure.keychain.service.results.DecryptVerifyResult; import org.sufficientlysecure.keychain.service.KeychainIntentService; import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler; import org.sufficientlysecure.keychain.ui.dialog.DeleteFileDialogFragment; @@ -178,19 +178,20 @@ public class DecryptFileFragment extends DecryptFragment { // get returned data bundle Bundle returnData = message.getData(); - PgpDecryptVerifyResult decryptVerifyResult = + DecryptVerifyResult result = returnData.getParcelable(KeychainIntentService.RESULT_DECRYPT_VERIFY_RESULT); - if (PgpDecryptVerifyResult.KEY_PASSHRASE_NEEDED == decryptVerifyResult.getStatus()) { - showPassphraseDialogForFilename(decryptVerifyResult.getKeyIdPassphraseNeeded()); - } else if (PgpDecryptVerifyResult.SYMMETRIC_PASSHRASE_NEEDED == - decryptVerifyResult.getStatus()) { - showPassphraseDialogForFilename(Constants.key.symmetric); - } else { - - // go on... - askForOutputFilename(decryptVerifyResult.getDecryptMetadata().getFilename()); + switch (result.getResult()) { + case DecryptVerifyResult.RESULT_PENDING_ASYM_PASSPHRASE: + showPassphraseDialog(result.getKeyIdPassphraseNeeded()); + return; + case DecryptVerifyResult.RESULT_PENDING_SYM_PASSPHRASE: + showPassphraseDialog(Constants.key.symmetric); + return; } + + // go on... + askForOutputFilename(result.getDecryptMetadata().getFilename()); } } }; @@ -257,35 +258,38 @@ public class DecryptFileFragment extends DecryptFragment { // get returned data bundle Bundle returnData = message.getData(); - PgpDecryptVerifyResult decryptVerifyResult = + DecryptVerifyResult result = returnData.getParcelable(KeychainIntentService.RESULT_DECRYPT_VERIFY_RESULT); - if (PgpDecryptVerifyResult.KEY_PASSHRASE_NEEDED == decryptVerifyResult.getStatus()) { - showPassphraseDialog(decryptVerifyResult.getKeyIdPassphraseNeeded()); - } else if (PgpDecryptVerifyResult.SYMMETRIC_PASSHRASE_NEEDED == - decryptVerifyResult.getStatus()) { - showPassphraseDialog(Constants.key.symmetric); - } else { - // display signature result in activity - onResult(decryptVerifyResult); - - if (mDeleteAfter.isChecked()) { - // Create and show dialog to delete original file - DeleteFileDialogFragment deleteFileDialog = DeleteFileDialogFragment.newInstance(mInputUri); - deleteFileDialog.show(getActivity().getSupportFragmentManager(), "deleteDialog"); - setInputUri(null); - } + switch (result.getResult()) { + case DecryptVerifyResult.RESULT_PENDING_ASYM_PASSPHRASE: + showPassphraseDialog(result.getKeyIdPassphraseNeeded()); + return; + case DecryptVerifyResult.RESULT_PENDING_SYM_PASSPHRASE: + showPassphraseDialog(Constants.key.symmetric); + return; + } - /* - // A future open after decryption feature - if () { - Intent viewFile = new Intent(Intent.ACTION_VIEW); - viewFile.setData(mOutputUri); - startActivity(viewFile); - } - */ + // display signature result in activity + onResult(result); + + if (mDeleteAfter.isChecked()) { + // Create and show dialog to delete original file + DeleteFileDialogFragment deleteFileDialog = DeleteFileDialogFragment.newInstance(mInputUri); + deleteFileDialog.show(getActivity().getSupportFragmentManager(), "deleteDialog"); + setInputUri(null); + } + + /* + // A future open after decryption feature + if () { + Intent viewFile = new Intent(Intent.ACTION_VIEW); + viewFile.setData(mOutputUri); + startActivity(viewFile); } + */ } + } }; |