From 0b8475223c556b956326d9c0f81b0a436c0f41b5 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 6 Dec 2018 17:28:51 +0100 Subject: [PATCH] Prevent deleting folders with pending operations --- app/src/main/java/eu/faircode/email/FragmentFolder.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/FragmentFolder.java b/app/src/main/java/eu/faircode/email/FragmentFolder.java index 9d29f9a2eb..bf63370e3b 100644 --- a/app/src/main/java/eu/faircode/email/FragmentFolder.java +++ b/app/src/main/java/eu/faircode/email/FragmentFolder.java @@ -272,6 +272,11 @@ public class FragmentFolder extends FragmentEx { long id = args.getLong("id"); DB db = DB.getInstance(getContext()); + int count = db.operation().getOperationCount(id, null); + if (count > 0) + throw new IllegalArgumentException( + getResources().getQuantityString( + R.plurals.title_notification_operations, count, count)); db.folder().setFolderTbd(id); ServiceSynchronize.reload(getContext(), "delete folder");