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 String compose_font;
private boolean dsn = true;
private Integer encrypt = null;
private boolean media = true;
private boolean compact = false;
@ -1586,8 +1587,8 @@ public class FragmentCompose extends FragmentBase {
ImageButton ib = v.findViewById(R.id.button);
TextView tv = v.findViewById(R.id.text);
v.setAlpha(state == State.LOADED ? 1f : Helper.LOW_LIGHT);
ib.setEnabled(state == State.LOADED);
v.setAlpha(state == State.LOADED && !dsn ? 1f : Helper.LOW_LIGHT);
ib.setEnabled(state == State.LOADED && !dsn);
if (EntityMessage.PGP_SIGNONLY.equals(encrypt) || EntityMessage.SMIME_SIGNONLY.equals(encrypt)) {
ib.setImageResource(R.drawable.twotone_gesture_24);
@ -4267,6 +4268,7 @@ public class FragmentCompose extends FragmentBase {
EntityLog.log(context, "Selected=" + selected.email);
if (!"dsn".equals(action)) {
if (plain_only &&
!"resend".equals(action) &&
!"editasnew".equals(action))
@ -4282,6 +4284,7 @@ public class FragmentCompose extends FragmentBase {
data.draft.ui_encrypt = EntityMessage.PGP_SIGNONLY;
else
data.draft.ui_encrypt = EntityMessage.SMIME_SIGNONLY;
}
if (receipt_default)
data.draft.receipt_request = true;
@ -4519,6 +4522,7 @@ public class FragmentCompose extends FragmentBase {
} else if ("participation".equals(action))
data.draft.subject = status + ": " + ref.subject;
if (!"dsn".equals(action)) {
// Sensitivity
data.draft.sensitivity = ref.sensitivity;
@ -4548,6 +4552,7 @@ public class FragmentCompose extends FragmentBase {
hasSmimeKey(context, recipients))
data.draft.ui_encrypt = ref.ui_encrypt;
}
}
// Reply template
EntityAnswer a = null;
@ -4970,6 +4975,7 @@ public class FragmentCompose extends FragmentBase {
}
working = data.draft.id;
dsn = (data.draft.dsn != null && !EntityMessage.DSN_NONE.equals(data.draft.dsn));
encrypt = data.draft.ui_encrypt;
invalidateOptionsMenu();
@ -5767,8 +5773,10 @@ public class FragmentCompose extends FragmentBase {
args.putBoolean("remind_external", external);
}
if (draft.ui_encrypt == null ||
EntityMessage.ENCRYPT_NONE.equals(draft.ui_encrypt)) {
if ((draft.dsn == null ||
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_smime", hasSmimeKey(context, recipients));
}
@ -6866,7 +6874,6 @@ public class FragmentCompose extends FragmentBase {
final Spinner spEncrypt = dview.findViewById(R.id.spEncrypt);
final ImageButton ibEncryption = dview.findViewById(R.id.ibEncryption);
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 ImageButton ibSensitivity = dview.findViewById(R.id.ibSensitivity);
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() {
@Override
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);
if (message.dsn == null || EntityMessage.DSN_NONE.equals(message.dsn)) {
if (message.from != null && message.from.length > 0)
for (EntityAttachment attachment : attachments)
if (EntityAttachment.PGP_KEY.equals(attachment.encryption)) {
@ -710,6 +711,7 @@ public class MessageHelper {
Log.w(msg);
throw new IllegalArgumentException(msg);
}
}
build(context, message, attachments, identity, send, imessage);

@ -387,25 +387,10 @@
android:layout_height="wrap_content"
android:layout_marginEnd="12dp"
android:entries="@array/priorityNames"
app:layout_constraintEnd_toStartOf="@id/ibPriority"
app:layout_constraintEnd_toStartOf="@id/ibSensitivity"
app:layout_constraintStart_toStartOf="parent"
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
android:id="@+id/tvSensitivity"
android:layout_width="0dp"
@ -524,6 +509,8 @@
android:layout_height="0dp"
app:constraint_referenced_ids="
cbPlainOnly,cbReceipt,
tvEncrypt,spEncrypt,ibEncryption" />
tvEncrypt,spEncrypt,ibEncryption,
tvPriority,spPriority,
tvSensitivity,spSensitivity,ibSensitivity" />
</androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ScrollViewEx>
Loading…
Cancel
Save