Add a context menu and multi-select to the contacts list - #31301
Open
meh7an wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a context menu to contacts in the Contacts box, similar to the contact actions in the mobile apps, and a selection mode to delete several contacts at once.
Right-clicking a contact shows:
Secret chats and video calls from the mobile menu are not included: the desktop app has no secret chats, and video can be turned on from the call panel. Starting a call from the menu uses
Ui::PreventDelayedActivation(), so the main window isn't activated over the call panel when the menu closes.Selection works like choosing several recipients in the forward box. After the first contact is selected, clicking other contacts toggles them, the box title shows how many are selected, and the buttons change to Delete and Cancel. Delete asks for confirmation and removes all selected contacts with a single
contacts.deleteContactsrequest. Global search results in the box are not contacts, so they only get Send message and Call.The list shows story outlines by reusing each row's checkbox:
PeerListStorieschecks rows with active stories and draws their segments. Because of that, the box keeps the selection itself instead of using the rows' checked state. Selected rows draw the same round check over the userpic as other peer lists, andPeerListStories::setRowSelected()shows the regular selection outline for a selected row and ignores story updates for it until it is deselected, when its story outline is restored.ContactsBoxController::setRowSelected()forwards to it, or just checks the row when stories aren't shown.The contacts list was built once when contacts loaded, so a deleted contact stayed in the open box. The box now listens for contact status updates and removes rows of users that are no longer contacts.
Testing
Built and tested on macOS (Debug):