diff options
| author | Danilo M. <danix@danix.xyz> | 2026-08-14 12:56:53 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-08-14 12:56:53 +0200 |
| commit | 8a2e02a3e1a669a738d1de4615720378d5cc2d38 (patch) | |
| tree | c1dc8fb4cad01987fb192869887e28d7e37fb4f1 /src/messageview.h | |
| parent | f7f868ce00e01e4026be19437242537967875ce5 (diff) | |
| download | qtmaildir-8a2e02a3e1a669a738d1de4615720378d5cc2d38.tar.gz qtmaildir-8a2e02a3e1a669a738d1de4615720378d5cc2d38.zip | |
feat(search): search for the selected body text
selectedText() reads the selection with no script injection; JavaScript stays
disabled in the profile. The page's standard menu is kept and the entries are
added to it below a separator.
The quoting is tested through a function taking the text, so it needs no live
web engine: a selection is arbitrary prose and can carry quotes, newlines and
query syntax, none of which notmuch reports as an error.
Diffstat (limited to 'src/messageview.h')
| -rw-r--r-- | src/messageview.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/messageview.h b/src/messageview.h index 26ed216..3e600f0 100644 --- a/src/messageview.h +++ b/src/messageview.h @@ -140,6 +140,15 @@ public: /// parsing it back: rich text does not survive a second parse. QList<SearchOffer> headerSearchOffers() const { return m_headerOffers; } + /// The offer for a body selection, its query empty when there is nothing + /// usable selected. + /// + /// Takes the text rather than reading the page, so the quoting is testable + /// without a live web engine and a rendered document. A selection is + /// arbitrary prose and can carry quotes, newlines and query syntax, none + /// of which notmuch reports as an error. + SearchOffer selectionSearchOffer(const QString &selectedText) const; + public slots: void toggleHtml(); void loadRemoteContent(); @@ -235,6 +244,9 @@ private: /// Builds and pops the header's menu at `pos`, in the label's coordinates. void showHeaderContextMenu(const QPoint &pos); + /// Builds and pops the web view's menu, keeping its standard entries. + void showBodyContextMenu(const QPoint &pos); + /// Appends a "Search for ..." submenu per offer, each holding the replace /// and the narrow operation. /// |
