mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-30 05:02:26 -05:00
commit
29f7552c3a
@ -42,7 +42,7 @@ import com.fsck.k9.search.LocalSearch;
|
||||
import com.fsck.k9.search.SqlQueryBuilder;
|
||||
import com.fsck.k9.search.SearchSpecification.Attribute;
|
||||
import com.fsck.k9.search.SearchSpecification.SearchCondition;
|
||||
import com.fsck.k9.search.SearchSpecification.Searchfield;
|
||||
import com.fsck.k9.search.SearchSpecification.SearchField;
|
||||
import com.fsck.k9.mail.ssl.LocalKeyStore;
|
||||
import com.fsck.k9.view.ColorChip;
|
||||
import com.larswerkman.colorpicker.ColorPicker;
|
||||
@ -1732,17 +1732,17 @@ public class Account implements BaseAccount, StoreConfig {
|
||||
switch (displayMode) {
|
||||
case FIRST_CLASS: {
|
||||
// Count messages in the INBOX and non-special first class folders
|
||||
search.and(Searchfield.DISPLAY_CLASS, FolderClass.FIRST_CLASS.name(),
|
||||
search.and(SearchField.DISPLAY_CLASS, FolderClass.FIRST_CLASS.name(),
|
||||
Attribute.EQUALS);
|
||||
break;
|
||||
}
|
||||
case FIRST_AND_SECOND_CLASS: {
|
||||
// Count messages in the INBOX and non-special first and second class folders
|
||||
search.and(Searchfield.DISPLAY_CLASS, FolderClass.FIRST_CLASS.name(),
|
||||
search.and(SearchField.DISPLAY_CLASS, FolderClass.FIRST_CLASS.name(),
|
||||
Attribute.EQUALS);
|
||||
|
||||
// TODO: Create a proper interface for creating arbitrary condition trees
|
||||
SearchCondition searchCondition = new SearchCondition(Searchfield.DISPLAY_CLASS,
|
||||
SearchCondition searchCondition = new SearchCondition(SearchField.DISPLAY_CLASS,
|
||||
Attribute.EQUALS, FolderClass.SECOND_CLASS.name());
|
||||
ConditionsTreeNode root = search.getConditions();
|
||||
if (root.mRight != null) {
|
||||
@ -1754,7 +1754,7 @@ public class Account implements BaseAccount, StoreConfig {
|
||||
}
|
||||
case NOT_SECOND_CLASS: {
|
||||
// Count messages in the INBOX and non-special non-second-class folders
|
||||
search.and(Searchfield.DISPLAY_CLASS, FolderClass.SECOND_CLASS.name(),
|
||||
search.and(SearchField.DISPLAY_CLASS, FolderClass.SECOND_CLASS.name(),
|
||||
Attribute.NOT_EQUALS);
|
||||
break;
|
||||
}
|
||||
@ -1792,7 +1792,7 @@ public class Account implements BaseAccount, StoreConfig {
|
||||
excludeSpecialFolder(search, getOutboxFolderName());
|
||||
excludeSpecialFolder(search, getSentFolderName());
|
||||
excludeSpecialFolder(search, getErrorFolderName());
|
||||
search.or(new SearchCondition(Searchfield.FOLDER, Attribute.EQUALS, getInboxFolderName()));
|
||||
search.or(new SearchCondition(SearchField.FOLDER, Attribute.EQUALS, getInboxFolderName()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1816,12 +1816,12 @@ public class Account implements BaseAccount, StoreConfig {
|
||||
excludeSpecialFolder(search, getTrashFolderName());
|
||||
excludeSpecialFolder(search, getSpamFolderName());
|
||||
excludeSpecialFolder(search, getOutboxFolderName());
|
||||
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);
|
||||
search.and(SearchField.FOLDER, folderName, Attribute.NOT_EQUALS);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ import com.fsck.k9.preferences.SettingsImporter.ImportResults;
|
||||
import com.fsck.k9.search.LocalSearch;
|
||||
import com.fsck.k9.search.SearchAccount;
|
||||
import com.fsck.k9.search.SearchSpecification.Attribute;
|
||||
import com.fsck.k9.search.SearchSpecification.Searchfield;
|
||||
import com.fsck.k9.search.SearchSpecification.SearchField;
|
||||
import com.fsck.k9.view.ColorChip;
|
||||
|
||||
import de.cketti.library.changelog.ChangeLog;
|
||||
@ -366,7 +366,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
||||
realAccount.limitToDisplayableFolders(search);
|
||||
}
|
||||
|
||||
search.and(Searchfield.READ, "1", Attribute.NOT_EQUALS);
|
||||
search.and(SearchField.READ, "1", Attribute.NOT_EQUALS);
|
||||
|
||||
return search;
|
||||
}
|
||||
@ -1864,7 +1864,7 @@ public class Accounts extends K9ListActivity implements OnItemClickListener {
|
||||
realAccount.limitToDisplayableFolders(search);
|
||||
}
|
||||
|
||||
search.and(Searchfield.FLAGGED, "1", Attribute.EQUALS);
|
||||
search.and(SearchField.FLAGGED, "1", Attribute.EQUALS);
|
||||
|
||||
return new AccountClickListener(search);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ import com.fsck.k9.mail.Message;
|
||||
import com.fsck.k9.mailstore.LocalFolder;
|
||||
import com.fsck.k9.search.LocalSearch;
|
||||
import com.fsck.k9.search.SearchSpecification.Attribute;
|
||||
import com.fsck.k9.search.SearchSpecification.Searchfield;
|
||||
import com.fsck.k9.search.SearchSpecification.SearchField;
|
||||
import com.fsck.k9.service.MailService;
|
||||
|
||||
import de.cketti.library.changelog.ChangeLog;
|
||||
@ -1102,7 +1102,7 @@ public class FolderList extends K9ListActivity {
|
||||
getString(R.string.flagged_modifier));
|
||||
|
||||
LocalSearch search = new LocalSearch(searchTitle);
|
||||
search.and(Searchfield.FLAGGED, "1", Attribute.EQUALS);
|
||||
search.and(SearchField.FLAGGED, "1", Attribute.EQUALS);
|
||||
|
||||
search.addAllowedFolder(folder.name);
|
||||
search.addAccountUuid(account.getUuid());
|
||||
@ -1117,7 +1117,7 @@ public class FolderList extends K9ListActivity {
|
||||
getString(R.string.unread_modifier));
|
||||
|
||||
LocalSearch search = new LocalSearch(searchTitle);
|
||||
search.and(Searchfield.READ, "1", Attribute.NOT_EQUALS);
|
||||
search.and(SearchField.READ, "1", Attribute.NOT_EQUALS);
|
||||
|
||||
search.addAllowedFolder(folder.name);
|
||||
search.addAccountUuid(account.getUuid());
|
||||
|
@ -49,7 +49,7 @@ import com.fsck.k9.search.SearchAccount;
|
||||
import com.fsck.k9.search.SearchSpecification;
|
||||
import com.fsck.k9.search.SearchSpecification.Attribute;
|
||||
import com.fsck.k9.search.SearchSpecification.SearchCondition;
|
||||
import com.fsck.k9.search.SearchSpecification.Searchfield;
|
||||
import com.fsck.k9.search.SearchSpecification.SearchField;
|
||||
import com.fsck.k9.view.MessageHeader;
|
||||
import com.fsck.k9.view.MessageOpenPgpView;
|
||||
import com.fsck.k9.view.MessageTitleView;
|
||||
@ -404,9 +404,9 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
||||
mSearch.setManualSearch(true);
|
||||
mNoThreading = true;
|
||||
|
||||
mSearch.or(new SearchCondition(Searchfield.SENDER, Attribute.CONTAINS, query));
|
||||
mSearch.or(new SearchCondition(Searchfield.SUBJECT, Attribute.CONTAINS, query));
|
||||
mSearch.or(new SearchCondition(Searchfield.MESSAGE_CONTENTS, Attribute.CONTAINS, query));
|
||||
mSearch.or(new SearchCondition(SearchField.SENDER, Attribute.CONTAINS, query));
|
||||
mSearch.or(new SearchCondition(SearchField.SUBJECT, Attribute.CONTAINS, query));
|
||||
mSearch.or(new SearchCondition(SearchField.MESSAGE_CONTENTS, Attribute.CONTAINS, query));
|
||||
|
||||
Bundle appData = intent.getBundleExtra(SearchManager.APP_DATA);
|
||||
if (appData != null) {
|
||||
@ -1221,7 +1221,7 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
||||
public void showMoreFromSameSender(String senderAddress) {
|
||||
LocalSearch tmpSearch = new LocalSearch("From " + senderAddress);
|
||||
tmpSearch.addAccountUuids(mSearch.getAccountUuids());
|
||||
tmpSearch.and(Searchfield.SENDER, senderAddress, Attribute.CONTAINS);
|
||||
tmpSearch.and(SearchField.SENDER, senderAddress, Attribute.CONTAINS);
|
||||
|
||||
MessageListFragment fragment = MessageListFragment.newInstance(tmpSearch, false, false);
|
||||
|
||||
@ -1310,7 +1310,7 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
||||
|
||||
LocalSearch tmpSearch = new LocalSearch();
|
||||
tmpSearch.addAccountUuid(account.getUuid());
|
||||
tmpSearch.and(Searchfield.THREAD_ID, String.valueOf(threadRootId), Attribute.EQUALS);
|
||||
tmpSearch.and(SearchField.THREAD_ID, String.valueOf(threadRootId), Attribute.EQUALS);
|
||||
|
||||
MessageListFragment fragment = MessageListFragment.newInstance(tmpSearch, true, false);
|
||||
addMessageListFragment(fragment, true);
|
||||
|
@ -99,7 +99,7 @@ import com.fsck.k9.search.ConditionsTreeNode;
|
||||
import com.fsck.k9.search.LocalSearch;
|
||||
import com.fsck.k9.search.SearchSpecification;
|
||||
import com.fsck.k9.search.SearchSpecification.SearchCondition;
|
||||
import com.fsck.k9.search.SearchSpecification.Searchfield;
|
||||
import com.fsck.k9.search.SearchSpecification.SearchField;
|
||||
import com.fsck.k9.search.SqlQueryBuilder;
|
||||
|
||||
import com.handmark.pulltorefresh.library.ILoadingLayout;
|
||||
@ -3360,7 +3360,7 @@ public class MessageListFragment extends Fragment implements OnItemClickListener
|
||||
private String getThreadId(LocalSearch search) {
|
||||
for (ConditionsTreeNode node : search.getLeafSet()) {
|
||||
SearchCondition condition = node.mCondition;
|
||||
if (condition.field == Searchfield.THREAD_ID) {
|
||||
if (condition.field == SearchField.THREAD_ID) {
|
||||
return condition.value;
|
||||
}
|
||||
}
|
||||
|
@ -22,14 +22,13 @@ import com.fsck.k9.mail.MessageRetrievalListener;
|
||||
import com.fsck.k9.mail.MessagingException;
|
||||
import com.fsck.k9.mail.Store;
|
||||
import com.fsck.k9.mailstore.StorageManager.StorageProvider;
|
||||
import com.fsck.k9.mail.store.StoreConfig;
|
||||
import com.fsck.k9.mailstore.LockableDatabase.DbCallback;
|
||||
import com.fsck.k9.mailstore.LockableDatabase.WrappedException;
|
||||
import com.fsck.k9.provider.EmailProvider;
|
||||
import com.fsck.k9.provider.EmailProvider.MessageColumns;
|
||||
import com.fsck.k9.search.LocalSearch;
|
||||
import com.fsck.k9.search.SearchSpecification.Attribute;
|
||||
import com.fsck.k9.search.SearchSpecification.Searchfield;
|
||||
import com.fsck.k9.search.SearchSpecification.SearchField;
|
||||
import com.fsck.k9.search.SqlQueryBuilder;
|
||||
|
||||
import java.io.File;
|
||||
@ -671,7 +670,7 @@ public class LocalStore extends Store implements Serializable {
|
||||
String rootIdString = Long.toString(rootId);
|
||||
|
||||
LocalSearch search = new LocalSearch();
|
||||
search.and(Searchfield.THREAD_ID, rootIdString, Attribute.EQUALS);
|
||||
search.and(SearchField.THREAD_ID, rootIdString, Attribute.EQUALS);
|
||||
|
||||
return searchForMessages(null, search);
|
||||
}
|
||||
|
@ -11,8 +11,9 @@ import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.fsck.k9.search.SearchSpecification.Attribute;
|
||||
import com.fsck.k9.search.SearchSpecification.Searchfield;
|
||||
import com.fsck.k9.search.SearchSpecification.SearchCondition;
|
||||
import com.fsck.k9.search.SearchSpecification.SearchField;
|
||||
|
||||
|
||||
/**
|
||||
* This class stores search conditions. It's basically a boolean expression binary tree.
|
||||
@ -96,7 +97,7 @@ public class ConditionsTreeNode implements Parcelable {
|
||||
Operator tmpValue = ConditionsTreeNode.Operator.valueOf(cursor.getString(5));
|
||||
|
||||
if (tmpValue == Operator.CONDITION) {
|
||||
condition = new SearchCondition(Searchfield.valueOf(cursor.getString(0)),
|
||||
condition = new SearchCondition(SearchField.valueOf(cursor.getString(0)),
|
||||
Attribute.valueOf(cursor.getString(2)), cursor.getString(1));
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ public class LocalSearch implements SearchSpecification {
|
||||
*
|
||||
* @throws IllegalConditionException
|
||||
*/
|
||||
public void and(Searchfield field, String value, Attribute attribute) {
|
||||
public void and(SearchField field, String value, Attribute attribute) {
|
||||
and(new SearchCondition(field, attribute, value));
|
||||
}
|
||||
|
||||
@ -243,7 +243,7 @@ public class LocalSearch implements SearchSpecification {
|
||||
* - do and on root of it & rest of search
|
||||
* - do or between folder nodes
|
||||
*/
|
||||
mConditions = and(new SearchCondition(Searchfield.FOLDER, Attribute.EQUALS, name));
|
||||
mConditions = and(new SearchCondition(SearchField.FOLDER, Attribute.EQUALS, name));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -254,7 +254,7 @@ public class LocalSearch implements SearchSpecification {
|
||||
public List<String> getFolderNames() {
|
||||
List<String> results = new ArrayList<String>();
|
||||
for (ConditionsTreeNode node : mLeafSet) {
|
||||
if (node.mCondition.field == Searchfield.FOLDER &&
|
||||
if (node.mCondition.field == SearchField.FOLDER &&
|
||||
node.mCondition.attribute == Attribute.EQUALS) {
|
||||
results.add(node.mCondition.value);
|
||||
}
|
||||
@ -285,8 +285,8 @@ public class LocalSearch implements SearchSpecification {
|
||||
}
|
||||
|
||||
for (ConditionsTreeNode node : leafSet) {
|
||||
if (node.getCondition().field == Searchfield.SUBJECT ||
|
||||
node.getCondition().field == Searchfield.SENDER ) {
|
||||
if (node.getCondition().field == SearchField.SUBJECT ||
|
||||
node.getCondition().field == SearchField.SENDER ) {
|
||||
return node.getCondition().value;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,8 @@ import android.content.Context;
|
||||
import com.fsck.k9.BaseAccount;
|
||||
import com.fsck.k9.R;
|
||||
import com.fsck.k9.search.SearchSpecification.Attribute;
|
||||
import com.fsck.k9.search.SearchSpecification.Searchfield;
|
||||
import com.fsck.k9.search.SearchSpecification.SearchField;
|
||||
|
||||
|
||||
/**
|
||||
* This class is basically a wrapper around a LocalSearch. It allows to expose it as
|
||||
@ -21,7 +22,7 @@ public class SearchAccount implements BaseAccount {
|
||||
String name = context.getString(R.string.search_all_messages_title);
|
||||
|
||||
LocalSearch tmpSearch = new LocalSearch(name);
|
||||
tmpSearch.and(Searchfield.SEARCHABLE, "1", Attribute.EQUALS);
|
||||
tmpSearch.and(SearchField.SEARCHABLE, "1", Attribute.EQUALS);
|
||||
|
||||
return new SearchAccount(ALL_MESSAGES, tmpSearch, name,
|
||||
context.getString(R.string.search_all_messages_detail));
|
||||
@ -32,7 +33,7 @@ public class SearchAccount implements BaseAccount {
|
||||
public static SearchAccount createUnifiedInboxAccount(Context context) {
|
||||
String name = context.getString(R.string.integrated_inbox_title);
|
||||
LocalSearch tmpSearch = new LocalSearch(name);
|
||||
tmpSearch.and(Searchfield.INTEGRATE, "1", Attribute.EQUALS);
|
||||
tmpSearch.and(SearchField.INTEGRATE, "1", Attribute.EQUALS);
|
||||
return new SearchAccount(UNIFIED_INBOX, tmpSearch, name,
|
||||
context.getString(R.string.integrated_inbox_detail));
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public interface SearchSpecification extends Parcelable {
|
||||
* preview, mime_type
|
||||
*
|
||||
*/
|
||||
public enum Searchfield {
|
||||
public enum SearchField {
|
||||
SUBJECT,
|
||||
DATE,
|
||||
UID,
|
||||
@ -101,9 +101,9 @@ public interface SearchSpecification extends Parcelable {
|
||||
public class SearchCondition implements Parcelable {
|
||||
public final String value;
|
||||
public final Attribute attribute;
|
||||
public final Searchfield field;
|
||||
public final SearchField field;
|
||||
|
||||
public SearchCondition(Searchfield field, Attribute attribute, String value) {
|
||||
public SearchCondition(SearchField field, Attribute attribute, String value) {
|
||||
this.value = value;
|
||||
this.attribute = attribute;
|
||||
this.field = field;
|
||||
@ -112,7 +112,7 @@ public interface SearchSpecification extends Parcelable {
|
||||
private SearchCondition(Parcel in) {
|
||||
this.value = in.readString();
|
||||
this.attribute = Attribute.values()[in.readInt()];
|
||||
this.field = Searchfield.values()[in.readInt()];
|
||||
this.field = SearchField.values()[in.readInt()];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -9,7 +9,7 @@ import com.fsck.k9.mailstore.LocalFolder;
|
||||
import com.fsck.k9.mailstore.LocalStore;
|
||||
import com.fsck.k9.search.SearchSpecification.Attribute;
|
||||
import com.fsck.k9.search.SearchSpecification.SearchCondition;
|
||||
import com.fsck.k9.search.SearchSpecification.Searchfield;
|
||||
import com.fsck.k9.search.SearchSpecification.SearchField;
|
||||
|
||||
|
||||
public class SqlQueryBuilder {
|
||||
@ -200,7 +200,7 @@ public class SqlQueryBuilder {
|
||||
private static void appendExprRight(SearchCondition condition, StringBuilder query,
|
||||
List<String> selectionArgs) {
|
||||
String value = condition.value;
|
||||
Searchfield field = condition.field;
|
||||
SearchField field = condition.field;
|
||||
|
||||
query.append(" ");
|
||||
String selectionArg = null;
|
||||
@ -256,7 +256,7 @@ public class SqlQueryBuilder {
|
||||
selectionArgs.add(selectionArg);
|
||||
}
|
||||
|
||||
private static boolean isNumberColumn(Searchfield field) {
|
||||
private static boolean isNumberColumn(SearchField field) {
|
||||
switch (field) {
|
||||
case ATTACHMENT_COUNT:
|
||||
case DATE:
|
||||
|
Loading…
Reference in New Issue
Block a user