mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-17 07:30:16 -05:00
Exclude folders Trash, Spam, and Outbox from "All messages"
This commit is contained in:
parent
8c8e0d299d
commit
d14bdc0b79
@ -1856,6 +1856,30 @@ public class Account implements BaseAccount {
|
|||||||
search.or(new SearchCondition(Searchfield.FOLDER, Attribute.EQUALS, getInboxFolderName()));
|
search.or(new SearchCondition(Searchfield.FOLDER, Attribute.EQUALS, getInboxFolderName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modify the supplied {@link LocalSearch} instance to exclude "unwanted" folders.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Currently the following folders are excluded:
|
||||||
|
* <ul>
|
||||||
|
* <li>Trash</li>
|
||||||
|
* <li>Spam</li>
|
||||||
|
* <li>Outbox</li>
|
||||||
|
* </ul>
|
||||||
|
* The Inbox will always be included even if one of the special folders is configured to point
|
||||||
|
* to the Inbox.
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param search
|
||||||
|
* The {@code LocalSearch} instance to modify.
|
||||||
|
*/
|
||||||
|
public void excludeUnwantedFolders(LocalSearch search) {
|
||||||
|
excludeSpecialFolder(search, getTrashFolderName());
|
||||||
|
excludeSpecialFolder(search, getSpamFolderName());
|
||||||
|
excludeSpecialFolder(search, getOutboxFolderName());
|
||||||
|
search.or(new SearchCondition(Searchfield.FOLDER, Attribute.EQUALS, getInboxFolderName()));
|
||||||
|
}
|
||||||
|
|
||||||
private void excludeSpecialFolder(LocalSearch search, String folderName) {
|
private void excludeSpecialFolder(LocalSearch search, String folderName) {
|
||||||
if (!K9.FOLDER_NONE.equals(folderName)) {
|
if (!K9.FOLDER_NONE.equals(folderName)) {
|
||||||
search.and(Searchfield.FOLDER, folderName, Attribute.NOT_EQUALS);
|
search.and(Searchfield.FOLDER, folderName, Attribute.NOT_EQUALS);
|
||||||
|
@ -42,8 +42,14 @@ public class SqlQueryBuilder {
|
|||||||
case SEARCHABLE: {
|
case SEARCHABLE: {
|
||||||
switch (account.getSearchableFolders()) {
|
switch (account.getSearchableFolders()) {
|
||||||
case ALL: {
|
case ALL: {
|
||||||
// Dummy condition, always select
|
// Create temporary LocalSearch object so we can use...
|
||||||
query.append("1");
|
LocalSearch tempSearch = new LocalSearch();
|
||||||
|
// ...the helper methods in Account to create the necessary conditions
|
||||||
|
// to exclude "unwanted" folders.
|
||||||
|
account.excludeUnwantedFolders(tempSearch);
|
||||||
|
|
||||||
|
buildWhereClauseInternal(account, tempSearch.getConditions(), query,
|
||||||
|
selectionArgs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DISPLAYABLE: {
|
case DISPLAYABLE: {
|
||||||
|
Loading…
Reference in New Issue
Block a user