Commit Graph

556 Commits

Author SHA1 Message Date
Manos Pitsidianakis
7eceef93e9
melib/backends: remove folder_operation
folder_operation functionalities will go to BackendFolder trait
2019-12-18 15:43:30 +02:00
Manos Pitsidianakis
9080e0fd96
melib: rename FolderConf rename field to alias 2019-12-18 15:40:57 +02:00
Manos Pitsidianakis
bb18ddc944
ui: make search cache rebuild account-specific
ReIndex command is supposed to be account specific yet the account
argument was ignored
2019-12-18 08:59:04 +02:00
Manos Pitsidianakis
2b6f6ab42c
melib: Add BackendFolder methods, move special usage logic to backend
- add count() method to return (unseen, total) counts
- add is_subscribed()
- add set_special_usage() and set_is_subscribed()

concerns #8
2019-12-18 08:58:49 +02:00
Manos Pitsidianakis
8f63572584
Small refactors to avoid implicit unwrap() panics 2019-12-15 19:47:42 +02:00
Manos Pitsidianakis
0201241786
melib/backends: MailBackend::refresh() returns Result
Handle cases were refresh() would fail properly. Fixes a crash reported in #13
2019-12-15 08:55:08 +02:00
Manos Pitsidianakis
17a0f31b3e
ui/accounts: split StartupCheck event semantics
UIEvent::StartupCheck was meant to notify the UI that a folder had made
progress and polling its async worker would return a
Result<Vec<Envelope>>. However the StartupCheck was received by
MailListing components which called account.status() which did the
polling. That means that if the polling got back results, the listing
would have to call account.status() again to show them. This is a
problem in configurations with only one account because there aren't any
other sources of event to force the listing to recheck account.status()

A new event UIEvent::WorkerProgress will do the job of notifying an
Account to poll its workers and the account will send a startupcheck if
it has made progress. That way the refresh progress is as follows:

