Commit graph

4359 commits

Author SHA1 Message Date
Michael Gratton
3c4d5c5e9d Geary.RFC822.MailboxAddress: Handle long headers being folded
Remove "\n " sequences from RFC822 text before decoding so that any
long mailboxes/mailbox lists folded before the 80 char limit are
unfolded.

Fixes #1009
2021-01-20 19:24:17 +11:00
Michael Gratton
b51b933b6d Geary.RFC822.Subject: Handle long headers being folded
Remove "\n " sequences from RFC822 text before decoding so that any
long subject lines folded before the 80 char limit are unfolded.

Fixes #895
2021-01-20 19:20:30 +11:00
Michael Gratton
c331145fd3 client: Clean up database upgrade dialog implementation
Rename `UpgradeDialog` to `DatabaseManager` since it's not actually a
dialog, move it into the APplication package. Replace old Glade UI file
with a custom built dialog since it's trivial and so we can make it
modal for a main window.

Fixes #1007
2021-01-19 23:50:29 +11:00
Michael Gratton
642bf00e88 Util.Email.SearchExpressionFactory: Use ICU for work breaking
Implement search query text word segmentaion using ICU, so that
languages that don't use spaces for word delimiters are correctly
tokenised.
2021-01-19 20:49:01 +11:00
Michael Gratton
2f81fdf146 build: Add minimal ICU VAPI for UBreakIterator 2021-01-19 20:49:01 +11:00
Michael Gratton
58cae0ae40 Geary.ImapDB.Account: Drop post-search stemmed term greedy match removal
Stop post-processing search results by dropping results that contain a
matched term that is longer by some criterion than a stemmed term.

Since this cannot be specified by SQLite's FTS queries, it has to be
done outside of the search, which can have a substantial impact on
performance, and either means running multiple queries outside of a
transaction to get the required number of search results (potentially
a large number of times), running the pruning within a transaction
(potentially blocking the DB for a large length of time), or returning
the wrong number of search results (potentially confusing the caller).

Because of these disadvantages, and since SearchQuery's maximum
difference in lengths between term and stemmed variant helps to prevent
greedy matching anyway, just drop the post processing.
2021-01-19 20:49:01 +11:00
Michael Gratton
24140c07cd Geary.App.RemoveOperation: Queue a window count check after executing
Since when removing messages from the conversation monitor (especially
when a search is changed) the window might get smaller, queue a check
to re-fill if needed.
2021-01-19 20:49:01 +11:00
Michael Gratton
d98467a3f4 Geary.ImapDB.Account: Print SQL for search statements before executing
Helps to debug what the expression generator is doing.
2021-01-19 20:49:01 +11:00
Michael Gratton
d74c024bc9 Geary.FtsSearchQuery: Re-introduce FTS search optimisations
Per commit 9a137699, ensure we tell SQLite what index it should be
using, and are doing the FTS search in a sub-select. Without these,
FTS search is an order of magnitude slower.
2021-01-19 20:49:01 +11:00
Michael Gratton
36ba76b83b src/engine/imap-db/imap-db-fts5-*.c: Fix build warnings 2021-01-19 20:49:01 +11:00
Michael Gratton
7e38198287 ImapDb.Database: Register new ICU-based tokeniser for FTS
The SQLite tokeniser does not deal with scripts that do not use spaces
for word breaking (CJK, Thai, etc), thus searching in those languages
does not work well.

This adds a custom SQLite tokeniser based on ICU that breaks words for
all languages supported by that library, and uses NFKC_Casefold
normalisation to handle normalisation, case folding, and dropping of
ignorable characters.

Fixes #121
2021-01-19 20:48:59 +11:00
Douglas Fuller
90711f234e Geary.App.FillWindowOperation: detect stale FillWindowOperations
When a user types in the search box, there may still be oustanding
FillWindowOperations queued on previous instances of SearchFolder
from previous keystrokes. This can result in a FillWindowOperation
with a stale value of ConversationMonitor.window_lowest from a previous
search executing on the current one. Detect this and return immediately.

Fixes: #838
2021-01-19 20:48:17 +11:00
Michael Gratton
bb02e157c6 Geary.App.SearchFolder: Substantial implementation rework
This does the following:

 * Makes updating the search query a non-async call, so that apps can
   call it and forget about it
 * Makes updating search results only update the folder's contents
   when finished, and not if cancelled
 * Cancels any existing search tasks if the query is updated
 * Swaps sending removed signals before inserted signals to make the
   conversation viewer happier
