When loading an account for the first time, folders may not be processed
such that parents are handled first, leading to phantom folders created
for them.
This is particularly noticeable for GMail accounts, where the `[GMail]`
folder would typically show up, since it was created twice.
Add `create_personal_folder` method, implement it in
ImapEngine.GenericAccount. Use this when creating required special
folders to reduce code duplication.
Set local folder special use when they are loaded rather than doing it
in two steps, so that when client code is notified of the folders
being available, they will already have the correct special type.
Use a simple list of strings to store path steps, since we don't know
what the root will be in advance, and this leads to errors if callers
try to compare the info's paths to (say) an actual IMAP path.
Store path steps in a SpecialUse to path step map property, rather than
as individual properties for each special use, to reduce repetition.
Otherwise, the post install script on Fedora crashes with:
`FileNotFoundError: [Errno 2] No such file or directory: 'itstool'`.
It is in the Ubuntu/Debian dependencies so simply add it for Fedora as well
Replace open method with an async ctor, so we can make a few properties
non-null by default, and callers need to call one less call. Make
destination folder configurable, and require email flags passed in
via the ctor, not every time when saving.
When the drafts folder is selected, and a draft is being edited, and
that dis discarded, there is a race between the composer disappearing
(and hence the draft being shown again) and the draft itself being
removed from the folder. Attempt to check for this and avoid reporting
the problem.
When displaying a new empty composer, only consider those attached to
the current main window. Ensure that when re-using an existing composer,
that no composers in the undo buffer are used. Ensure drafts are
displayed full-pane when appropriate. Clean up redundant parts of
the `show_composer` API a bit.
Clean up and simplify how composers are constructed. Ensure all
composers are constructed via Application.Composer. Provide a set of
APIs for constructing different kinds of composers with minimal
parameters, rather than having one method with eleventy different
parameters.
Mirror API changes in Composer.Widget by splitting `load` method up
into a method for each different composer type. Clean up internals a
bit as a result. Rename `ComposeType` enum and its values to
`ContextType` to better reflect what it does.
Expect the same variant format for the `show-folder` and `show-email`
application actions. Use existing email and folder store factory
lookup methods for these. Update DesktopNotifications plugin to simply
pass variant values from plugin classes through to notifications.
Implement these in Application.EmailStoreFactory's implementation of
the interface.
This switches the variant format used to `(account_id,email_id)` to
match that used for folders, and so a folder doesn't need to be
specified when showing an email.
This breaks opening email from desktop notifications, but that will be
fixed shortly.
Only signal folders available/unavailable if non-empty when adding or
removing accounts, avoid producing two collections when signalling, and
fix removing folders from the store before signalling that they have
been removed.
Move implementation and management of Plugin.Account instances from
FolderStoreFactory here, so that other objects (e.g. plugin composers)
can access the implementation's backing account context.
Hook into the controller's signals for notification of accounts becoming
available so we get AccountContext objects to work with, and hook into
those to get notifications of folders becoming available, and work with
those so plugins get the exact same view of these as the client itself
does.
Most of the plugin implementation classes require instances of the
controller and other objects obtained from the application instance,
rather than the application instance itself. So pass that and the other
objects in instead of the application.
Add signals for folder contexts being added and remove, and hence also
require them to be added and removed in bulk, as collections.
Also, hook MainWindow up to use these signals rather than requiring
Controller manually manage notifying each main window of each folder
becoming available/unavailable.