mirror of https://github.com/M66B/FairEmail.git
Added extended reply header
This commit is contained in:
parent
772698cf2b
commit
0f6b2b316a
|
@ -2520,11 +2520,38 @@ public class FragmentCompose extends FragmentBase {
|
||||||
if ("reply".equals(action) || "reply_all".equals(action))
|
if ("reply".equals(action) || "reply_all".equals(action))
|
||||||
refText = "<blockquote>" + refText + "</blockquote>";
|
refText = "<blockquote>" + refText + "</blockquote>";
|
||||||
|
|
||||||
String refBody = String.format("<p>%s %s:</p>\n%s",
|
// Build reply header
|
||||||
Html.escapeHtml(new Date(ref.received).toString()),
|
StringBuilder sb = new StringBuilder();
|
||||||
Html.escapeHtml(MessageHelper.formatAddresses(ref.from)),
|
boolean extended_reply = prefs.getBoolean("extended_reply", false);
|
||||||
refText);
|
if (extended_reply) {
|
||||||
Helper.writeText(data.draft.getRefFile(context), refBody);
|
sb.append("<p>");
|
||||||
|
if (ref.from != null && ref.from.length > 0)
|
||||||
|
sb.append("<strong>").append(context.getString(R.string.title_from)).append("</strong> ")
|
||||||
|
.append(Html.escapeHtml(MessageHelper.formatAddresses(ref.from)))
|
||||||
|
.append("<br>\n");
|
||||||
|
if (ref.to != null && ref.to.length > 0)
|
||||||
|
sb.append("<strong>").append(context.getString(R.string.title_to)).append("</strong> ")
|
||||||
|
.append(Html.escapeHtml(MessageHelper.formatAddresses(ref.to))).
|
||||||
|
append("<br>\n");
|
||||||
|
if (ref.cc != null && ref.cc.length > 0)
|
||||||
|
sb.append("<strong>").append(context.getString(R.string.title_cc)).append("</strong> ")
|
||||||
|
.append(Html.escapeHtml(MessageHelper.formatAddresses(ref.cc)))
|
||||||
|
.append("<br>\n");
|
||||||
|
sb.append("<strong>").append(context.getString(R.string.title_received)).append("</strong> ")
|
||||||
|
.append(Html.escapeHtml(new Date(ref.received).toString()))
|
||||||
|
.append("<br>\n");
|
||||||
|
sb.append("<strong>").append(context.getString(R.string.title_subject)).append("</strong> ")
|
||||||
|
.append(Html.escapeHtml(ref.subject == null ? "" : ref.subject));
|
||||||
|
sb.append("</p>\n");
|
||||||
|
} else {
|
||||||
|
sb.append("<p>");
|
||||||
|
sb.append(Html.escapeHtml(new Date(ref.received).toString())).append(" ");
|
||||||
|
sb.append(Html.escapeHtml(MessageHelper.formatAddresses(ref.from))).append(":");
|
||||||
|
sb.append("</p>\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.append(refText);
|
||||||
|
Helper.writeText(data.draft.getRefFile(context), sb.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ("new".equals(action)) {
|
if ("new".equals(action)) {
|
||||||
|
|
|
@ -48,6 +48,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
||||||
private SwitchCompat swSuggestReceived;
|
private SwitchCompat swSuggestReceived;
|
||||||
private Button btnLocalContacts;
|
private Button btnLocalContacts;
|
||||||
private SwitchCompat swPrefixOnce;
|
private SwitchCompat swPrefixOnce;
|
||||||
|
private SwitchCompat swExtendedReply;
|
||||||
private SwitchCompat swPlainOnly;
|
private SwitchCompat swPlainOnly;
|
||||||
private SwitchCompat swUsenetSignature;
|
private SwitchCompat swUsenetSignature;
|
||||||
private SwitchCompat swAutoResize;
|
private SwitchCompat swAutoResize;
|
||||||
|
@ -59,7 +60,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
||||||
private Spinner spSendDelayed;
|
private Spinner spSendDelayed;
|
||||||
|
|
||||||
private final static String[] RESET_OPTIONS = new String[]{
|
private final static String[] RESET_OPTIONS = new String[]{
|
||||||
"keyboard", "suggest_sent", "suggested_received", "prefix_once", "plain_only", "usenet_signature",
|
"keyboard", "suggest_sent", "suggested_received", "prefix_once", "extended_reply", "plain_only", "usenet_signature",
|
||||||
"autoresize", "encrypt_default", "receipt_default", "resize", "lookup_mx", "send_delayed"
|
"autoresize", "encrypt_default", "receipt_default", "resize", "lookup_mx", "send_delayed"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -78,6 +79,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
||||||
swSuggestReceived = view.findViewById(R.id.swSuggestReceived);
|
swSuggestReceived = view.findViewById(R.id.swSuggestReceived);
|
||||||
btnLocalContacts = view.findViewById(R.id.btnLocalContacts);
|
btnLocalContacts = view.findViewById(R.id.btnLocalContacts);
|
||||||
swPrefixOnce = view.findViewById(R.id.swPrefixOnce);
|
swPrefixOnce = view.findViewById(R.id.swPrefixOnce);
|
||||||
|
swExtendedReply = view.findViewById(R.id.swExtendedReply);
|
||||||
swPlainOnly = view.findViewById(R.id.swPlainOnly);
|
swPlainOnly = view.findViewById(R.id.swPlainOnly);
|
||||||
swUsenetSignature = view.findViewById(R.id.swUsenetSignature);
|
swUsenetSignature = view.findViewById(R.id.swUsenetSignature);
|
||||||
swAutoResize = view.findViewById(R.id.swAutoResize);
|
swAutoResize = view.findViewById(R.id.swAutoResize);
|
||||||
|
@ -130,6 +132,13 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
swExtendedReply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||||
|
prefs.edit().putBoolean("extended_reply", checked).apply();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
swPlainOnly.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
swPlainOnly.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||||
|
@ -250,6 +259,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
||||||
swSuggestSent.setChecked(prefs.getBoolean("suggest_sent", false));
|
swSuggestSent.setChecked(prefs.getBoolean("suggest_sent", false));
|
||||||
swSuggestReceived.setChecked(prefs.getBoolean("suggest_received", false));
|
swSuggestReceived.setChecked(prefs.getBoolean("suggest_received", false));
|
||||||
swPrefixOnce.setChecked(prefs.getBoolean("prefix_once", true));
|
swPrefixOnce.setChecked(prefs.getBoolean("prefix_once", true));
|
||||||
|
swExtendedReply.setChecked(prefs.getBoolean("extended_reply", false));
|
||||||
swPlainOnly.setChecked(prefs.getBoolean("plain_only", false));
|
swPlainOnly.setChecked(prefs.getBoolean("plain_only", false));
|
||||||
swUsenetSignature.setChecked(prefs.getBoolean("usenet_signature", false));
|
swUsenetSignature.setChecked(prefs.getBoolean("usenet_signature", false));
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,17 @@
|
||||||
app:layout_constraintTop_toBottomOf="@id/btnLocalContacts"
|
app:layout_constraintTop_toBottomOf="@id/btnLocalContacts"
|
||||||
app:switchPadding="12dp" />
|
app:switchPadding="12dp" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
|
android:id="@+id/swExtendedReply"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:text="@string/title_advanced_extended_reply"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/swPrefixOnce"
|
||||||
|
app:switchPadding="12dp" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
android:id="@+id/swPlainOnly"
|
android:id="@+id/swPlainOnly"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -116,7 +127,7 @@
|
||||||
android:text="@string/title_advanced_plain_only"
|
android:text="@string/title_advanced_plain_only"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/swPrefixOnce"
|
app:layout_constraintTop_toBottomOf="@id/swExtendedReply"
|
||||||
app:switchPadding="12dp" />
|
app:switchPadding="12dp" />
|
||||||
|
|
||||||
<androidx.appcompat.widget.SwitchCompat
|
<androidx.appcompat.widget.SwitchCompat
|
||||||
|
|
|
@ -229,6 +229,7 @@
|
||||||
<string name="title_advanced_suggest_sent">Suggest addresses found in sent messages</string>
|
<string name="title_advanced_suggest_sent">Suggest addresses found in sent messages</string>
|
||||||
<string name="title_advanced_suggest_received">Suggest addresses found in received messages</string>
|
<string name="title_advanced_suggest_received">Suggest addresses found in received messages</string>
|
||||||
<string name="title_advanced_prefix_once">Prefix subject only once on replying or forwarding</string>
|
<string name="title_advanced_prefix_once">Prefix subject only once on replying or forwarding</string>
|
||||||
|
<string name="title_advanced_extended_reply">Use extended reply header</string>
|
||||||
<string name="title_advanced_plain_only">Send plain text only by default</string>
|
<string name="title_advanced_plain_only">Send plain text only by default</string>
|
||||||
<string name="title_advanced_usenet_signature">Usenet signature convention</string>
|
<string name="title_advanced_usenet_signature">Usenet signature convention</string>
|
||||||
<string name="title_advanced_autoresize">Automatically resize attached and embedded images</string>
|
<string name="title_advanced_autoresize">Automatically resize attached and embedded images</string>
|
||||||
|
|
Loading…
Reference in New Issue