Added search in headers (debug version only)

pull/198/head
M66B 4 years ago
parent c1e6d7bf34
commit 2c4f5ab0be

@ -454,6 +454,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
criteria.in_keywords = false;
criteria.in_message = false;
criteria.in_notes = false;
criteria.in_headers = false;
criteria.with_flagged = true;
FragmentMessages.search(
context, owner, parentFragment.getParentFragmentManager(),

@ -270,6 +270,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
criteria.in_keywords,
criteria.in_message,
criteria.in_notes,
criteria.in_headers,
criteria.with_unseen,
criteria.with_flagged,
criteria.with_hidden,
@ -675,6 +676,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
boolean in_keywords = true;
boolean in_message = true;
boolean in_notes = true;
boolean in_headers = false;
boolean with_unseen;
boolean with_flagged;
boolean with_hidden;
@ -868,6 +870,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
this.in_keywords == other.in_keywords &&
this.in_message == other.in_message &&
this.in_notes == other.in_notes &&
this.in_headers == other.in_headers &&
this.with_unseen == other.with_unseen &&
this.with_flagged == other.with_flagged &&
this.with_hidden == other.with_hidden &&
@ -893,6 +896,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
" keywords=" + in_keywords +
" message=" + in_message +
" notes=" + in_notes +
" headers=" + in_headers +
" unseen=" + with_unseen +
" flagged=" + with_flagged +
" hidden=" + with_hidden +

@ -328,6 +328,7 @@ public interface DaoMessage {
" OR (:keywords AND `keywords` LIKE :find COLLATE NOCASE)" + // no index
" OR (:message AND `preview` LIKE :find COLLATE NOCASE)" + // no index
" OR (:notes AND `notes` LIKE :find COLLATE NOCASE)" + // no index
" OR (:headers AND `headers` LIKE :find COLLATE NOCASE)" + // no index
" OR (attachment.name LIKE :find COLLATE NOCASE)" + // no index
" OR (attachment.type LIKE :find COLLATE NOCASE)) AS matched" + // no index
" FROM message" +
@ -350,7 +351,7 @@ public interface DaoMessage {
" LIMIT :limit OFFSET :offset")
List<TupleMatch> matchMessages(
Long account, Long folder, String find,
boolean senders, boolean recipients, boolean subject, boolean keywords, boolean message, boolean notes,
boolean senders, boolean recipients, boolean subject, boolean keywords, boolean message, boolean notes, boolean headers,
boolean unseen, boolean flagged, boolean hidden, boolean encrypted, boolean with_attachments, boolean with_notes,
int type_count, String[] types,
Integer size,

@ -99,6 +99,7 @@ public class FragmentDialogSearch extends FragmentDialogBase {
final CheckBox cbKeywords = dview.findViewById(R.id.cbKeywords);
final CheckBox cbMessage = dview.findViewById(R.id.cbMessage);
final CheckBox cbNotes = dview.findViewById(R.id.cbNotes);
final CheckBox cbHeaders = dview.findViewById(R.id.cbHeaders);
final CheckBox cbUnseen = dview.findViewById(R.id.cbUnseen);
final CheckBox cbFlagged = dview.findViewById(R.id.cbFlagged);
final CheckBox cbHidden = dview.findViewById(R.id.cbHidden);
@ -198,9 +199,12 @@ public class FragmentDialogSearch extends FragmentDialogBase {
if (grpMore.getVisibility() == View.VISIBLE) {
ibMore.setImageLevel(1);
grpMore.setVisibility(View.GONE);
cbHeaders.setVisibility(View.GONE);
} else {
ibMore.setImageLevel(0);
grpMore.setVisibility(View.VISIBLE);
if (BuildConfig.DEBUG)
cbHeaders.setVisibility(View.VISIBLE);
}
}
};
@ -218,6 +222,7 @@ public class FragmentDialogSearch extends FragmentDialogBase {
cbKeywords.setEnabled(!isChecked);
cbMessage.setEnabled(!isChecked);
cbNotes.setEnabled(!isChecked);
cbHeaders.setEnabled(!isChecked);
cbUnseen.setEnabled(!isChecked);
cbFlagged.setEnabled(!isChecked);
cbHidden.setEnabled(!isChecked);
@ -313,6 +318,7 @@ public class FragmentDialogSearch extends FragmentDialogBase {
tvBefore.setText(null);
grpMore.setVisibility(View.GONE);
cbHeaders.setVisibility(View.GONE);
etQuery.requestFocus();
if (imm != null)
@ -355,6 +361,7 @@ public class FragmentDialogSearch extends FragmentDialogBase {
criteria.in_keywords = cbKeywords.isChecked();
criteria.in_message = cbMessage.isChecked();
criteria.in_notes = cbNotes.isChecked();
criteria.in_headers = cbHeaders.isChecked();
criteria.with_unseen = cbUnseen.isChecked();
criteria.with_flagged = cbFlagged.isChecked();
criteria.with_hidden = cbHidden.isChecked();

@ -333,6 +333,18 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSearchTextHint" />
<CheckBox
android:id="@+id/cbHeaders"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="12dp"
android:text="@string/title_search_in_headers"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbNotes" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvAnd"
android:layout_width="wrap_content"
@ -342,7 +354,7 @@
android:text="@string/title_search_with"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbNotes" />
app:layout_constraintTop_toBottomOf="@id/cbHeaders" />
<CheckBox
android:id="@+id/cbUnseen"

@ -1175,6 +1175,7 @@
<string name="title_search_in_keywords">In keywords (if supported)</string>
<string name="title_search_in_message">In message text</string>
<string name="title_search_in_notes">In local notes</string>
<string name="title_search_in_headers" translatable="false">In headers</string>
<string name="title_search_with">Limit search to</string>
<string name="title_search_with_unseen">Unread</string>
<string name="title_search_with_flagged">Starred</string>

Loading…
Cancel
Save