1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-24 02:12:15 -05:00

Don't create folder -NONE- when excluding special folders from a search

This commit is contained in:
cketti 2013-03-31 01:02:31 +01:00
parent ce0308f528
commit f95e64f766

View File

@ -1848,11 +1848,17 @@ public class Account implements BaseAccount {
* The {@code LocalSearch} instance to modify.
*/
public void excludeSpecialFolders(LocalSearch search) {
search.and(Searchfield.FOLDER, getTrashFolderName(), Attribute.NOT_EQUALS);
search.and(Searchfield.FOLDER, getDraftsFolderName(), Attribute.NOT_EQUALS);
search.and(Searchfield.FOLDER, getSpamFolderName(), Attribute.NOT_EQUALS);
search.and(Searchfield.FOLDER, getOutboxFolderName(), Attribute.NOT_EQUALS);
search.and(Searchfield.FOLDER, getSentFolderName(), Attribute.NOT_EQUALS);
excludeSpecialFolder(search, getTrashFolderName());
excludeSpecialFolder(search, getDraftsFolderName());
excludeSpecialFolder(search, getSpamFolderName());
excludeSpecialFolder(search, getOutboxFolderName());
excludeSpecialFolder(search, getSentFolderName());
search.or(new SearchCondition(Searchfield.FOLDER, Attribute.EQUALS, getInboxFolderName()));
}
private void excludeSpecialFolder(LocalSearch search, String folderName) {
if (!K9.FOLDER_NONE.equals(folderName)) {
search.and(Searchfield.FOLDER, folderName, Attribute.NOT_EQUALS);
}
}
}