Worker thread sends WorkerProgress event -> State calls appropriate
account's account.status() method -> account polls workers, and if there
are new results send StartupCheck events -> State passes StartupCheck
events to components -> Listings update themselves when they receive the
event
2019-12-14 19:56:43 +02:00
Manos Pitsidianakis
65efb23f14
melib/MailBackend: add refresh() method
Initiate refresh manually.
2019-12-14 18:58:59 +02:00
Manos Pitsidianakis
d2b4057b7b
melib/MailBackend: add connect() method 2019-12-14 18:58:55 +02:00
Manos Pitsidianakis
10368612ab
ui/listing: prevent spinning on is_online check
Since self.component is never drawn if account is not online, it will
remain dirty and everything will be redrawn again and again, blocking
the UI.
2019-12-14 18:57:58 +02:00
Manos Pitsidianakis
ab3e01359a
ui/Component: change set_dirty() to set_dirty(value)
Next commit will need to set a child component as not dirty so we need
set_dirty(value) instead of set_dirty() that always sets is to true.
2019-12-14 18:57:58 +02:00
Manos Pitsidianakis
2e38ea11e2
melib: make MailBackend::is_online() return Result<()>
Return Result<()> instead of bool to indicate connection status in order
to be able to show errors to user.
2019-12-14 18:57:52 +02:00
Manos Pitsidianakis
18a8d22b85
ui/shortcuts: Replace arrow key use with configurable shortcuts 2019-12-14 14:16:12 +02:00
Manos Pitsidianakis
aa9a6a3128
melib: add SpecialUseMailbox::detect_usage method 2019-12-13 00:04:59 +02:00
Manos Pitsidianakis
d69be5bb0b
ui/accounts: don't panic if Backend::folders is_err 2019-12-13 00:04:58 +02:00
Manos Pitsidianakis
328b17a995
ui/CompactListing: use Segment Trees to calculate max page column width
Given a range of entries that occupy a page (eg [0, 50] for a page of 50
rows high) get the max entry width for this column by using maximum
range queries with segment trees.
2019-12-12 11:11:32 +02:00
Manos Pitsidianakis
7432be5aaa
ui/listings: truncate subject at 150 grapheme width
Large subjects would cause large CellBuffer allocations.
2019-12-12 11:07:54 +02:00
Manos Pitsidianakis
b401b64f35
ui/CellBuffer: change row_iter() bounds to Range
Writing a range x..y is more ergonomic than (x, y+ 1)
2019-12-12 11:04:14 +02:00
Manos Pitsidianakis
59f7f03d64
ui: refactor watch thread spawning procedure
- Remove unnecessary parameters from watch(), reload()
- Add NewThread event that adds new threads in
work_controller.static_threads hashmap
- removed obsolete field State.threads
- silence watch thread error notifications
2019-12-12 01:04:33 +02:00
Manos Pitsidianakis
b93154a596
ui/MailListings: fix set_seen action not being processed 2019-12-11 01:58:35 +02:00
Manos Pitsidianakis
f05a4205f7
melib/ui: small fixes
- melib/imap: accept quoted strings with escaped quotes in
protocol_parser
- ui/accounts: return unavailabity correctly if folder's worker slot is
empty instead of judging only by its vacancy
- ui/MailView: set view as not dirty if envelope loading from backend
fails so that it stops requesting it in every subsequent redraw
2019-12-11 00:17:11 +02:00
Manos Pitsidianakis
6f76cd9acc
melib: add special_usage() method to BackendFolder
Eventually after loading potential usage values from configuration,
backends will be able to change the usage values themselves. IMAP and
JMAP have the ability to set Mailbox roles (IMAP needs LIST-SPECIAL
extension
2019-12-11 00:15:36 +02:00
Manos Pitsidianakis
ad7c91bc29
ui/sqlite3: warn user if db hasn't been initialised 2019-12-09 20:30:37 +02:00
Manos Pitsidianakis
40e928dad3
Push version to 0.4.1 2019-12-08 11:36:38 +02:00
Manos Pitsidianakis
0eaf17871a
melib: add set_tags command in BackendOp 2019-12-08 11:25:54 +02:00
Manos Pitsidianakis
f632bc4c08
ui: update rows on TagAdd/TagRemove
Except for threadlisting
2019-12-07 20:47:59 +02:00
Manos Pitsidianakis
c6f1fa9be0
ui: Add TagAction
Add/Remove
2019-12-07 17:31:49 +02:00
Manos Pitsidianakis
fdb42cfc0c
ui/status: show tag and search backend info
Show tag and search backend info for each account.
2019-12-07 17:17:08 +02:00
Manos Pitsidianakis
b858fcb0ab
ui/conf: change field order
Change field order because FolderConf has an extra_settings sinkhole
field for serde, which catches any setting that could go to the other
field.
2019-12-07 17:17:08 +02:00
Manos Pitsidianakis
e5da10093d
ui/listing: use MailListingTrait instead of ListingTrait 2019-12-07 17:17:05 +02:00
Manos Pitsidianakis
8e27b86453
Add MailListingTrait
Inheriting ListingTrait
2019-12-07 17:16:00 +02:00
Manos Pitsidianakis
6cf73b4238
Remove Option<EnvelopeHash> from ListingTrait
It was never used.
2019-12-07 01:38:43 +02:00
Manos Pitsidianakis
46a807eee1
melib: remove control characters from subject 2019-12-07 01:36:52 +02:00
Manos Pitsidianakis
d376f83f48
ui/conversations: fix padding left unpainted 2019-12-06 16:37:44 +02:00
Manos Pitsidianakis
d048d8566d
ui: add format=flowed if text/plain att is the only one 2019-12-06 16:37:44 +02:00
Manos Pitsidianakis
c431fb6dff
ui: use BoundsIterator in clear_area 2019-12-06 12:33:59 +02:00
Manos Pitsidianakis
3a3b815b3a
ui/accounts: add save_special method for mail
Add save_special method in Accounts. save_special() saves mail to the
first folder_type (eg Draft, Sent, Inbox) folder it finds or to any
other as fall over.
2019-12-03 13:30:42 +02:00
Manos Pitsidianakis
ef26b03bb6
Add some documentation 2019-12-01 17:13:36 +02:00
Manos Pitsidianakis
16ccff0f44
ui: add RowIterator and BoundsIterator for CellBuffer
Use `RowIterator` to iterate the cells of a row without the need to do
any bounds checking; the iterator will simply return `None` when it
reaches the end of the row.  `RowIterator` can be created via the
`CellBuffer::row_iter` method and can be returned by `BoundsIterator`
which iterates each row.
2019-12-01 17:13:36 +02:00
Manos Pitsidianakis
3ae43817a1
ui: user-configured colors for tags in mail listings 2019-12-01 12:10:31 +02:00
Manos Pitsidianakis
bca33370cc
Add tag settings in UI config module 2019-12-01 12:09:35 +02:00
Manos Pitsidianakis
19a268b8a7
ui: add tags in compact, conversations 2019-11-30 21:55:40 +02:00
Manos Pitsidianakis
d31c629ac4
ui: add tags in plain listing 2019-11-30 17:44:54 +02:00
Manos Pitsidianakis
6d380cefd1
ui: add keep_{f,b}g flags in Cell
It might be necessary to know if a cell has to keep its colours while
the character content doesn't change. For example the tags in a mail
listing can have colour backgrounds that should be immutable if the user
highlights each entry.

The flags should be reset every time the cell itself is reset.
2019-11-30 17:44:54 +02:00
Manos Pitsidianakis
b54bd6de84
ui: pass search to libnotmuch for notmuch accounts 2019-11-30 17:39:12 +02:00
Manos Pitsidianakis
49dccb94a5
bin: add notmuch feature
Add notmuch feature that includes melib/notmuch_backend and a new
feature for the ui crate. We need the latter in order to know from
within ui if we have been linked with libnotmuch
2019-11-30 17:31:49 +02:00
Manos Pitsidianakis
0b845a0d16
Small fixes
- Update documentation on include config syntax
- Accept relative paths in include config syntax
- Fix one line clearing that shouldn't be redrawn in html view
- Fix shortcuts not being honored in Composer
2019-11-29 12:15:05 +02:00
Manos Pitsidianakis
d4f20b0c0d
Fix Raw envelope view starting one line line earlier 2019-11-28 22:32:13 +02:00
Manos Pitsidianakis
c04513ac94
ui: add shortcut! macro to compare shortcuts values
This is used in process_event() functions of UI Components. When a key
has been input we have to compare it with the configured shortcuts from
a hashmap.

Add shortcut! macro that checks shortcut hashmaps for the given name and
doesn't panic if it's missing.
2019-11-28 22:16:56 +02:00
Manos Pitsidianakis
4048eab424
ui/conf: Add include file feature
Use

  #include "path/to/file"

In configuration file to include other files.
2019-11-27 22:21:25 +02:00