The goal of this patch is to fix mail filtering for non-IMAP resources. Currently the Mail Filter Agent will looks for inbox collections and only subscribe to items on these. The logic to find the inbox folders is to look for the default inbox collection or collections with remote identifier set to "INBOX". This will work fine for IMAP resources as their remote IDs follow the original IMAP folder name. For other resources, like Akonadi EWS the inbox folder is not guaranteed to have a meaningful name (in case of EWS this will be a long random-like base64 string).
The resource has the ability to indicate special collections in its tree, including the inbox collection. Unfortunately the folderIsInbox() method will not take this into account.
The patch changes the behaviour of the above method to not only use the default inbox collection but any collection that is marked as an inbox collection.
The only side-effect I have found is that the collection properties dialog in KMail will no longer allow changing the inbox collection icon as the code blocks this setting from all local or inbox collections. I guess this should be acceptable.