From 161f96dc05b0d40ce4e892f436e816c4e785729e Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 21 Apr 2025 11:56:53 +0200 Subject: [PATCH] Prevent deleting folders with children --- FAQ.md | 2 +- app/src/main/java/eu/faircode/email/AdapterFolder.java | 3 ++- app/src/main/java/eu/faircode/email/FragmentFolder.java | 7 ++++++- index.html | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/FAQ.md b/FAQ.md index 0ebb70a9c1..ea190bc3f4 100644 --- a/FAQ.md +++ b/FAQ.md @@ -109,7 +109,7 @@ Related questions: * Load more messages: long press a folder in the folder list, select *Fetch more messages* * Delete a message, skipping trash: long press the trash icon * Delete an account/identity: (Main) Settings, tap Manual setup, tap Accounts/Identities, tap the account/identity, tap the trash icon in the top right corner -* Delete a folder: long press the folder in the folder list, Edit properties, tap the trash icon in the top right corner +* Delete a folder: long press the folder in the folder list, Edit properties, tap the trash icon in the top right corner. Note that you can't delete folders which still have sub folders. * Undo send: Outbox, swipe the message in the list left or right * Delete a contact: please [see this FAQ](#faq171) * Store sent messages in the inbox: please [see this FAQ](#faq142) diff --git a/app/src/main/java/eu/faircode/email/AdapterFolder.java b/app/src/main/java/eu/faircode/email/AdapterFolder.java index 08995f761c..ffde2ebd16 100644 --- a/app/src/main/java/eu/faircode/email/AdapterFolder.java +++ b/app/src/main/java/eu/faircode/email/AdapterFolder.java @@ -730,7 +730,8 @@ public class AdapterFolder extends RecyclerView.Adapter children = db.folder().getChildFolders(id); + args.putBoolean("children", (children != null && !children.isEmpty())); + if (folder != null) { EntityAccount account = db.account().getAccount(folder.account); if (account != null) { @@ -377,7 +381,8 @@ public class FragmentFolder extends FragmentBase { deletable = (folder != null && !folder.read_only && - EntityFolder.USER.equals(folder.type)); + EntityFolder.USER.equals(folder.type) && + !args.getBoolean("children")); invalidateOptionsMenu(); } diff --git a/index.html b/index.html index 410b8e11b4..1483f711e2 100644 --- a/index.html +++ b/index.html @@ -121,7 +121,7 @@
  • Load more messages: long press a folder in the folder list, select Fetch more messages
  • Delete a message, skipping trash: long press the trash icon
  • Delete an account/identity: (Main) Settings, tap Manual setup, tap Accounts/Identities, tap the account/identity, tap the trash icon in the top right corner
  • -
  • Delete a folder: long press the folder in the folder list, Edit properties, tap the trash icon in the top right corner
  • +
  • Delete a folder: long press the folder in the folder list, Edit properties, tap the trash icon in the top right corner. Note that you can’t delete folders which still have sub folders.
  • Undo send: Outbox, swipe the message in the list left or right
  • Delete a contact: please see this FAQ
  • Store sent messages in the inbox: please see this FAQ