|
|
|
@ -161,6 +161,7 @@ import org.jsoup.nodes.Node;
|
|
|
|
|
import org.jsoup.nodes.TextNode;
|
|
|
|
|
import org.jsoup.select.Elements;
|
|
|
|
|
import org.jsoup.select.NodeFilter;
|
|
|
|
|
import org.openintents.openpgp.IOpenPgpService2;
|
|
|
|
|
import org.openintents.openpgp.OpenPgpError;
|
|
|
|
|
import org.openintents.openpgp.util.OpenPgpApi;
|
|
|
|
|
import org.openintents.openpgp.util.OpenPgpServiceConnection;
|
|
|
|
@ -1205,11 +1206,6 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
|
|
|
|
|
tvNoInternetAttachments.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
|
|
final String pkg = Helper.getOpenKeychainPackage(getContext());
|
|
|
|
|
Log.i("PGP binding to " + pkg);
|
|
|
|
|
pgpService = new OpenPgpServiceConnection(getContext(), pkg);
|
|
|
|
|
pgpService.bindToService();
|
|
|
|
|
|
|
|
|
|
return view;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1374,6 +1370,10 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
|
|
|
|
|
state = State.NONE;
|
|
|
|
|
|
|
|
|
|
Runnable load = new Runnable() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
try {
|
|
|
|
|
if (savedInstanceState == null) {
|
|
|
|
|
if (working < 0) {
|
|
|
|
|
Bundle a = getArguments();
|
|
|
|
@ -1410,12 +1410,12 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
setArguments(a);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
draftLoader.execute(this, args, "compose:new");
|
|
|
|
|
draftLoader.execute(FragmentCompose.this, args, "compose:new");
|
|
|
|
|
} else {
|
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
|
args.putString("action", "edit");
|
|
|
|
|
args.putLong("id", working);
|
|
|
|
|
draftLoader.execute(this, args, "compose:edit");
|
|
|
|
|
draftLoader.execute(FragmentCompose.this, args, "compose:edit");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
working = savedInstanceState.getLong("fair:working");
|
|
|
|
@ -1428,8 +1428,28 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
|
args.putString("action", working < 0 ? "new" : "edit");
|
|
|
|
|
args.putLong("id", working);
|
|
|
|
|
draftLoader.execute(this, args, "compose:instance");
|
|
|
|
|
draftLoader.execute(FragmentCompose.this, args, "compose:instance");
|
|
|
|
|
}
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
Log.e(ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
final String pkg = Helper.getOpenKeychainPackage(getContext());
|
|
|
|
|
Log.i("PGP binding to " + pkg);
|
|
|
|
|
pgpService = new OpenPgpServiceConnection(getContext(), pkg, new OpenPgpServiceConnection.OnBound() {
|
|
|
|
|
@Override
|
|
|
|
|
public void onBound(IOpenPgpService2 service) {
|
|
|
|
|
load.run();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onError(Exception e) {
|
|
|
|
|
load.run();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
pgpService.bindToService();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -4623,13 +4643,25 @@ public class FragmentCompose extends FragmentBase {
|
|
|
|
|
data.draft.plain_only = true;
|
|
|
|
|
|
|
|
|
|
// Encryption
|
|
|
|
|
List<Address> recipients = new ArrayList<>();
|
|
|
|
|
if (data.draft.to != null)
|
|
|
|
|
recipients.addAll(Arrays.asList(data.draft.to));
|
|
|
|
|
if (data.draft.cc != null)
|
|
|
|
|
recipients.addAll(Arrays.asList(data.draft.cc));
|
|
|
|
|
if (data.draft.bcc != null)
|
|
|
|
|
recipients.addAll(Arrays.asList(data.draft.bcc));
|
|
|
|
|
|
|
|
|
|
if (EntityMessage.PGP_SIGNONLY.equals(ref.ui_encrypt) ||
|
|
|
|
|
EntityMessage.PGP_SIGNENCRYPT.equals(ref.ui_encrypt)) {
|
|
|
|
|
if (Helper.isOpenKeychainInstalled(context) && selected.sign_key != null)
|
|
|
|
|
if (Helper.isOpenKeychainInstalled(context) &&
|
|
|
|
|
selected.sign_key != null &&
|
|
|
|
|
hasPgpKey(context, recipients))
|
|
|
|
|
data.draft.ui_encrypt = ref.ui_encrypt;
|
|
|
|
|
} else if (EntityMessage.SMIME_SIGNONLY.equals(ref.ui_encrypt) ||
|
|
|
|
|
EntityMessage.SMIME_SIGNENCRYPT.equals(ref.ui_encrypt)) {
|
|
|
|
|
if (ActivityBilling.isPro(context) && selected.sign_key_alias != null)
|
|
|
|
|
if (ActivityBilling.isPro(context) &&
|
|
|
|
|
selected.sign_key_alias != null &&
|
|
|
|
|
hasSmimeKey(context, recipients))
|
|
|
|
|
data.draft.ui_encrypt = ref.ui_encrypt;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|