Bug: Bogus UI design and undefined UI states in "Message Synchronizing" IMAP Account Settings
Status: NEW
Priority: --
Created: 2021-01-11 22:57:40+00:00
Resolved: 2023-03-16 19:13:12+00:00

+++ This bug was initially created as a clone of Bug #1620426 +++

Coming from bug 1620426, there's a lot of things fundamentally wrong with the user interface/behaviour of the "Message Synchronizing" options of IMAP account settings.
Inviting Alex to comment on my proposal for better UI design/behaviour below.
This is reminiscent of Bug 1641225: similar problem in another spot.

## STR:

1) Add existing email account on IMAP (here: GMX.de account) with default settings
2) Observe status and reflect meaning of the following setting (checked by default):
  `≡ > Account Settings > YourAccount > Synchronization and Storage > Message Synchronizing`:
  `[x] Keep messages in all folders for this account on this computer`
  `    Note: Changing this affects all folders in this account. To set individual folders, use the Advanced… button.`
3) Click `[Advanced...] ` Button of the same setting and compare (if necessary, remove some checkmarks from the account's folders and confirm with OK, then compare checkbox status vs. Advanced folder settings).

## Actual Result:

TL;DR: Bogus UI design + wrong/undefined UI states = useless-UI!

- Although the checkbox for *all folders* is checked, after clicking on "Advanced" button, some folders are unchecked (on this fresh gmx account, "Gelöscht - Trash" and "Spamverdacht - (Suspected) Junk"). That's irritating - all folders should be preselected, because that's the current setting we're coming from. Now I'm not sure which of my folders are actually marked for offline use or not.
- Default synchronize settings should not exclude Junk or Trash folders - valuable messages from new senders often end up in Junk, and the reason for trash is to have a safety net for accidental deletions - so in this day and age where storage is no longer a big issue but network might, I'd certainly want those synchronized.
- After confirming a subset of folders (less than all!) for offline use via `Advanced` dialog, the checkmark for *all folders* is *still* set: That's a bug. Wrong UI state!
- As *All* vs. *Some* folders are two mutually exclusive options, the single checkbox UI design is wrong to begin with: this needs 2 radio boxes, with the folder selector as a sub-element of the second.
- We're editing the account settings of *one* specific account - yet the Advanced Dialog shows the offline settings for *all folders of all accounts* (why!?), current account not indicated in any way, and if I edit third account, it will still show me the first account at the top. That's irritating and highly error-prone.
- Bug 1620426 reports that folders checked for synchronization are changing randomly over time. This might be a misunderstanding because the UI does nothing to explain the difference between "Subscribe..." (from folder list) and "Synchronize" (see comment 1). However, for Synchronize, I had another case where one custom subfolder was checked and another one next to it wasn't, yet I'm quite sure I've never touched that deep setting. The unchecked folder was empty iirc, but that shouldn't matter. After fixing the UI, we should probably have tests if it works.


## Expected Result

- Rectify the UI design and behaviour!

## Proposal for UI design/behaviour

- 1 checkbox (on/off) and 2 radio boxes, with the folder selector as a sub-element of the second.
  ```
  [x] Keep messages for offline use on this computer:
       (o) For all folders of this account
       ( ) For selected folders: [Select folders...]
  ```
- Removing main checkmark stops all folders from synchronizing, sets the radio to "For all folders..." and disables the radios and the button.
- Setting checkmark preselects "all folders", which user can change to selected folders.
- We can leave the folder selector button always enabled when main checkmark is checked, but clicking the button must initially change the radio to "selected folders". On exit from folder selector, if all folders have been selected, return the radio to "all folders". If all folders have been deselected, return radio to "all folders", but remove the main checkmark and focus that.
- [Select folders...] should only show the folder tree for the currently edited account.
- Ensure full keyboard accessibility.
- For bonus points, implement intelligent alerts and/or inline notifications.