Skip encryption, etc for DSNs

pull/194/merge
M66B 3 years ago
parent 679c15017f
commit ea8223e047

@ -274,6 +274,7 @@ public class FragmentCompose extends FragmentBase {
private boolean monospaced = false; private boolean monospaced = false;
private String compose_font; private String compose_font;
private boolean dsn = true;
private Integer encrypt = null; private Integer encrypt = null;
private boolean media = true; private boolean media = true;
private boolean compact = false; private boolean compact = false;
@ -1586,8 +1587,8 @@ public class FragmentCompose extends FragmentBase {
ImageButton ib = v.findViewById(R.id.button); ImageButton ib = v.findViewById(R.id.button);
TextView tv = v.findViewById(R.id.text); TextView tv = v.findViewById(R.id.text);
v.setAlpha(state == State.LOADED ? 1f : Helper.LOW_LIGHT); v.setAlpha(state == State.LOADED && !dsn ? 1f : Helper.LOW_LIGHT);
ib.setEnabled(state == State.LOADED); ib.setEnabled(state == State.LOADED && !dsn);
if (EntityMessage.PGP_SIGNONLY.equals(encrypt) || EntityMessage.SMIME_SIGNONLY.equals(encrypt)) { if (EntityMessage.PGP_SIGNONLY.equals(encrypt) || EntityMessage.SMIME_SIGNONLY.equals(encrypt)) {
ib.setImageResource(R.drawable.twotone_gesture_24); ib.setImageResource(R.drawable.twotone_gesture_24);
@ -4267,6 +4268,7 @@ public class FragmentCompose extends FragmentBase {
EntityLog.log(context, "Selected=" + selected.email); EntityLog.log(context, "Selected=" + selected.email);
if (!"dsn".equals(action)) {
if (plain_only && if (plain_only &&
!"resend".equals(action) && !"resend".equals(action) &&
!"editasnew".equals(action)) !"editasnew".equals(action))
@ -4282,6 +4284,7 @@ public class FragmentCompose extends FragmentBase {
data.draft.ui_encrypt = EntityMessage.PGP_SIGNONLY; data.draft.ui_encrypt = EntityMessage.PGP_SIGNONLY;
else else
data.draft.ui_encrypt = EntityMessage.SMIME_SIGNONLY; data.draft.ui_encrypt = EntityMessage.SMIME_SIGNONLY;
}
if (receipt_default) if (receipt_default)
data.draft.receipt_request = true; data.draft.receipt_request = true;
@ -4519,6 +4522,7 @@ public class FragmentCompose extends FragmentBase {
} else if ("participation".equals(action)) } else if ("participation".equals(action))
data.draft.subject = status + ": " + ref.subject; data.draft.subject = status + ": " + ref.subject;
if (!"dsn".equals(action)) {
// Sensitivity // Sensitivity
data.draft.sensitivity = ref.sensitivity; data.draft.sensitivity = ref.sensitivity;
@ -4548,6 +4552,7 @@ public class FragmentCompose extends FragmentBase {
hasSmimeKey(context, recipients)) hasSmimeKey(context, recipients))
data.draft.ui_encrypt = ref.ui_encrypt; data.draft.ui_encrypt = ref.ui_encrypt;
} }
}
// Reply template // Reply template
EntityAnswer a = null; EntityAnswer a = null;
@ -4970,6 +4975,7 @@ public class FragmentCompose extends FragmentBase {
} }
working = data.draft.id; working = data.draft.id;
dsn = (data.draft.dsn != null && !EntityMessage.DSN_NONE.equals(data.draft.dsn));
encrypt = data.draft.ui_encrypt; encrypt = data.draft.ui_encrypt;
invalidateOptionsMenu(); invalidateOptionsMenu();
@ -5767,8 +5773,10 @@ public class FragmentCompose extends FragmentBase {
args.putBoolean("remind_external", external); args.putBoolean("remind_external", external);
} }
if (draft.ui_encrypt == null || if ((draft.dsn == null ||
EntityMessage.ENCRYPT_NONE.equals(draft.ui_encrypt)) { EntityMessage.DSN_NONE.equals(draft.dsn)) &&
(draft.ui_encrypt == null ||
EntityMessage.ENCRYPT_NONE.equals(draft.ui_encrypt))) {
args.putBoolean("remind_pgp", hasPgpKey(context, recipients)); args.putBoolean("remind_pgp", hasPgpKey(context, recipients));
args.putBoolean("remind_smime", hasSmimeKey(context, recipients)); args.putBoolean("remind_smime", hasSmimeKey(context, recipients));
} }
@ -6866,7 +6874,6 @@ public class FragmentCompose extends FragmentBase {
final Spinner spEncrypt = dview.findViewById(R.id.spEncrypt); final Spinner spEncrypt = dview.findViewById(R.id.spEncrypt);
final ImageButton ibEncryption = dview.findViewById(R.id.ibEncryption); final ImageButton ibEncryption = dview.findViewById(R.id.ibEncryption);
final Spinner spPriority = dview.findViewById(R.id.spPriority); final Spinner spPriority = dview.findViewById(R.id.spPriority);
final ImageButton ibPriority = dview.findViewById(R.id.ibPriority);
final Spinner spSensitivity = dview.findViewById(R.id.spSensitivity); final Spinner spSensitivity = dview.findViewById(R.id.spSensitivity);
final ImageButton ibSensitivity = dview.findViewById(R.id.ibSensitivity); final ImageButton ibSensitivity = dview.findViewById(R.id.ibSensitivity);
final TextView tvSendAt = dview.findViewById(R.id.tvSendAt); final TextView tvSendAt = dview.findViewById(R.id.tvSendAt);
@ -7131,13 +7138,6 @@ public class FragmentCompose extends FragmentBase {
} }
}); });
ibPriority.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// Invisible
}
});
spSensitivity.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { spSensitivity.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override @Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

@ -489,6 +489,7 @@ public class MessageHelper {
List<EntityAttachment> attachments = db.attachment().getAttachments(message.id); List<EntityAttachment> attachments = db.attachment().getAttachments(message.id);
if (message.dsn == null || EntityMessage.DSN_NONE.equals(message.dsn)) {
if (message.from != null && message.from.length > 0) if (message.from != null && message.from.length > 0)
for (EntityAttachment attachment : attachments) for (EntityAttachment attachment : attachments)
if (EntityAttachment.PGP_KEY.equals(attachment.encryption)) { if (EntityAttachment.PGP_KEY.equals(attachment.encryption)) {
@ -710,6 +711,7 @@ public class MessageHelper {
Log.w(msg); Log.w(msg);
throw new IllegalArgumentException(msg); throw new IllegalArgumentException(msg);
} }
}
build(context, message, attachments, identity, send, imessage); build(context, message, attachments, identity, send, imessage);

@ -387,25 +387,10 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="12dp" android:layout_marginEnd="12dp"
android:entries="@array/priorityNames" android:entries="@array/priorityNames"
app:layout_constraintEnd_toStartOf="@id/ibPriority" app:layout_constraintEnd_toStartOf="@id/ibSensitivity"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvPriority" /> app:layout_constraintTop_toBottomOf="@id/tvPriority" />
<eu.faircode.email.FixedImageButton
android:id="@+id/ibPriority"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_info"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_info"
android:visibility="invisible"
app:layout_constraintBottom_toBottomOf="@+id/spPriority"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@drawable/twotone_info_24"
app:tint="?attr/colorAccent" />
<eu.faircode.email.FixedTextView <eu.faircode.email.FixedTextView
android:id="@+id/tvSensitivity" android:id="@+id/tvSensitivity"
android:layout_width="0dp" android:layout_width="0dp"
@ -524,6 +509,8 @@
android:layout_height="0dp" android:layout_height="0dp"
app:constraint_referenced_ids=" app:constraint_referenced_ids="
cbPlainOnly,cbReceipt, cbPlainOnly,cbReceipt,
tvEncrypt,spEncrypt,ibEncryption" /> tvEncrypt,spEncrypt,ibEncryption,
tvPriority,spPriority,
tvSensitivity,spSensitivity,ibSensitivity" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ScrollViewEx> </eu.faircode.email.ScrollViewEx>
Loading…
Cancel
Save