mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-17 07:30:16 -05:00
Only list messages in searchable folders under "All messages"
This commit is contained in:
parent
251428e963
commit
d3e840a9ee
@ -21,7 +21,10 @@ public class SearchAccount implements BaseAccount {
|
||||
// create the all messages search ( all accounts is default when none specified )
|
||||
public static SearchAccount createAllMessagesAccount(Context context) {
|
||||
String name = context.getString(R.string.search_all_messages_title);
|
||||
|
||||
LocalSearch tmpSearch = new LocalSearch(name);
|
||||
tmpSearch.and(Searchfield.SEARCHABLE, "1", Attribute.EQUALS);
|
||||
|
||||
return new SearchAccount(ALL_MESSAGES, tmpSearch, name,
|
||||
context.getString(R.string.search_all_messages_detail));
|
||||
}
|
||||
|
@ -81,7 +81,8 @@ public interface SearchSpecification extends Parcelable {
|
||||
INTEGRATE,
|
||||
READ,
|
||||
FLAGGED,
|
||||
DISPLAY_CLASS
|
||||
DISPLAY_CLASS,
|
||||
SEARCHABLE
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,6 +21,7 @@ public class SqlQueryBuilder {
|
||||
private static void buildWhereClauseInternal(Account account, ConditionsTreeNode node,
|
||||
StringBuilder query, List<String> selectionArgs) {
|
||||
if (node == null) {
|
||||
query.append("1");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -38,6 +39,33 @@ public class SqlQueryBuilder {
|
||||
selectionArgs.add(Long.toString(folderId));
|
||||
break;
|
||||
}
|
||||
case SEARCHABLE: {
|
||||
switch (account.getSearchableFolders()) {
|
||||
case ALL: {
|
||||
// Dummy condition, always select
|
||||
query.append("1");
|
||||
break;
|
||||
}
|
||||
case DISPLAYABLE: {
|
||||
// Create temporary LocalSearch object so we can use...
|
||||
LocalSearch tempSearch = new LocalSearch();
|
||||
// ...the helper methods in Account to create the necessary conditions
|
||||
// to limit the selection to displayable, non-special folders.
|
||||
account.excludeSpecialFolders(tempSearch);
|
||||
account.limitToDisplayableFolders(tempSearch);
|
||||
|
||||
buildWhereClauseInternal(account, tempSearch.getConditions(), query,
|
||||
selectionArgs);
|
||||
break;
|
||||
}
|
||||
case NONE: {
|
||||
// Dummy condition, never select
|
||||
query.append("0");
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
appendCondition(condition, query, selectionArgs);
|
||||
}
|
||||
@ -101,10 +129,6 @@ public class SqlQueryBuilder {
|
||||
columnName = "flags";
|
||||
break;
|
||||
}
|
||||
case FOLDER: {
|
||||
columnName = "folder_id";
|
||||
break;
|
||||
}
|
||||
case ID: {
|
||||
columnName = "id";
|
||||
break;
|
||||
@ -153,6 +177,11 @@ public class SqlQueryBuilder {
|
||||
columnName = "display_class";
|
||||
break;
|
||||
}
|
||||
case FOLDER:
|
||||
case SEARCHABLE: {
|
||||
// Special cases handled in buildWhereClauseInternal()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (columnName == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user