mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-26 01:36:55 +00:00
Added special search for encrypted messages
This commit is contained in:
parent
3aeb5d6e77
commit
e7f179c90d
4 changed files with 13 additions and 3 deletions
|
@ -169,6 +169,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
|||
Boolean seen = null;
|
||||
Boolean flagged = null;
|
||||
Boolean snoozed = null;
|
||||
Boolean encrypted = null;
|
||||
String find = (TextUtils.isEmpty(query) ? null : query.toLowerCase(Locale.ROOT));
|
||||
if (find != null && find.startsWith(context.getString(R.string.title_search_special_prefix) + ":")) {
|
||||
String special = find.split(":")[1];
|
||||
|
@ -178,6 +179,8 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
|||
flagged = true;
|
||||
else if (context.getString(R.string.title_search_special_snoozed).equals(special))
|
||||
snoozed = true;
|
||||
else if (context.getString(R.string.title_search_special_encrypted).equals(special))
|
||||
encrypted = true;
|
||||
}
|
||||
|
||||
int found = 0;
|
||||
|
@ -190,13 +193,14 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
|||
state.matches = db.message().matchMessages(
|
||||
folder,
|
||||
"%" + find + "%",
|
||||
seen, flagged, snoozed,
|
||||
seen, flagged, snoozed, encrypted,
|
||||
SEARCH_LIMIT, state.offset);
|
||||
Log.i("Boundary device folder=" + folder +
|
||||
" query=" + query +
|
||||
" seen=" + seen +
|
||||
" flagged=" + flagged +
|
||||
" snoozed=" + snoozed +
|
||||
" encrypted=" + encrypted +
|
||||
" offset=" + state.offset +
|
||||
" size=" + state.matches.size());
|
||||
state.offset += Math.min(state.matches.size(), SEARCH_LIMIT);
|
||||
|
@ -211,7 +215,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
|
|||
|
||||
TupleMatch match = state.matches.get(i);
|
||||
|
||||
if (find == null || seen != null || flagged != null || snoozed != null)
|
||||
if (find == null || seen != null || flagged != null || snoozed != null || encrypted != null)
|
||||
match.matched = true;
|
||||
else {
|
||||
if (match.matched == null || !match.matched)
|
||||
|
|
|
@ -234,9 +234,13 @@ public interface DaoMessage {
|
|||
" AND (:seen IS NULL OR ui_seen = :seen)" +
|
||||
" AND (:flagged IS NULL OR ui_flagged = :flagged)" +
|
||||
" AND (:hidden IS NULL OR (CASE WHEN ui_snoozed IS NULL THEN 0 ELSE 1 END) = :hidden)" +
|
||||
" AND (:encrypted IS NULL OR encrypt = 1)" +
|
||||
" ORDER BY received DESC" +
|
||||
" LIMIT :limit OFFSET :offset")
|
||||
List<TupleMatch> matchMessages(Long folder, String find, Boolean seen, Boolean flagged, Boolean hidden, int limit, int offset);
|
||||
List<TupleMatch> matchMessages(
|
||||
Long folder, String find,
|
||||
Boolean seen, Boolean flagged, Boolean hidden, Boolean encrypted,
|
||||
int limit, int offset);
|
||||
|
||||
@Query("SELECT id" +
|
||||
" FROM message" +
|
||||
|
|
|
@ -63,6 +63,7 @@ public class SearchViewEx extends SearchView {
|
|||
cursor.addRow(new Object[]{-2, prefix + ":" + getContext().getString(R.string.title_search_special_unseen)});
|
||||
cursor.addRow(new Object[]{-3, prefix + ":" + getContext().getString(R.string.title_search_special_flagged)});
|
||||
cursor.addRow(new Object[]{-4, prefix + ":" + getContext().getString(R.string.title_search_special_snoozed)});
|
||||
cursor.addRow(new Object[]{-5, prefix + ":" + getContext().getString(R.string.title_search_special_encrypted)});
|
||||
SimpleCursorAdapter adapter = new SimpleCursorAdapter(
|
||||
getContext(),
|
||||
R.layout.search_suggestion,
|
||||
|
|
|
@ -967,6 +967,7 @@
|
|||
<string name="title_search_special_unseen">unread</string>
|
||||
<string name="title_search_special_flagged">starred</string>
|
||||
<string name="title_search_special_snoozed">hidden</string>
|
||||
<string name="title_search_special_encrypted">encrypted</string>
|
||||
|
||||
<string name="title_widget_title_count">New message count</string>
|
||||
<string name="title_widget_title_list">Message list</string>
|
||||
|
|
Loading…
Reference in a new issue