1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 11:42:16 -05:00

Rename from Searchfield to SearchField

This commit is contained in:
Marine 2015-02-16 14:07:41 +01:00
parent 74820a40db
commit 980d799087
11 changed files with 36 additions and 42 deletions

View File

@ -39,10 +39,10 @@ import com.fsck.k9.provider.EmailProvider;
import com.fsck.k9.provider.EmailProvider.StatsColumns;
import com.fsck.k9.search.ConditionsTreeNode;
import com.fsck.k9.search.LocalSearch;
import com.fsck.k9.search.SearchSpecification;
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.mail.ssl.LocalKeyStore;
import com.fsck.k9.view.ColorChip;
import com.larswerkman.colorpicker.ColorPicker;
@ -1754,17 +1754,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(SearchSpecification.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(SearchSpecification.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(SearchSpecification.SearchField.DISPLAY_CLASS,
Attribute.EQUALS, FolderClass.SECOND_CLASS.name());
ConditionsTreeNode root = search.getConditions();
if (root.mRight != null) {
@ -1776,7 +1776,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(SearchSpecification.SearchField.DISPLAY_CLASS, FolderClass.SECOND_CLASS.name(),
Attribute.NOT_EQUALS);
break;
}
@ -1814,7 +1814,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(SearchSpecification.SearchField.FOLDER, Attribute.EQUALS, getInboxFolderName()));
}
/**
@ -1838,12 +1838,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(SearchSpecification.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(SearchSpecification.SearchField.FOLDER, folderName, Attribute.NOT_EQUALS);
}
}

View File

@ -91,8 +91,8 @@ import com.fsck.k9.preferences.SettingsImporter.ImportContents;
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;
import com.fsck.k9.search.SearchSpecification.Attribute;
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(SearchSpecification.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(SearchSpecification.SearchField.FLAGGED, "1", Attribute.EQUALS);
return new AccountClickListener(search);
}

View File

@ -57,8 +57,8 @@ import com.fsck.k9.mail.Folder;
import com.fsck.k9.mail.Message;
import com.fsck.k9.mailstore.LocalFolder;
import com.fsck.k9.search.LocalSearch;
import com.fsck.k9.search.SearchSpecification;
import com.fsck.k9.search.SearchSpecification.Attribute;
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(SearchSpecification.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(SearchSpecification.SearchField.READ, "1", Attribute.NOT_EQUALS);
search.addAllowedFolder(folder.name);
search.addAccountUuid(account.getUuid());

View File

@ -49,7 +49,6 @@ 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.view.MessageHeader;
import com.fsck.k9.view.MessageOpenPgpView;
import com.fsck.k9.view.MessageTitleView;
@ -404,9 +403,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(SearchSpecification.SearchField.SENDER, Attribute.CONTAINS, query));
mSearch.or(new SearchCondition(SearchSpecification.SearchField.SUBJECT, Attribute.CONTAINS, query));
mSearch.or(new SearchCondition(SearchSpecification.SearchField.MESSAGE_CONTENTS, Attribute.CONTAINS, query));
Bundle appData = intent.getBundleExtra(SearchManager.APP_DATA);
if (appData != null) {
@ -1221,7 +1220,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(SearchSpecification.SearchField.SENDER, senderAddress, Attribute.CONTAINS);
MessageListFragment fragment = MessageListFragment.newInstance(tmpSearch, false, false);
@ -1310,7 +1309,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(SearchSpecification.SearchField.THREAD_ID, String.valueOf(threadRootId), Attribute.EQUALS);
MessageListFragment fragment = MessageListFragment.newInstance(tmpSearch, true, false);
addMessageListFragment(fragment, true);

View File

@ -99,7 +99,6 @@ 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.SqlQueryBuilder;
import com.handmark.pulltorefresh.library.ILoadingLayout;
@ -3360,7 +3359,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 == SearchSpecification.SearchField.THREAD_ID) {
return condition.value;
}
}

View File

@ -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;
import com.fsck.k9.search.SearchSpecification.Attribute;
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(SearchSpecification.SearchField.THREAD_ID, rootIdString, Attribute.EQUALS);
return searchForMessages(null, search);
}

View File

@ -11,7 +11,6 @@ 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;
/**
@ -96,7 +95,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(SearchSpecification.SearchField.valueOf(cursor.getString(0)),
Attribute.valueOf(cursor.getString(2)), cursor.getString(1));
}

View File

@ -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;
}
}

View File

@ -5,7 +5,6 @@ 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;
/**
* This class is basically a wrapper around a LocalSearch. It allows to expose it as
@ -21,7 +20,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(SearchSpecification.SearchField.SEARCHABLE, "1", Attribute.EQUALS);
return new SearchAccount(ALL_MESSAGES, tmpSearch, name,
context.getString(R.string.search_all_messages_detail));
@ -32,7 +31,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(SearchSpecification.SearchField.INTEGRATE, "1", Attribute.EQUALS);
return new SearchAccount(UNIFIED_INBOX, tmpSearch, name,
context.getString(R.string.integrated_inbox_detail));
}

View File

@ -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

View File

@ -9,7 +9,6 @@ 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;
public class SqlQueryBuilder {
@ -200,7 +199,7 @@ public class SqlQueryBuilder {
private static void appendExprRight(SearchCondition condition, StringBuilder query,
List<String> selectionArgs) {
String value = condition.value;
Searchfield field = condition.field;
SearchSpecification.SearchField field = condition.field;
query.append(" ");
String selectionArg = null;
@ -256,7 +255,7 @@ public class SqlQueryBuilder {
selectionArgs.add(selectionArg);
}
private static boolean isNumberColumn(Searchfield field) {
private static boolean isNumberColumn(SearchSpecification.SearchField field) {
switch (field) {
case ATTACHMENT_COUNT:
case DATE: