Provide message search capability from the folder list.

The search is performed in all folders for the account
to which the folders belong.
This commit is contained in:
Joe Steele 2013-01-13 22:35:59 -05:00
parent 512d67a10e
commit ad16bf94cd
3 changed files with 23 additions and 2 deletions

View File

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/search"
android:icon="?attr/iconActionSearch"
android:showAsAction="always"
android:title="@string/search_action"/>
<item
android:id="@+id/filter_folders"
android:icon="?attr/iconActionSearchFolder"

View File

@ -537,6 +537,11 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
return true;
case R.id.search:
onSearchRequested();
return true;
case R.id.compose:
MessageCompose.actionCompose(this, mAccount);
@ -598,6 +603,14 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
}
}
@Override
public boolean onSearchRequested() {
Bundle appData = new Bundle();
appData.putString(MessageList.EXTRA_SEARCH_ACCOUNT, mAccount.getUuid());
startSearch(null, false, appData, false);
return true;
}
private void onOpenFolder(String folder) {
LocalSearch search = new LocalSearch(folder);
search.addAccountUuid(mAccount.getUuid());

View File

@ -58,7 +58,7 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
private static final String EXTRA_SPECIAL_FOLDER = "special_folder";
// used for remote search
private static final String EXTRA_SEARCH_ACCOUNT = "com.fsck.k9.search_account";
public static final String EXTRA_SEARCH_ACCOUNT = "com.fsck.k9.search_account";
private static final String EXTRA_SEARCH_FOLDER = "com.fsck.k9.search_folder";
public static void actionDisplaySearch(Context context, SearchSpecification search,
@ -180,7 +180,10 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
Bundle appData = getIntent().getBundleExtra(SearchManager.APP_DATA);
if (appData != null) {
mSearch.addAccountUuid(appData.getString(EXTRA_SEARCH_ACCOUNT));
mSearch.addAllowedFolder(appData.getString(EXTRA_SEARCH_FOLDER));
// searches started from a folder list activity will provide an account, but no folder
if (appData.getString(EXTRA_SEARCH_FOLDER) != null) {
mSearch.addAllowedFolder(appData.getString(EXTRA_SEARCH_FOLDER));
}
} else {
mSearch.addAccountUuid(LocalSearch.ALL_ACCOUNTS);
}