Trying a fix for #585

This commit is contained in:
Dominik Schürmann 2014-04-19 14:47:19 +02:00
parent 7ee4a44afa
commit b22cf763c4
4 changed files with 20 additions and 16 deletions

View File

@ -307,7 +307,6 @@ public class EncryptFileFragment extends Fragment {
int compressionId = ((Choice) mFileCompression.getSelectedItem()).getId();
data.putInt(KeychainIntentService.ENCRYPT_COMPRESSION_ID, compressionId);
// data.putBoolean(KeychainIntentService.ENCRYPT_GENERATE_SIGNATURE, mGenerateSignature);
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);

View File

@ -208,7 +208,6 @@ public class EncryptMessageFragment extends Fragment {
int compressionId = Preferences.getPreferences(getActivity()).getDefaultMessageCompression();
data.putInt(KeychainIntentService.ENCRYPT_COMPRESSION_ID, compressionId);
// data.putBoolean(KeychainIntentService.ENCRYPT_GENERATE_SIGNATURE, mGenerateSignature);
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);

View File

@ -48,6 +48,7 @@ import org.spongycastle.openpgp.operator.PBESecretKeyDecryptor;
import org.spongycastle.openpgp.operator.jcajce.JcePBESecretKeyDecryptorBuilder;
import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.compatibility.DialogFragmentWorkaround;
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
import org.sufficientlysecure.keychain.provider.KeychainContract;
@ -73,21 +74,25 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
* encryption. Based on mSecretKeyId it asks for a passphrase to open a private key or it asks
* for a symmetric passphrase
*/
public static void show(FragmentActivity context, long keyId, Handler returnHandler) {
public static void show(final FragmentActivity context, final long keyId, final Handler returnHandler) {
// Create a new Messenger for the communication back
Messenger messenger = new Messenger(returnHandler);
final Messenger messenger = new Messenger(returnHandler);
DialogFragmentWorkaround.INTERFACE.runnableRunDelayed(new Runnable() {
public void run() {
try {
PassphraseDialogFragment passphraseDialog = PassphraseDialogFragment.newInstance(context,
messenger, keyId);
passphraseDialog.show(context.getSupportFragmentManager(), "passphraseDialog");
} catch (PgpGeneralException e) {
Log.d(Constants.TAG, "No passphrase for this secret key, encrypt directly!");
Log.d(Constants.TAG, "No passphrase for this secret key!");
// send message to handler to start encryption directly
returnHandler.sendEmptyMessage(PassphraseDialogFragment.MESSAGE_OKAY);
}
}
});
}
/**
* Creates new instance of this dialog fragment
@ -201,7 +206,8 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor
try {
clickSecretKey = PgpKeyHelper.getKeyNum(new ProviderHelper(activity)
.getPGPSecretKeyRingWithKeyId(secretKeyId),
curKeyIndex);
curKeyIndex
);
} catch (ProviderHelper.NotFoundException e) {
Log.e(Constants.TAG, "key not found!", e);
}

View File

@ -280,7 +280,7 @@
<!-- errors without preceeding Error: -->
<string name="error_only_files_are_supported">Direct binary data without actual file in filesystem is not supported.</string>
<string name="error_jelly_bean_needed">You need Android 4.1 to use Android's NFC Beam feature!</string>
<string name="error_jelly_bean_needed">You need Android 4.1 to use Android\'s NFC Beam feature!</string>
<string name="error_nfc_needed">NFC is not available on your device!</string>
<string name="error_nothing_import">Nothing to import!</string>
<string name="error_keyserver_insufficient_query">Insufficient server query</string>