Commit Graph

1951 Commits

Author SHA1 Message Date
miruka
702497cb48 Fix 403 error on invited room chat page
Don't try to fetch room members while user is only invited or has left
the room.
2020-08-25 09:37:09 -04:00
miruka
0d2be820fe Allow "replying" to an event with a file
Send a pseudo-reply consisting of two messages: a `m.text` which is just
a reply with an empty body, then the file event itself.

This is a workaround to the restriction imposed by the Matrix API,
which prevents us from simply attaching a reply to a media event:
https://matrix.org/docs/spec/client_server/latest#rich-replies
2020-08-24 10:17:04 -04:00
miruka
6d9a013d5d Composer: allow sending a reply with no text
Useful for "forwarding" a message (to the same room)
2020-08-24 09:54:49 -04:00
miruka
bbb46a9feb Disallow whitespace in composer aliases
These cause problems with the composer alias parsing code.
If an alias from the config file has whitespace, only the first word
will be taken into account (ignoring any leading or trailing whitespace).
2020-08-24 09:54:49 -04:00
miruka
83f35c034e Refactor MessageArea composer alias handling
Simplify the code, make it more declarative, and improve the reliability
of sending typing notifications (notably when changing the used alias in
the middle of a message).
2020-08-24 09:54:49 -04:00
miruka
aba47ef26b Discard room members from outdated initial sync
Fix in cooperation with matrix-nio commit
ffc42287c22a1179a9be7d4e47555693417f715d, see its description.
2020-08-24 09:54:49 -04:00
miruka
b83fd63769 Save composer state as right user when using alias
If the chat was opened under e.g. "@user1:example.org", but the
composer text is "o abc" where "o" is a composer alias for
"@other_account:example.org", save the composer text to state.json as
"@user1:example.org" and not the alias user.
2020-08-24 09:54:49 -04:00
miruka
df3f1fb645 Remove all Backend "get_any_client"-using methods
thumbnail() and download() were remaining.
Use a direct and carefully chosen MatrixClient's methods instead to
avoid problems mentioned in the previous commit 7502c1.
2020-08-24 09:54:43 -04:00
miruka
0f2efa9ba3 Don't pick a random client to get user profiles
Causes problem if one of the candidate client is on a server that
doesn't federate (e.g. a local one). Move the `get_profile()` function
from Backend to MatrixClient.
2020-08-23 16:18:54 -04:00
miruka
7502c1a9b4 Don't use TapHandlers in TextArea/TextField
Causes conflicts on touch/pen which prevent the component from being
focused. Use the normal press/pressHold signals instead.
2020-08-23 15:41:20 -04:00
miruka
71a2951f5b Move tooltip window hover detector to HToolTip
Having a HoverHandler covering the root ApplicationWindow causes
problems for some Qt Quick Controls with pen/touch, e.g. it's impossible
to focus a TextArea/TextField.

