Added reply CC rule parameter

This commit is contained in:
M66B 2019-02-18 09:19:12 +00:00
parent 9b7d108ccc
commit f3aaeca24c
4 changed files with 24 additions and 2 deletions

View File

@ -194,6 +194,7 @@ public class EntityRule {
private void onActionAnswer(Context context, DB db, EntityMessage message, JSONObject jargs) throws JSONException, IOException {
long iid = jargs.getLong("identity");
long aid = jargs.getLong("answer");
boolean cc = (jargs.has("cc") && jargs.getBoolean("cc"));
EntityIdentity identity = db.identity().getIdentity(iid);
if (identity == null)
@ -213,6 +214,8 @@ public class EntityRule {
reply.thread = message.thread;
reply.to = (message.reply == null || message.reply.length == 0 ? message.from : message.reply);
reply.from = new InternetAddress[]{new InternetAddress(identity.email, identity.name)};
if (cc)
reply.cc = message.cc;
reply.subject = context.getString(R.string.title_subject_reply, message.subject == null ? "" : message.subject);
reply.sender = MessageHelper.getSortKey(reply.from);
reply.received = new Date().getTime();

View File

@ -78,6 +78,7 @@ public class FragmentRule extends FragmentBase {
private Spinner spTarget;
private Spinner spIdent;
private Spinner spAnswer;
private CheckBox cbCc;
private BottomNavigationView bottom_navigation;
private ContentLoadingProgressBar pbWait;
private Group grpReady;
@ -128,6 +129,7 @@ public class FragmentRule extends FragmentBase {
spTarget = view.findViewById(R.id.spTarget);
spIdent = view.findViewById(R.id.spIdent);
spAnswer = view.findViewById(R.id.spAnswer);
cbCc = view.findViewById(R.id.cbCc);
bottom_navigation = view.findViewById(R.id.bottom_navigation);
pbWait = view.findViewById(R.id.pbWait);
grpReady = view.findViewById(R.id.grpReady);
@ -378,6 +380,9 @@ public class FragmentRule extends FragmentBase {
spAnswer.setSelection(pos);
break;
}
boolean cc = (jaction.has("cc") && jaction.getBoolean("cc"));
cbCc.setChecked(cc);
break;
}
@ -601,8 +606,10 @@ public class FragmentRule extends FragmentBase {
case EntityRule.TYPE_ANSWER:
EntityIdentity identity = (EntityIdentity) spIdent.getSelectedItem();
EntityAnswer answer = (EntityAnswer) spAnswer.getSelectedItem();
boolean cc = cbCc.isChecked();
jaction.put("identity", identity.id);
jaction.put("answer", answer.id);
jaction.put("cc", cc);
break;
}
}

View File

@ -334,6 +334,15 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvAnswerTemplate" />
<CheckBox
android:id="@+id/cbCc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_rule_cc"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/spAnswer" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpReady"
android:layout_width="0dp"
@ -350,13 +359,15 @@
android:id="@+id/grpMove"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="tvMoveTarget,spTarget" />
app:constraint_referenced_ids="
tvMoveTarget,spTarget" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpAnswer"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="tvAnswerIdentity,spIdent,tvAnswerTemplate,spAnswer" />
app:constraint_referenced_ids="
tvAnswerIdentity,spIdent,tvAnswerTemplate,spAnswer,cbCc" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

View File

@ -436,6 +436,7 @@
<string name="title_rule_folder">Folder</string>
<string name="title_rule_identity">Identity</string>
<string name="title_rule_answer">Reply template</string>
<string name="title_rule_cc">Reply to CC addresses</string>
<string name="title_rule_name_missing">Rule name missing</string>
<string name="title_rule_condition_missing">Condition missing</string>