mirror of
https://github.com/moparisthebest/k-9
synced 2024-11-30 13:12:25 -05:00
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:
parent
512d67a10e
commit
ad16bf94cd
@ -1,5 +1,10 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
|
<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
|
<item
|
||||||
android:id="@+id/filter_folders"
|
android:id="@+id/filter_folders"
|
||||||
android:icon="?attr/iconActionSearchFolder"
|
android:icon="?attr/iconActionSearchFolder"
|
||||||
|
@ -537,6 +537,11 @@ public class FolderList extends K9ListActivity implements OnNavigationListener {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
case R.id.search:
|
||||||
|
onSearchRequested();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
case R.id.compose:
|
case R.id.compose:
|
||||||
MessageCompose.actionCompose(this, mAccount);
|
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) {
|
private void onOpenFolder(String folder) {
|
||||||
LocalSearch search = new LocalSearch(folder);
|
LocalSearch search = new LocalSearch(folder);
|
||||||
search.addAccountUuid(mAccount.getUuid());
|
search.addAccountUuid(mAccount.getUuid());
|
||||||
|
@ -58,7 +58,7 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
|||||||
private static final String EXTRA_SPECIAL_FOLDER = "special_folder";
|
private static final String EXTRA_SPECIAL_FOLDER = "special_folder";
|
||||||
|
|
||||||
// used for remote search
|
// 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";
|
private static final String EXTRA_SEARCH_FOLDER = "com.fsck.k9.search_folder";
|
||||||
|
|
||||||
public static void actionDisplaySearch(Context context, SearchSpecification search,
|
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);
|
Bundle appData = getIntent().getBundleExtra(SearchManager.APP_DATA);
|
||||||
if (appData != null) {
|
if (appData != null) {
|
||||||
mSearch.addAccountUuid(appData.getString(EXTRA_SEARCH_ACCOUNT));
|
mSearch.addAccountUuid(appData.getString(EXTRA_SEARCH_ACCOUNT));
|
||||||
|
// 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));
|
mSearch.addAllowedFolder(appData.getString(EXTRA_SEARCH_FOLDER));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mSearch.addAccountUuid(LocalSearch.ALL_ACCOUNTS);
|
mSearch.addAccountUuid(LocalSearch.ALL_ACCOUNTS);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user