mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-11 09:19:46 +01:00
Prevent deleting folders with children
This commit is contained in:
2
FAQ.md
2
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)
|
||||
|
||||
@@ -730,7 +730,8 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
||||
if (folder.selectable && Shortcuts.can(context))
|
||||
popupMenu.getMenu().add(Menu.NONE, R.string.title_pin, order++, R.string.title_pin);
|
||||
|
||||
if (!folder.read_only && EntityFolder.USER.equals(folder.type))
|
||||
if (!folder.read_only && EntityFolder.USER.equals(folder.type) &&
|
||||
(folder.child_refs == null || folder.child_refs.isEmpty()))
|
||||
popupMenu.getMenu().add(Menu.NONE, R.string.title_delete, order++, R.string.title_delete);
|
||||
|
||||
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
|
||||
@@ -52,6 +52,7 @@ import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.google.android.material.snackbar.Snackbar;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class FragmentFolder extends FragmentBase {
|
||||
@@ -301,6 +302,9 @@ public class FragmentFolder extends FragmentBase {
|
||||
EntityFolder parent = db.folder().getFolderByName(aid, parentName);
|
||||
EntityFolder folder = db.folder().getFolder(id);
|
||||
|
||||
List<EntityFolder> 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();
|
||||
}
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
<li>Load more messages: long press a folder in the folder list, select <em>Fetch more messages</em></li>
|
||||
<li>Delete a message, skipping trash: long press the trash icon</li>
|
||||
<li>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</li>
|
||||
<li>Delete a folder: long press the folder in the folder list, Edit properties, tap the trash icon in the top right corner</li>
|
||||
<li>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.</li>
|
||||
<li>Undo send: Outbox, swipe the message in the list left or right</li>
|
||||
<li>Delete a contact: please <a href="#faq171">see this FAQ</a></li>
|
||||
<li>Store sent messages in the inbox: please <a href="#faq142">see this FAQ</a></li>
|
||||
|
||||
Reference in New Issue
Block a user