2021-01-19 20:48:17 +11:00
Michael Gratton
f560707271 Geary.FtsSearchQuery: Fixes for email text disjunctions
Ensure OR is actually used to separate disjuncts, don't prefix match
non-stemmed terms when a stemmed version exists or when EXACT is
specified. Ensure column is correctly specified per disjunct.
2021-01-19 20:48:17 +11:00
Michael Gratton
9bd2359464 Geary.Account: Make new_search_query synchronous
Constructing a new query should be fast, and it no longer needs to be
done async, so remove async from the method and simplify callers.
2021-01-19 20:48:17 +11:00
Michael Gratton
9cb3a0d98c Geary.FtsSearchQuery: Fix build with vala ~ <= 0.48 2021-01-19 20:48:17 +11:00
Michael Gratton
4c911f5be7 Geary.App.SearchFolder: Only update search if query is different
This prevents re-running a search for e.g. whitespace-only changes.
2021-01-19 20:48:17 +11:00
Michael Gratton
092d117c8c Geary.SearchQuery: Enable checking queries and terms for equality
Add `SearchQuery.equal_to` method and virtual `Term.equal_to` method,
overriding it as needed in subclasses.
2021-01-19 20:48:17 +11:00
Michael Gratton
20a4fd3ed2 Geary.ImapDb.SearchQuery: Rename to Geary.FtsSearchQuery
There's nothing IMAP-specific about the class, so move it to common
and rename to reflect what it is actually used for.
2021-01-19 20:48:17 +11:00
Michael Gratton
2ab7b2c39e Geary.ImapDb.SearchQuery: Handle queries with some/all negated terms
SQLite FTS5 doesn't allow all negated terms in matches, and since NOT
is a binary operator (rather than unary) negated terms should be listed
after any positive terms.
2021-01-19 20:48:17 +11:00
Michael Gratton
6ffbfcf5d4 Geary.ImapDb.SearchQuery: Handle folder and deleted message exclusions
Ensure designated excluded folders, folderless messages, and
marked-for-deletion messages are excluded from FTS search results.
2021-01-19 20:48:17 +11:00
Michael Gratton
6a614adf73 Geary.ImapDb.SearchQuery: Use expression to generate FTS5 queries
Move SQL generation for FTS search from ImapDb.Account to SearchQuery.
Convert to use Geary.SearchQuery.Term instances to generate SQL, rather
than parsing the expression. Simplify the generated SQL substantially
and generate MATCH values that work with SQLite FTS5.
2021-01-19 20:48:17 +11:00
Michael Gratton
e0396c322e Geary.ImapDb.SearchQuery: Require stemmer to be passed in to ctor
Since constructing a libstemmer object is non trivial, this allows a
per-account instance to be created just once, and improves testability.
2021-01-19 20:48:17 +11:00
Michael Gratton
0112c8192c Geary.SearchQuery: Allow client apps to build search queries
Adds classes that allow building arbitrary query expressions and require
an instance to be provided to Geary.SearchQuery, to be set as a
property.

This enables query expressions to be parsed by clients instead of the
engine, in which ever whay they choose.
2021-01-19 20:48:17 +11:00
Michael Gratton
4fe0d92147 engine: Convert from SQLite FTS3/4 to FTS5 for full-text-search
Add SQL migration that drops the old FTS4 MessageSearchTable table,
re-create as a FTS5 table, clean up the column names a bit, and adds a
flags column so unread/starred queries can be made fast.

Define a SQLite FTS5 extension function `geary_matches()` to replace
the FTS3 `offsets()` function which no longer exists in FTS5, based on
Tracker's implementation.

Update code to FTS5 conventions (docid -> rowid, etc), use new column
names, populate and update the flags column as the email's flags
change, and use new match function for getting matching tokens.

Advanced searches are probably currently broken, these will be fixed
by subsequent commits.
2021-01-19 20:48:17 +11:00
Michael Gratton
435a5e90f4 Geary.NamedFlag: Add serialise method for non-debug persistence 2021-01-19 20:48:17 +11:00
Jeremias Ortega
e0fab92d3c
application-main-window: Add shortcut to select inbox
Closes: https://gitlab.gnome.org/GNOME/geary/-/issues/1108
2021-01-17 16:55:49 -06:00
Michael Gratton
2fb9d46103 Convert private properties into fields. 2021-01-16 22:58:19 +00:00
Rico Tzschichholz
30105fd4c2 Don't alter or try to write [GtkChild] properties
See https://gitlab.gnome.org/GNOME/vala/issues/1121
2021-01-16 19:16:35 +01:00
Michael Gratton
1ff30d9448 Merge branch 'mjog/db-sql-log-extended' into 'mainline'
Geary.Db.Statement: Log SQL statements with params where possible

