Added deletion of send operations

This commit is contained in:
M66B 2024-04-29 11:26:22 +02:00
parent 4995900afc
commit caab02b0d6
3 changed files with 35 additions and 0 deletions

View File

@ -46,6 +46,7 @@ public class FragmentDialogOperationsDelete extends FragmentDialogBase {
final CheckBox cbMove = dview.findViewById(R.id.cbMove);
final CheckBox cbFlag = dview.findViewById(R.id.cbFlag);
final CheckBox cbDelete = dview.findViewById(R.id.cbDelete);
final CheckBox cbSend = dview.findViewById(R.id.cbSend);
return new AlertDialog.Builder(context)
.setView(dview)
@ -58,6 +59,7 @@ public class FragmentDialogOperationsDelete extends FragmentDialogBase {
args.putBoolean("move", cbMove.isChecked());
args.putBoolean("flag", cbFlag.isChecked());
args.putBoolean("delete", cbDelete.isChecked());
args.putBoolean("send", cbSend.isChecked());
new SimpleTask<Integer>() {
private Toast toast = null;
@ -81,6 +83,7 @@ public class FragmentDialogOperationsDelete extends FragmentDialogBase {
boolean move = args.getBoolean("move");
boolean flag = args.getBoolean("flag");
boolean delete = args.getBoolean("delete");
boolean send = args.getBoolean("send");
int deleted = 0;
DB db = DB.getInstance(context);
@ -143,6 +146,14 @@ public class FragmentDialogOperationsDelete extends FragmentDialogBase {
db.endTransaction();
}
if (send) {
List<EntityOperation> ops = db.operation().getOperations(EntityOperation.SEND);
for (EntityOperation op : ops) {
ActivityCompose.undoSend(op.message, context);
deleted++;
}
}
if (deleted > 0)
ServiceSynchronize.reload(context, null, true, "deleted operations");

View File

@ -124,5 +124,28 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbDelete" />
<CheckBox
android:id="@+id/cbSend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_delete_operation_send"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDelete" />
<TextView
android:id="@+id/tvSend"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="48dp"
android:fontFamily="monospace"
android:text="SEND"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textSize="12sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbSend" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

View File

@ -1379,6 +1379,7 @@
<string name="title_delete_operation_move">Move operations</string>
<string name="title_delete_operation_flag">Flag operations</string>
<string name="title_delete_operation_delete">Delete operations</string>
<string name="title_delete_operation_send">Send operations</string>
<string name="title_delete_operation_deleted">%1$d operations deleted</string>
<string name="title_delete_contacts">Delete all local contacts?</string>
<string name="title_delete_contacts_remark">All contacts shown and not shown will be deleted, even if searched!</string>