1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -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. * The {@code LocalSearch} instance to modify.
*/ */
public void excludeSpecialFolders(LocalSearch search) { public void excludeSpecialFolders(LocalSearch search) {
search.and(Searchfield.FOLDER, getTrashFolderName(), Attribute.NOT_EQUALS); excludeSpecialFolder(search, getTrashFolderName());
search.and(Searchfield.FOLDER, getDraftsFolderName(), Attribute.NOT_EQUALS); excludeSpecialFolder(search, getDraftsFolderName());
search.and(Searchfield.FOLDER, getSpamFolderName(), Attribute.NOT_EQUALS); excludeSpecialFolder(search, getSpamFolderName());
search.and(Searchfield.FOLDER, getOutboxFolderName(), Attribute.NOT_EQUALS); excludeSpecialFolder(search, getOutboxFolderName());
search.and(Searchfield.FOLDER, getSentFolderName(), Attribute.NOT_EQUALS); excludeSpecialFolder(search, getSentFolderName());
search.or(new SearchCondition(Searchfield.FOLDER, Attribute.EQUALS, getInboxFolderName())); 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);
}
}
} }