The HoverHandler is moved to HToolTip (since it's used for those),
targets the ApplicationWindow but is now only enabled while a tooltip is
visible.
2020-08-23 15:17:06 -04:00
miruka
f68dda9f14 Don't start with any member in autocompl. models
Fix the AutoCompletedMembers filter model to ensure that it doesn't
pick all the items from the corresponding room member model on startup,
wait until the user actually uses the completion feature to fill it.
2020-08-23 10:54:03 -04:00
miruka
fc6827807c Fix mentioning blank display names
If the display name of a user is blank (e.g. just a space character),
autocomplete it as a user ID.

If the display name starts or ends with whitespace, trim it.
2020-08-23 10:46:59 -04:00
miruka
fbf6e48b5b Fix mentioning users without display names 2020-08-23 09:41:41 -04:00
miruka
e79094c18c Fix click on user delegate not making it a mention 2020-08-23 09:23:34 -04:00
miruka
4000d70514 Reset input method when autocompleting a user
Fixes IME being left in a strange state upon autocompleting a word that
was being edited.
2020-08-23 09:14:45 -04:00
miruka
0434659ad1 CompletableUserDelegate avatar: respect uiScale 2020-08-22 15:17:52 -04:00
miruka
223197b84e Pass HTTPS server URL to Python when possible
Reduce the time it takes to connect to the server since Python won't
need to guess the real protocol.
2020-08-22 15:15:15 -04:00
miruka
9cc9229fdb Simplify pinging & properly close aiohttp session 2020-08-22 13:19:38 -04:00
miruka
f327c99a99 Use the new improved anchel.nl JSON API
The /publiclist.json provides all the server event/downtime logs
in one file, so we don't have to do requests for every server anymore.
2020-08-22 13:10:04 -04:00
miruka
e7f769b344 HTextArea: consider preeditText for getWordAt()
`preeditText` is partial input from IME and touchscreen
autocompleting keyboards, consider it together with `text` for the
`getWordAt()` function.

This should allow user autocompletion to work properly in these
specific conditions.
2020-08-22 01:47:53 -04:00
miruka
eadc4bb317 Remove unused function inside UserAutoCompletion 2020-08-22 01:44:41 -04:00
miruka
bc3d6d902f Fix @autocomplete closing after one character
Typing e.g. "@a" would work, but "@ab" would always instantly close
the autocompletion UI if the cursor was at the end of the text area.
2020-08-22 01:23:44 -04:00
miruka
8ab4ce8ad7 Bump version to v0.6.1 2020-08-21 12:10:22 -04:00
miruka
12c47476fc Add theme properties for autocompletion UI 2020-08-21 12:10:22 -04:00
miruka
044060d1c0 Color name when highlighting member delegates 2020-08-21 12:10:22 -04:00
miruka
010675001c Add bottom margin to autocompletion UI 2020-08-21 12:10:22 -04:00
miruka
6f37ce3519 Fix completing in the middle of a name with spaces 2020-08-21 12:10:22 -04:00
miruka
bea1d60621 Fix autocompletion for users without display name 2020-08-21 12:10:22 -04:00
miruka
cd81c94ce8 Fix autocompletion for display names with spaces 2020-08-21 12:10:22 -04:00
miruka
9dc9a5e70f Clip the autocompletion UI 2020-08-21 12:10:21 -04:00
miruka
9b3d01b9a8 ServerDelegate: add ping icon tooltips 2020-08-21 12:10:21 -04:00
miruka
93b73b86bb Add a "table header" to server browser 2020-08-21 12:10:21 -04:00
miruka
6160deace5 Improve ServerBrowser text wording 2020-08-21 12:10:21 -04:00
miruka
85f4620b3b Equalize "Homeserver address" label padding 2020-08-21 12:10:21 -04:00
miruka
339341da68 Disable new scrollbar auto-show behavior for now
There are still some usability issues to fix with it
2020-08-21 12:10:18 -04:00
miruka
b79b032184 Better delegate for completable users 2020-08-21 09:27:01 -04:00
miruka
6dcc244998 Move UserAutoCompletion outside of Composer 2020-08-21 05:50:37 -04:00
miruka
4ea3a7d52a Remove HFlickable leftover debug print 2020-08-21 05:33:59 -04:00
miruka
e0e92152d0 Fix infinite account spinner when logging in twice 2020-08-21 05:33:57 -04:00
miruka
bd01d9edd0 Fix segfault when leaving loading server list page 2020-08-21 05:18:08 -04:00
miruka
6ba6202771 Fix clicking on server in server browser 2020-08-21 05:10:32 -04:00
miruka
2ccb28fa49 Box/popups: ignore enter press on disabled buttons 2020-08-21 05:08:12 -04:00
miruka
8fbe59f6eb Fix cursorShape over fields inside a HFlickable
Bug introduced in 6b907, made the cursor stay as a normal arrow when
hovering text fields/areas inside a HFlickable due to the
HKineticScrollingDisabler's width/height being incorrectly set.
2020-08-21 04:58:58 -04:00
miruka
43b14f3129 Make autocompletion work not just at end of line 2020-08-21 04:44:55 -04:00
miruka
1b919ec7be Cursor moves before last word: close completion UI 2020-08-21 01:46:07 -04:00
miruka
063f9d2b1d Only mention tab-completed usernames 2020-08-21 01:21:51 -04:00
miruka
5ba669444d Add basic user autocompletion UI 2020-08-21 01:21:10 -04:00
miruka
ec17d54923 ServerDelegate: ignore compact mode 2020-08-21 01:19:18 -04:00
miruka
cc06645275 Add spinner when fetching homeservers list 2020-08-21 01:19:18 -04:00
miruka
4f1b007e6f Add some top/bottom padding to account bar 2020-08-21 01:19:18 -04:00
miruka
ede99b310e Fix login box tab shortcuts 2020-08-21 01:19:18 -04:00
miruka
3c79ffbf21 Don't show register/reset tabs on sso login box 2020-08-21 01:19:18 -04:00
miruka
f648807730 Remove unused Device model item 2020-08-21 01:19:18 -04:00
miruka
e303ee1fc9 SignInSso: return to server list on Cancel click 2020-08-21 01:19:18 -04:00
miruka
5ac5dbd1d5 Add usual FlickShortcuts to server browser 2020-08-21 01:19:18 -04:00
miruka
21fbe7a96b Show scrollbars for a few seconds at first
Lets the user know that there's content to scroll.
2020-08-21 01:19:18 -04:00
miruka
11def5c99f Mozilla server is now in anchel.nl public list 2020-08-21 01:19:17 -04:00
miruka
2f1889423b Room & member filter fields: support (shift+)tab 2020-08-21 01:19:17 -04:00
miruka
007a11b4aa Change "go to homeserver address" icon 2020-08-21 01:19:17 -04:00
miruka
d945bed0a3 Increase "Homeserver address" text bottom padding 2020-08-21 01:19:17 -04:00
miruka
d3092c4929 Clear server list highlight when field text edited 2020-08-21 01:19:17 -04:00
miruka
21462dc25f Remove unused theme smallPaneHighlight property 2020-08-21 01:19:17 -04:00
miruka
c51a771a65 Add colored border to HListView highlight delegate 2020-08-21 01:19:17 -04:00
miruka
05f2c20924 Remove leftover pdb call in MatrixClient._send() 2020-08-21 01:18:44 -04:00
miruka
4760ccac5e Filter servers also by their name 2020-08-19 06:37:26 -04:00
miruka
ab390704eb Use homeserver URL field also as a filter field 2020-08-19 04:39:50 -04:00
miruka
16970d5e56 Auto-detect homeserver scheme:// 2020-08-19 02:14:46 -04:00
miruka
2fa8b2c5f9 Add a public server list to the initial login page 2020-08-19 01:13:34 -04:00
miruka
1a6273681d Fix HMenuItemPopupSpawner 2020-08-19 00:16:42 -04:00
miruka
21fe4b7bd1 Add spacing between MemberDelegate name-last seen 2020-08-16 16:17:22 -04:00
miruka
cc7c0ad336 Add theme property to Utils
Gets set to the window.theme when a theme is loaded, done to avoid
having to refer to the window object from utils.
2020-08-03 01:29:37 -04:00
miruka
a389238024 Add window.makePopup(), utils.makePopup() wrapper 2020-08-03 01:26:35 -04:00
miruka
c813e92ac7 Move hideErrorTypes & showError() to PythonBridge 2020-08-03 01:19:08 -04:00
miruka
040e966d27 Remove utils.sendFile(), useless wrapper 2020-08-03 01:05:19 -04:00
miruka
09ae0d7776 Server discovery: no need to recreate a client 2020-07-30 22:59:24 -04:00
miruka
758edd8a6a Upload sync filter & use filter ID for syncs
rather than passing an entire filter dict for every single syncs.
This shortens the request URL and prevents troubles with some servers
that have an absurdly low max URL length (e.g. halogen.city).
2020-07-30 22:53:43 -04:00
miruka
03f9ec94ff Fix autolinking user IDs including ; or < 2020-07-29 02:00:49 -04:00
miruka
865d6b8bc8 ServerBrowser: strip trailing slashes from URL 2020-07-27 16:40:04 -04:00
miruka
db5d9b57f8 RoomDelegate subtitle: lazy-fetch missing profiles 2020-07-27 04:32:00 -04:00
miruka
a0912106ca EventDelegate: fix not setting fetchProfilesFuture 2020-07-27 04:24:40 -04:00
miruka
d127ad978c Correctly handle initial sync member events
Previously, member events in initial syncs (unless user had "hide member
events" and "hide profile events" set to false in their config) were
completely discarded with the help of a sync filter, instead of simply
being hidden like events loaded from room backfilling.

This was done due to the common case of rooms getting only
userconfig-ignored/hidden events on startup (especially with the
low number of initial events requested for lazy initial sync),
and thus having nothing to show as "last message" in
the room list (room delegate subtitles).

Other problems resulted from this, like missing join/leave events
when the config was set to hide profile events but not other
member events, and the "Members not synced" (#54) in encrypted room
with recent discarded member events.

The discarding filter is no longer used. Instead, if a room in the room
list has no visible "last message" and is currently visible to the user,
messages will be lazily fetched until we find something adequate or the
room goes out of view.
2020-07-27 03:59:41 -04:00
miruka
f1f24f5121 Don't log "unknown member event" warnings
These just mean we haven't noticed any change in a profile event, and
haven't been of any use.
2020-07-27 02:43:11 -04:00
miruka
fcf6b45bf6 Disable timeline scrolling when a popup is open 2020-07-27 00:16:04 -04:00
miruka
6d8980bcb3 Use nio's new restore_login() method 2020-07-27 00:15:52 -04:00
miruka
e611f89fe3 Fix/update Backend._do_login() docstring 2020-07-26 23:40:15 -04:00
miruka
3ab2864f22 SignInSso: add a copy URL button 2020-07-26 20:58:14 -04:00
miruka
ddee50f28a Show a shorter URL to open for SSO
Show "http://127.0.0.1:port", which will automatically redirect to the
long ugly homeserver's URL.
2020-07-26 20:40:55 -04:00
miruka
157ea2ffb2 Add support for SSO authentication 2020-07-26 20:34:06 -04:00
miruka
d7907db547 Ask for server URL before showing sign in box
Contact the server's .well-known API before anything to get
available login flows instead of blindly assuming it will be
m.login.password, and to get the server's real URL instead of
requiring users to remember that e.g. it's "chat.privacytools.io"
and not just "privacytools.io" despite user IDs making it look like so.

The server field will also now remember the last accepted URL.
2020-07-24 02:36:24 -04:00
miruka
b94d1e8168 Fix possible race condition when writing user file
While a user file write operation #1 was queued in the _write_loop,
it was possible meanwhile for another function to read the file
(the current old version on disk), add some data to it,
add submit the write (operation #2).
The modifications from operatio #1 were then completly lost at best.
2020-07-24 01:01:37 -04:00
miruka
872ee49a79 Don't catch SIGQUIT and SIGTERM
Give a way to quickly force quit. Catching SIGTERM also causes problems
with the live-reload script.
2020-07-24 00:45:58 -04:00
miruka
3a7ad5859f qml_bridge: remove old signal code 2020-07-24 00:22:51 -04:00
miruka
87ad3ccab1 Fix truncated "Loading previous messag..." text 2020-07-22 16:26:30 -04:00
vslg
6b9077816e Add HKineticScrollingDisabler to HFlickable
Also make horizontal scrolling available when
kinetic scrolling is disabled
2020-07-22 15:45:05 -04:00
miruka
5dbcf9c825 Image viewer: fix info bar text vertical alignment 2020-07-22 01:31:06 -04:00
miruka
aba29a198d Increase image viewer bar opacity
Make it easier to read on bright images
2020-07-22 01:22:42 -04:00
miruka
d00b29f076 Add media.openExternallyOnClick setting
Makes clicking on image open them externally and middle-clicking open
them in the mirage image viewer, the reverse of the default behavior.
2020-07-22 00:14:15 -04:00
miruka
0f1d0f336e Don't show avatar tooltips when context menu open 2020-07-22 00:04:12 -04:00
miruka
e917e29913 Image viewer: respect autoHideOSDAfterMsec setting 2020-07-22 00:00:53 -04:00
miruka
ad8c9d55dc Raise max flicking speed while keyboard-scrolling
Lets holding the page down/up keybinds properly do their job again
2020-07-21 23:54:35 -04:00
miruka
c1f9416f1a Clipboard change → force image preview update 2020-07-21 23:47:41 -04:00
miruka
0088fadddd Compress images in a separate process
Compression with Pillow can take long, especially with large
clipboard PNG images.
Doing this in a separate process prevents the async event loop from
getting blocked, and allows multiple compression operations to run in
parallel.
2020-07-21 23:35:16 -04:00
miruka
286b7a951a Disable optim. when recompressing clipboard PNG
Far too slow for big (10MB+) PNG
2020-07-21 23:09:07 -04:00
miruka
1c218c82ec Ignore reply header links for keyboard open binds
Don't open the multiple links contained in the "In reply to <user>"
text of fallback replies when using keyboard shortcuts to open
links/media.
2020-07-21 22:46:05 -04:00
miruka
7214180a66 Don't send typing notif if no permission to talk 2020-07-21 22:13:44 -04:00
miruka
da7417f13f Fix SettingsView stealing focus from popups
Making the window narrow enough to switch to "mobile mode", then big
again would trigger a signal in SettingsView that switched focus to it,
even when it wasn't visible.
2020-07-21 22:11:13 -04:00
miruka
8c1d7a868e Catch 403 error when getting offline user presence
It's possible to get a MatrixForbidden error when trying to retrieve a
offline room member's presence, if that member actually left the room
but the server hasn't yet sent the update.
2020-07-21 21:02:28 -04:00
miruka
a402c7657a Don't render invisible thumbnail spinner 2020-07-21 19:50:49 -04:00
miruka
43cfb74460 Fix HTTP event image not loading on click 2020-07-21 19:45:52 -04:00
miruka
377b11220e Auto-hide image viewer bars when needed 2020-07-21 19:42:57 -04:00
miruka
fdc06d81fd Add info bar to image viewer 2020-07-21 17:34:45 -04:00
miruka
48eac96976 Add "Open externally" to media event context menu 2020-07-21 01:06:31 -04:00
miruka
3435dbc2f8 Add copyFilesLocalPath keybind 2020-07-20 23:28:07 -04:00
miruka
67b7821fae Ctrl+C, non-E2E media: copy HTTP URL, not filename 2020-07-20 23:17:51 -04:00
miruka
99017adc1d Model item events: add a media_http_url field 2020-07-20 23:09:28 -04:00
miruka
55e22ea948 Add openMessagesLinksOrFilesExternally keybind
This required us to set the media downloaded local path on events
entirely from python instead of simply lazy-fetching them when needed
from QML, due to pyotherside's async nature and files that must be open
in a certain order.
2020-07-20 23:07:52 -04:00
miruka
89e6931d9d Fix ViewerButtons implicit width calculation 2020-07-20 21:39:52 -04:00
miruka
93b46dcfee Move AutoDirectionLayout sum function to Utils 2020-07-20 21:37:08 -04:00
miruka
acd02a67a0 Add image viewer keybinds 2020-07-20 21:34:00 -04:00
miruka
0cd2678797 Event context menu: copy HTTP media URL, not MXC 2020-07-20 19:58:44 -04:00
miruka
2fb4ad5eae Improve timeline GIF auto-pausing
Pause when any popup is covering the timeline (image viewer or not), and
work when opened by ctrl+o, not just when clicking the thumbnail.
2020-07-20 19:51:35 -04:00
miruka
93baaf51a0 Fix HPopup not calling window.visiblePopupsChanged 2020-07-20 19:47:48 -04:00
miruka
e5b102c761 Hide HImage pause button in image viewer
Have only the one from the viewer's button bar
2020-07-20 19:39:32 -04:00
miruka
a8e1ece1ea Add buttons to image viewer 2020-07-20 19:39:31 -04:00
miruka
595714f9f6 Fix HButtonContent when no icon 2020-07-20 18:52:44 -04:00
miruka
e62d99c3cc Stricter requirements to consider a client healthy
A healthy client must not only have a sync task running, but also have
finished its initial sync and have been succesful in its last sync
attempt.

The previous weak requirement caused this issue:
Have two clients, one on a failing server, and try to fetch a media,
thumbnail or profile: since these functions don't need auth, any
healthy client is picked to do the request, but the previous
requirement made it possible to pick the failing client.
2020-07-20 16:03:46 -04:00
miruka
b803c34338 Make middle click also work outside of image 2020-07-20 14:30:00 -04:00
miruka
66a44b5251 Split ImageViewer components 2020-07-20 14:27:52 -04:00
miruka
9444225afa Remove pressDelay from image viewer flickable
Seems to create a bug where the user can accidentally scroll the
timeline behind the popup instead of the image viewer flickable itself
2020-07-20 13:24:03 -04:00
miruka
7bfaced66b Fix event list + composer double context menu
Don't also Aopen the composer's context menu when there are
highlighted or selected messages in the timeline and user presses the
menu key.
2020-07-20 12:40:38 -04:00
miruka
e38a4ed408 Fix context menu encrypted media check 2020-07-20 12:34:32 -04:00
miruka
6bdf39ad68 Fix contextmenu "Copy text" when event highlighted
When an event was highlighted with the keyboard, right clicking a
message and clicking "Copy text" would always copy the message that was
highlighted instead of the one the user aimed for.
2020-07-20 12:31:40 -04:00
miruka
15b1720775 Pause timeline GIF while image viewer is open 2020-07-20 01:09:06 -04:00
miruka
30ce271ebc Real "copy URL" & "copy path" context menu entries
Replace the poorly implemented 2-in-1 "copy address" media event
menu option with:

- Copy <mediaType> address: visible for non-encrypted media, always
  copies the http URL

- Copy local path: always visible for already downloaded media, even if
  they were downloaded before mirage was started
2020-07-20 00:22:12 -04:00
miruka
37579fc664 Cleaner context menu "copy text" icon 2020-07-20 00:21:41 -04:00
miruka
2001fcf70a openImageViewer(): take an optional callback 2020-07-19 20:33:40 -04:00
miruka
066102e64d fullscreen: alt. scale mode only if image < window 2020-07-19 20:29:25 -04:00
miruka
06c2a24c9e Image viewer: separate fullscreen functions 2020-07-19 20:27:08 -04:00
miruka
48014cb8e5 Allow right clicking outside of image to close it 2020-07-19 20:22:36 -04:00
miruka
8053bd7d01 EventFile: respond to middle click (same as left) 2020-07-19 20:21:26 -04:00
miruka
b8833af3f9 HTile: add middleClicked() signal 2020-07-19 20:20:53 -04:00
miruka
8a73e65254 Rename openMessagesLinks keybind (...OrFiles) 2020-07-19 20:17:52 -04:00
miruka
de6d8fa59d Make media openable with the openLinks keybind
This involved a refactoring to move all the media handling functions
(downloading, opening externally, etc) out of the Event delegates and
into the EventList, which manage keybinds instead.

This should also be better for performance since all these functions are
no longer duplicated for every Event in view.

Other user-noticable change: clicking on non-image media will
always download and open them no matter if the room is encrypted or not,
instead of opening non-encrypted files in browser like before. It will
be possible to still do that with an "open externally" command later.
2020-07-19 20:10:31 -04:00
miruka
fe08014697 Image viewer: make thumbnailPath property optional 2020-07-19 16:51:06 -04:00
miruka
e2c6f0e64c Don't cancel upload if server max size is unknown 2020-07-19 16:24:16 -04:00
miruka
2dbb155a22 Fix clicking in image viewer always closing GIFs 2020-07-19 16:02:38 -04:00
miruka
465d31790f Image viewer: handle images without known w/h
There's no way to know in advance the real size for
HTTP image previews and m.image events sent by some clients
2020-07-19 15:50:10 -04:00
miruka
6b1a5a46e6 Fix upload for servers not returning max size 2020-07-19 15:37:05 -04:00
miruka
7595c522c4 Fix image upload without thumbnail 2020-07-19 15:34:06 -04:00