See merge request GNOME/geary!629
2021-01-15 23:50:42 +00:00
Michael Gratton
298e4ec2e9 Geary.Db.Statement: Log SQL statements with params where possible
Ensure when SQL logging is enabled, that SQL statements are logged
with parameter values filled in where possible.
2021-01-16 10:07:04 +11:00
Michael Gratton
506a5b5fc6 Components.WebView: Remove selection_changed signal
Now that vala only notifies on property changes when the value actually
changes, and GLib emits a warning when connecting to notify signals for
properties that don't exist, it's safer to use notify signals for
property changes, and hence this isn't needed any more.

This patch removes the signal, ensures the `has_selection` gets set
correctly, and updates signal listeners to use notify instead.

Fixes #1058, #1118 and possibly others.
2021-01-16 00:24:53 +11:00
Michael Gratton
2892189094 Components.WebView: Fix CI failure building with WebKitGTK >= 2.31
The `webkit_settings_set_enable_plugins` method has been deprecated in
2.31, and calling it emits a warning which trips up the test suite.
2021-01-14 22:00:12 +11:00
Julian Sparber
a1a31734c4 components: ensure correct initial state for headerbars buttons
fixes: https://gitlab.gnome.org/GNOME/geary/-/issues/1112
2021-01-12 12:40:56 +01:00
Michael Gratton
7ec99e1f6b client: Implement showing window menu when F10 pressed
Fixes #1102
2021-01-08 09:34:27 +11:00
Michael Gratton
1ad29a9be9 Merge branch 'sidebar-improvments' into 'mainline'
Modernize folder list (without rewrite)

Closes #880 and #1029

See merge request GNOME/geary!618
2021-01-07 22:29:05 +00:00
Michael Gratton
0f760d7aad Merge branch 'issue_689' into 'mainline'
Issue 689: Archive option in message right click menu

See merge request GNOME/geary!605
2021-01-07 22:18:54 +00:00
Michael Gratton
bf3a0e830b Merge branch 'adaptive_dialogs' into 'mainline'
Make account-editor adaptive

See merge request GNOME/geary!609
2021-01-07 21:54:57 +00:00
Michael Gratton
008fe162ad Merge branch 'make_it_fit' into 'mainline'
Make geary fit to small screen sizes

See merge request GNOME/geary!602
2021-01-07 21:37:30 +00:00
Carlos Langoni
c7a0c00de8 Archive option in message right click menu 2021-01-07 12:02:19 -03:00
Julian Sparber
8aa5f291e8 folder-list: mordernize sidebar
This makes each row a better click target and improves spacing in
general. This move the expander arrow to the left and removes the
indentation for folders which makes it possible to define a much
smaller width for the sidebar.

Fixes: https://gitlab.gnome.org/GNOME/geary/-/issues/880,
       https://gitlab.gnome.org/GNOME/geary/-/issues/1029
2020-12-09 11:08:33 +01:00
Julian Sparber
e070607f58 folder-list: allow to toggle expaned on the entire row 2020-12-09 11:08:33 +01:00
Julian Sparber
a57a1d46d7 folder-list: Don't expand folder list automatically 2020-12-09 11:08:33 +01:00
Marek Černocký
6023aac70e Fixed i18n 2020-11-27 17:56:31 +01:00
Julian Sparber
3530a804a1 compnents-info-bar: use custom infobar so that the buttons reflow 2020-11-18 16:50:18 +01:00
Julian Sparber
9c6ca541cc conversation-viewer: move actions to the bottom when they don't fit 2020-11-18 14:59:43 +01:00
Julian Sparber
a30afb9e86 account-editor: replace remove confirm view with dialog 2020-11-17 13:45:57 +01:00
Adrien Plazas
84c94463cd accounts-editor-eit-pane: Ellipsize the account row label
This will help the pane fit in narrower widths.
2020-11-17 11:48:31 +01:00
Adrien Plazas
bab1759af0 accounts-editor-add-pane: Reduce the minimum entry width
This will help the pane fit in narrower widths.
2020-11-17 11:48:31 +01:00
Michael Gratton
ec7ea98494 Merge branch 'mjog/283-plain-text-whitespace-fixes' into 'mainline'
Email body whitespace fixes

See merge request GNOME/geary!610
2020-11-05 08:19:16 +00:00