mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-23 14:41:08 +00:00
Added option to use template name as subject
This commit is contained in:
parent
e0a379ee8d
commit
f674a4b14d
4 changed files with 32 additions and 13 deletions
|
@ -676,7 +676,8 @@ public class EntityRule {
|
|||
|
||||
long iid = jargs.getLong("identity");
|
||||
long aid = jargs.getLong("answer");
|
||||
boolean add_text = jargs.optBoolean("text", true);
|
||||
boolean answer_subject = jargs.optBoolean("answer_subject", false);
|
||||
boolean original_text = jargs.optBoolean("original_text", true);
|
||||
String to = jargs.optString("to");
|
||||
boolean cc = jargs.optBoolean("cc");
|
||||
boolean attachments = jargs.optBoolean("attachments");
|
||||
|
@ -699,6 +700,7 @@ public class EntityRule {
|
|||
throw new IllegalArgumentException("Rule template missing name=" + rule.name);
|
||||
|
||||
answer = new EntityAnswer();
|
||||
answer.name = message.subject;
|
||||
answer.text = "";
|
||||
} else {
|
||||
answer = db.answer().getAnswer(aid);
|
||||
|
@ -749,7 +751,10 @@ public class EntityRule {
|
|||
reply.cc = message.cc;
|
||||
reply.unsubscribe = "mailto:" + identity.email;
|
||||
reply.auto_submitted = true;
|
||||
reply.subject = EntityMessage.getSubject(context, message.language, message.subject, !isReply);
|
||||
reply.subject = EntityMessage.getSubject(context,
|
||||
message.language,
|
||||
answer_subject ? answer.name : message.subject,
|
||||
!isReply);
|
||||
reply.received = new Date().getTime();
|
||||
reply.sender = MessageHelper.getSortKey(reply.from);
|
||||
|
||||
|
@ -760,7 +765,7 @@ public class EntityRule {
|
|||
|
||||
String body = answer.getHtml(message.from);
|
||||
|
||||
if (add_text) {
|
||||
if (original_text) {
|
||||
Document msg = JsoupEx.parse(body);
|
||||
|
||||
Element div = msg.createElement("div");
|
||||
|
|
|
@ -140,7 +140,8 @@ public class FragmentRule extends FragmentBase {
|
|||
private Spinner spIdent;
|
||||
|
||||
private Spinner spAnswer;
|
||||
private CheckBox cbIncludeMessageText;
|
||||
private CheckBox cbAnswerSubject;
|
||||
private CheckBox cbOriginalText;
|
||||
private EditText etTo;
|
||||
private ImageButton ibTo;
|
||||
private CheckBox cbCc;
|
||||
|
@ -291,7 +292,8 @@ public class FragmentRule extends FragmentBase {
|
|||
spIdent = view.findViewById(R.id.spIdent);
|
||||
|
||||
spAnswer = view.findViewById(R.id.spAnswer);
|
||||
cbIncludeMessageText = view.findViewById(R.id.cbIncludeMessageText);
|
||||
cbAnswerSubject = view.findViewById(R.id.cbAnswerSubject);
|
||||
cbOriginalText = view.findViewById(R.id.cbOriginalText);
|
||||
etTo = view.findViewById(R.id.etTo);
|
||||
ibTo = view.findViewById(R.id.ibTo);
|
||||
cbCc = view.findViewById(R.id.cbCc);
|
||||
|
@ -1139,7 +1141,8 @@ public class FragmentRule extends FragmentBase {
|
|||
break;
|
||||
}
|
||||
|
||||
cbIncludeMessageText.setChecked(jaction.optBoolean("text", true));
|
||||
cbAnswerSubject.setChecked(jaction.optBoolean("answer_subject", false));
|
||||
cbOriginalText.setChecked(jaction.optBoolean("original_text", true));
|
||||
|
||||
etTo.setText(jaction.optString("to"));
|
||||
cbCc.setChecked(jaction.optBoolean("cc"));
|
||||
|
@ -1481,7 +1484,8 @@ public class FragmentRule extends FragmentBase {
|
|||
EntityAnswer answer = (EntityAnswer) spAnswer.getSelectedItem();
|
||||
jaction.put("identity", identity == null ? -1 : identity.id);
|
||||
jaction.put("answer", answer == null || answer.id == null ? -1 : answer.id);
|
||||
jaction.put("text", cbIncludeMessageText.isChecked());
|
||||
jaction.put("answer_subject", cbAnswerSubject.isChecked());
|
||||
jaction.put("original_text", cbOriginalText.isChecked());
|
||||
jaction.put("to", etTo.getText().toString().trim());
|
||||
jaction.put("cc", cbCc.isChecked());
|
||||
jaction.put("attachments", cbWithAttachments.isChecked());
|
||||
|
|
|
@ -841,14 +841,23 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/tvAnswerTemplate" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbIncludeMessageText"
|
||||
android:id="@+id/cbAnswerSubject"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:text="@string/title_rule_answer_subject"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/spAnswer" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbOriginalText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_rule_include_message_text"
|
||||
android:text="@string/title_rule_original_text"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/spAnswer" />
|
||||
app:layout_constraintTop_toBottomOf="@id/cbAnswerSubject" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
android:id="@+id/tvTo"
|
||||
|
@ -859,7 +868,7 @@
|
|||
android:text="@string/title_rule_forward_to"
|
||||
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/cbIncludeMessageText" />
|
||||
app:layout_constraintTop_toBottomOf="@id/cbOriginalText" />
|
||||
|
||||
<eu.faircode.email.EditTextPlain
|
||||
android:id="@+id/etTo"
|
||||
|
@ -1075,7 +1084,7 @@
|
|||
android:id="@+id/grpAnswer"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:constraint_referenced_ids="tvAnswerIdentity,spIdent,tvAnswerTemplate,spAnswer,cbIncludeMessageText,tvTo,etTo,ibTo,cbCc,cbWithAttachments,tvAnswerRemark" />
|
||||
app:constraint_referenced_ids="tvAnswerIdentity,spIdent,tvAnswerTemplate,spAnswer,cbAnswerSubject,cbOriginalText,tvTo,etTo,ibTo,cbCc,cbWithAttachments,tvAnswerRemark" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/grpTts"
|
||||
|
|
|
@ -1545,7 +1545,8 @@
|
|||
<string name="title_rule_thread">All messages in same conversation and folder</string>
|
||||
<string name="title_rule_identity">Identity</string>
|
||||
<string name="title_rule_template">Reply template</string>
|
||||
<string name="title_rule_include_message_text">Include message text</string>
|
||||
<string name="title_rule_answer_subject">Use template name as subject</string>
|
||||
<string name="title_rule_original_text">Include original message text</string>
|
||||
<string name="title_rule_forward_to">Forward to</string>
|
||||
<string name="title_rule_cc">Reply to CC addresses</string>
|
||||
<string name="title_rule_with_attachments">With attachments</string>
|
||||
|
|
Loading…
Reference in a new issue